pdf.worker.js 1.5 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * Javascript code in this page
  4. *
  5. * Copyright 2021 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. /* 1 */
  37. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38. Object.defineProperty(exports, "__esModule", ({
  39. value: true
  40. }));
  41. exports.WorkerTask = exports.WorkerMessageHandler = void 0;
  42. var _util = __w_pdfjs_require__(2);
  43. var _primitives = __w_pdfjs_require__(5);
  44. var _pdf_manager = __w_pdfjs_require__(6);
  45. var _writer = __w_pdfjs_require__(48);
  46. var _is_node = __w_pdfjs_require__(4);
  47. var _message_handler = __w_pdfjs_require__(69);
  48. var _worker_stream = __w_pdfjs_require__(70);
  49. var _core_utils = __w_pdfjs_require__(8);
  50. class WorkerTask {
  51. constructor(name) {
  52. this.name = name;
  53. this.terminated = false;
  54. this._capability = (0, _util.createPromiseCapability)();
  55. }
  56. get finished() {
  57. return this._capability.promise;
  58. }
  59. finish() {
  60. this._capability.resolve();
  61. }
  62. terminate() {
  63. this.terminated = true;
  64. }
  65. ensureNotTerminated() {
  66. if (this.terminated) {
  67. throw new Error("Worker task was terminated");
  68. }
  69. }
  70. }
  71. exports.WorkerTask = WorkerTask;
  72. class WorkerMessageHandler {
  73. static setup(handler, port) {
  74. var testMessageProcessed = false;
  75. handler.on("test", function wphSetupTest(data) {
  76. if (testMessageProcessed) {
  77. return;
  78. }
  79. testMessageProcessed = true;
  80. if (!(data instanceof Uint8Array)) {
  81. handler.send("test", null);
  82. return;
  83. }
  84. const supportTransfers = data[0] === 255;
  85. handler.postMessageTransfers = supportTransfers;
  86. handler.send("test", {
  87. supportTransfers
  88. });
  89. });
  90. handler.on("configure", function wphConfigure(data) {
  91. (0, _util.setVerbosityLevel)(data.verbosity);
  92. });
  93. handler.on("GetDocRequest", function wphSetupDoc(data) {
  94. return WorkerMessageHandler.createDocumentHandler(data, port);
  95. });
  96. }
  97. static createDocumentHandler(docParams, port) {
  98. var pdfManager;
  99. var terminated = false;
  100. var cancelXHRs = null;
  101. var WorkerTasks = [];
  102. const verbosity = (0, _util.getVerbosityLevel)();
  103. const apiVersion = docParams.apiVersion;
  104. const workerVersion = '2.8.335';
  105. if (apiVersion !== workerVersion) {
  106. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  107. }
  108. const enumerableProperties = [];
  109. for (const property in []) {
  110. enumerableProperties.push(property);
  111. }
  112. if (enumerableProperties.length) {
  113. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  114. }
  115. if (typeof ReadableStream === "undefined") {
  116. throw new Error("The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); " + "please use a `legacy`-build instead.");
  117. }
  118. var docId = docParams.docId;
  119. var docBaseUrl = docParams.docBaseUrl;
  120. var workerHandlerName = docParams.docId + "_worker";
  121. var handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  122. handler.postMessageTransfers = docParams.postMessageTransfers;
  123. function ensureNotTerminated() {
  124. if (terminated) {
  125. throw new Error("Worker was terminated");
  126. }
  127. }
  128. function startWorkerTask(task) {
  129. WorkerTasks.push(task);
  130. }
  131. function finishWorkerTask(task) {
  132. task.finish();
  133. var i = WorkerTasks.indexOf(task);
  134. WorkerTasks.splice(i, 1);
  135. }
  136. async function loadDocument(recoveryMode) {
  137. await pdfManager.ensureDoc("checkHeader");
  138. await pdfManager.ensureDoc("parseStartXRef");
  139. await pdfManager.ensureDoc("parse", [recoveryMode]);
  140. if (!recoveryMode) {
  141. await pdfManager.ensureDoc("checkFirstPage");
  142. }
  143. const [numPages, fingerprint, isPureXfa] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprint"), pdfManager.ensureDoc("isPureXfa")]);
  144. return {
  145. numPages,
  146. fingerprint,
  147. isPureXfa
  148. };
  149. }
  150. function getPdfManager(data, evaluatorOptions, enableXfa) {
  151. var pdfManagerCapability = (0, _util.createPromiseCapability)();
  152. let newPdfManager;
  153. var source = data.source;
  154. if (source.data) {
  155. try {
  156. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, enableXfa, docBaseUrl);
  157. pdfManagerCapability.resolve(newPdfManager);
  158. } catch (ex) {
  159. pdfManagerCapability.reject(ex);
  160. }
  161. return pdfManagerCapability.promise;
  162. }
  163. var pdfStream,
  164. cachedChunks = [];
  165. try {
  166. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  167. } catch (ex) {
  168. pdfManagerCapability.reject(ex);
  169. return pdfManagerCapability.promise;
  170. }
  171. var fullRequest = pdfStream.getFullReader();
  172. fullRequest.headersReady.then(function () {
  173. if (!fullRequest.isRangeSupported) {
  174. return;
  175. }
  176. var disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  177. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  178. msgHandler: handler,
  179. password: source.password,
  180. length: fullRequest.contentLength,
  181. disableAutoFetch,
  182. rangeChunkSize: source.rangeChunkSize
  183. }, evaluatorOptions, enableXfa, docBaseUrl);
  184. for (let i = 0; i < cachedChunks.length; i++) {
  185. newPdfManager.sendProgressiveData(cachedChunks[i]);
  186. }
  187. cachedChunks = [];
  188. pdfManagerCapability.resolve(newPdfManager);
  189. cancelXHRs = null;
  190. }).catch(function (reason) {
  191. pdfManagerCapability.reject(reason);
  192. cancelXHRs = null;
  193. });
  194. var loaded = 0;
  195. var flushChunks = function () {
  196. var pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  197. if (source.length && pdfFile.length !== source.length) {
  198. (0, _util.warn)("reported HTTP length is different from actual");
  199. }
  200. try {
  201. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, enableXfa, docBaseUrl);
  202. pdfManagerCapability.resolve(newPdfManager);
  203. } catch (ex) {
  204. pdfManagerCapability.reject(ex);
  205. }
  206. cachedChunks = [];
  207. };
  208. var readPromise = new Promise(function (resolve, reject) {
  209. var readChunk = function ({
  210. value,
  211. done
  212. }) {
  213. try {
  214. ensureNotTerminated();
  215. if (done) {
  216. if (!newPdfManager) {
  217. flushChunks();
  218. }
  219. cancelXHRs = null;
  220. return;
  221. }
  222. loaded += (0, _util.arrayByteLength)(value);
  223. if (!fullRequest.isStreamingSupported) {
  224. handler.send("DocProgress", {
  225. loaded,
  226. total: Math.max(loaded, fullRequest.contentLength || 0)
  227. });
  228. }
  229. if (newPdfManager) {
  230. newPdfManager.sendProgressiveData(value);
  231. } else {
  232. cachedChunks.push(value);
  233. }
  234. fullRequest.read().then(readChunk, reject);
  235. } catch (e) {
  236. reject(e);
  237. }
  238. };
  239. fullRequest.read().then(readChunk, reject);
  240. });
  241. readPromise.catch(function (e) {
  242. pdfManagerCapability.reject(e);
  243. cancelXHRs = null;
  244. });
  245. cancelXHRs = function (reason) {
  246. pdfStream.cancelAllRequests(reason);
  247. };
  248. return pdfManagerCapability.promise;
  249. }
  250. function setupDoc(data) {
  251. function onSuccess(doc) {
  252. ensureNotTerminated();
  253. handler.send("GetDoc", {
  254. pdfInfo: doc
  255. });
  256. }
  257. function onFailure(ex) {
  258. ensureNotTerminated();
  259. if (ex instanceof _util.PasswordException) {
  260. var task = new WorkerTask(`PasswordException: response ${ex.code}`);
  261. startWorkerTask(task);
  262. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  263. password
  264. }) {
  265. finishWorkerTask(task);
  266. pdfManager.updatePassword(password);
  267. pdfManagerReady();
  268. }).catch(function () {
  269. finishWorkerTask(task);
  270. handler.send("DocException", ex);
  271. });
  272. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  273. handler.send("DocException", ex);
  274. } else {
  275. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  276. }
  277. }
  278. function pdfManagerReady() {
  279. ensureNotTerminated();
  280. loadDocument(false).then(onSuccess, function (reason) {
  281. ensureNotTerminated();
  282. if (!(reason instanceof _core_utils.XRefParseException)) {
  283. onFailure(reason);
  284. return;
  285. }
  286. pdfManager.requestLoadedStream();
  287. pdfManager.onLoadedStream().then(function () {
  288. ensureNotTerminated();
  289. loadDocument(true).then(onSuccess, onFailure);
  290. });
  291. });
  292. }
  293. ensureNotTerminated();
  294. var evaluatorOptions = {
  295. maxImageSize: data.maxImageSize,
  296. disableFontFace: data.disableFontFace,
  297. ignoreErrors: data.ignoreErrors,
  298. isEvalSupported: data.isEvalSupported,
  299. fontExtraProperties: data.fontExtraProperties
  300. };
  301. getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) {
  302. if (terminated) {
  303. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  304. throw new Error("Worker was terminated");
  305. }
  306. pdfManager = newPdfManager;
  307. pdfManager.onLoadedStream().then(function (stream) {
  308. handler.send("DataLoaded", {
  309. length: stream.bytes.byteLength
  310. });
  311. });
  312. }).then(pdfManagerReady, onFailure);
  313. }
  314. handler.on("GetPage", function wphSetupGetPage(data) {
  315. return pdfManager.getPage(data.pageIndex).then(function (page) {
  316. 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]) {
  317. return {
  318. rotate,
  319. ref,
  320. userUnit,
  321. view
  322. };
  323. });
  324. });
  325. });
  326. handler.on("GetPageIndex", function wphSetupGetPageIndex({
  327. ref
  328. }) {
  329. const pageRef = _primitives.Ref.get(ref.num, ref.gen);
  330. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  331. });
  332. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  333. return pdfManager.ensureCatalog("destinations");
  334. });
  335. handler.on("GetDestination", function wphSetupGetDestination(data) {
  336. return pdfManager.ensureCatalog("getDestination", [data.id]);
  337. });
  338. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  339. return pdfManager.ensureCatalog("pageLabels");
  340. });
  341. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  342. return pdfManager.ensureCatalog("pageLayout");
  343. });
  344. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  345. return pdfManager.ensureCatalog("pageMode");
  346. });
  347. handler.on("GetViewerPreferences", function (data) {
  348. return pdfManager.ensureCatalog("viewerPreferences");
  349. });
  350. handler.on("GetOpenAction", function (data) {
  351. return pdfManager.ensureCatalog("openAction");
  352. });
  353. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  354. return pdfManager.ensureCatalog("attachments");
  355. });
  356. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  357. return pdfManager.ensureCatalog("javaScript");
  358. });
  359. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  360. return pdfManager.ensureCatalog("jsActions");
  361. });
  362. handler.on("GetPageJSActions", function ({
  363. pageIndex
  364. }) {
  365. return pdfManager.getPage(pageIndex).then(function (page) {
  366. return page.jsActions;
  367. });
  368. });
  369. handler.on("GetPageXfa", function wphSetupGetXfa({
  370. pageIndex
  371. }) {
  372. return pdfManager.getPage(pageIndex).then(function (page) {
  373. return pdfManager.ensure(page, "xfaData");
  374. });
  375. });
  376. handler.on("GetIsPureXfa", function wphSetupGetIsPureXfa(data) {
  377. return pdfManager.ensureDoc("isPureXfa");
  378. });
  379. handler.on("GetOutline", function wphSetupGetOutline(data) {
  380. return pdfManager.ensureCatalog("documentOutline");
  381. });
  382. handler.on("GetOptionalContentConfig", function (data) {
  383. return pdfManager.ensureCatalog("optionalContentConfig");
  384. });
  385. handler.on("GetPermissions", function (data) {
  386. return pdfManager.ensureCatalog("permissions");
  387. });
  388. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  389. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  390. });
  391. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  392. return pdfManager.ensureCatalog("markInfo");
  393. });
  394. handler.on("GetData", function wphSetupGetData(data) {
  395. pdfManager.requestLoadedStream();
  396. return pdfManager.onLoadedStream().then(function (stream) {
  397. return stream.bytes;
  398. });
  399. });
  400. handler.on("GetStats", function wphSetupGetStats(data) {
  401. return pdfManager.ensureXRef("stats");
  402. });
  403. handler.on("GetAnnotations", function ({
  404. pageIndex,
  405. intent
  406. }) {
  407. return pdfManager.getPage(pageIndex).then(function (page) {
  408. return page.getAnnotationsData(intent);
  409. });
  410. });
  411. handler.on("GetFieldObjects", function (data) {
  412. return pdfManager.ensureDoc("fieldObjects");
  413. });
  414. handler.on("HasJSActions", function (data) {
  415. return pdfManager.ensureDoc("hasJSActions");
  416. });
  417. handler.on("GetCalculationOrderIds", function (data) {
  418. return pdfManager.ensureDoc("calculationOrderIds");
  419. });
  420. handler.on("SaveDocument", function ({
  421. numPages,
  422. annotationStorage,
  423. filename
  424. }) {
  425. pdfManager.requestLoadedStream();
  426. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  427. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  428. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  429. const task = new WorkerTask(`Save: page ${pageIndex}`);
  430. startWorkerTask(task);
  431. return page.save(handler, task, annotationStorage).finally(function () {
  432. finishWorkerTask(task);
  433. });
  434. }));
  435. }
  436. return Promise.all(promises).then(function ([stream, acroForm, xref, startXRef, ...refs]) {
  437. let newRefs = [];
  438. for (const ref of refs) {
  439. newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs);
  440. }
  441. if (newRefs.length === 0) {
  442. return stream.bytes;
  443. }
  444. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || [];
  445. let xfaDatasets = null;
  446. if (Array.isArray(xfa)) {
  447. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  448. if (xfa[i] === "datasets") {
  449. xfaDatasets = xfa[i + 1];
  450. }
  451. }
  452. } else {
  453. (0, _util.warn)("Unsupported XFA type.");
  454. }
  455. let newXrefInfo = Object.create(null);
  456. if (xref.trailer) {
  457. const infoObj = Object.create(null);
  458. const xrefInfo = xref.trailer.get("Info") || null;
  459. if (xrefInfo instanceof _primitives.Dict) {
  460. xrefInfo.forEach((key, value) => {
  461. if ((0, _util.isString)(key) && (0, _util.isString)(value)) {
  462. infoObj[key] = (0, _util.stringToPDFString)(value);
  463. }
  464. });
  465. }
  466. newXrefInfo = {
  467. rootRef: xref.trailer.getRaw("Root") || null,
  468. encrypt: xref.trailer.getRaw("Encrypt") || null,
  469. newRef: xref.getNewRef(),
  470. infoRef: xref.trailer.getRaw("Info") || null,
  471. info: infoObj,
  472. fileIds: xref.trailer.getRaw("ID") || null,
  473. startXRef,
  474. filename
  475. };
  476. }
  477. xref.resetNewRef();
  478. return (0, _writer.incrementalUpdate)({
  479. originalData: stream.bytes,
  480. xrefInfo: newXrefInfo,
  481. newRefs,
  482. xref,
  483. datasetsRef: xfaDatasets
  484. });
  485. });
  486. });
  487. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  488. var pageIndex = data.pageIndex;
  489. pdfManager.getPage(pageIndex).then(function (page) {
  490. var task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  491. startWorkerTask(task);
  492. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  493. page.getOperatorList({
  494. handler,
  495. sink,
  496. task,
  497. intent: data.intent,
  498. renderInteractiveForms: data.renderInteractiveForms,
  499. annotationStorage: data.annotationStorage
  500. }).then(function (operatorListInfo) {
  501. finishWorkerTask(task);
  502. if (start) {
  503. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  504. }
  505. sink.close();
  506. }, function (reason) {
  507. finishWorkerTask(task);
  508. if (task.terminated) {
  509. return;
  510. }
  511. handler.send("UnsupportedFeature", {
  512. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  513. });
  514. sink.error(reason);
  515. });
  516. });
  517. });
  518. handler.on("GetTextContent", function wphExtractText(data, sink) {
  519. var pageIndex = data.pageIndex;
  520. sink.onPull = function (desiredSize) {};
  521. sink.onCancel = function (reason) {};
  522. pdfManager.getPage(pageIndex).then(function (page) {
  523. var task = new WorkerTask("GetTextContent: page " + pageIndex);
  524. startWorkerTask(task);
  525. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  526. page.extractTextContent({
  527. handler,
  528. task,
  529. sink,
  530. normalizeWhitespace: data.normalizeWhitespace,
  531. combineTextItems: data.combineTextItems
  532. }).then(function () {
  533. finishWorkerTask(task);
  534. if (start) {
  535. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  536. }
  537. sink.close();
  538. }, function (reason) {
  539. finishWorkerTask(task);
  540. if (task.terminated) {
  541. return;
  542. }
  543. sink.error(reason);
  544. });
  545. });
  546. });
  547. handler.on("FontFallback", function (data) {
  548. return pdfManager.fontFallback(data.id, handler);
  549. });
  550. handler.on("Cleanup", function wphCleanup(data) {
  551. return pdfManager.cleanup(true);
  552. });
  553. handler.on("Terminate", function wphTerminate(data) {
  554. terminated = true;
  555. const waitOn = [];
  556. if (pdfManager) {
  557. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  558. const cleanupPromise = pdfManager.cleanup();
  559. waitOn.push(cleanupPromise);
  560. pdfManager = null;
  561. } else {
  562. (0, _primitives.clearPrimitiveCaches)();
  563. }
  564. if (cancelXHRs) {
  565. cancelXHRs(new _util.AbortException("Worker was terminated."));
  566. }
  567. WorkerTasks.forEach(function (task) {
  568. waitOn.push(task.finished);
  569. task.terminate();
  570. });
  571. return Promise.all(waitOn).then(function () {
  572. handler.destroy();
  573. handler = null;
  574. });
  575. });
  576. handler.on("Ready", function wphReady(data) {
  577. setupDoc(docParams);
  578. docParams = null;
  579. });
  580. return workerHandlerName;
  581. }
  582. static initializeFromPort(port) {
  583. var handler = new _message_handler.MessageHandler("worker", "main", port);
  584. WorkerMessageHandler.setup(handler, port);
  585. handler.send("ready", null);
  586. }
  587. }
  588. exports.WorkerMessageHandler = WorkerMessageHandler;
  589. function isMessagePort(maybePort) {
  590. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  591. }
  592. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  593. WorkerMessageHandler.initializeFromPort(self);
  594. }
  595. /***/ }),
  596. /* 2 */
  597. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  598. Object.defineProperty(exports, "__esModule", ({
  599. value: true
  600. }));
  601. exports.arrayByteLength = arrayByteLength;
  602. exports.arraysToBytes = arraysToBytes;
  603. exports.assert = assert;
  604. exports.bytesToString = bytesToString;
  605. exports.createObjectURL = createObjectURL;
  606. exports.createPromiseCapability = createPromiseCapability;
  607. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  608. exports.escapeString = escapeString;
  609. exports.getModificationDate = getModificationDate;
  610. exports.getVerbosityLevel = getVerbosityLevel;
  611. exports.info = info;
  612. exports.isArrayBuffer = isArrayBuffer;
  613. exports.isArrayEqual = isArrayEqual;
  614. exports.isAscii = isAscii;
  615. exports.isBool = isBool;
  616. exports.isNum = isNum;
  617. exports.isSameOrigin = isSameOrigin;
  618. exports.isString = isString;
  619. exports.objectFromMap = objectFromMap;
  620. exports.objectSize = objectSize;
  621. exports.removeNullCharacters = removeNullCharacters;
  622. exports.setVerbosityLevel = setVerbosityLevel;
  623. exports.shadow = shadow;
  624. exports.string32 = string32;
  625. exports.stringToBytes = stringToBytes;
  626. exports.stringToPDFString = stringToPDFString;
  627. exports.stringToUTF16BEString = stringToUTF16BEString;
  628. exports.stringToUTF8String = stringToUTF8String;
  629. exports.unreachable = unreachable;
  630. exports.utf8StringToString = utf8StringToString;
  631. exports.warn = warn;
  632. 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.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;
  633. __w_pdfjs_require__(3);
  634. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  635. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  636. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  637. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  638. const PermissionFlag = {
  639. PRINT: 0x04,
  640. MODIFY_CONTENTS: 0x08,
  641. COPY: 0x10,
  642. MODIFY_ANNOTATIONS: 0x20,
  643. FILL_INTERACTIVE_FORMS: 0x100,
  644. COPY_FOR_ACCESSIBILITY: 0x200,
  645. ASSEMBLE: 0x400,
  646. PRINT_HIGH_QUALITY: 0x800
  647. };
  648. exports.PermissionFlag = PermissionFlag;
  649. const TextRenderingMode = {
  650. FILL: 0,
  651. STROKE: 1,
  652. FILL_STROKE: 2,
  653. INVISIBLE: 3,
  654. FILL_ADD_TO_PATH: 4,
  655. STROKE_ADD_TO_PATH: 5,
  656. FILL_STROKE_ADD_TO_PATH: 6,
  657. ADD_TO_PATH: 7,
  658. FILL_STROKE_MASK: 3,
  659. ADD_TO_PATH_FLAG: 4
  660. };
  661. exports.TextRenderingMode = TextRenderingMode;
  662. const ImageKind = {
  663. GRAYSCALE_1BPP: 1,
  664. RGB_24BPP: 2,
  665. RGBA_32BPP: 3
  666. };
  667. exports.ImageKind = ImageKind;
  668. const AnnotationType = {
  669. TEXT: 1,
  670. LINK: 2,
  671. FREETEXT: 3,
  672. LINE: 4,
  673. SQUARE: 5,
  674. CIRCLE: 6,
  675. POLYGON: 7,
  676. POLYLINE: 8,
  677. HIGHLIGHT: 9,
  678. UNDERLINE: 10,
  679. SQUIGGLY: 11,
  680. STRIKEOUT: 12,
  681. STAMP: 13,
  682. CARET: 14,
  683. INK: 15,
  684. POPUP: 16,
  685. FILEATTACHMENT: 17,
  686. SOUND: 18,
  687. MOVIE: 19,
  688. WIDGET: 20,
  689. SCREEN: 21,
  690. PRINTERMARK: 22,
  691. TRAPNET: 23,
  692. WATERMARK: 24,
  693. THREED: 25,
  694. REDACT: 26
  695. };
  696. exports.AnnotationType = AnnotationType;
  697. const AnnotationStateModelType = {
  698. MARKED: "Marked",
  699. REVIEW: "Review"
  700. };
  701. exports.AnnotationStateModelType = AnnotationStateModelType;
  702. const AnnotationMarkedState = {
  703. MARKED: "Marked",
  704. UNMARKED: "Unmarked"
  705. };
  706. exports.AnnotationMarkedState = AnnotationMarkedState;
  707. const AnnotationReviewState = {
  708. ACCEPTED: "Accepted",
  709. REJECTED: "Rejected",
  710. CANCELLED: "Cancelled",
  711. COMPLETED: "Completed",
  712. NONE: "None"
  713. };
  714. exports.AnnotationReviewState = AnnotationReviewState;
  715. const AnnotationReplyType = {
  716. GROUP: "Group",
  717. REPLY: "R"
  718. };
  719. exports.AnnotationReplyType = AnnotationReplyType;
  720. const AnnotationFlag = {
  721. INVISIBLE: 0x01,
  722. HIDDEN: 0x02,
  723. PRINT: 0x04,
  724. NOZOOM: 0x08,
  725. NOROTATE: 0x10,
  726. NOVIEW: 0x20,
  727. READONLY: 0x40,
  728. LOCKED: 0x80,
  729. TOGGLENOVIEW: 0x100,
  730. LOCKEDCONTENTS: 0x200
  731. };
  732. exports.AnnotationFlag = AnnotationFlag;
  733. const AnnotationFieldFlag = {
  734. READONLY: 0x0000001,
  735. REQUIRED: 0x0000002,
  736. NOEXPORT: 0x0000004,
  737. MULTILINE: 0x0001000,
  738. PASSWORD: 0x0002000,
  739. NOTOGGLETOOFF: 0x0004000,
  740. RADIO: 0x0008000,
  741. PUSHBUTTON: 0x0010000,
  742. COMBO: 0x0020000,
  743. EDIT: 0x0040000,
  744. SORT: 0x0080000,
  745. FILESELECT: 0x0100000,
  746. MULTISELECT: 0x0200000,
  747. DONOTSPELLCHECK: 0x0400000,
  748. DONOTSCROLL: 0x0800000,
  749. COMB: 0x1000000,
  750. RICHTEXT: 0x2000000,
  751. RADIOSINUNISON: 0x2000000,
  752. COMMITONSELCHANGE: 0x4000000
  753. };
  754. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  755. const AnnotationBorderStyleType = {
  756. SOLID: 1,
  757. DASHED: 2,
  758. BEVELED: 3,
  759. INSET: 4,
  760. UNDERLINE: 5
  761. };
  762. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  763. const AnnotationActionEventType = {
  764. E: "Mouse Enter",
  765. X: "Mouse Exit",
  766. D: "Mouse Down",
  767. U: "Mouse Up",
  768. Fo: "Focus",
  769. Bl: "Blur",
  770. PO: "PageOpen",
  771. PC: "PageClose",
  772. PV: "PageVisible",
  773. PI: "PageInvisible",
  774. K: "Keystroke",
  775. F: "Format",
  776. V: "Validate",
  777. C: "Calculate"
  778. };
  779. exports.AnnotationActionEventType = AnnotationActionEventType;
  780. const DocumentActionEventType = {
  781. WC: "WillClose",
  782. WS: "WillSave",
  783. DS: "DidSave",
  784. WP: "WillPrint",
  785. DP: "DidPrint"
  786. };
  787. exports.DocumentActionEventType = DocumentActionEventType;
  788. const PageActionEventType = {
  789. O: "PageOpen",
  790. C: "PageClose"
  791. };
  792. exports.PageActionEventType = PageActionEventType;
  793. const StreamType = {
  794. UNKNOWN: "UNKNOWN",
  795. FLATE: "FLATE",
  796. LZW: "LZW",
  797. DCT: "DCT",
  798. JPX: "JPX",
  799. JBIG: "JBIG",
  800. A85: "A85",
  801. AHX: "AHX",
  802. CCF: "CCF",
  803. RLX: "RLX"
  804. };
  805. exports.StreamType = StreamType;
  806. const FontType = {
  807. UNKNOWN: "UNKNOWN",
  808. TYPE1: "TYPE1",
  809. TYPE1C: "TYPE1C",
  810. CIDFONTTYPE0: "CIDFONTTYPE0",
  811. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  812. TRUETYPE: "TRUETYPE",
  813. CIDFONTTYPE2: "CIDFONTTYPE2",
  814. TYPE3: "TYPE3",
  815. OPENTYPE: "OPENTYPE",
  816. TYPE0: "TYPE0",
  817. MMTYPE1: "MMTYPE1"
  818. };
  819. exports.FontType = FontType;
  820. const VerbosityLevel = {
  821. ERRORS: 0,
  822. WARNINGS: 1,
  823. INFOS: 5
  824. };
  825. exports.VerbosityLevel = VerbosityLevel;
  826. const CMapCompressionType = {
  827. NONE: 0,
  828. BINARY: 1,
  829. STREAM: 2
  830. };
  831. exports.CMapCompressionType = CMapCompressionType;
  832. const OPS = {
  833. dependency: 1,
  834. setLineWidth: 2,
  835. setLineCap: 3,
  836. setLineJoin: 4,
  837. setMiterLimit: 5,
  838. setDash: 6,
  839. setRenderingIntent: 7,
  840. setFlatness: 8,
  841. setGState: 9,
  842. save: 10,
  843. restore: 11,
  844. transform: 12,
  845. moveTo: 13,
  846. lineTo: 14,
  847. curveTo: 15,
  848. curveTo2: 16,
  849. curveTo3: 17,
  850. closePath: 18,
  851. rectangle: 19,
  852. stroke: 20,
  853. closeStroke: 21,
  854. fill: 22,
  855. eoFill: 23,
  856. fillStroke: 24,
  857. eoFillStroke: 25,
  858. closeFillStroke: 26,
  859. closeEOFillStroke: 27,
  860. endPath: 28,
  861. clip: 29,
  862. eoClip: 30,
  863. beginText: 31,
  864. endText: 32,
  865. setCharSpacing: 33,
  866. setWordSpacing: 34,
  867. setHScale: 35,
  868. setLeading: 36,
  869. setFont: 37,
  870. setTextRenderingMode: 38,
  871. setTextRise: 39,
  872. moveText: 40,
  873. setLeadingMoveText: 41,
  874. setTextMatrix: 42,
  875. nextLine: 43,
  876. showText: 44,
  877. showSpacedText: 45,
  878. nextLineShowText: 46,
  879. nextLineSetSpacingShowText: 47,
  880. setCharWidth: 48,
  881. setCharWidthAndBounds: 49,
  882. setStrokeColorSpace: 50,
  883. setFillColorSpace: 51,
  884. setStrokeColor: 52,
  885. setStrokeColorN: 53,
  886. setFillColor: 54,
  887. setFillColorN: 55,
  888. setStrokeGray: 56,
  889. setFillGray: 57,
  890. setStrokeRGBColor: 58,
  891. setFillRGBColor: 59,
  892. setStrokeCMYKColor: 60,
  893. setFillCMYKColor: 61,
  894. shadingFill: 62,
  895. beginInlineImage: 63,
  896. beginImageData: 64,
  897. endInlineImage: 65,
  898. paintXObject: 66,
  899. markPoint: 67,
  900. markPointProps: 68,
  901. beginMarkedContent: 69,
  902. beginMarkedContentProps: 70,
  903. endMarkedContent: 71,
  904. beginCompat: 72,
  905. endCompat: 73,
  906. paintFormXObjectBegin: 74,
  907. paintFormXObjectEnd: 75,
  908. beginGroup: 76,
  909. endGroup: 77,
  910. beginAnnotations: 78,
  911. endAnnotations: 79,
  912. beginAnnotation: 80,
  913. endAnnotation: 81,
  914. paintJpegXObject: 82,
  915. paintImageMaskXObject: 83,
  916. paintImageMaskXObjectGroup: 84,
  917. paintImageXObject: 85,
  918. paintInlineImageXObject: 86,
  919. paintInlineImageXObjectGroup: 87,
  920. paintImageXObjectRepeat: 88,
  921. paintImageMaskXObjectRepeat: 89,
  922. paintSolidColorImageMask: 90,
  923. constructPath: 91
  924. };
  925. exports.OPS = OPS;
  926. const UNSUPPORTED_FEATURES = {
  927. unknown: "unknown",
  928. forms: "forms",
  929. javaScript: "javaScript",
  930. smask: "smask",
  931. shadingPattern: "shadingPattern",
  932. font: "font",
  933. errorTilingPattern: "errorTilingPattern",
  934. errorExtGState: "errorExtGState",
  935. errorXObject: "errorXObject",
  936. errorFontLoadType3: "errorFontLoadType3",
  937. errorFontState: "errorFontState",
  938. errorFontMissing: "errorFontMissing",
  939. errorFontTranslate: "errorFontTranslate",
  940. errorColorSpace: "errorColorSpace",
  941. errorOperatorList: "errorOperatorList",
  942. errorFontToUnicode: "errorFontToUnicode",
  943. errorFontLoadNative: "errorFontLoadNative",
  944. errorFontGetPath: "errorFontGetPath",
  945. errorMarkedContent: "errorMarkedContent"
  946. };
  947. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  948. const PasswordResponses = {
  949. NEED_PASSWORD: 1,
  950. INCORRECT_PASSWORD: 2
  951. };
  952. exports.PasswordResponses = PasswordResponses;
  953. let verbosity = VerbosityLevel.WARNINGS;
  954. function setVerbosityLevel(level) {
  955. if (Number.isInteger(level)) {
  956. verbosity = level;
  957. }
  958. }
  959. function getVerbosityLevel() {
  960. return verbosity;
  961. }
  962. function info(msg) {
  963. if (verbosity >= VerbosityLevel.INFOS) {
  964. console.log(`Info: ${msg}`);
  965. }
  966. }
  967. function warn(msg) {
  968. if (verbosity >= VerbosityLevel.WARNINGS) {
  969. console.log(`Warning: ${msg}`);
  970. }
  971. }
  972. function unreachable(msg) {
  973. throw new Error(msg);
  974. }
  975. function assert(cond, msg) {
  976. if (!cond) {
  977. unreachable(msg);
  978. }
  979. }
  980. function isSameOrigin(baseUrl, otherUrl) {
  981. let base;
  982. try {
  983. base = new URL(baseUrl);
  984. if (!base.origin || base.origin === "null") {
  985. return false;
  986. }
  987. } catch (e) {
  988. return false;
  989. }
  990. const other = new URL(otherUrl, base);
  991. return base.origin === other.origin;
  992. }
  993. function _isValidProtocol(url) {
  994. if (!url) {
  995. return false;
  996. }
  997. switch (url.protocol) {
  998. case "http:":
  999. case "https:":
  1000. case "ftp:":
  1001. case "mailto:":
  1002. case "tel:":
  1003. return true;
  1004. default:
  1005. return false;
  1006. }
  1007. }
  1008. function createValidAbsoluteUrl(url, baseUrl) {
  1009. if (!url) {
  1010. return null;
  1011. }
  1012. try {
  1013. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1014. if (_isValidProtocol(absoluteUrl)) {
  1015. return absoluteUrl;
  1016. }
  1017. } catch (ex) {}
  1018. return null;
  1019. }
  1020. function shadow(obj, prop, value) {
  1021. Object.defineProperty(obj, prop, {
  1022. value,
  1023. enumerable: true,
  1024. configurable: true,
  1025. writable: false
  1026. });
  1027. return value;
  1028. }
  1029. const BaseException = function BaseExceptionClosure() {
  1030. function BaseException(message) {
  1031. if (this.constructor === BaseException) {
  1032. unreachable("Cannot initialize BaseException.");
  1033. }
  1034. this.message = message;
  1035. this.name = this.constructor.name;
  1036. }
  1037. BaseException.prototype = new Error();
  1038. BaseException.constructor = BaseException;
  1039. return BaseException;
  1040. }();
  1041. exports.BaseException = BaseException;
  1042. class PasswordException extends BaseException {
  1043. constructor(msg, code) {
  1044. super(msg);
  1045. this.code = code;
  1046. }
  1047. }
  1048. exports.PasswordException = PasswordException;
  1049. class UnknownErrorException extends BaseException {
  1050. constructor(msg, details) {
  1051. super(msg);
  1052. this.details = details;
  1053. }
  1054. }
  1055. exports.UnknownErrorException = UnknownErrorException;
  1056. class InvalidPDFException extends BaseException {}
  1057. exports.InvalidPDFException = InvalidPDFException;
  1058. class MissingPDFException extends BaseException {}
  1059. exports.MissingPDFException = MissingPDFException;
  1060. class UnexpectedResponseException extends BaseException {
  1061. constructor(msg, status) {
  1062. super(msg);
  1063. this.status = status;
  1064. }
  1065. }
  1066. exports.UnexpectedResponseException = UnexpectedResponseException;
  1067. class FormatError extends BaseException {}
  1068. exports.FormatError = FormatError;
  1069. class AbortException extends BaseException {}
  1070. exports.AbortException = AbortException;
  1071. const NullCharactersRegExp = /\x00/g;
  1072. function removeNullCharacters(str) {
  1073. if (typeof str !== "string") {
  1074. warn("The argument for removeNullCharacters must be a string.");
  1075. return str;
  1076. }
  1077. return str.replace(NullCharactersRegExp, "");
  1078. }
  1079. function bytesToString(bytes) {
  1080. assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
  1081. const length = bytes.length;
  1082. const MAX_ARGUMENT_COUNT = 8192;
  1083. if (length < MAX_ARGUMENT_COUNT) {
  1084. return String.fromCharCode.apply(null, bytes);
  1085. }
  1086. const strBuf = [];
  1087. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1088. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1089. const chunk = bytes.subarray(i, chunkEnd);
  1090. strBuf.push(String.fromCharCode.apply(null, chunk));
  1091. }
  1092. return strBuf.join("");
  1093. }
  1094. function stringToBytes(str) {
  1095. assert(typeof str === "string", "Invalid argument for stringToBytes");
  1096. const length = str.length;
  1097. const bytes = new Uint8Array(length);
  1098. for (let i = 0; i < length; ++i) {
  1099. bytes[i] = str.charCodeAt(i) & 0xff;
  1100. }
  1101. return bytes;
  1102. }
  1103. function arrayByteLength(arr) {
  1104. if (arr.length !== undefined) {
  1105. return arr.length;
  1106. }
  1107. assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
  1108. return arr.byteLength;
  1109. }
  1110. function arraysToBytes(arr) {
  1111. const length = arr.length;
  1112. if (length === 1 && arr[0] instanceof Uint8Array) {
  1113. return arr[0];
  1114. }
  1115. let resultLength = 0;
  1116. for (let i = 0; i < length; i++) {
  1117. resultLength += arrayByteLength(arr[i]);
  1118. }
  1119. let pos = 0;
  1120. const data = new Uint8Array(resultLength);
  1121. for (let i = 0; i < length; i++) {
  1122. let item = arr[i];
  1123. if (!(item instanceof Uint8Array)) {
  1124. if (typeof item === "string") {
  1125. item = stringToBytes(item);
  1126. } else {
  1127. item = new Uint8Array(item);
  1128. }
  1129. }
  1130. const itemLength = item.byteLength;
  1131. data.set(item, pos);
  1132. pos += itemLength;
  1133. }
  1134. return data;
  1135. }
  1136. function string32(value) {
  1137. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1138. }
  1139. function objectSize(obj) {
  1140. return Object.keys(obj).length;
  1141. }
  1142. function objectFromMap(map) {
  1143. const obj = Object.create(null);
  1144. for (const [key, value] of map) {
  1145. obj[key] = value;
  1146. }
  1147. return obj;
  1148. }
  1149. function isLittleEndian() {
  1150. const buffer8 = new Uint8Array(4);
  1151. buffer8[0] = 1;
  1152. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1153. return view32[0] === 1;
  1154. }
  1155. const IsLittleEndianCached = {
  1156. get value() {
  1157. return shadow(this, "value", isLittleEndian());
  1158. }
  1159. };
  1160. exports.IsLittleEndianCached = IsLittleEndianCached;
  1161. function isEvalSupported() {
  1162. try {
  1163. new Function("");
  1164. return true;
  1165. } catch (e) {
  1166. return false;
  1167. }
  1168. }
  1169. const IsEvalSupportedCached = {
  1170. get value() {
  1171. return shadow(this, "value", isEvalSupported());
  1172. }
  1173. };
  1174. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  1175. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1176. class Util {
  1177. static makeHexColor(r, g, b) {
  1178. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1179. }
  1180. static transform(m1, m2) {
  1181. 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]];
  1182. }
  1183. static applyTransform(p, m) {
  1184. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1185. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1186. return [xt, yt];
  1187. }
  1188. static applyInverseTransform(p, m) {
  1189. const d = m[0] * m[3] - m[1] * m[2];
  1190. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1191. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1192. return [xt, yt];
  1193. }
  1194. static getAxialAlignedBoundingBox(r, m) {
  1195. const p1 = Util.applyTransform(r, m);
  1196. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1197. const p3 = Util.applyTransform([r[0], r[3]], m);
  1198. const p4 = Util.applyTransform([r[2], r[1]], m);
  1199. 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])];
  1200. }
  1201. static inverseTransform(m) {
  1202. const d = m[0] * m[3] - m[1] * m[2];
  1203. 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];
  1204. }
  1205. static apply3dTransform(m, v) {
  1206. 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]];
  1207. }
  1208. static singularValueDecompose2dScale(m) {
  1209. const transpose = [m[0], m[2], m[1], m[3]];
  1210. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1211. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1212. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1213. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1214. const first = (a + d) / 2;
  1215. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1216. const sx = first + second || 1;
  1217. const sy = first - second || 1;
  1218. return [Math.sqrt(sx), Math.sqrt(sy)];
  1219. }
  1220. static normalizeRect(rect) {
  1221. const r = rect.slice(0);
  1222. if (rect[0] > rect[2]) {
  1223. r[0] = rect[2];
  1224. r[2] = rect[0];
  1225. }
  1226. if (rect[1] > rect[3]) {
  1227. r[1] = rect[3];
  1228. r[3] = rect[1];
  1229. }
  1230. return r;
  1231. }
  1232. static intersect(rect1, rect2) {
  1233. function compare(a, b) {
  1234. return a - b;
  1235. }
  1236. const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  1237. const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  1238. const result = [];
  1239. rect1 = Util.normalizeRect(rect1);
  1240. rect2 = Util.normalizeRect(rect2);
  1241. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  1242. result[0] = orderedX[1];
  1243. result[2] = orderedX[2];
  1244. } else {
  1245. return null;
  1246. }
  1247. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  1248. result[1] = orderedY[1];
  1249. result[3] = orderedY[2];
  1250. } else {
  1251. return null;
  1252. }
  1253. return result;
  1254. }
  1255. }
  1256. exports.Util = Util;
  1257. 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];
  1258. function stringToPDFString(str) {
  1259. const length = str.length,
  1260. strBuf = [];
  1261. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1262. for (let i = 2; i < length; i += 2) {
  1263. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1264. }
  1265. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1266. for (let i = 2; i < length; i += 2) {
  1267. strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
  1268. }
  1269. } else {
  1270. for (let i = 0; i < length; ++i) {
  1271. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1272. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1273. }
  1274. }
  1275. return strBuf.join("");
  1276. }
  1277. function escapeString(str) {
  1278. return str.replace(/([()\\\n\r])/g, match => {
  1279. if (match === "\n") {
  1280. return "\\n";
  1281. } else if (match === "\r") {
  1282. return "\\r";
  1283. }
  1284. return `\\${match}`;
  1285. });
  1286. }
  1287. function isAscii(str) {
  1288. return /^[\x00-\x7F]*$/.test(str);
  1289. }
  1290. function stringToUTF16BEString(str) {
  1291. const buf = ["\xFE\xFF"];
  1292. for (let i = 0, ii = str.length; i < ii; i++) {
  1293. const char = str.charCodeAt(i);
  1294. buf.push(String.fromCharCode(char >> 8 & 0xff));
  1295. buf.push(String.fromCharCode(char & 0xff));
  1296. }
  1297. return buf.join("");
  1298. }
  1299. function stringToUTF8String(str) {
  1300. return decodeURIComponent(escape(str));
  1301. }
  1302. function utf8StringToString(str) {
  1303. return unescape(encodeURIComponent(str));
  1304. }
  1305. function isBool(v) {
  1306. return typeof v === "boolean";
  1307. }
  1308. function isNum(v) {
  1309. return typeof v === "number";
  1310. }
  1311. function isString(v) {
  1312. return typeof v === "string";
  1313. }
  1314. function isArrayBuffer(v) {
  1315. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1316. }
  1317. function isArrayEqual(arr1, arr2) {
  1318. if (arr1.length !== arr2.length) {
  1319. return false;
  1320. }
  1321. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1322. if (arr1[i] !== arr2[i]) {
  1323. return false;
  1324. }
  1325. }
  1326. return true;
  1327. }
  1328. function getModificationDate(date = new Date()) {
  1329. 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")];
  1330. return buffer.join("");
  1331. }
  1332. function createPromiseCapability() {
  1333. const capability = Object.create(null);
  1334. let isSettled = false;
  1335. Object.defineProperty(capability, "settled", {
  1336. get() {
  1337. return isSettled;
  1338. }
  1339. });
  1340. capability.promise = new Promise(function (resolve, reject) {
  1341. capability.resolve = function (data) {
  1342. isSettled = true;
  1343. resolve(data);
  1344. };
  1345. capability.reject = function (reason) {
  1346. isSettled = true;
  1347. reject(reason);
  1348. };
  1349. });
  1350. return capability;
  1351. }
  1352. function createObjectURL(data, contentType = "", forceDataSchema = false) {
  1353. if (URL.createObjectURL && !forceDataSchema) {
  1354. return URL.createObjectURL(new Blob([data], {
  1355. type: contentType
  1356. }));
  1357. }
  1358. const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1359. let buffer = `data:${contentType};base64,`;
  1360. for (let i = 0, ii = data.length; i < ii; i += 3) {
  1361. const b1 = data[i] & 0xff;
  1362. const b2 = data[i + 1] & 0xff;
  1363. const b3 = data[i + 2] & 0xff;
  1364. const d1 = b1 >> 2,
  1365. d2 = (b1 & 3) << 4 | b2 >> 4;
  1366. const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  1367. const d4 = i + 2 < ii ? b3 & 0x3f : 64;
  1368. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1369. }
  1370. return buffer;
  1371. }
  1372. /***/ }),
  1373. /* 3 */
  1374. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1375. var _is_node = __w_pdfjs_require__(4);
  1376. ;
  1377. /***/ }),
  1378. /* 4 */
  1379. /***/ ((__unused_webpack_module, exports) => {
  1380. Object.defineProperty(exports, "__esModule", ({
  1381. value: true
  1382. }));
  1383. exports.isNodeJS = void 0;
  1384. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1385. exports.isNodeJS = isNodeJS;
  1386. /***/ }),
  1387. /* 5 */
  1388. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1389. Object.defineProperty(exports, "__esModule", ({
  1390. value: true
  1391. }));
  1392. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1393. exports.isCmd = isCmd;
  1394. exports.isDict = isDict;
  1395. exports.isEOF = isEOF;
  1396. exports.isName = isName;
  1397. exports.isRef = isRef;
  1398. exports.isRefsEqual = isRefsEqual;
  1399. exports.isStream = isStream;
  1400. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = void 0;
  1401. var _util = __w_pdfjs_require__(2);
  1402. const EOF = {};
  1403. exports.EOF = EOF;
  1404. const Name = function NameClosure() {
  1405. let nameCache = Object.create(null);
  1406. function Name(name) {
  1407. this.name = name;
  1408. }
  1409. Name.prototype = {};
  1410. Name.get = function Name_get(name) {
  1411. const nameValue = nameCache[name];
  1412. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1413. };
  1414. Name._clearCache = function () {
  1415. nameCache = Object.create(null);
  1416. };
  1417. return Name;
  1418. }();
  1419. exports.Name = Name;
  1420. const Cmd = function CmdClosure() {
  1421. let cmdCache = Object.create(null);
  1422. function Cmd(cmd) {
  1423. this.cmd = cmd;
  1424. }
  1425. Cmd.prototype = {};
  1426. Cmd.get = function Cmd_get(cmd) {
  1427. const cmdValue = cmdCache[cmd];
  1428. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1429. };
  1430. Cmd._clearCache = function () {
  1431. cmdCache = Object.create(null);
  1432. };
  1433. return Cmd;
  1434. }();
  1435. exports.Cmd = Cmd;
  1436. const Dict = function DictClosure() {
  1437. const nonSerializable = function nonSerializableClosure() {
  1438. return nonSerializable;
  1439. };
  1440. function Dict(xref) {
  1441. this._map = Object.create(null);
  1442. this.xref = xref;
  1443. this.objId = null;
  1444. this.suppressEncryption = false;
  1445. this.__nonSerializable__ = nonSerializable;
  1446. }
  1447. Dict.prototype = {
  1448. assignXref: function Dict_assignXref(newXref) {
  1449. this.xref = newXref;
  1450. },
  1451. get size() {
  1452. return Object.keys(this._map).length;
  1453. },
  1454. get(key1, key2, key3) {
  1455. let value = this._map[key1];
  1456. if (value === undefined && key2 !== undefined) {
  1457. value = this._map[key2];
  1458. if (value === undefined && key3 !== undefined) {
  1459. value = this._map[key3];
  1460. }
  1461. }
  1462. if (value instanceof Ref && this.xref) {
  1463. return this.xref.fetch(value, this.suppressEncryption);
  1464. }
  1465. return value;
  1466. },
  1467. async getAsync(key1, key2, key3) {
  1468. let value = this._map[key1];
  1469. if (value === undefined && key2 !== undefined) {
  1470. value = this._map[key2];
  1471. if (value === undefined && key3 !== undefined) {
  1472. value = this._map[key3];
  1473. }
  1474. }
  1475. if (value instanceof Ref && this.xref) {
  1476. return this.xref.fetchAsync(value, this.suppressEncryption);
  1477. }
  1478. return value;
  1479. },
  1480. getArray(key1, key2, key3) {
  1481. let value = this.get(key1, key2, key3);
  1482. if (!Array.isArray(value) || !this.xref) {
  1483. return value;
  1484. }
  1485. value = value.slice();
  1486. for (let i = 0, ii = value.length; i < ii; i++) {
  1487. if (!(value[i] instanceof Ref)) {
  1488. continue;
  1489. }
  1490. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1491. }
  1492. return value;
  1493. },
  1494. getRaw: function Dict_getRaw(key) {
  1495. return this._map[key];
  1496. },
  1497. getKeys: function Dict_getKeys() {
  1498. return Object.keys(this._map);
  1499. },
  1500. getRawValues: function Dict_getRawValues() {
  1501. return Object.values(this._map);
  1502. },
  1503. set: function Dict_set(key, value) {
  1504. this._map[key] = value;
  1505. },
  1506. has: function Dict_has(key) {
  1507. return this._map[key] !== undefined;
  1508. },
  1509. forEach: function Dict_forEach(callback) {
  1510. for (const key in this._map) {
  1511. callback(key, this.get(key));
  1512. }
  1513. }
  1514. };
  1515. Dict.empty = function () {
  1516. const emptyDict = new Dict(null);
  1517. emptyDict.set = (key, value) => {
  1518. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1519. };
  1520. return emptyDict;
  1521. }();
  1522. Dict.merge = function ({
  1523. xref,
  1524. dictArray,
  1525. mergeSubDicts = false
  1526. }) {
  1527. const mergedDict = new Dict(xref);
  1528. if (!mergeSubDicts) {
  1529. for (const dict of dictArray) {
  1530. if (!(dict instanceof Dict)) {
  1531. continue;
  1532. }
  1533. for (const [key, value] of Object.entries(dict._map)) {
  1534. if (mergedDict._map[key] === undefined) {
  1535. mergedDict._map[key] = value;
  1536. }
  1537. }
  1538. }
  1539. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1540. }
  1541. const properties = new Map();
  1542. for (const dict of dictArray) {
  1543. if (!(dict instanceof Dict)) {
  1544. continue;
  1545. }
  1546. for (const [key, value] of Object.entries(dict._map)) {
  1547. let property = properties.get(key);
  1548. if (property === undefined) {
  1549. property = [];
  1550. properties.set(key, property);
  1551. }
  1552. property.push(value);
  1553. }
  1554. }
  1555. for (const [name, values] of properties) {
  1556. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1557. mergedDict._map[name] = values[0];
  1558. continue;
  1559. }
  1560. const subDict = new Dict(xref);
  1561. for (const dict of values) {
  1562. if (!(dict instanceof Dict)) {
  1563. continue;
  1564. }
  1565. for (const [key, value] of Object.entries(dict._map)) {
  1566. if (subDict._map[key] === undefined) {
  1567. subDict._map[key] = value;
  1568. }
  1569. }
  1570. }
  1571. if (subDict.size > 0) {
  1572. mergedDict._map[name] = subDict;
  1573. }
  1574. }
  1575. properties.clear();
  1576. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1577. };
  1578. return Dict;
  1579. }();
  1580. exports.Dict = Dict;
  1581. const Ref = function RefClosure() {
  1582. let refCache = Object.create(null);
  1583. function Ref(num, gen) {
  1584. this.num = num;
  1585. this.gen = gen;
  1586. }
  1587. Ref.prototype = {
  1588. toString: function Ref_toString() {
  1589. if (this.gen === 0) {
  1590. return `${this.num}R`;
  1591. }
  1592. return `${this.num}R${this.gen}`;
  1593. }
  1594. };
  1595. Ref.get = function (num, gen) {
  1596. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1597. const refValue = refCache[key];
  1598. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1599. };
  1600. Ref._clearCache = function () {
  1601. refCache = Object.create(null);
  1602. };
  1603. return Ref;
  1604. }();
  1605. exports.Ref = Ref;
  1606. class RefSet {
  1607. constructor(parent = null) {
  1608. this._set = new Set(parent && parent._set);
  1609. }
  1610. has(ref) {
  1611. return this._set.has(ref.toString());
  1612. }
  1613. put(ref) {
  1614. this._set.add(ref.toString());
  1615. }
  1616. remove(ref) {
  1617. this._set.delete(ref.toString());
  1618. }
  1619. forEach(callback) {
  1620. for (const ref of this._set.values()) {
  1621. callback(ref);
  1622. }
  1623. }
  1624. clear() {
  1625. this._set.clear();
  1626. }
  1627. }
  1628. exports.RefSet = RefSet;
  1629. class RefSetCache {
  1630. constructor() {
  1631. this._map = new Map();
  1632. }
  1633. get size() {
  1634. return this._map.size;
  1635. }
  1636. get(ref) {
  1637. return this._map.get(ref.toString());
  1638. }
  1639. has(ref) {
  1640. return this._map.has(ref.toString());
  1641. }
  1642. put(ref, obj) {
  1643. this._map.set(ref.toString(), obj);
  1644. }
  1645. putAlias(ref, aliasRef) {
  1646. this._map.set(ref.toString(), this.get(aliasRef));
  1647. }
  1648. forEach(callback) {
  1649. for (const value of this._map.values()) {
  1650. callback(value);
  1651. }
  1652. }
  1653. clear() {
  1654. this._map.clear();
  1655. }
  1656. }
  1657. exports.RefSetCache = RefSetCache;
  1658. function isEOF(v) {
  1659. return v === EOF;
  1660. }
  1661. function isName(v, name) {
  1662. return v instanceof Name && (name === undefined || v.name === name);
  1663. }
  1664. function isCmd(v, cmd) {
  1665. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1666. }
  1667. function isDict(v, type) {
  1668. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1669. }
  1670. function isRef(v) {
  1671. return v instanceof Ref;
  1672. }
  1673. function isRefsEqual(v1, v2) {
  1674. return v1.num === v2.num && v1.gen === v2.gen;
  1675. }
  1676. function isStream(v) {
  1677. return typeof v === "object" && v !== null && v.getBytes !== undefined;
  1678. }
  1679. function clearPrimitiveCaches() {
  1680. Cmd._clearCache();
  1681. Name._clearCache();
  1682. Ref._clearCache();
  1683. }
  1684. /***/ }),
  1685. /* 6 */
  1686. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1687. Object.defineProperty(exports, "__esModule", ({
  1688. value: true
  1689. }));
  1690. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1691. var _util = __w_pdfjs_require__(2);
  1692. var _chunked_stream = __w_pdfjs_require__(7);
  1693. var _core_utils = __w_pdfjs_require__(8);
  1694. var _document = __w_pdfjs_require__(9);
  1695. var _stream = __w_pdfjs_require__(12);
  1696. function parseDocBaseUrl(url) {
  1697. if (url) {
  1698. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  1699. if (absoluteUrl) {
  1700. return absoluteUrl.href;
  1701. }
  1702. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  1703. }
  1704. return null;
  1705. }
  1706. class BasePdfManager {
  1707. constructor() {
  1708. if (this.constructor === BasePdfManager) {
  1709. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1710. }
  1711. }
  1712. get docId() {
  1713. return this._docId;
  1714. }
  1715. get password() {
  1716. return this._password;
  1717. }
  1718. get docBaseUrl() {
  1719. return this._docBaseUrl;
  1720. }
  1721. onLoadedStream() {
  1722. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1723. }
  1724. ensureDoc(prop, args) {
  1725. return this.ensure(this.pdfDocument, prop, args);
  1726. }
  1727. ensureXRef(prop, args) {
  1728. return this.ensure(this.pdfDocument.xref, prop, args);
  1729. }
  1730. ensureCatalog(prop, args) {
  1731. return this.ensure(this.pdfDocument.catalog, prop, args);
  1732. }
  1733. getPage(pageIndex) {
  1734. return this.pdfDocument.getPage(pageIndex);
  1735. }
  1736. fontFallback(id, handler) {
  1737. return this.pdfDocument.fontFallback(id, handler);
  1738. }
  1739. cleanup(manuallyTriggered = false) {
  1740. return this.pdfDocument.cleanup(manuallyTriggered);
  1741. }
  1742. async ensure(obj, prop, args) {
  1743. (0, _util.unreachable)("Abstract method `ensure` called");
  1744. }
  1745. requestRange(begin, end) {
  1746. (0, _util.unreachable)("Abstract method `requestRange` called");
  1747. }
  1748. requestLoadedStream() {
  1749. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1750. }
  1751. sendProgressiveData(chunk) {
  1752. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1753. }
  1754. updatePassword(password) {
  1755. this._password = password;
  1756. }
  1757. terminate(reason) {
  1758. (0, _util.unreachable)("Abstract method `terminate` called");
  1759. }
  1760. }
  1761. class LocalPdfManager extends BasePdfManager {
  1762. constructor(docId, data, password, evaluatorOptions, enableXfa, docBaseUrl) {
  1763. super();
  1764. this._docId = docId;
  1765. this._password = password;
  1766. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1767. this.evaluatorOptions = evaluatorOptions;
  1768. this.enableXfa = enableXfa;
  1769. const stream = new _stream.Stream(data);
  1770. this.pdfDocument = new _document.PDFDocument(this, stream);
  1771. this._loadedStreamPromise = Promise.resolve(stream);
  1772. }
  1773. async ensure(obj, prop, args) {
  1774. const value = obj[prop];
  1775. if (typeof value === "function") {
  1776. return value.apply(obj, args);
  1777. }
  1778. return value;
  1779. }
  1780. requestRange(begin, end) {
  1781. return Promise.resolve();
  1782. }
  1783. requestLoadedStream() {}
  1784. onLoadedStream() {
  1785. return this._loadedStreamPromise;
  1786. }
  1787. terminate(reason) {}
  1788. }
  1789. exports.LocalPdfManager = LocalPdfManager;
  1790. class NetworkPdfManager extends BasePdfManager {
  1791. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  1792. super();
  1793. this._docId = docId;
  1794. this._password = args.password;
  1795. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1796. this.msgHandler = args.msgHandler;
  1797. this.evaluatorOptions = evaluatorOptions;
  1798. this.enableXfa = enableXfa;
  1799. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1800. msgHandler: args.msgHandler,
  1801. length: args.length,
  1802. disableAutoFetch: args.disableAutoFetch,
  1803. rangeChunkSize: args.rangeChunkSize
  1804. });
  1805. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1806. }
  1807. async ensure(obj, prop, args) {
  1808. try {
  1809. const value = obj[prop];
  1810. if (typeof value === "function") {
  1811. return value.apply(obj, args);
  1812. }
  1813. return value;
  1814. } catch (ex) {
  1815. if (!(ex instanceof _core_utils.MissingDataException)) {
  1816. throw ex;
  1817. }
  1818. await this.requestRange(ex.begin, ex.end);
  1819. return this.ensure(obj, prop, args);
  1820. }
  1821. }
  1822. requestRange(begin, end) {
  1823. return this.streamManager.requestRange(begin, end);
  1824. }
  1825. requestLoadedStream() {
  1826. this.streamManager.requestAllChunks();
  1827. }
  1828. sendProgressiveData(chunk) {
  1829. this.streamManager.onReceiveData({
  1830. chunk
  1831. });
  1832. }
  1833. onLoadedStream() {
  1834. return this.streamManager.onLoadedStream();
  1835. }
  1836. terminate(reason) {
  1837. this.streamManager.abort(reason);
  1838. }
  1839. }
  1840. exports.NetworkPdfManager = NetworkPdfManager;
  1841. /***/ }),
  1842. /* 7 */
  1843. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1844. Object.defineProperty(exports, "__esModule", ({
  1845. value: true
  1846. }));
  1847. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  1848. var _util = __w_pdfjs_require__(2);
  1849. var _core_utils = __w_pdfjs_require__(8);
  1850. class ChunkedStream {
  1851. constructor(length, chunkSize, manager) {
  1852. this.bytes = new Uint8Array(length);
  1853. this.start = 0;
  1854. this.pos = 0;
  1855. this.end = length;
  1856. this.chunkSize = chunkSize;
  1857. this._loadedChunks = new Set();
  1858. this.numChunks = Math.ceil(length / chunkSize);
  1859. this.manager = manager;
  1860. this.progressiveDataLength = 0;
  1861. this.lastSuccessfulEnsureByteChunk = -1;
  1862. }
  1863. getMissingChunks() {
  1864. const chunks = [];
  1865. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1866. if (!this._loadedChunks.has(chunk)) {
  1867. chunks.push(chunk);
  1868. }
  1869. }
  1870. return chunks;
  1871. }
  1872. getBaseStreams() {
  1873. return [this];
  1874. }
  1875. get numChunksLoaded() {
  1876. return this._loadedChunks.size;
  1877. }
  1878. allChunksLoaded() {
  1879. return this.numChunksLoaded === this.numChunks;
  1880. }
  1881. onReceiveData(begin, chunk) {
  1882. const chunkSize = this.chunkSize;
  1883. if (begin % chunkSize !== 0) {
  1884. throw new Error(`Bad begin offset: ${begin}`);
  1885. }
  1886. const end = begin + chunk.byteLength;
  1887. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1888. throw new Error(`Bad end offset: ${end}`);
  1889. }
  1890. this.bytes.set(new Uint8Array(chunk), begin);
  1891. const beginChunk = Math.floor(begin / chunkSize);
  1892. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1893. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1894. this._loadedChunks.add(curChunk);
  1895. }
  1896. }
  1897. onReceiveProgressiveData(data) {
  1898. let position = this.progressiveDataLength;
  1899. const beginChunk = Math.floor(position / this.chunkSize);
  1900. this.bytes.set(new Uint8Array(data), position);
  1901. position += data.byteLength;
  1902. this.progressiveDataLength = position;
  1903. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  1904. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1905. this._loadedChunks.add(curChunk);
  1906. }
  1907. }
  1908. ensureByte(pos) {
  1909. if (pos < this.progressiveDataLength) {
  1910. return;
  1911. }
  1912. const chunk = Math.floor(pos / this.chunkSize);
  1913. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  1914. return;
  1915. }
  1916. if (!this._loadedChunks.has(chunk)) {
  1917. throw new _core_utils.MissingDataException(pos, pos + 1);
  1918. }
  1919. this.lastSuccessfulEnsureByteChunk = chunk;
  1920. }
  1921. ensureRange(begin, end) {
  1922. if (begin >= end) {
  1923. return;
  1924. }
  1925. if (end <= this.progressiveDataLength) {
  1926. return;
  1927. }
  1928. const chunkSize = this.chunkSize;
  1929. const beginChunk = Math.floor(begin / chunkSize);
  1930. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1931. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1932. if (!this._loadedChunks.has(chunk)) {
  1933. throw new _core_utils.MissingDataException(begin, end);
  1934. }
  1935. }
  1936. }
  1937. nextEmptyChunk(beginChunk) {
  1938. const numChunks = this.numChunks;
  1939. for (let i = 0; i < numChunks; ++i) {
  1940. const chunk = (beginChunk + i) % numChunks;
  1941. if (!this._loadedChunks.has(chunk)) {
  1942. return chunk;
  1943. }
  1944. }
  1945. return null;
  1946. }
  1947. hasChunk(chunk) {
  1948. return this._loadedChunks.has(chunk);
  1949. }
  1950. get length() {
  1951. return this.end - this.start;
  1952. }
  1953. get isEmpty() {
  1954. return this.length === 0;
  1955. }
  1956. getByte() {
  1957. const pos = this.pos;
  1958. if (pos >= this.end) {
  1959. return -1;
  1960. }
  1961. if (pos >= this.progressiveDataLength) {
  1962. this.ensureByte(pos);
  1963. }
  1964. return this.bytes[this.pos++];
  1965. }
  1966. getUint16() {
  1967. const b0 = this.getByte();
  1968. const b1 = this.getByte();
  1969. if (b0 === -1 || b1 === -1) {
  1970. return -1;
  1971. }
  1972. return (b0 << 8) + b1;
  1973. }
  1974. getInt32() {
  1975. const b0 = this.getByte();
  1976. const b1 = this.getByte();
  1977. const b2 = this.getByte();
  1978. const b3 = this.getByte();
  1979. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1980. }
  1981. getBytes(length, forceClamped = false) {
  1982. const bytes = this.bytes;
  1983. const pos = this.pos;
  1984. const strEnd = this.end;
  1985. if (!length) {
  1986. if (strEnd > this.progressiveDataLength) {
  1987. this.ensureRange(pos, strEnd);
  1988. }
  1989. const subarray = bytes.subarray(pos, strEnd);
  1990. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  1991. }
  1992. let end = pos + length;
  1993. if (end > strEnd) {
  1994. end = strEnd;
  1995. }
  1996. if (end > this.progressiveDataLength) {
  1997. this.ensureRange(pos, end);
  1998. }
  1999. this.pos = end;
  2000. const subarray = bytes.subarray(pos, end);
  2001. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2002. }
  2003. peekByte() {
  2004. const peekedByte = this.getByte();
  2005. if (peekedByte !== -1) {
  2006. this.pos--;
  2007. }
  2008. return peekedByte;
  2009. }
  2010. peekBytes(length, forceClamped = false) {
  2011. const bytes = this.getBytes(length, forceClamped);
  2012. this.pos -= bytes.length;
  2013. return bytes;
  2014. }
  2015. getByteRange(begin, end) {
  2016. if (begin < 0) {
  2017. begin = 0;
  2018. }
  2019. if (end > this.end) {
  2020. end = this.end;
  2021. }
  2022. if (end > this.progressiveDataLength) {
  2023. this.ensureRange(begin, end);
  2024. }
  2025. return this.bytes.subarray(begin, end);
  2026. }
  2027. skip(n) {
  2028. if (!n) {
  2029. n = 1;
  2030. }
  2031. this.pos += n;
  2032. }
  2033. reset() {
  2034. this.pos = this.start;
  2035. }
  2036. moveStart() {
  2037. this.start = this.pos;
  2038. }
  2039. makeSubStream(start, length, dict) {
  2040. if (length) {
  2041. if (start + length > this.progressiveDataLength) {
  2042. this.ensureRange(start, start + length);
  2043. }
  2044. } else {
  2045. if (start >= this.progressiveDataLength) {
  2046. this.ensureByte(start);
  2047. }
  2048. }
  2049. function ChunkedStreamSubstream() {}
  2050. ChunkedStreamSubstream.prototype = Object.create(this);
  2051. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2052. const chunkSize = this.chunkSize;
  2053. const beginChunk = Math.floor(this.start / chunkSize);
  2054. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2055. const missingChunks = [];
  2056. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2057. if (!this._loadedChunks.has(chunk)) {
  2058. missingChunks.push(chunk);
  2059. }
  2060. }
  2061. return missingChunks;
  2062. };
  2063. ChunkedStreamSubstream.prototype.allChunksLoaded = function () {
  2064. if (this.numChunksLoaded === this.numChunks) {
  2065. return true;
  2066. }
  2067. return this.getMissingChunks().length === 0;
  2068. };
  2069. const subStream = new ChunkedStreamSubstream();
  2070. subStream.pos = subStream.start = start;
  2071. subStream.end = start + length || this.end;
  2072. subStream.dict = dict;
  2073. return subStream;
  2074. }
  2075. }
  2076. exports.ChunkedStream = ChunkedStream;
  2077. class ChunkedStreamManager {
  2078. constructor(pdfNetworkStream, args) {
  2079. this.length = args.length;
  2080. this.chunkSize = args.rangeChunkSize;
  2081. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2082. this.pdfNetworkStream = pdfNetworkStream;
  2083. this.disableAutoFetch = args.disableAutoFetch;
  2084. this.msgHandler = args.msgHandler;
  2085. this.currRequestId = 0;
  2086. this._chunksNeededByRequest = new Map();
  2087. this._requestsByChunk = new Map();
  2088. this._promisesByRequest = new Map();
  2089. this.progressiveDataLength = 0;
  2090. this.aborted = false;
  2091. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2092. }
  2093. onLoadedStream() {
  2094. return this._loadedStreamCapability.promise;
  2095. }
  2096. sendRequest(begin, end) {
  2097. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2098. if (!rangeReader.isStreamingSupported) {
  2099. rangeReader.onProgress = this.onProgress.bind(this);
  2100. }
  2101. let chunks = [],
  2102. loaded = 0;
  2103. const promise = new Promise((resolve, reject) => {
  2104. const readChunk = chunk => {
  2105. try {
  2106. if (!chunk.done) {
  2107. const data = chunk.value;
  2108. chunks.push(data);
  2109. loaded += (0, _util.arrayByteLength)(data);
  2110. if (rangeReader.isStreamingSupported) {
  2111. this.onProgress({
  2112. loaded
  2113. });
  2114. }
  2115. rangeReader.read().then(readChunk, reject);
  2116. return;
  2117. }
  2118. const chunkData = (0, _util.arraysToBytes)(chunks);
  2119. chunks = null;
  2120. resolve(chunkData);
  2121. } catch (e) {
  2122. reject(e);
  2123. }
  2124. };
  2125. rangeReader.read().then(readChunk, reject);
  2126. });
  2127. promise.then(data => {
  2128. if (this.aborted) {
  2129. return;
  2130. }
  2131. this.onReceiveData({
  2132. chunk: data,
  2133. begin
  2134. });
  2135. });
  2136. }
  2137. requestAllChunks() {
  2138. const missingChunks = this.stream.getMissingChunks();
  2139. this._requestChunks(missingChunks);
  2140. return this._loadedStreamCapability.promise;
  2141. }
  2142. _requestChunks(chunks) {
  2143. const requestId = this.currRequestId++;
  2144. const chunksNeeded = new Set();
  2145. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2146. for (const chunk of chunks) {
  2147. if (!this.stream.hasChunk(chunk)) {
  2148. chunksNeeded.add(chunk);
  2149. }
  2150. }
  2151. if (chunksNeeded.size === 0) {
  2152. return Promise.resolve();
  2153. }
  2154. const capability = (0, _util.createPromiseCapability)();
  2155. this._promisesByRequest.set(requestId, capability);
  2156. const chunksToRequest = [];
  2157. for (const chunk of chunksNeeded) {
  2158. let requestIds = this._requestsByChunk.get(chunk);
  2159. if (!requestIds) {
  2160. requestIds = [];
  2161. this._requestsByChunk.set(chunk, requestIds);
  2162. chunksToRequest.push(chunk);
  2163. }
  2164. requestIds.push(requestId);
  2165. }
  2166. if (chunksToRequest.length > 0) {
  2167. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2168. for (const groupedChunk of groupedChunksToRequest) {
  2169. const begin = groupedChunk.beginChunk * this.chunkSize;
  2170. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2171. this.sendRequest(begin, end);
  2172. }
  2173. }
  2174. return capability.promise.catch(reason => {
  2175. if (this.aborted) {
  2176. return;
  2177. }
  2178. throw reason;
  2179. });
  2180. }
  2181. getStream() {
  2182. return this.stream;
  2183. }
  2184. requestRange(begin, end) {
  2185. end = Math.min(end, this.length);
  2186. const beginChunk = this.getBeginChunk(begin);
  2187. const endChunk = this.getEndChunk(end);
  2188. const chunks = [];
  2189. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2190. chunks.push(chunk);
  2191. }
  2192. return this._requestChunks(chunks);
  2193. }
  2194. requestRanges(ranges = []) {
  2195. const chunksToRequest = [];
  2196. for (const range of ranges) {
  2197. const beginChunk = this.getBeginChunk(range.begin);
  2198. const endChunk = this.getEndChunk(range.end);
  2199. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2200. if (!chunksToRequest.includes(chunk)) {
  2201. chunksToRequest.push(chunk);
  2202. }
  2203. }
  2204. }
  2205. chunksToRequest.sort(function (a, b) {
  2206. return a - b;
  2207. });
  2208. return this._requestChunks(chunksToRequest);
  2209. }
  2210. groupChunks(chunks) {
  2211. const groupedChunks = [];
  2212. let beginChunk = -1;
  2213. let prevChunk = -1;
  2214. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2215. const chunk = chunks[i];
  2216. if (beginChunk < 0) {
  2217. beginChunk = chunk;
  2218. }
  2219. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2220. groupedChunks.push({
  2221. beginChunk,
  2222. endChunk: prevChunk + 1
  2223. });
  2224. beginChunk = chunk;
  2225. }
  2226. if (i + 1 === chunks.length) {
  2227. groupedChunks.push({
  2228. beginChunk,
  2229. endChunk: chunk + 1
  2230. });
  2231. }
  2232. prevChunk = chunk;
  2233. }
  2234. return groupedChunks;
  2235. }
  2236. onProgress(args) {
  2237. this.msgHandler.send("DocProgress", {
  2238. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2239. total: this.length
  2240. });
  2241. }
  2242. onReceiveData(args) {
  2243. const chunk = args.chunk;
  2244. const isProgressive = args.begin === undefined;
  2245. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2246. const end = begin + chunk.byteLength;
  2247. const beginChunk = Math.floor(begin / this.chunkSize);
  2248. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2249. if (isProgressive) {
  2250. this.stream.onReceiveProgressiveData(chunk);
  2251. this.progressiveDataLength = end;
  2252. } else {
  2253. this.stream.onReceiveData(begin, chunk);
  2254. }
  2255. if (this.stream.allChunksLoaded()) {
  2256. this._loadedStreamCapability.resolve(this.stream);
  2257. }
  2258. const loadedRequests = [];
  2259. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2260. const requestIds = this._requestsByChunk.get(curChunk);
  2261. if (!requestIds) {
  2262. continue;
  2263. }
  2264. this._requestsByChunk.delete(curChunk);
  2265. for (const requestId of requestIds) {
  2266. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2267. if (chunksNeeded.has(curChunk)) {
  2268. chunksNeeded.delete(curChunk);
  2269. }
  2270. if (chunksNeeded.size > 0) {
  2271. continue;
  2272. }
  2273. loadedRequests.push(requestId);
  2274. }
  2275. }
  2276. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2277. let nextEmptyChunk;
  2278. if (this.stream.numChunksLoaded === 1) {
  2279. const lastChunk = this.stream.numChunks - 1;
  2280. if (!this.stream.hasChunk(lastChunk)) {
  2281. nextEmptyChunk = lastChunk;
  2282. }
  2283. } else {
  2284. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2285. }
  2286. if (Number.isInteger(nextEmptyChunk)) {
  2287. this._requestChunks([nextEmptyChunk]);
  2288. }
  2289. }
  2290. for (const requestId of loadedRequests) {
  2291. const capability = this._promisesByRequest.get(requestId);
  2292. this._promisesByRequest.delete(requestId);
  2293. capability.resolve();
  2294. }
  2295. this.msgHandler.send("DocProgress", {
  2296. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2297. total: this.length
  2298. });
  2299. }
  2300. onError(err) {
  2301. this._loadedStreamCapability.reject(err);
  2302. }
  2303. getBeginChunk(begin) {
  2304. return Math.floor(begin / this.chunkSize);
  2305. }
  2306. getEndChunk(end) {
  2307. return Math.floor((end - 1) / this.chunkSize) + 1;
  2308. }
  2309. abort(reason) {
  2310. this.aborted = true;
  2311. if (this.pdfNetworkStream) {
  2312. this.pdfNetworkStream.cancelAllRequests(reason);
  2313. }
  2314. for (const capability of this._promisesByRequest.values()) {
  2315. capability.reject(reason);
  2316. }
  2317. }
  2318. }
  2319. exports.ChunkedStreamManager = ChunkedStreamManager;
  2320. /***/ }),
  2321. /* 8 */
  2322. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2323. Object.defineProperty(exports, "__esModule", ({
  2324. value: true
  2325. }));
  2326. exports.collectActions = collectActions;
  2327. exports.encodeToXmlString = encodeToXmlString;
  2328. exports.escapePDFName = escapePDFName;
  2329. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2330. exports.getInheritableProperty = getInheritableProperty;
  2331. exports.getLookupTableFactory = getLookupTableFactory;
  2332. exports.isWhiteSpace = isWhiteSpace;
  2333. exports.log2 = log2;
  2334. exports.parseXFAPath = parseXFAPath;
  2335. exports.readInt8 = readInt8;
  2336. exports.readUint16 = readUint16;
  2337. exports.readUint32 = readUint32;
  2338. exports.toRomanNumerals = toRomanNumerals;
  2339. exports.XRefParseException = exports.XRefEntryException = exports.MissingDataException = void 0;
  2340. var _util = __w_pdfjs_require__(2);
  2341. var _primitives = __w_pdfjs_require__(5);
  2342. function getLookupTableFactory(initializer) {
  2343. let lookup;
  2344. return function () {
  2345. if (initializer) {
  2346. lookup = Object.create(null);
  2347. initializer(lookup);
  2348. initializer = null;
  2349. }
  2350. return lookup;
  2351. };
  2352. }
  2353. function getArrayLookupTableFactory(initializer) {
  2354. let lookup;
  2355. return function () {
  2356. if (initializer) {
  2357. let arr = initializer();
  2358. initializer = null;
  2359. lookup = Object.create(null);
  2360. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2361. lookup[arr[i]] = arr[i + 1];
  2362. }
  2363. arr = null;
  2364. }
  2365. return lookup;
  2366. };
  2367. }
  2368. class MissingDataException extends _util.BaseException {
  2369. constructor(begin, end) {
  2370. super(`Missing data [${begin}, ${end})`);
  2371. this.begin = begin;
  2372. this.end = end;
  2373. }
  2374. }
  2375. exports.MissingDataException = MissingDataException;
  2376. class XRefEntryException extends _util.BaseException {}
  2377. exports.XRefEntryException = XRefEntryException;
  2378. class XRefParseException extends _util.BaseException {}
  2379. exports.XRefParseException = XRefParseException;
  2380. function getInheritableProperty({
  2381. dict,
  2382. key,
  2383. getArray = false,
  2384. stopWhenFound = true
  2385. }) {
  2386. let values;
  2387. const visited = new _primitives.RefSet();
  2388. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  2389. if (dict.objId) {
  2390. visited.put(dict.objId);
  2391. }
  2392. const value = getArray ? dict.getArray(key) : dict.get(key);
  2393. if (value !== undefined) {
  2394. if (stopWhenFound) {
  2395. return value;
  2396. }
  2397. if (!values) {
  2398. values = [];
  2399. }
  2400. values.push(value);
  2401. }
  2402. dict = dict.get("Parent");
  2403. }
  2404. return values;
  2405. }
  2406. 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"];
  2407. function toRomanNumerals(number, lowerCase = false) {
  2408. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2409. const romanBuf = [];
  2410. let pos;
  2411. while (number >= 1000) {
  2412. number -= 1000;
  2413. romanBuf.push("M");
  2414. }
  2415. pos = number / 100 | 0;
  2416. number %= 100;
  2417. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2418. pos = number / 10 | 0;
  2419. number %= 10;
  2420. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2421. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2422. const romanStr = romanBuf.join("");
  2423. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2424. }
  2425. function log2(x) {
  2426. if (x <= 0) {
  2427. return 0;
  2428. }
  2429. return Math.ceil(Math.log2(x));
  2430. }
  2431. function readInt8(data, offset) {
  2432. return data[offset] << 24 >> 24;
  2433. }
  2434. function readUint16(data, offset) {
  2435. return data[offset] << 8 | data[offset + 1];
  2436. }
  2437. function readUint32(data, offset) {
  2438. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2439. }
  2440. function isWhiteSpace(ch) {
  2441. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2442. }
  2443. function parseXFAPath(path) {
  2444. const positionPattern = /(.+)\[([0-9]+)\]$/;
  2445. return path.split(".").map(component => {
  2446. const m = component.match(positionPattern);
  2447. if (m) {
  2448. return {
  2449. name: m[1],
  2450. pos: parseInt(m[2], 10)
  2451. };
  2452. }
  2453. return {
  2454. name: component,
  2455. pos: 0
  2456. };
  2457. });
  2458. }
  2459. function escapePDFName(str) {
  2460. const buffer = [];
  2461. let start = 0;
  2462. for (let i = 0, ii = str.length; i < ii; i++) {
  2463. const char = str.charCodeAt(i);
  2464. 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) {
  2465. if (start < i) {
  2466. buffer.push(str.substring(start, i));
  2467. }
  2468. buffer.push(`#${char.toString(16)}`);
  2469. start = i + 1;
  2470. }
  2471. }
  2472. if (buffer.length === 0) {
  2473. return str;
  2474. }
  2475. if (start < str.length) {
  2476. buffer.push(str.substring(start, str.length));
  2477. }
  2478. return buffer.join("");
  2479. }
  2480. function _collectJS(entry, xref, list, parents) {
  2481. if (!entry) {
  2482. return;
  2483. }
  2484. let parent = null;
  2485. if ((0, _primitives.isRef)(entry)) {
  2486. if (parents.has(entry)) {
  2487. return;
  2488. }
  2489. parent = entry;
  2490. parents.put(parent);
  2491. entry = xref.fetch(entry);
  2492. }
  2493. if (Array.isArray(entry)) {
  2494. for (const element of entry) {
  2495. _collectJS(element, xref, list, parents);
  2496. }
  2497. } else if (entry instanceof _primitives.Dict) {
  2498. if ((0, _primitives.isName)(entry.get("S"), "JavaScript") && entry.has("JS")) {
  2499. const js = entry.get("JS");
  2500. let code;
  2501. if ((0, _primitives.isStream)(js)) {
  2502. code = (0, _util.bytesToString)(js.getBytes());
  2503. } else {
  2504. code = js;
  2505. }
  2506. code = (0, _util.stringToPDFString)(code);
  2507. if (code) {
  2508. list.push(code);
  2509. }
  2510. }
  2511. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2512. }
  2513. if (parent) {
  2514. parents.remove(parent);
  2515. }
  2516. }
  2517. function collectActions(xref, dict, eventType) {
  2518. const actions = Object.create(null);
  2519. const additionalActionsDicts = getInheritableProperty({
  2520. dict,
  2521. key: "AA",
  2522. stopWhenFound: false
  2523. });
  2524. if (additionalActionsDicts) {
  2525. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2526. const additionalActions = additionalActionsDicts[i];
  2527. if (!(additionalActions instanceof _primitives.Dict)) {
  2528. continue;
  2529. }
  2530. for (const key of additionalActions.getKeys()) {
  2531. const action = eventType[key];
  2532. if (!action) {
  2533. continue;
  2534. }
  2535. const actionDict = additionalActions.getRaw(key);
  2536. const parents = new _primitives.RefSet();
  2537. const list = [];
  2538. _collectJS(actionDict, xref, list, parents);
  2539. if (list.length > 0) {
  2540. actions[action] = list;
  2541. }
  2542. }
  2543. }
  2544. }
  2545. if (dict.has("A")) {
  2546. const actionDict = dict.get("A");
  2547. const parents = new _primitives.RefSet();
  2548. const list = [];
  2549. _collectJS(actionDict, xref, list, parents);
  2550. if (list.length > 0) {
  2551. actions.Action = list;
  2552. }
  2553. }
  2554. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2555. }
  2556. const XMLEntities = {
  2557. 0x3c: "&lt;",
  2558. 0x3e: "&gt;",
  2559. 0x26: "&amp;",
  2560. 0x22: "&quot;",
  2561. 0x27: "&apos;"
  2562. };
  2563. function encodeToXmlString(str) {
  2564. const buffer = [];
  2565. let start = 0;
  2566. for (let i = 0, ii = str.length; i < ii; i++) {
  2567. const char = str.codePointAt(i);
  2568. if (0x20 <= char && char <= 0x7e) {
  2569. const entity = XMLEntities[char];
  2570. if (entity) {
  2571. if (start < i) {
  2572. buffer.push(str.substring(start, i));
  2573. }
  2574. buffer.push(entity);
  2575. start = i + 1;
  2576. }
  2577. } else {
  2578. if (start < i) {
  2579. buffer.push(str.substring(start, i));
  2580. }
  2581. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2582. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2583. i++;
  2584. }
  2585. start = i + 1;
  2586. }
  2587. }
  2588. if (buffer.length === 0) {
  2589. return str;
  2590. }
  2591. if (start < str.length) {
  2592. buffer.push(str.substring(start, str.length));
  2593. }
  2594. return buffer.join("");
  2595. }
  2596. /***/ }),
  2597. /* 9 */
  2598. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2599. Object.defineProperty(exports, "__esModule", ({
  2600. value: true
  2601. }));
  2602. exports.PDFDocument = exports.Page = void 0;
  2603. var _util = __w_pdfjs_require__(2);
  2604. var _obj = __w_pdfjs_require__(10);
  2605. var _primitives = __w_pdfjs_require__(5);
  2606. var _core_utils = __w_pdfjs_require__(8);
  2607. var _stream = __w_pdfjs_require__(12);
  2608. var _annotation = __w_pdfjs_require__(27);
  2609. var _crypto = __w_pdfjs_require__(22);
  2610. var _parser = __w_pdfjs_require__(11);
  2611. var _operator_list = __w_pdfjs_require__(46);
  2612. var _evaluator = __w_pdfjs_require__(29);
  2613. var _factory = __w_pdfjs_require__(49);
  2614. const DEFAULT_USER_UNIT = 1.0;
  2615. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2616. function isAnnotationRenderable(annotation, intent) {
  2617. return intent === "display" && annotation.viewable || intent === "print" && annotation.printable;
  2618. }
  2619. class Page {
  2620. constructor({
  2621. pdfManager,
  2622. xref,
  2623. pageIndex,
  2624. pageDict,
  2625. ref,
  2626. globalIdFactory,
  2627. fontCache,
  2628. builtInCMapCache,
  2629. globalImageCache,
  2630. nonBlendModesSet,
  2631. xfaFactory
  2632. }) {
  2633. this.pdfManager = pdfManager;
  2634. this.pageIndex = pageIndex;
  2635. this.pageDict = pageDict;
  2636. this.xref = xref;
  2637. this.ref = ref;
  2638. this.fontCache = fontCache;
  2639. this.builtInCMapCache = builtInCMapCache;
  2640. this.globalImageCache = globalImageCache;
  2641. this.nonBlendModesSet = nonBlendModesSet;
  2642. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2643. this.resourcesPromise = null;
  2644. this.xfaFactory = xfaFactory;
  2645. const idCounters = {
  2646. obj: 0
  2647. };
  2648. this._localIdFactory = class extends globalIdFactory {
  2649. static createObjId() {
  2650. return `p${pageIndex}_${++idCounters.obj}`;
  2651. }
  2652. };
  2653. }
  2654. _getInheritableProperty(key, getArray = false) {
  2655. const value = (0, _core_utils.getInheritableProperty)({
  2656. dict: this.pageDict,
  2657. key,
  2658. getArray,
  2659. stopWhenFound: false
  2660. });
  2661. if (!Array.isArray(value)) {
  2662. return value;
  2663. }
  2664. if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
  2665. return value[0];
  2666. }
  2667. return _primitives.Dict.merge({
  2668. xref: this.xref,
  2669. dictArray: value
  2670. });
  2671. }
  2672. get content() {
  2673. return this.pageDict.get("Contents");
  2674. }
  2675. get resources() {
  2676. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  2677. }
  2678. _getBoundingBox(name) {
  2679. if (this.xfaData) {
  2680. const {
  2681. width,
  2682. height
  2683. } = this.xfaData.attributes.style;
  2684. return [0, 0, parseInt(width), parseInt(height)];
  2685. }
  2686. const box = this._getInheritableProperty(name, true);
  2687. if (Array.isArray(box) && box.length === 4) {
  2688. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2689. return box;
  2690. }
  2691. (0, _util.warn)(`Empty /${name} entry.`);
  2692. }
  2693. return null;
  2694. }
  2695. get mediaBox() {
  2696. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  2697. }
  2698. get cropBox() {
  2699. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  2700. }
  2701. get userUnit() {
  2702. let obj = this.pageDict.get("UserUnit");
  2703. if (!(0, _util.isNum)(obj) || obj <= 0) {
  2704. obj = DEFAULT_USER_UNIT;
  2705. }
  2706. return (0, _util.shadow)(this, "userUnit", obj);
  2707. }
  2708. get view() {
  2709. const {
  2710. cropBox,
  2711. mediaBox
  2712. } = this;
  2713. let view;
  2714. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  2715. view = mediaBox;
  2716. } else {
  2717. const box = _util.Util.intersect(cropBox, mediaBox);
  2718. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2719. view = box;
  2720. } else {
  2721. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  2722. }
  2723. }
  2724. return (0, _util.shadow)(this, "view", view || mediaBox);
  2725. }
  2726. get rotate() {
  2727. let rotate = this._getInheritableProperty("Rotate") || 0;
  2728. if (rotate % 90 !== 0) {
  2729. rotate = 0;
  2730. } else if (rotate >= 360) {
  2731. rotate = rotate % 360;
  2732. } else if (rotate < 0) {
  2733. rotate = (rotate % 360 + 360) % 360;
  2734. }
  2735. return (0, _util.shadow)(this, "rotate", rotate);
  2736. }
  2737. getContentStream() {
  2738. const content = this.content;
  2739. let stream;
  2740. if (Array.isArray(content)) {
  2741. const xref = this.xref;
  2742. const streams = [];
  2743. for (const subStream of content) {
  2744. streams.push(xref.fetchIfRef(subStream));
  2745. }
  2746. stream = new _stream.StreamsSequenceStream(streams);
  2747. } else if ((0, _primitives.isStream)(content)) {
  2748. stream = content;
  2749. } else {
  2750. stream = new _stream.NullStream();
  2751. }
  2752. return stream;
  2753. }
  2754. get xfaData() {
  2755. if (this.xfaFactory) {
  2756. return (0, _util.shadow)(this, "xfaData", this.xfaFactory.getPage(this.pageIndex));
  2757. }
  2758. return (0, _util.shadow)(this, "xfaData", null);
  2759. }
  2760. save(handler, task, annotationStorage) {
  2761. const partialEvaluator = new _evaluator.PartialEvaluator({
  2762. xref: this.xref,
  2763. handler,
  2764. pageIndex: this.pageIndex,
  2765. idFactory: this._localIdFactory,
  2766. fontCache: this.fontCache,
  2767. builtInCMapCache: this.builtInCMapCache,
  2768. globalImageCache: this.globalImageCache,
  2769. options: this.evaluatorOptions
  2770. });
  2771. return this._parsedAnnotations.then(function (annotations) {
  2772. const newRefsPromises = [];
  2773. for (const annotation of annotations) {
  2774. if (!isAnnotationRenderable(annotation, "print")) {
  2775. continue;
  2776. }
  2777. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  2778. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  2779. return null;
  2780. }));
  2781. }
  2782. return Promise.all(newRefsPromises);
  2783. });
  2784. }
  2785. loadResources(keys) {
  2786. if (!this.resourcesPromise) {
  2787. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  2788. }
  2789. return this.resourcesPromise.then(() => {
  2790. const objectLoader = new _obj.ObjectLoader(this.resources, keys, this.xref);
  2791. return objectLoader.load();
  2792. });
  2793. }
  2794. getOperatorList({
  2795. handler,
  2796. sink,
  2797. task,
  2798. intent,
  2799. renderInteractiveForms,
  2800. annotationStorage
  2801. }) {
  2802. const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
  2803. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  2804. const partialEvaluator = new _evaluator.PartialEvaluator({
  2805. xref: this.xref,
  2806. handler,
  2807. pageIndex: this.pageIndex,
  2808. idFactory: this._localIdFactory,
  2809. fontCache: this.fontCache,
  2810. builtInCMapCache: this.builtInCMapCache,
  2811. globalImageCache: this.globalImageCache,
  2812. options: this.evaluatorOptions
  2813. });
  2814. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2815. const pageListPromise = dataPromises.then(([contentStream]) => {
  2816. const opList = new _operator_list.OperatorList(intent, sink);
  2817. handler.send("StartRenderPage", {
  2818. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  2819. pageIndex: this.pageIndex,
  2820. intent
  2821. });
  2822. return partialEvaluator.getOperatorList({
  2823. stream: contentStream,
  2824. task,
  2825. resources: this.resources,
  2826. operatorList: opList
  2827. }).then(function () {
  2828. return opList;
  2829. });
  2830. });
  2831. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  2832. if (annotations.length === 0) {
  2833. pageOpList.flush(true);
  2834. return {
  2835. length: pageOpList.totalLength
  2836. };
  2837. }
  2838. const opListPromises = [];
  2839. for (const annotation of annotations) {
  2840. if (isAnnotationRenderable(annotation, intent) && !annotation.isHidden(annotationStorage)) {
  2841. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderInteractiveForms, annotationStorage).catch(function (reason) {
  2842. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  2843. return null;
  2844. }));
  2845. }
  2846. }
  2847. return Promise.all(opListPromises).then(function (opLists) {
  2848. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  2849. for (const opList of opLists) {
  2850. pageOpList.addOpList(opList);
  2851. }
  2852. pageOpList.addOp(_util.OPS.endAnnotations, []);
  2853. pageOpList.flush(true);
  2854. return {
  2855. length: pageOpList.totalLength
  2856. };
  2857. });
  2858. });
  2859. }
  2860. extractTextContent({
  2861. handler,
  2862. task,
  2863. normalizeWhitespace,
  2864. sink,
  2865. combineTextItems
  2866. }) {
  2867. const contentStreamPromise = this.pdfManager.ensure(this, "getContentStream");
  2868. const resourcesPromise = this.loadResources(["ExtGState", "XObject", "Font"]);
  2869. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  2870. return dataPromises.then(([contentStream]) => {
  2871. const partialEvaluator = new _evaluator.PartialEvaluator({
  2872. xref: this.xref,
  2873. handler,
  2874. pageIndex: this.pageIndex,
  2875. idFactory: this._localIdFactory,
  2876. fontCache: this.fontCache,
  2877. builtInCMapCache: this.builtInCMapCache,
  2878. globalImageCache: this.globalImageCache,
  2879. options: this.evaluatorOptions
  2880. });
  2881. return partialEvaluator.getTextContent({
  2882. stream: contentStream,
  2883. task,
  2884. resources: this.resources,
  2885. normalizeWhitespace,
  2886. combineTextItems,
  2887. sink
  2888. });
  2889. });
  2890. }
  2891. getAnnotationsData(intent) {
  2892. return this._parsedAnnotations.then(function (annotations) {
  2893. const annotationsData = [];
  2894. for (let i = 0, ii = annotations.length; i < ii; i++) {
  2895. if (!intent || isAnnotationRenderable(annotations[i], intent)) {
  2896. annotationsData.push(annotations[i].data);
  2897. }
  2898. }
  2899. return annotationsData;
  2900. });
  2901. }
  2902. get annotations() {
  2903. const annots = this._getInheritableProperty("Annots");
  2904. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  2905. }
  2906. get _parsedAnnotations() {
  2907. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  2908. const annotationPromises = [];
  2909. for (const annotationRef of this.annotations) {
  2910. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  2911. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  2912. return null;
  2913. }));
  2914. }
  2915. return Promise.all(annotationPromises).then(function (annotations) {
  2916. return annotations.filter(annotation => !!annotation);
  2917. });
  2918. });
  2919. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  2920. }
  2921. get jsActions() {
  2922. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  2923. return (0, _util.shadow)(this, "jsActions", actions);
  2924. }
  2925. }
  2926. exports.Page = Page;
  2927. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  2928. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  2929. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  2930. const FINGERPRINT_FIRST_BYTES = 1024;
  2931. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  2932. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.[0-9]$/;
  2933. function find(stream, signature, limit = 1024, backwards = false) {
  2934. const signatureLength = signature.length;
  2935. const scanBytes = stream.peekBytes(limit);
  2936. const scanLength = scanBytes.length - signatureLength;
  2937. if (scanLength <= 0) {
  2938. return false;
  2939. }
  2940. if (backwards) {
  2941. const signatureEnd = signatureLength - 1;
  2942. let pos = scanBytes.length - 1;
  2943. while (pos >= signatureEnd) {
  2944. let j = 0;
  2945. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  2946. j++;
  2947. }
  2948. if (j >= signatureLength) {
  2949. stream.pos += pos - signatureEnd;
  2950. return true;
  2951. }
  2952. pos--;
  2953. }
  2954. } else {
  2955. let pos = 0;
  2956. while (pos <= scanLength) {
  2957. let j = 0;
  2958. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  2959. j++;
  2960. }
  2961. if (j >= signatureLength) {
  2962. stream.pos += pos;
  2963. return true;
  2964. }
  2965. pos++;
  2966. }
  2967. }
  2968. return false;
  2969. }
  2970. class PDFDocument {
  2971. constructor(pdfManager, arg) {
  2972. let stream;
  2973. if ((0, _primitives.isStream)(arg)) {
  2974. stream = arg;
  2975. } else if ((0, _util.isArrayBuffer)(arg)) {
  2976. stream = new _stream.Stream(arg);
  2977. } else {
  2978. throw new Error("PDFDocument: Unknown argument type");
  2979. }
  2980. if (stream.length <= 0) {
  2981. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  2982. }
  2983. this.pdfManager = pdfManager;
  2984. this.stream = stream;
  2985. this.xref = new _obj.XRef(stream, pdfManager);
  2986. this._pagePromises = [];
  2987. this._version = null;
  2988. const idCounters = {
  2989. font: 0
  2990. };
  2991. this._globalIdFactory = class {
  2992. static getDocId() {
  2993. return `g_${pdfManager.docId}`;
  2994. }
  2995. static createFontId() {
  2996. return `f${++idCounters.font}`;
  2997. }
  2998. static createObjId() {
  2999. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3000. }
  3001. };
  3002. }
  3003. parse(recoveryMode) {
  3004. this.xref.parse(recoveryMode);
  3005. this.catalog = new _obj.Catalog(this.pdfManager, this.xref);
  3006. if (this.catalog.version) {
  3007. this._version = this.catalog.version;
  3008. }
  3009. }
  3010. get linearization() {
  3011. let linearization = null;
  3012. try {
  3013. linearization = _parser.Linearization.create(this.stream);
  3014. } catch (err) {
  3015. if (err instanceof _core_utils.MissingDataException) {
  3016. throw err;
  3017. }
  3018. (0, _util.info)(err);
  3019. }
  3020. return (0, _util.shadow)(this, "linearization", linearization);
  3021. }
  3022. get startXRef() {
  3023. const stream = this.stream;
  3024. let startXRef = 0;
  3025. if (this.linearization) {
  3026. stream.reset();
  3027. if (find(stream, ENDOBJ_SIGNATURE)) {
  3028. startXRef = stream.pos + 6 - stream.start;
  3029. }
  3030. } else {
  3031. const step = 1024;
  3032. const startXRefLength = STARTXREF_SIGNATURE.length;
  3033. let found = false,
  3034. pos = stream.end;
  3035. while (!found && pos > 0) {
  3036. pos -= step - startXRefLength;
  3037. if (pos < 0) {
  3038. pos = 0;
  3039. }
  3040. stream.pos = pos;
  3041. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3042. }
  3043. if (found) {
  3044. stream.skip(9);
  3045. let ch;
  3046. do {
  3047. ch = stream.getByte();
  3048. } while ((0, _core_utils.isWhiteSpace)(ch));
  3049. let str = "";
  3050. while (ch >= 0x20 && ch <= 0x39) {
  3051. str += String.fromCharCode(ch);
  3052. ch = stream.getByte();
  3053. }
  3054. startXRef = parseInt(str, 10);
  3055. if (isNaN(startXRef)) {
  3056. startXRef = 0;
  3057. }
  3058. }
  3059. }
  3060. return (0, _util.shadow)(this, "startXRef", startXRef);
  3061. }
  3062. checkHeader() {
  3063. const stream = this.stream;
  3064. stream.reset();
  3065. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3066. return;
  3067. }
  3068. stream.moveStart();
  3069. const MAX_PDF_VERSION_LENGTH = 12;
  3070. let version = "",
  3071. ch;
  3072. while ((ch = stream.getByte()) > 0x20) {
  3073. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3074. break;
  3075. }
  3076. version += String.fromCharCode(ch);
  3077. }
  3078. if (!this._version) {
  3079. this._version = version.substring(5);
  3080. }
  3081. }
  3082. parseStartXRef() {
  3083. this.xref.setStartXRef(this.startXRef);
  3084. }
  3085. get numPages() {
  3086. if (this.xfaFactory) {
  3087. return (0, _util.shadow)(this, "numPages", this.xfaFactory.numberPages);
  3088. }
  3089. const linearization = this.linearization;
  3090. const num = linearization ? linearization.numPages : this.catalog.numPages;
  3091. return (0, _util.shadow)(this, "numPages", num);
  3092. }
  3093. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3094. const RECURSION_LIMIT = 10;
  3095. if (!Array.isArray(fields)) {
  3096. return false;
  3097. }
  3098. return fields.every(field => {
  3099. field = this.xref.fetchIfRef(field);
  3100. if (!(field instanceof _primitives.Dict)) {
  3101. return false;
  3102. }
  3103. if (field.has("Kids")) {
  3104. if (++recursionDepth > RECURSION_LIMIT) {
  3105. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3106. return false;
  3107. }
  3108. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3109. }
  3110. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3111. const rectangle = field.get("Rect");
  3112. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3113. return isSignature && isInvisible;
  3114. });
  3115. }
  3116. get xfaData() {
  3117. const acroForm = this.catalog.acroForm;
  3118. if (!acroForm) {
  3119. return null;
  3120. }
  3121. const xfa = acroForm.get("XFA");
  3122. const entries = {
  3123. "xdp:xdp": "",
  3124. template: "",
  3125. datasets: "",
  3126. config: "",
  3127. connectionSet: "",
  3128. localeSet: "",
  3129. stylesheet: "",
  3130. "/xdp:xdp": ""
  3131. };
  3132. if ((0, _primitives.isStream)(xfa) && !xfa.isEmpty) {
  3133. try {
  3134. entries["xdp:xdp"] = (0, _util.stringToUTF8String)((0, _util.bytesToString)(xfa.getBytes()));
  3135. return entries;
  3136. } catch (_) {
  3137. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3138. return null;
  3139. }
  3140. }
  3141. if (!Array.isArray(xfa) || xfa.length === 0) {
  3142. return null;
  3143. }
  3144. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3145. let name;
  3146. if (i === 0) {
  3147. name = "xdp:xdp";
  3148. } else if (i === ii - 2) {
  3149. name = "/xdp:xdp";
  3150. } else {
  3151. name = xfa[i];
  3152. }
  3153. if (!entries.hasOwnProperty(name)) {
  3154. continue;
  3155. }
  3156. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3157. if (!(0, _primitives.isStream)(data) || data.isEmpty) {
  3158. continue;
  3159. }
  3160. try {
  3161. entries[name] = (0, _util.stringToUTF8String)((0, _util.bytesToString)(data.getBytes()));
  3162. } catch (_) {
  3163. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3164. return null;
  3165. }
  3166. }
  3167. return entries;
  3168. }
  3169. get xfaFactory() {
  3170. if (this.pdfManager.enableXfa && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3171. const data = this.xfaData;
  3172. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3173. }
  3174. return (0, _util.shadow)(this, "xfaFaxtory", null);
  3175. }
  3176. get isPureXfa() {
  3177. return this.xfaFactory !== null;
  3178. }
  3179. get formInfo() {
  3180. const formInfo = {
  3181. hasFields: false,
  3182. hasAcroForm: false,
  3183. hasXfa: false
  3184. };
  3185. const acroForm = this.catalog.acroForm;
  3186. if (!acroForm) {
  3187. return (0, _util.shadow)(this, "formInfo", formInfo);
  3188. }
  3189. try {
  3190. const fields = acroForm.get("Fields");
  3191. const hasFields = Array.isArray(fields) && fields.length > 0;
  3192. formInfo.hasFields = hasFields;
  3193. const xfa = acroForm.get("XFA");
  3194. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || (0, _primitives.isStream)(xfa) && !xfa.isEmpty;
  3195. const sigFlags = acroForm.get("SigFlags");
  3196. const hasOnlyDocumentSignatures = !!(sigFlags & 0x1) && this._hasOnlyDocumentSignatures(fields);
  3197. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3198. } catch (ex) {
  3199. if (ex instanceof _core_utils.MissingDataException) {
  3200. throw ex;
  3201. }
  3202. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3203. }
  3204. return (0, _util.shadow)(this, "formInfo", formInfo);
  3205. }
  3206. get documentInfo() {
  3207. const DocumentInfoValidators = {
  3208. Title: _util.isString,
  3209. Author: _util.isString,
  3210. Subject: _util.isString,
  3211. Keywords: _util.isString,
  3212. Creator: _util.isString,
  3213. Producer: _util.isString,
  3214. CreationDate: _util.isString,
  3215. ModDate: _util.isString,
  3216. Trapped: _primitives.isName
  3217. };
  3218. let version = this._version;
  3219. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3220. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3221. version = null;
  3222. }
  3223. const docInfo = {
  3224. PDFFormatVersion: version,
  3225. IsLinearized: !!this.linearization,
  3226. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3227. IsXFAPresent: this.formInfo.hasXfa,
  3228. IsCollectionPresent: !!this.catalog.collection
  3229. };
  3230. let infoDict;
  3231. try {
  3232. infoDict = this.xref.trailer.get("Info");
  3233. } catch (err) {
  3234. if (err instanceof _core_utils.MissingDataException) {
  3235. throw err;
  3236. }
  3237. (0, _util.info)("The document information dictionary is invalid.");
  3238. }
  3239. if ((0, _primitives.isDict)(infoDict)) {
  3240. for (const key of infoDict.getKeys()) {
  3241. const value = infoDict.get(key);
  3242. if (DocumentInfoValidators[key]) {
  3243. if (DocumentInfoValidators[key](value)) {
  3244. docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
  3245. } else {
  3246. (0, _util.info)(`Bad value in document info for "${key}".`);
  3247. }
  3248. } else if (typeof key === "string") {
  3249. let customValue;
  3250. if ((0, _util.isString)(value)) {
  3251. customValue = (0, _util.stringToPDFString)(value);
  3252. } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
  3253. customValue = value;
  3254. } else {
  3255. (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`);
  3256. continue;
  3257. }
  3258. if (!docInfo.Custom) {
  3259. docInfo.Custom = Object.create(null);
  3260. }
  3261. docInfo.Custom[key] = customValue;
  3262. }
  3263. }
  3264. }
  3265. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3266. }
  3267. get fingerprint() {
  3268. let hash;
  3269. const idArray = this.xref.trailer.get("ID");
  3270. if (Array.isArray(idArray) && idArray[0] && (0, _util.isString)(idArray[0]) && idArray[0] !== EMPTY_FINGERPRINT) {
  3271. hash = (0, _util.stringToBytes)(idArray[0]);
  3272. } else {
  3273. hash = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3274. }
  3275. const fingerprintBuf = [];
  3276. for (let i = 0, ii = hash.length; i < ii; i++) {
  3277. const hex = hash[i].toString(16);
  3278. fingerprintBuf.push(hex.padStart(2, "0"));
  3279. }
  3280. return (0, _util.shadow)(this, "fingerprint", fingerprintBuf.join(""));
  3281. }
  3282. _getLinearizationPage(pageIndex) {
  3283. const {
  3284. catalog,
  3285. linearization
  3286. } = this;
  3287. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3288. return this.xref.fetchAsync(ref).then(obj => {
  3289. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
  3290. if (ref && !catalog.pageKidsCountCache.has(ref)) {
  3291. catalog.pageKidsCountCache.put(ref, 1);
  3292. }
  3293. return [obj, ref];
  3294. }
  3295. throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary.");
  3296. }).catch(reason => {
  3297. (0, _util.info)(reason);
  3298. return catalog.getPageDict(pageIndex);
  3299. });
  3300. }
  3301. getPage(pageIndex) {
  3302. if (this._pagePromises[pageIndex] !== undefined) {
  3303. return this._pagePromises[pageIndex];
  3304. }
  3305. const {
  3306. catalog,
  3307. linearization
  3308. } = this;
  3309. if (this.xfaFactory) {
  3310. return Promise.resolve(new Page({
  3311. pdfManager: this.pdfManager,
  3312. xref: this.xref,
  3313. pageIndex,
  3314. pageDict: _primitives.Dict.empty,
  3315. ref: null,
  3316. globalIdFactory: this._globalIdFactory,
  3317. fontCache: catalog.fontCache,
  3318. builtInCMapCache: catalog.builtInCMapCache,
  3319. globalImageCache: catalog.globalImageCache,
  3320. nonBlendModesSet: catalog.nonBlendModesSet,
  3321. xfaFactory: this.xfaFactory
  3322. }));
  3323. }
  3324. const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
  3325. return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {
  3326. return new Page({
  3327. pdfManager: this.pdfManager,
  3328. xref: this.xref,
  3329. pageIndex,
  3330. pageDict,
  3331. ref,
  3332. globalIdFactory: this._globalIdFactory,
  3333. fontCache: catalog.fontCache,
  3334. builtInCMapCache: catalog.builtInCMapCache,
  3335. globalImageCache: catalog.globalImageCache,
  3336. nonBlendModesSet: catalog.nonBlendModesSet,
  3337. xfaFactory: null
  3338. });
  3339. });
  3340. }
  3341. checkFirstPage() {
  3342. return this.getPage(0).catch(async reason => {
  3343. if (reason instanceof _core_utils.XRefEntryException) {
  3344. this._pagePromises.length = 0;
  3345. await this.cleanup();
  3346. throw new _core_utils.XRefParseException();
  3347. }
  3348. });
  3349. }
  3350. fontFallback(id, handler) {
  3351. return this.catalog.fontFallback(id, handler);
  3352. }
  3353. async cleanup(manuallyTriggered = false) {
  3354. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
  3355. }
  3356. _collectFieldObjects(name, fieldRef, promises) {
  3357. const field = this.xref.fetchIfRef(fieldRef);
  3358. if (field.has("T")) {
  3359. const partName = (0, _util.stringToPDFString)(field.get("T"));
  3360. if (name === "") {
  3361. name = partName;
  3362. } else {
  3363. name = `${name}.${partName}`;
  3364. }
  3365. }
  3366. if (!promises.has(name)) {
  3367. promises.set(name, []);
  3368. }
  3369. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  3370. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  3371. return null;
  3372. }));
  3373. if (field.has("Kids")) {
  3374. const kids = field.get("Kids");
  3375. for (const kid of kids) {
  3376. this._collectFieldObjects(name, kid, promises);
  3377. }
  3378. }
  3379. }
  3380. get fieldObjects() {
  3381. if (!this.formInfo.hasFields) {
  3382. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  3383. }
  3384. const allFields = Object.create(null);
  3385. const fieldPromises = new Map();
  3386. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  3387. this._collectFieldObjects("", fieldRef, fieldPromises);
  3388. }
  3389. const allPromises = [];
  3390. for (const [name, promises] of fieldPromises) {
  3391. allPromises.push(Promise.all(promises).then(fields => {
  3392. fields = fields.filter(field => !!field);
  3393. if (fields.length > 0) {
  3394. allFields[name] = fields;
  3395. }
  3396. }));
  3397. }
  3398. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  3399. }
  3400. get hasJSActions() {
  3401. return (0, _util.shadow)(this, "hasJSActions", this.fieldObjects.then(fieldObjects => {
  3402. return fieldObjects !== null && Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null)) || !!this.catalog.jsActions;
  3403. }));
  3404. }
  3405. get calculationOrderIds() {
  3406. const acroForm = this.catalog.acroForm;
  3407. if (!acroForm || !acroForm.has("CO")) {
  3408. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3409. }
  3410. const calculationOrder = acroForm.get("CO");
  3411. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  3412. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3413. }
  3414. const ids = calculationOrder.filter(_primitives.isRef).map(ref => ref.toString());
  3415. if (ids.length === 0) {
  3416. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3417. }
  3418. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  3419. }
  3420. }
  3421. exports.PDFDocument = PDFDocument;
  3422. /***/ }),
  3423. /* 10 */
  3424. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  3425. Object.defineProperty(exports, "__esModule", ({
  3426. value: true
  3427. }));
  3428. exports.XRef = exports.ObjectLoader = exports.FileSpec = exports.Catalog = void 0;
  3429. var _util = __w_pdfjs_require__(2);
  3430. var _primitives = __w_pdfjs_require__(5);
  3431. var _core_utils = __w_pdfjs_require__(8);
  3432. var _parser = __w_pdfjs_require__(11);
  3433. var _crypto = __w_pdfjs_require__(22);
  3434. var _colorspace = __w_pdfjs_require__(23);
  3435. var _image_utils = __w_pdfjs_require__(24);
  3436. var _metadata_parser = __w_pdfjs_require__(25);
  3437. function fetchDestination(dest) {
  3438. return (0, _primitives.isDict)(dest) ? dest.get("D") : dest;
  3439. }
  3440. class Catalog {
  3441. constructor(pdfManager, xref) {
  3442. this.pdfManager = pdfManager;
  3443. this.xref = xref;
  3444. this._catDict = xref.getCatalogObj();
  3445. if (!(0, _primitives.isDict)(this._catDict)) {
  3446. throw new _util.FormatError("Catalog object is not a dictionary.");
  3447. }
  3448. this.fontCache = new _primitives.RefSetCache();
  3449. this.builtInCMapCache = new Map();
  3450. this.globalImageCache = new _image_utils.GlobalImageCache();
  3451. this.pageKidsCountCache = new _primitives.RefSetCache();
  3452. this.nonBlendModesSet = new _primitives.RefSet();
  3453. }
  3454. get version() {
  3455. const version = this._catDict.get("Version");
  3456. if (!(0, _primitives.isName)(version)) {
  3457. return (0, _util.shadow)(this, "version", null);
  3458. }
  3459. return (0, _util.shadow)(this, "version", version.name);
  3460. }
  3461. get collection() {
  3462. let collection = null;
  3463. try {
  3464. const obj = this._catDict.get("Collection");
  3465. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  3466. collection = obj;
  3467. }
  3468. } catch (ex) {
  3469. if (ex instanceof _core_utils.MissingDataException) {
  3470. throw ex;
  3471. }
  3472. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  3473. }
  3474. return (0, _util.shadow)(this, "collection", collection);
  3475. }
  3476. get acroForm() {
  3477. let acroForm = null;
  3478. try {
  3479. const obj = this._catDict.get("AcroForm");
  3480. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  3481. acroForm = obj;
  3482. }
  3483. } catch (ex) {
  3484. if (ex instanceof _core_utils.MissingDataException) {
  3485. throw ex;
  3486. }
  3487. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  3488. }
  3489. return (0, _util.shadow)(this, "acroForm", acroForm);
  3490. }
  3491. get metadata() {
  3492. const streamRef = this._catDict.getRaw("Metadata");
  3493. if (!(0, _primitives.isRef)(streamRef)) {
  3494. return (0, _util.shadow)(this, "metadata", null);
  3495. }
  3496. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  3497. const stream = this.xref.fetch(streamRef, suppressEncryption);
  3498. let metadata = null;
  3499. if ((0, _primitives.isStream)(stream) && (0, _primitives.isDict)(stream.dict)) {
  3500. const type = stream.dict.get("Type");
  3501. const subtype = stream.dict.get("Subtype");
  3502. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  3503. try {
  3504. const data = (0, _util.stringToUTF8String)((0, _util.bytesToString)(stream.getBytes()));
  3505. if (data) {
  3506. metadata = new _metadata_parser.MetadataParser(data).serializable;
  3507. }
  3508. } catch (e) {
  3509. if (e instanceof _core_utils.MissingDataException) {
  3510. throw e;
  3511. }
  3512. (0, _util.info)("Skipping invalid metadata.");
  3513. }
  3514. }
  3515. }
  3516. return (0, _util.shadow)(this, "metadata", metadata);
  3517. }
  3518. get markInfo() {
  3519. let markInfo = null;
  3520. try {
  3521. markInfo = this._readMarkInfo();
  3522. } catch (ex) {
  3523. if (ex instanceof _core_utils.MissingDataException) {
  3524. throw ex;
  3525. }
  3526. (0, _util.warn)("Unable to read mark info.");
  3527. }
  3528. return (0, _util.shadow)(this, "markInfo", markInfo);
  3529. }
  3530. _readMarkInfo() {
  3531. const obj = this._catDict.get("MarkInfo");
  3532. if (!(0, _primitives.isDict)(obj)) {
  3533. return null;
  3534. }
  3535. const markInfo = Object.assign(Object.create(null), {
  3536. Marked: false,
  3537. UserProperties: false,
  3538. Suspects: false
  3539. });
  3540. for (const key in markInfo) {
  3541. if (!obj.has(key)) {
  3542. continue;
  3543. }
  3544. const value = obj.get(key);
  3545. if (!(0, _util.isBool)(value)) {
  3546. continue;
  3547. }
  3548. markInfo[key] = value;
  3549. }
  3550. return markInfo;
  3551. }
  3552. get toplevelPagesDict() {
  3553. const pagesObj = this._catDict.get("Pages");
  3554. if (!(0, _primitives.isDict)(pagesObj)) {
  3555. throw new _util.FormatError("Invalid top-level pages dictionary.");
  3556. }
  3557. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  3558. }
  3559. get documentOutline() {
  3560. let obj = null;
  3561. try {
  3562. obj = this._readDocumentOutline();
  3563. } catch (ex) {
  3564. if (ex instanceof _core_utils.MissingDataException) {
  3565. throw ex;
  3566. }
  3567. (0, _util.warn)("Unable to read document outline.");
  3568. }
  3569. return (0, _util.shadow)(this, "documentOutline", obj);
  3570. }
  3571. _readDocumentOutline() {
  3572. let obj = this._catDict.get("Outlines");
  3573. if (!(0, _primitives.isDict)(obj)) {
  3574. return null;
  3575. }
  3576. obj = obj.getRaw("First");
  3577. if (!(0, _primitives.isRef)(obj)) {
  3578. return null;
  3579. }
  3580. const root = {
  3581. items: []
  3582. };
  3583. const queue = [{
  3584. obj,
  3585. parent: root
  3586. }];
  3587. const processed = new _primitives.RefSet();
  3588. processed.put(obj);
  3589. const xref = this.xref,
  3590. blackColor = new Uint8ClampedArray(3);
  3591. while (queue.length > 0) {
  3592. const i = queue.shift();
  3593. const outlineDict = xref.fetchIfRef(i.obj);
  3594. if (outlineDict === null) {
  3595. continue;
  3596. }
  3597. if (!outlineDict.has("Title")) {
  3598. throw new _util.FormatError("Invalid outline item encountered.");
  3599. }
  3600. const data = {
  3601. url: null,
  3602. dest: null
  3603. };
  3604. Catalog.parseDestDictionary({
  3605. destDict: outlineDict,
  3606. resultObj: data,
  3607. docBaseUrl: this.pdfManager.docBaseUrl
  3608. });
  3609. const title = outlineDict.get("Title");
  3610. const flags = outlineDict.get("F") || 0;
  3611. const color = outlineDict.getArray("C");
  3612. const count = outlineDict.get("Count");
  3613. let rgbColor = blackColor;
  3614. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  3615. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  3616. }
  3617. const outlineItem = {
  3618. dest: data.dest,
  3619. url: data.url,
  3620. unsafeUrl: data.unsafeUrl,
  3621. newWindow: data.newWindow,
  3622. title: (0, _util.stringToPDFString)(title),
  3623. color: rgbColor,
  3624. count: Number.isInteger(count) ? count : undefined,
  3625. bold: !!(flags & 2),
  3626. italic: !!(flags & 1),
  3627. items: []
  3628. };
  3629. i.parent.items.push(outlineItem);
  3630. obj = outlineDict.getRaw("First");
  3631. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  3632. queue.push({
  3633. obj,
  3634. parent: outlineItem
  3635. });
  3636. processed.put(obj);
  3637. }
  3638. obj = outlineDict.getRaw("Next");
  3639. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  3640. queue.push({
  3641. obj,
  3642. parent: i.parent
  3643. });
  3644. processed.put(obj);
  3645. }
  3646. }
  3647. return root.items.length > 0 ? root.items : null;
  3648. }
  3649. get permissions() {
  3650. let permissions = null;
  3651. try {
  3652. permissions = this._readPermissions();
  3653. } catch (ex) {
  3654. if (ex instanceof _core_utils.MissingDataException) {
  3655. throw ex;
  3656. }
  3657. (0, _util.warn)("Unable to read permissions.");
  3658. }
  3659. return (0, _util.shadow)(this, "permissions", permissions);
  3660. }
  3661. _readPermissions() {
  3662. const encrypt = this.xref.trailer.get("Encrypt");
  3663. if (!(0, _primitives.isDict)(encrypt)) {
  3664. return null;
  3665. }
  3666. let flags = encrypt.get("P");
  3667. if (!(0, _util.isNum)(flags)) {
  3668. return null;
  3669. }
  3670. flags += 2 ** 32;
  3671. const permissions = [];
  3672. for (const key in _util.PermissionFlag) {
  3673. const value = _util.PermissionFlag[key];
  3674. if (flags & value) {
  3675. permissions.push(value);
  3676. }
  3677. }
  3678. return permissions;
  3679. }
  3680. get optionalContentConfig() {
  3681. let config = null;
  3682. try {
  3683. const properties = this._catDict.get("OCProperties");
  3684. if (!properties) {
  3685. return (0, _util.shadow)(this, "optionalContentConfig", null);
  3686. }
  3687. const defaultConfig = properties.get("D");
  3688. if (!defaultConfig) {
  3689. return (0, _util.shadow)(this, "optionalContentConfig", null);
  3690. }
  3691. const groupsData = properties.get("OCGs");
  3692. if (!Array.isArray(groupsData)) {
  3693. return (0, _util.shadow)(this, "optionalContentConfig", null);
  3694. }
  3695. const groups = [];
  3696. const groupRefs = [];
  3697. for (const groupRef of groupsData) {
  3698. if (!(0, _primitives.isRef)(groupRef)) {
  3699. continue;
  3700. }
  3701. groupRefs.push(groupRef);
  3702. const group = this.xref.fetchIfRef(groupRef);
  3703. groups.push({
  3704. id: groupRef.toString(),
  3705. name: (0, _util.isString)(group.get("Name")) ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  3706. intent: (0, _util.isString)(group.get("Intent")) ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  3707. });
  3708. }
  3709. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  3710. config.groups = groups;
  3711. } catch (ex) {
  3712. if (ex instanceof _core_utils.MissingDataException) {
  3713. throw ex;
  3714. }
  3715. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  3716. }
  3717. return (0, _util.shadow)(this, "optionalContentConfig", config);
  3718. }
  3719. _readOptionalContentConfig(config, contentGroupRefs) {
  3720. function parseOnOff(refs) {
  3721. const onParsed = [];
  3722. if (Array.isArray(refs)) {
  3723. for (const value of refs) {
  3724. if (!(0, _primitives.isRef)(value)) {
  3725. continue;
  3726. }
  3727. if (contentGroupRefs.includes(value)) {
  3728. onParsed.push(value.toString());
  3729. }
  3730. }
  3731. }
  3732. return onParsed;
  3733. }
  3734. function parseOrder(refs, nestedLevels = 0) {
  3735. if (!Array.isArray(refs)) {
  3736. return null;
  3737. }
  3738. const order = [];
  3739. for (const value of refs) {
  3740. if ((0, _primitives.isRef)(value) && contentGroupRefs.includes(value)) {
  3741. parsedOrderRefs.put(value);
  3742. order.push(value.toString());
  3743. continue;
  3744. }
  3745. const nestedOrder = parseNestedOrder(value, nestedLevels);
  3746. if (nestedOrder) {
  3747. order.push(nestedOrder);
  3748. }
  3749. }
  3750. if (nestedLevels > 0) {
  3751. return order;
  3752. }
  3753. const hiddenGroups = [];
  3754. for (const groupRef of contentGroupRefs) {
  3755. if (parsedOrderRefs.has(groupRef)) {
  3756. continue;
  3757. }
  3758. hiddenGroups.push(groupRef.toString());
  3759. }
  3760. if (hiddenGroups.length) {
  3761. order.push({
  3762. name: null,
  3763. order: hiddenGroups
  3764. });
  3765. }
  3766. return order;
  3767. }
  3768. function parseNestedOrder(ref, nestedLevels) {
  3769. if (++nestedLevels > MAX_NESTED_LEVELS) {
  3770. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  3771. return null;
  3772. }
  3773. const value = xref.fetchIfRef(ref);
  3774. if (!Array.isArray(value)) {
  3775. return null;
  3776. }
  3777. const nestedName = xref.fetchIfRef(value[0]);
  3778. if (typeof nestedName !== "string") {
  3779. return null;
  3780. }
  3781. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  3782. if (!nestedOrder || !nestedOrder.length) {
  3783. return null;
  3784. }
  3785. return {
  3786. name: (0, _util.stringToPDFString)(nestedName),
  3787. order: nestedOrder
  3788. };
  3789. }
  3790. const xref = this.xref,
  3791. parsedOrderRefs = new _primitives.RefSet(),
  3792. MAX_NESTED_LEVELS = 10;
  3793. return {
  3794. name: (0, _util.isString)(config.get("Name")) ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  3795. creator: (0, _util.isString)(config.get("Creator")) ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  3796. baseState: (0, _primitives.isName)(config.get("BaseState")) ? config.get("BaseState").name : null,
  3797. on: parseOnOff(config.get("ON")),
  3798. off: parseOnOff(config.get("OFF")),
  3799. order: parseOrder(config.get("Order")),
  3800. groups: null
  3801. };
  3802. }
  3803. get numPages() {
  3804. const obj = this.toplevelPagesDict.get("Count");
  3805. if (!Number.isInteger(obj)) {
  3806. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  3807. }
  3808. return (0, _util.shadow)(this, "numPages", obj);
  3809. }
  3810. get destinations() {
  3811. const obj = this._readDests(),
  3812. dests = Object.create(null);
  3813. if (obj instanceof NameTree) {
  3814. const names = obj.getAll();
  3815. for (const name in names) {
  3816. dests[name] = fetchDestination(names[name]);
  3817. }
  3818. } else if (obj instanceof _primitives.Dict) {
  3819. obj.forEach(function (key, value) {
  3820. if (value) {
  3821. dests[key] = fetchDestination(value);
  3822. }
  3823. });
  3824. }
  3825. return (0, _util.shadow)(this, "destinations", dests);
  3826. }
  3827. getDestination(destinationId) {
  3828. const obj = this._readDests();
  3829. if (obj instanceof NameTree || obj instanceof _primitives.Dict) {
  3830. return fetchDestination(obj.get(destinationId) || null);
  3831. }
  3832. return null;
  3833. }
  3834. _readDests() {
  3835. const obj = this._catDict.get("Names");
  3836. if (obj && obj.has("Dests")) {
  3837. return new NameTree(obj.getRaw("Dests"), this.xref);
  3838. } else if (this._catDict.has("Dests")) {
  3839. return this._catDict.get("Dests");
  3840. }
  3841. return undefined;
  3842. }
  3843. get pageLabels() {
  3844. let obj = null;
  3845. try {
  3846. obj = this._readPageLabels();
  3847. } catch (ex) {
  3848. if (ex instanceof _core_utils.MissingDataException) {
  3849. throw ex;
  3850. }
  3851. (0, _util.warn)("Unable to read page labels.");
  3852. }
  3853. return (0, _util.shadow)(this, "pageLabels", obj);
  3854. }
  3855. _readPageLabels() {
  3856. const obj = this._catDict.getRaw("PageLabels");
  3857. if (!obj) {
  3858. return null;
  3859. }
  3860. const pageLabels = new Array(this.numPages);
  3861. let style = null,
  3862. prefix = "";
  3863. const numberTree = new NumberTree(obj, this.xref);
  3864. const nums = numberTree.getAll();
  3865. let currentLabel = "",
  3866. currentIndex = 1;
  3867. for (let i = 0, ii = this.numPages; i < ii; i++) {
  3868. if (i in nums) {
  3869. const labelDict = nums[i];
  3870. if (!(0, _primitives.isDict)(labelDict)) {
  3871. throw new _util.FormatError("PageLabel is not a dictionary.");
  3872. }
  3873. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  3874. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  3875. }
  3876. if (labelDict.has("S")) {
  3877. const s = labelDict.get("S");
  3878. if (!(0, _primitives.isName)(s)) {
  3879. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  3880. }
  3881. style = s.name;
  3882. } else {
  3883. style = null;
  3884. }
  3885. if (labelDict.has("P")) {
  3886. const p = labelDict.get("P");
  3887. if (!(0, _util.isString)(p)) {
  3888. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  3889. }
  3890. prefix = (0, _util.stringToPDFString)(p);
  3891. } else {
  3892. prefix = "";
  3893. }
  3894. if (labelDict.has("St")) {
  3895. const st = labelDict.get("St");
  3896. if (!(Number.isInteger(st) && st >= 1)) {
  3897. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  3898. }
  3899. currentIndex = st;
  3900. } else {
  3901. currentIndex = 1;
  3902. }
  3903. }
  3904. switch (style) {
  3905. case "D":
  3906. currentLabel = currentIndex;
  3907. break;
  3908. case "R":
  3909. case "r":
  3910. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  3911. break;
  3912. case "A":
  3913. case "a":
  3914. const LIMIT = 26;
  3915. const A_UPPER_CASE = 0x41,
  3916. A_LOWER_CASE = 0x61;
  3917. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  3918. const letterIndex = currentIndex - 1;
  3919. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  3920. const charBuf = [];
  3921. for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  3922. charBuf.push(character);
  3923. }
  3924. currentLabel = charBuf.join("");
  3925. break;
  3926. default:
  3927. if (style) {
  3928. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  3929. }
  3930. currentLabel = "";
  3931. }
  3932. pageLabels[i] = prefix + currentLabel;
  3933. currentIndex++;
  3934. }
  3935. return pageLabels;
  3936. }
  3937. get pageLayout() {
  3938. const obj = this._catDict.get("PageLayout");
  3939. let pageLayout = "";
  3940. if ((0, _primitives.isName)(obj)) {
  3941. switch (obj.name) {
  3942. case "SinglePage":
  3943. case "OneColumn":
  3944. case "TwoColumnLeft":
  3945. case "TwoColumnRight":
  3946. case "TwoPageLeft":
  3947. case "TwoPageRight":
  3948. pageLayout = obj.name;
  3949. }
  3950. }
  3951. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  3952. }
  3953. get pageMode() {
  3954. const obj = this._catDict.get("PageMode");
  3955. let pageMode = "UseNone";
  3956. if ((0, _primitives.isName)(obj)) {
  3957. switch (obj.name) {
  3958. case "UseNone":
  3959. case "UseOutlines":
  3960. case "UseThumbs":
  3961. case "FullScreen":
  3962. case "UseOC":
  3963. case "UseAttachments":
  3964. pageMode = obj.name;
  3965. }
  3966. }
  3967. return (0, _util.shadow)(this, "pageMode", pageMode);
  3968. }
  3969. get viewerPreferences() {
  3970. const ViewerPreferencesValidators = {
  3971. HideToolbar: _util.isBool,
  3972. HideMenubar: _util.isBool,
  3973. HideWindowUI: _util.isBool,
  3974. FitWindow: _util.isBool,
  3975. CenterWindow: _util.isBool,
  3976. DisplayDocTitle: _util.isBool,
  3977. NonFullScreenPageMode: _primitives.isName,
  3978. Direction: _primitives.isName,
  3979. ViewArea: _primitives.isName,
  3980. ViewClip: _primitives.isName,
  3981. PrintArea: _primitives.isName,
  3982. PrintClip: _primitives.isName,
  3983. PrintScaling: _primitives.isName,
  3984. Duplex: _primitives.isName,
  3985. PickTrayByPDFSize: _util.isBool,
  3986. PrintPageRange: Array.isArray,
  3987. NumCopies: Number.isInteger
  3988. };
  3989. const obj = this._catDict.get("ViewerPreferences");
  3990. let prefs = null;
  3991. if ((0, _primitives.isDict)(obj)) {
  3992. for (const key in ViewerPreferencesValidators) {
  3993. if (!obj.has(key)) {
  3994. continue;
  3995. }
  3996. const value = obj.get(key);
  3997. if (!ViewerPreferencesValidators[key](value)) {
  3998. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  3999. continue;
  4000. }
  4001. let prefValue;
  4002. switch (key) {
  4003. case "NonFullScreenPageMode":
  4004. switch (value.name) {
  4005. case "UseNone":
  4006. case "UseOutlines":
  4007. case "UseThumbs":
  4008. case "UseOC":
  4009. prefValue = value.name;
  4010. break;
  4011. default:
  4012. prefValue = "UseNone";
  4013. }
  4014. break;
  4015. case "Direction":
  4016. switch (value.name) {
  4017. case "L2R":
  4018. case "R2L":
  4019. prefValue = value.name;
  4020. break;
  4021. default:
  4022. prefValue = "L2R";
  4023. }
  4024. break;
  4025. case "ViewArea":
  4026. case "ViewClip":
  4027. case "PrintArea":
  4028. case "PrintClip":
  4029. switch (value.name) {
  4030. case "MediaBox":
  4031. case "CropBox":
  4032. case "BleedBox":
  4033. case "TrimBox":
  4034. case "ArtBox":
  4035. prefValue = value.name;
  4036. break;
  4037. default:
  4038. prefValue = "CropBox";
  4039. }
  4040. break;
  4041. case "PrintScaling":
  4042. switch (value.name) {
  4043. case "None":
  4044. case "AppDefault":
  4045. prefValue = value.name;
  4046. break;
  4047. default:
  4048. prefValue = "AppDefault";
  4049. }
  4050. break;
  4051. case "Duplex":
  4052. switch (value.name) {
  4053. case "Simplex":
  4054. case "DuplexFlipShortEdge":
  4055. case "DuplexFlipLongEdge":
  4056. prefValue = value.name;
  4057. break;
  4058. default:
  4059. prefValue = "None";
  4060. }
  4061. break;
  4062. case "PrintPageRange":
  4063. const length = value.length;
  4064. if (length % 2 !== 0) {
  4065. break;
  4066. }
  4067. const isValid = value.every((page, i, arr) => {
  4068. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  4069. });
  4070. if (isValid) {
  4071. prefValue = value;
  4072. }
  4073. break;
  4074. case "NumCopies":
  4075. if (value > 0) {
  4076. prefValue = value;
  4077. }
  4078. break;
  4079. default:
  4080. if (typeof value !== "boolean") {
  4081. throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
  4082. }
  4083. prefValue = value;
  4084. }
  4085. if (prefValue !== undefined) {
  4086. if (!prefs) {
  4087. prefs = Object.create(null);
  4088. }
  4089. prefs[key] = prefValue;
  4090. } else {
  4091. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  4092. }
  4093. }
  4094. }
  4095. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  4096. }
  4097. get openAction() {
  4098. const obj = this._catDict.get("OpenAction");
  4099. const openAction = Object.create(null);
  4100. if ((0, _primitives.isDict)(obj)) {
  4101. const destDict = new _primitives.Dict(this.xref);
  4102. destDict.set("A", obj);
  4103. const resultObj = {
  4104. url: null,
  4105. dest: null,
  4106. action: null
  4107. };
  4108. Catalog.parseDestDictionary({
  4109. destDict,
  4110. resultObj
  4111. });
  4112. if (Array.isArray(resultObj.dest)) {
  4113. openAction.dest = resultObj.dest;
  4114. } else if (resultObj.action) {
  4115. openAction.action = resultObj.action;
  4116. }
  4117. } else if (Array.isArray(obj)) {
  4118. openAction.dest = obj;
  4119. }
  4120. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  4121. }
  4122. get attachments() {
  4123. const obj = this._catDict.get("Names");
  4124. let attachments = null;
  4125. if (obj && obj.has("EmbeddedFiles")) {
  4126. const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  4127. const names = nameTree.getAll();
  4128. for (const name in names) {
  4129. const fs = new FileSpec(names[name], this.xref);
  4130. if (!attachments) {
  4131. attachments = Object.create(null);
  4132. }
  4133. attachments[(0, _util.stringToPDFString)(name)] = fs.serializable;
  4134. }
  4135. }
  4136. return (0, _util.shadow)(this, "attachments", attachments);
  4137. }
  4138. _collectJavaScript() {
  4139. const obj = this._catDict.get("Names");
  4140. let javaScript = null;
  4141. function appendIfJavaScriptDict(name, jsDict) {
  4142. const type = jsDict.get("S");
  4143. if (!(0, _primitives.isName)(type, "JavaScript")) {
  4144. return;
  4145. }
  4146. let js = jsDict.get("JS");
  4147. if ((0, _primitives.isStream)(js)) {
  4148. js = (0, _util.bytesToString)(js.getBytes());
  4149. } else if (!(0, _util.isString)(js)) {
  4150. return;
  4151. }
  4152. if (javaScript === null) {
  4153. javaScript = Object.create(null);
  4154. }
  4155. javaScript[name] = (0, _util.stringToPDFString)(js);
  4156. }
  4157. if (obj && obj.has("JavaScript")) {
  4158. const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref);
  4159. const names = nameTree.getAll();
  4160. for (const name in names) {
  4161. const jsDict = names[name];
  4162. if ((0, _primitives.isDict)(jsDict)) {
  4163. appendIfJavaScriptDict(name, jsDict);
  4164. }
  4165. }
  4166. }
  4167. const openAction = this._catDict.get("OpenAction");
  4168. if ((0, _primitives.isDict)(openAction) && (0, _primitives.isName)(openAction.get("S"), "JavaScript")) {
  4169. appendIfJavaScriptDict("OpenAction", openAction);
  4170. }
  4171. return javaScript;
  4172. }
  4173. get javaScript() {
  4174. const javaScript = this._collectJavaScript();
  4175. return (0, _util.shadow)(this, "javaScript", javaScript ? Object.values(javaScript) : null);
  4176. }
  4177. get jsActions() {
  4178. const js = this._collectJavaScript();
  4179. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  4180. if (!actions && js) {
  4181. actions = Object.create(null);
  4182. }
  4183. if (actions && js) {
  4184. for (const [key, val] of Object.entries(js)) {
  4185. if (key in actions) {
  4186. actions[key].push(val);
  4187. } else {
  4188. actions[key] = [val];
  4189. }
  4190. }
  4191. }
  4192. return (0, _util.shadow)(this, "jsActions", actions);
  4193. }
  4194. fontFallback(id, handler) {
  4195. const promises = [];
  4196. this.fontCache.forEach(function (promise) {
  4197. promises.push(promise);
  4198. });
  4199. return Promise.all(promises).then(translatedFonts => {
  4200. for (const translatedFont of translatedFonts) {
  4201. if (translatedFont.loadedName === id) {
  4202. translatedFont.fallback(handler);
  4203. return;
  4204. }
  4205. }
  4206. });
  4207. }
  4208. cleanup(manuallyTriggered = false) {
  4209. (0, _primitives.clearPrimitiveCaches)();
  4210. this.globalImageCache.clear(manuallyTriggered);
  4211. this.pageKidsCountCache.clear();
  4212. this.nonBlendModesSet.clear();
  4213. const promises = [];
  4214. this.fontCache.forEach(function (promise) {
  4215. promises.push(promise);
  4216. });
  4217. return Promise.all(promises).then(translatedFonts => {
  4218. for (const {
  4219. dict
  4220. } of translatedFonts) {
  4221. delete dict.cacheKey;
  4222. }
  4223. this.fontCache.clear();
  4224. this.builtInCMapCache.clear();
  4225. });
  4226. }
  4227. getPageDict(pageIndex) {
  4228. const capability = (0, _util.createPromiseCapability)();
  4229. const nodesToVisit = [this._catDict.getRaw("Pages")];
  4230. const visitedNodes = new _primitives.RefSet();
  4231. const xref = this.xref,
  4232. pageKidsCountCache = this.pageKidsCountCache;
  4233. let count,
  4234. currentPageIndex = 0;
  4235. function next() {
  4236. while (nodesToVisit.length) {
  4237. const currentNode = nodesToVisit.pop();
  4238. if ((0, _primitives.isRef)(currentNode)) {
  4239. count = pageKidsCountCache.get(currentNode);
  4240. if (count > 0 && currentPageIndex + count < pageIndex) {
  4241. currentPageIndex += count;
  4242. continue;
  4243. }
  4244. if (visitedNodes.has(currentNode)) {
  4245. capability.reject(new _util.FormatError("Pages tree contains circular reference."));
  4246. return;
  4247. }
  4248. visitedNodes.put(currentNode);
  4249. xref.fetchAsync(currentNode).then(function (obj) {
  4250. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
  4251. if (pageIndex === currentPageIndex) {
  4252. if (currentNode && !pageKidsCountCache.has(currentNode)) {
  4253. pageKidsCountCache.put(currentNode, 1);
  4254. }
  4255. capability.resolve([obj, currentNode]);
  4256. } else {
  4257. currentPageIndex++;
  4258. next();
  4259. }
  4260. return;
  4261. }
  4262. nodesToVisit.push(obj);
  4263. next();
  4264. }, capability.reject);
  4265. return;
  4266. }
  4267. if (!(0, _primitives.isDict)(currentNode)) {
  4268. capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  4269. return;
  4270. }
  4271. count = currentNode.get("Count");
  4272. if (Number.isInteger(count) && count >= 0) {
  4273. const objId = currentNode.objId;
  4274. if (objId && !pageKidsCountCache.has(objId)) {
  4275. pageKidsCountCache.put(objId, count);
  4276. }
  4277. if (currentPageIndex + count <= pageIndex) {
  4278. currentPageIndex += count;
  4279. continue;
  4280. }
  4281. }
  4282. const kids = currentNode.get("Kids");
  4283. if (!Array.isArray(kids)) {
  4284. if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
  4285. if (currentPageIndex === pageIndex) {
  4286. capability.resolve([currentNode, null]);
  4287. return;
  4288. }
  4289. currentPageIndex++;
  4290. continue;
  4291. }
  4292. capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
  4293. return;
  4294. }
  4295. for (let last = kids.length - 1; last >= 0; last--) {
  4296. nodesToVisit.push(kids[last]);
  4297. }
  4298. }
  4299. capability.reject(new Error(`Page index ${pageIndex} not found.`));
  4300. }
  4301. next();
  4302. return capability.promise;
  4303. }
  4304. getPageIndex(pageRef) {
  4305. const xref = this.xref;
  4306. function pagesBeforeRef(kidRef) {
  4307. let total = 0,
  4308. parentRef;
  4309. return xref.fetchAsync(kidRef).then(function (node) {
  4310. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
  4311. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  4312. }
  4313. if (!node) {
  4314. return null;
  4315. }
  4316. if (!(0, _primitives.isDict)(node)) {
  4317. throw new _util.FormatError("Node must be a dictionary.");
  4318. }
  4319. parentRef = node.getRaw("Parent");
  4320. return node.getAsync("Parent");
  4321. }).then(function (parent) {
  4322. if (!parent) {
  4323. return null;
  4324. }
  4325. if (!(0, _primitives.isDict)(parent)) {
  4326. throw new _util.FormatError("Parent must be a dictionary.");
  4327. }
  4328. return parent.getAsync("Kids");
  4329. }).then(function (kids) {
  4330. if (!kids) {
  4331. return null;
  4332. }
  4333. const kidPromises = [];
  4334. let found = false;
  4335. for (let i = 0, ii = kids.length; i < ii; i++) {
  4336. const kid = kids[i];
  4337. if (!(0, _primitives.isRef)(kid)) {
  4338. throw new _util.FormatError("Kid must be a reference.");
  4339. }
  4340. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  4341. found = true;
  4342. break;
  4343. }
  4344. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  4345. if (!(0, _primitives.isDict)(obj)) {
  4346. throw new _util.FormatError("Kid node must be a dictionary.");
  4347. }
  4348. if (obj.has("Count")) {
  4349. total += obj.get("Count");
  4350. } else {
  4351. total++;
  4352. }
  4353. }));
  4354. }
  4355. if (!found) {
  4356. throw new _util.FormatError("Kid reference not found in parent's kids.");
  4357. }
  4358. return Promise.all(kidPromises).then(function () {
  4359. return [total, parentRef];
  4360. });
  4361. });
  4362. }
  4363. let total = 0;
  4364. function next(ref) {
  4365. return pagesBeforeRef(ref).then(function (args) {
  4366. if (!args) {
  4367. return total;
  4368. }
  4369. const [count, parentRef] = args;
  4370. total += count;
  4371. return next(parentRef);
  4372. });
  4373. }
  4374. return next(pageRef);
  4375. }
  4376. static parseDestDictionary(params) {
  4377. function addDefaultProtocolToUrl(url) {
  4378. return url.startsWith("www.") ? `http://${url}` : url;
  4379. }
  4380. function tryConvertUrlEncoding(url) {
  4381. try {
  4382. return (0, _util.stringToUTF8String)(url);
  4383. } catch (e) {
  4384. return url;
  4385. }
  4386. }
  4387. const destDict = params.destDict;
  4388. if (!(0, _primitives.isDict)(destDict)) {
  4389. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  4390. return;
  4391. }
  4392. const resultObj = params.resultObj;
  4393. if (typeof resultObj !== "object") {
  4394. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  4395. return;
  4396. }
  4397. const docBaseUrl = params.docBaseUrl || null;
  4398. let action = destDict.get("A"),
  4399. url,
  4400. dest;
  4401. if (!(0, _primitives.isDict)(action)) {
  4402. if (destDict.has("Dest")) {
  4403. action = destDict.get("Dest");
  4404. } else {
  4405. action = destDict.get("AA");
  4406. if ((0, _primitives.isDict)(action)) {
  4407. if (action.has("D")) {
  4408. action = action.get("D");
  4409. } else if (action.has("U")) {
  4410. action = action.get("U");
  4411. }
  4412. }
  4413. }
  4414. }
  4415. if ((0, _primitives.isDict)(action)) {
  4416. const actionType = action.get("S");
  4417. if (!(0, _primitives.isName)(actionType)) {
  4418. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  4419. return;
  4420. }
  4421. const actionName = actionType.name;
  4422. switch (actionName) {
  4423. case "URI":
  4424. url = action.get("URI");
  4425. if ((0, _primitives.isName)(url)) {
  4426. url = "/" + url.name;
  4427. } else if ((0, _util.isString)(url)) {
  4428. url = addDefaultProtocolToUrl(url);
  4429. }
  4430. break;
  4431. case "GoTo":
  4432. dest = action.get("D");
  4433. break;
  4434. case "Launch":
  4435. case "GoToR":
  4436. const urlDict = action.get("F");
  4437. if ((0, _primitives.isDict)(urlDict)) {
  4438. url = urlDict.get("F") || null;
  4439. } else if ((0, _util.isString)(urlDict)) {
  4440. url = urlDict;
  4441. }
  4442. let remoteDest = action.get("D");
  4443. if (remoteDest) {
  4444. if ((0, _primitives.isName)(remoteDest)) {
  4445. remoteDest = remoteDest.name;
  4446. }
  4447. if ((0, _util.isString)(url)) {
  4448. const baseUrl = url.split("#")[0];
  4449. if ((0, _util.isString)(remoteDest)) {
  4450. url = baseUrl + "#" + remoteDest;
  4451. } else if (Array.isArray(remoteDest)) {
  4452. url = baseUrl + "#" + JSON.stringify(remoteDest);
  4453. }
  4454. }
  4455. }
  4456. const newWindow = action.get("NewWindow");
  4457. if ((0, _util.isBool)(newWindow)) {
  4458. resultObj.newWindow = newWindow;
  4459. }
  4460. break;
  4461. case "Named":
  4462. const namedAction = action.get("N");
  4463. if ((0, _primitives.isName)(namedAction)) {
  4464. resultObj.action = namedAction.name;
  4465. }
  4466. break;
  4467. case "JavaScript":
  4468. const jsAction = action.get("JS");
  4469. let js;
  4470. if ((0, _primitives.isStream)(jsAction)) {
  4471. js = (0, _util.bytesToString)(jsAction.getBytes());
  4472. } else if ((0, _util.isString)(jsAction)) {
  4473. js = jsAction;
  4474. }
  4475. if (js) {
  4476. const URL_OPEN_METHODS = ["app.launchURL", "window.open"];
  4477. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  4478. const jsUrl = regex.exec((0, _util.stringToPDFString)(js));
  4479. if (jsUrl && jsUrl[2]) {
  4480. url = jsUrl[2];
  4481. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  4482. resultObj.newWindow = true;
  4483. }
  4484. break;
  4485. }
  4486. }
  4487. default:
  4488. if (actionName === "JavaScript" || actionName === "ResetForm" || actionName === "SubmitForm") {
  4489. break;
  4490. }
  4491. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  4492. break;
  4493. }
  4494. } else if (destDict.has("Dest")) {
  4495. dest = destDict.get("Dest");
  4496. }
  4497. if ((0, _util.isString)(url)) {
  4498. url = tryConvertUrlEncoding(url);
  4499. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl);
  4500. if (absoluteUrl) {
  4501. resultObj.url = absoluteUrl.href;
  4502. }
  4503. resultObj.unsafeUrl = url;
  4504. }
  4505. if (dest) {
  4506. if ((0, _primitives.isName)(dest)) {
  4507. dest = dest.name;
  4508. }
  4509. if ((0, _util.isString)(dest) || Array.isArray(dest)) {
  4510. resultObj.dest = dest;
  4511. }
  4512. }
  4513. }
  4514. }
  4515. exports.Catalog = Catalog;
  4516. var XRef = function XRefClosure() {
  4517. function XRef(stream, pdfManager) {
  4518. this.stream = stream;
  4519. this.pdfManager = pdfManager;
  4520. this.entries = [];
  4521. this.xrefstms = Object.create(null);
  4522. this._cacheMap = new Map();
  4523. this.stats = {
  4524. streamTypes: Object.create(null),
  4525. fontTypes: Object.create(null)
  4526. };
  4527. this._newRefNum = null;
  4528. }
  4529. XRef.prototype = {
  4530. getNewRef: function XRef_getNewRef() {
  4531. if (this._newRefNum === null) {
  4532. this._newRefNum = this.entries.length;
  4533. }
  4534. return _primitives.Ref.get(this._newRefNum++, 0);
  4535. },
  4536. resetNewRef: function XRef_resetNewRef() {
  4537. this._newRefNum = null;
  4538. },
  4539. setStartXRef: function XRef_setStartXRef(startXRef) {
  4540. this.startXRefQueue = [startXRef];
  4541. },
  4542. parse: function XRef_parse(recoveryMode) {
  4543. var trailerDict;
  4544. if (!recoveryMode) {
  4545. trailerDict = this.readXRef();
  4546. } else {
  4547. (0, _util.warn)("Indexing all PDF objects");
  4548. trailerDict = this.indexObjects();
  4549. }
  4550. trailerDict.assignXref(this);
  4551. this.trailer = trailerDict;
  4552. let encrypt;
  4553. try {
  4554. encrypt = trailerDict.get("Encrypt");
  4555. } catch (ex) {
  4556. if (ex instanceof _core_utils.MissingDataException) {
  4557. throw ex;
  4558. }
  4559. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  4560. }
  4561. if ((0, _primitives.isDict)(encrypt)) {
  4562. var ids = trailerDict.get("ID");
  4563. var fileId = ids && ids.length ? ids[0] : "";
  4564. encrypt.suppressEncryption = true;
  4565. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  4566. }
  4567. let root;
  4568. try {
  4569. root = trailerDict.get("Root");
  4570. } catch (ex) {
  4571. if (ex instanceof _core_utils.MissingDataException) {
  4572. throw ex;
  4573. }
  4574. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  4575. }
  4576. if ((0, _primitives.isDict)(root) && root.has("Pages")) {
  4577. this.root = root;
  4578. } else {
  4579. if (!recoveryMode) {
  4580. throw new _core_utils.XRefParseException();
  4581. }
  4582. throw new _util.FormatError("Invalid root reference");
  4583. }
  4584. },
  4585. processXRefTable: function XRef_processXRefTable(parser) {
  4586. if (!("tableState" in this)) {
  4587. this.tableState = {
  4588. entryNum: 0,
  4589. streamPos: parser.lexer.stream.pos,
  4590. parserBuf1: parser.buf1,
  4591. parserBuf2: parser.buf2
  4592. };
  4593. }
  4594. var obj = this.readXRefTable(parser);
  4595. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  4596. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  4597. }
  4598. var dict = parser.getObj();
  4599. if (!(0, _primitives.isDict)(dict) && dict.dict) {
  4600. dict = dict.dict;
  4601. }
  4602. if (!(0, _primitives.isDict)(dict)) {
  4603. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  4604. }
  4605. delete this.tableState;
  4606. return dict;
  4607. },
  4608. readXRefTable: function XRef_readXRefTable(parser) {
  4609. var stream = parser.lexer.stream;
  4610. var tableState = this.tableState;
  4611. stream.pos = tableState.streamPos;
  4612. parser.buf1 = tableState.parserBuf1;
  4613. parser.buf2 = tableState.parserBuf2;
  4614. var obj;
  4615. while (true) {
  4616. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  4617. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  4618. break;
  4619. }
  4620. tableState.firstEntryNum = obj;
  4621. tableState.entryCount = parser.getObj();
  4622. }
  4623. var first = tableState.firstEntryNum;
  4624. var count = tableState.entryCount;
  4625. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  4626. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  4627. }
  4628. for (var i = tableState.entryNum; i < count; i++) {
  4629. tableState.streamPos = stream.pos;
  4630. tableState.entryNum = i;
  4631. tableState.parserBuf1 = parser.buf1;
  4632. tableState.parserBuf2 = parser.buf2;
  4633. var entry = {};
  4634. entry.offset = parser.getObj();
  4635. entry.gen = parser.getObj();
  4636. var type = parser.getObj();
  4637. if (type instanceof _primitives.Cmd) {
  4638. switch (type.cmd) {
  4639. case "f":
  4640. entry.free = true;
  4641. break;
  4642. case "n":
  4643. entry.uncompressed = true;
  4644. break;
  4645. }
  4646. }
  4647. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  4648. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  4649. }
  4650. if (i === 0 && entry.free && first === 1) {
  4651. first = 0;
  4652. }
  4653. if (!this.entries[i + first]) {
  4654. this.entries[i + first] = entry;
  4655. }
  4656. }
  4657. tableState.entryNum = 0;
  4658. tableState.streamPos = stream.pos;
  4659. tableState.parserBuf1 = parser.buf1;
  4660. tableState.parserBuf2 = parser.buf2;
  4661. delete tableState.firstEntryNum;
  4662. delete tableState.entryCount;
  4663. }
  4664. if (this.entries[0] && !this.entries[0].free) {
  4665. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  4666. }
  4667. return obj;
  4668. },
  4669. processXRefStream: function XRef_processXRefStream(stream) {
  4670. if (!("streamState" in this)) {
  4671. var streamParameters = stream.dict;
  4672. var byteWidths = streamParameters.get("W");
  4673. var range = streamParameters.get("Index");
  4674. if (!range) {
  4675. range = [0, streamParameters.get("Size")];
  4676. }
  4677. this.streamState = {
  4678. entryRanges: range,
  4679. byteWidths,
  4680. entryNum: 0,
  4681. streamPos: stream.pos
  4682. };
  4683. }
  4684. this.readXRefStream(stream);
  4685. delete this.streamState;
  4686. return stream.dict;
  4687. },
  4688. readXRefStream: function XRef_readXRefStream(stream) {
  4689. var i, j;
  4690. var streamState = this.streamState;
  4691. stream.pos = streamState.streamPos;
  4692. var byteWidths = streamState.byteWidths;
  4693. var typeFieldWidth = byteWidths[0];
  4694. var offsetFieldWidth = byteWidths[1];
  4695. var generationFieldWidth = byteWidths[2];
  4696. var entryRanges = streamState.entryRanges;
  4697. while (entryRanges.length > 0) {
  4698. var first = entryRanges[0];
  4699. var n = entryRanges[1];
  4700. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  4701. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  4702. }
  4703. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  4704. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  4705. }
  4706. for (i = streamState.entryNum; i < n; ++i) {
  4707. streamState.entryNum = i;
  4708. streamState.streamPos = stream.pos;
  4709. var type = 0,
  4710. offset = 0,
  4711. generation = 0;
  4712. for (j = 0; j < typeFieldWidth; ++j) {
  4713. type = type << 8 | stream.getByte();
  4714. }
  4715. if (typeFieldWidth === 0) {
  4716. type = 1;
  4717. }
  4718. for (j = 0; j < offsetFieldWidth; ++j) {
  4719. offset = offset << 8 | stream.getByte();
  4720. }
  4721. for (j = 0; j < generationFieldWidth; ++j) {
  4722. generation = generation << 8 | stream.getByte();
  4723. }
  4724. var entry = {};
  4725. entry.offset = offset;
  4726. entry.gen = generation;
  4727. switch (type) {
  4728. case 0:
  4729. entry.free = true;
  4730. break;
  4731. case 1:
  4732. entry.uncompressed = true;
  4733. break;
  4734. case 2:
  4735. break;
  4736. default:
  4737. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  4738. }
  4739. if (!this.entries[first + i]) {
  4740. this.entries[first + i] = entry;
  4741. }
  4742. }
  4743. streamState.entryNum = 0;
  4744. streamState.streamPos = stream.pos;
  4745. entryRanges.splice(0, 2);
  4746. }
  4747. },
  4748. indexObjects: function XRef_indexObjects() {
  4749. var TAB = 0x9,
  4750. LF = 0xa,
  4751. CR = 0xd,
  4752. SPACE = 0x20;
  4753. var PERCENT = 0x25,
  4754. LT = 0x3c;
  4755. function readToken(data, offset) {
  4756. var token = "",
  4757. ch = data[offset];
  4758. while (ch !== LF && ch !== CR && ch !== LT) {
  4759. if (++offset >= data.length) {
  4760. break;
  4761. }
  4762. token += String.fromCharCode(ch);
  4763. ch = data[offset];
  4764. }
  4765. return token;
  4766. }
  4767. function skipUntil(data, offset, what) {
  4768. var length = what.length,
  4769. dataLength = data.length;
  4770. var skipped = 0;
  4771. while (offset < dataLength) {
  4772. var i = 0;
  4773. while (i < length && data[offset + i] === what[i]) {
  4774. ++i;
  4775. }
  4776. if (i >= length) {
  4777. break;
  4778. }
  4779. offset++;
  4780. skipped++;
  4781. }
  4782. return skipped;
  4783. }
  4784. var objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  4785. const endobjRegExp = /\bendobj[\b\s]$/;
  4786. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  4787. const CHECK_CONTENT_LENGTH = 25;
  4788. var trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  4789. var startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  4790. const objBytes = new Uint8Array([111, 98, 106]);
  4791. var xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  4792. this.entries.length = 0;
  4793. var stream = this.stream;
  4794. stream.pos = 0;
  4795. var buffer = stream.getBytes();
  4796. var position = stream.start,
  4797. length = buffer.length;
  4798. var trailers = [],
  4799. xrefStms = [];
  4800. while (position < length) {
  4801. var ch = buffer[position];
  4802. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  4803. ++position;
  4804. continue;
  4805. }
  4806. if (ch === PERCENT) {
  4807. do {
  4808. ++position;
  4809. if (position >= length) {
  4810. break;
  4811. }
  4812. ch = buffer[position];
  4813. } while (ch !== LF && ch !== CR);
  4814. continue;
  4815. }
  4816. var token = readToken(buffer, position);
  4817. var m;
  4818. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  4819. position += skipUntil(buffer, position, trailerBytes);
  4820. trailers.push(position);
  4821. position += skipUntil(buffer, position, startxrefBytes);
  4822. } else if (m = objRegExp.exec(token)) {
  4823. const num = m[1] | 0,
  4824. gen = m[2] | 0;
  4825. if (!this.entries[num] || this.entries[num].gen === gen) {
  4826. this.entries[num] = {
  4827. offset: position - stream.start,
  4828. gen,
  4829. uncompressed: true
  4830. };
  4831. }
  4832. let contentLength,
  4833. startPos = position + token.length;
  4834. while (startPos < buffer.length) {
  4835. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  4836. contentLength = endPos - position;
  4837. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  4838. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  4839. if (endobjRegExp.test(tokenStr)) {
  4840. break;
  4841. } else {
  4842. const objToken = nestedObjRegExp.exec(tokenStr);
  4843. if (objToken && objToken[1]) {
  4844. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  4845. contentLength -= objToken[1].length;
  4846. break;
  4847. }
  4848. }
  4849. startPos = endPos;
  4850. }
  4851. const content = buffer.subarray(position, position + contentLength);
  4852. var xrefTagOffset = skipUntil(content, 0, xrefBytes);
  4853. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  4854. xrefStms.push(position - stream.start);
  4855. this.xrefstms[position - stream.start] = 1;
  4856. }
  4857. position += contentLength;
  4858. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  4859. trailers.push(position);
  4860. position += skipUntil(buffer, position, startxrefBytes);
  4861. } else {
  4862. position += token.length + 1;
  4863. }
  4864. }
  4865. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  4866. this.startXRefQueue.push(xrefStms[i]);
  4867. this.readXRef(true);
  4868. }
  4869. let trailerDict;
  4870. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  4871. stream.pos = trailers[i];
  4872. const parser = new _parser.Parser({
  4873. lexer: new _parser.Lexer(stream),
  4874. xref: this,
  4875. allowStreams: true,
  4876. recoveryMode: true
  4877. });
  4878. var obj = parser.getObj();
  4879. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  4880. continue;
  4881. }
  4882. const dict = parser.getObj();
  4883. if (!(0, _primitives.isDict)(dict)) {
  4884. continue;
  4885. }
  4886. try {
  4887. const rootDict = dict.get("Root");
  4888. if (!(rootDict instanceof _primitives.Dict)) {
  4889. continue;
  4890. }
  4891. const pagesDict = rootDict.get("Pages");
  4892. if (!(pagesDict instanceof _primitives.Dict)) {
  4893. continue;
  4894. }
  4895. const pagesCount = pagesDict.get("Count");
  4896. if (!Number.isInteger(pagesCount)) {
  4897. continue;
  4898. }
  4899. } catch (ex) {
  4900. continue;
  4901. }
  4902. if (dict.has("ID")) {
  4903. return dict;
  4904. }
  4905. trailerDict = dict;
  4906. }
  4907. if (trailerDict) {
  4908. return trailerDict;
  4909. }
  4910. throw new _util.InvalidPDFException("Invalid PDF structure.");
  4911. },
  4912. readXRef: function XRef_readXRef(recoveryMode) {
  4913. var stream = this.stream;
  4914. const startXRefParsedCache = Object.create(null);
  4915. try {
  4916. while (this.startXRefQueue.length) {
  4917. var startXRef = this.startXRefQueue[0];
  4918. if (startXRefParsedCache[startXRef]) {
  4919. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  4920. this.startXRefQueue.shift();
  4921. continue;
  4922. }
  4923. startXRefParsedCache[startXRef] = true;
  4924. stream.pos = startXRef + stream.start;
  4925. const parser = new _parser.Parser({
  4926. lexer: new _parser.Lexer(stream),
  4927. xref: this,
  4928. allowStreams: true
  4929. });
  4930. var obj = parser.getObj();
  4931. var dict;
  4932. if ((0, _primitives.isCmd)(obj, "xref")) {
  4933. dict = this.processXRefTable(parser);
  4934. if (!this.topDict) {
  4935. this.topDict = dict;
  4936. }
  4937. obj = dict.get("XRefStm");
  4938. if (Number.isInteger(obj)) {
  4939. var pos = obj;
  4940. if (!(pos in this.xrefstms)) {
  4941. this.xrefstms[pos] = 1;
  4942. this.startXRefQueue.push(pos);
  4943. }
  4944. }
  4945. } else if (Number.isInteger(obj)) {
  4946. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, _primitives.isStream)(obj = parser.getObj())) {
  4947. throw new _util.FormatError("Invalid XRef stream");
  4948. }
  4949. dict = this.processXRefStream(obj);
  4950. if (!this.topDict) {
  4951. this.topDict = dict;
  4952. }
  4953. if (!dict) {
  4954. throw new _util.FormatError("Failed to read XRef stream");
  4955. }
  4956. } else {
  4957. throw new _util.FormatError("Invalid XRef stream header");
  4958. }
  4959. obj = dict.get("Prev");
  4960. if (Number.isInteger(obj)) {
  4961. this.startXRefQueue.push(obj);
  4962. } else if ((0, _primitives.isRef)(obj)) {
  4963. this.startXRefQueue.push(obj.num);
  4964. }
  4965. this.startXRefQueue.shift();
  4966. }
  4967. return this.topDict;
  4968. } catch (e) {
  4969. if (e instanceof _core_utils.MissingDataException) {
  4970. throw e;
  4971. }
  4972. (0, _util.info)("(while reading XRef): " + e);
  4973. }
  4974. if (recoveryMode) {
  4975. return undefined;
  4976. }
  4977. throw new _core_utils.XRefParseException();
  4978. },
  4979. getEntry: function XRef_getEntry(i) {
  4980. var xrefEntry = this.entries[i];
  4981. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  4982. return xrefEntry;
  4983. }
  4984. return null;
  4985. },
  4986. fetchIfRef: function XRef_fetchIfRef(obj, suppressEncryption) {
  4987. if (obj instanceof _primitives.Ref) {
  4988. return this.fetch(obj, suppressEncryption);
  4989. }
  4990. return obj;
  4991. },
  4992. fetch: function XRef_fetch(ref, suppressEncryption) {
  4993. if (!(ref instanceof _primitives.Ref)) {
  4994. throw new Error("ref object is not a reference");
  4995. }
  4996. const num = ref.num;
  4997. const cacheEntry = this._cacheMap.get(num);
  4998. if (cacheEntry !== undefined) {
  4999. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  5000. cacheEntry.objId = ref.toString();
  5001. }
  5002. return cacheEntry;
  5003. }
  5004. let xrefEntry = this.getEntry(num);
  5005. if (xrefEntry === null) {
  5006. this._cacheMap.set(num, xrefEntry);
  5007. return xrefEntry;
  5008. }
  5009. if (xrefEntry.uncompressed) {
  5010. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  5011. } else {
  5012. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  5013. }
  5014. if ((0, _primitives.isDict)(xrefEntry)) {
  5015. xrefEntry.objId = ref.toString();
  5016. } else if ((0, _primitives.isStream)(xrefEntry)) {
  5017. xrefEntry.dict.objId = ref.toString();
  5018. }
  5019. return xrefEntry;
  5020. },
  5021. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  5022. var gen = ref.gen;
  5023. var num = ref.num;
  5024. if (xrefEntry.gen !== gen) {
  5025. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  5026. }
  5027. var stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  5028. const parser = new _parser.Parser({
  5029. lexer: new _parser.Lexer(stream),
  5030. xref: this,
  5031. allowStreams: true
  5032. });
  5033. var obj1 = parser.getObj();
  5034. var obj2 = parser.getObj();
  5035. var obj3 = parser.getObj();
  5036. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  5037. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  5038. }
  5039. if (obj3.cmd !== "obj") {
  5040. if (obj3.cmd.startsWith("obj")) {
  5041. num = parseInt(obj3.cmd.substring(3), 10);
  5042. if (!Number.isNaN(num)) {
  5043. return num;
  5044. }
  5045. }
  5046. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  5047. }
  5048. if (this.encrypt && !suppressEncryption) {
  5049. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  5050. } else {
  5051. xrefEntry = parser.getObj();
  5052. }
  5053. if (!(0, _primitives.isStream)(xrefEntry)) {
  5054. this._cacheMap.set(num, xrefEntry);
  5055. }
  5056. return xrefEntry;
  5057. },
  5058. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  5059. const tableOffset = xrefEntry.offset;
  5060. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  5061. if (!(0, _primitives.isStream)(stream)) {
  5062. throw new _util.FormatError("bad ObjStm stream");
  5063. }
  5064. const first = stream.dict.get("First");
  5065. const n = stream.dict.get("N");
  5066. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  5067. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  5068. }
  5069. let parser = new _parser.Parser({
  5070. lexer: new _parser.Lexer(stream),
  5071. xref: this,
  5072. allowStreams: true
  5073. });
  5074. const nums = new Array(n);
  5075. const offsets = new Array(n);
  5076. for (let i = 0; i < n; ++i) {
  5077. const num = parser.getObj();
  5078. if (!Number.isInteger(num)) {
  5079. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  5080. }
  5081. const offset = parser.getObj();
  5082. if (!Number.isInteger(offset)) {
  5083. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  5084. }
  5085. nums[i] = num;
  5086. offsets[i] = offset;
  5087. }
  5088. const start = (stream.start || 0) + first;
  5089. const entries = new Array(n);
  5090. for (let i = 0; i < n; ++i) {
  5091. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  5092. if (length < 0) {
  5093. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  5094. }
  5095. parser = new _parser.Parser({
  5096. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  5097. xref: this,
  5098. allowStreams: true
  5099. });
  5100. const obj = parser.getObj();
  5101. entries[i] = obj;
  5102. if ((0, _primitives.isStream)(obj)) {
  5103. continue;
  5104. }
  5105. const num = nums[i],
  5106. entry = this.entries[num];
  5107. if (entry && entry.offset === tableOffset && entry.gen === i) {
  5108. this._cacheMap.set(num, obj);
  5109. }
  5110. }
  5111. xrefEntry = entries[xrefEntry.gen];
  5112. if (xrefEntry === undefined) {
  5113. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  5114. }
  5115. return xrefEntry;
  5116. },
  5117. async fetchIfRefAsync(obj, suppressEncryption) {
  5118. if (obj instanceof _primitives.Ref) {
  5119. return this.fetchAsync(obj, suppressEncryption);
  5120. }
  5121. return obj;
  5122. },
  5123. async fetchAsync(ref, suppressEncryption) {
  5124. try {
  5125. return this.fetch(ref, suppressEncryption);
  5126. } catch (ex) {
  5127. if (!(ex instanceof _core_utils.MissingDataException)) {
  5128. throw ex;
  5129. }
  5130. await this.pdfManager.requestRange(ex.begin, ex.end);
  5131. return this.fetchAsync(ref, suppressEncryption);
  5132. }
  5133. },
  5134. getCatalogObj: function XRef_getCatalogObj() {
  5135. return this.root;
  5136. }
  5137. };
  5138. return XRef;
  5139. }();
  5140. exports.XRef = XRef;
  5141. class NameOrNumberTree {
  5142. constructor(root, xref, type) {
  5143. if (this.constructor === NameOrNumberTree) {
  5144. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  5145. }
  5146. this.root = root;
  5147. this.xref = xref;
  5148. this._type = type;
  5149. }
  5150. getAll() {
  5151. const dict = Object.create(null);
  5152. if (!this.root) {
  5153. return dict;
  5154. }
  5155. const xref = this.xref;
  5156. const processed = new _primitives.RefSet();
  5157. processed.put(this.root);
  5158. const queue = [this.root];
  5159. while (queue.length > 0) {
  5160. const obj = xref.fetchIfRef(queue.shift());
  5161. if (!(0, _primitives.isDict)(obj)) {
  5162. continue;
  5163. }
  5164. if (obj.has("Kids")) {
  5165. const kids = obj.get("Kids");
  5166. for (let i = 0, ii = kids.length; i < ii; i++) {
  5167. const kid = kids[i];
  5168. if (processed.has(kid)) {
  5169. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  5170. }
  5171. queue.push(kid);
  5172. processed.put(kid);
  5173. }
  5174. continue;
  5175. }
  5176. const entries = obj.get(this._type);
  5177. if (Array.isArray(entries)) {
  5178. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  5179. dict[xref.fetchIfRef(entries[i])] = xref.fetchIfRef(entries[i + 1]);
  5180. }
  5181. }
  5182. }
  5183. return dict;
  5184. }
  5185. get(key) {
  5186. if (!this.root) {
  5187. return null;
  5188. }
  5189. const xref = this.xref;
  5190. let kidsOrEntries = xref.fetchIfRef(this.root);
  5191. let loopCount = 0;
  5192. const MAX_LEVELS = 10;
  5193. while (kidsOrEntries.has("Kids")) {
  5194. if (++loopCount > MAX_LEVELS) {
  5195. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  5196. return null;
  5197. }
  5198. const kids = kidsOrEntries.get("Kids");
  5199. if (!Array.isArray(kids)) {
  5200. return null;
  5201. }
  5202. let l = 0,
  5203. r = kids.length - 1;
  5204. while (l <= r) {
  5205. const m = l + r >> 1;
  5206. const kid = xref.fetchIfRef(kids[m]);
  5207. const limits = kid.get("Limits");
  5208. if (key < xref.fetchIfRef(limits[0])) {
  5209. r = m - 1;
  5210. } else if (key > xref.fetchIfRef(limits[1])) {
  5211. l = m + 1;
  5212. } else {
  5213. kidsOrEntries = xref.fetchIfRef(kids[m]);
  5214. break;
  5215. }
  5216. }
  5217. if (l > r) {
  5218. return null;
  5219. }
  5220. }
  5221. const entries = kidsOrEntries.get(this._type);
  5222. if (Array.isArray(entries)) {
  5223. let l = 0,
  5224. r = entries.length - 2;
  5225. while (l <= r) {
  5226. const tmp = l + r >> 1,
  5227. m = tmp + (tmp & 1);
  5228. const currentKey = xref.fetchIfRef(entries[m]);
  5229. if (key < currentKey) {
  5230. r = m - 2;
  5231. } else if (key > currentKey) {
  5232. l = m + 2;
  5233. } else {
  5234. return xref.fetchIfRef(entries[m + 1]);
  5235. }
  5236. }
  5237. (0, _util.info)(`Falling back to an exhaustive search, for key "${key}", ` + `in "${this._type}" tree.`);
  5238. for (let m = 0, mm = entries.length; m < mm; m += 2) {
  5239. const currentKey = xref.fetchIfRef(entries[m]);
  5240. if (currentKey === key) {
  5241. (0, _util.warn)(`The "${key}" key was found at an incorrect, ` + `i.e. out-of-order, position in "${this._type}" tree.`);
  5242. return xref.fetchIfRef(entries[m + 1]);
  5243. }
  5244. }
  5245. }
  5246. return null;
  5247. }
  5248. }
  5249. class NameTree extends NameOrNumberTree {
  5250. constructor(root, xref) {
  5251. super(root, xref, "Names");
  5252. }
  5253. }
  5254. class NumberTree extends NameOrNumberTree {
  5255. constructor(root, xref) {
  5256. super(root, xref, "Nums");
  5257. }
  5258. }
  5259. var FileSpec = function FileSpecClosure() {
  5260. function FileSpec(root, xref) {
  5261. if (!root || !(0, _primitives.isDict)(root)) {
  5262. return;
  5263. }
  5264. this.xref = xref;
  5265. this.root = root;
  5266. if (root.has("FS")) {
  5267. this.fs = root.get("FS");
  5268. }
  5269. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  5270. if (root.has("RF")) {
  5271. (0, _util.warn)("Related file specifications are not supported");
  5272. }
  5273. this.contentAvailable = true;
  5274. if (!root.has("EF")) {
  5275. this.contentAvailable = false;
  5276. (0, _util.warn)("Non-embedded file specifications are not supported");
  5277. }
  5278. }
  5279. function pickPlatformItem(dict) {
  5280. if (dict.has("UF")) {
  5281. return dict.get("UF");
  5282. } else if (dict.has("F")) {
  5283. return dict.get("F");
  5284. } else if (dict.has("Unix")) {
  5285. return dict.get("Unix");
  5286. } else if (dict.has("Mac")) {
  5287. return dict.get("Mac");
  5288. } else if (dict.has("DOS")) {
  5289. return dict.get("DOS");
  5290. }
  5291. return null;
  5292. }
  5293. FileSpec.prototype = {
  5294. get filename() {
  5295. if (!this._filename && this.root) {
  5296. var filename = pickPlatformItem(this.root) || "unnamed";
  5297. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  5298. }
  5299. return this._filename;
  5300. },
  5301. get content() {
  5302. if (!this.contentAvailable) {
  5303. return null;
  5304. }
  5305. if (!this.contentRef && this.root) {
  5306. this.contentRef = pickPlatformItem(this.root.get("EF"));
  5307. }
  5308. var content = null;
  5309. if (this.contentRef) {
  5310. var xref = this.xref;
  5311. var fileObj = xref.fetchIfRef(this.contentRef);
  5312. if (fileObj && (0, _primitives.isStream)(fileObj)) {
  5313. content = fileObj.getBytes();
  5314. } else {
  5315. (0, _util.warn)("Embedded file specification points to non-existing/invalid " + "content");
  5316. }
  5317. } else {
  5318. (0, _util.warn)("Embedded file specification does not have a content");
  5319. }
  5320. return content;
  5321. },
  5322. get serializable() {
  5323. return {
  5324. filename: this.filename,
  5325. content: this.content
  5326. };
  5327. }
  5328. };
  5329. return FileSpec;
  5330. }();
  5331. exports.FileSpec = FileSpec;
  5332. const ObjectLoader = function () {
  5333. function mayHaveChildren(value) {
  5334. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
  5335. }
  5336. function addChildren(node, nodesToVisit) {
  5337. if (node instanceof _primitives.Dict) {
  5338. node = node.getRawValues();
  5339. } else if ((0, _primitives.isStream)(node)) {
  5340. node = node.dict.getRawValues();
  5341. } else if (!Array.isArray(node)) {
  5342. return;
  5343. }
  5344. for (const rawValue of node) {
  5345. if (mayHaveChildren(rawValue)) {
  5346. nodesToVisit.push(rawValue);
  5347. }
  5348. }
  5349. }
  5350. function ObjectLoader(dict, keys, xref) {
  5351. this.dict = dict;
  5352. this.keys = keys;
  5353. this.xref = xref;
  5354. this.refSet = null;
  5355. }
  5356. ObjectLoader.prototype = {
  5357. async load() {
  5358. if (!this.xref.stream.allChunksLoaded || this.xref.stream.allChunksLoaded()) {
  5359. return undefined;
  5360. }
  5361. const {
  5362. keys,
  5363. dict
  5364. } = this;
  5365. this.refSet = new _primitives.RefSet();
  5366. const nodesToVisit = [];
  5367. for (let i = 0, ii = keys.length; i < ii; i++) {
  5368. const rawValue = dict.getRaw(keys[i]);
  5369. if (rawValue !== undefined) {
  5370. nodesToVisit.push(rawValue);
  5371. }
  5372. }
  5373. return this._walk(nodesToVisit);
  5374. },
  5375. async _walk(nodesToVisit) {
  5376. const nodesToRevisit = [];
  5377. const pendingRequests = [];
  5378. while (nodesToVisit.length) {
  5379. let currentNode = nodesToVisit.pop();
  5380. if (currentNode instanceof _primitives.Ref) {
  5381. if (this.refSet.has(currentNode)) {
  5382. continue;
  5383. }
  5384. try {
  5385. this.refSet.put(currentNode);
  5386. currentNode = this.xref.fetch(currentNode);
  5387. } catch (ex) {
  5388. if (!(ex instanceof _core_utils.MissingDataException)) {
  5389. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  5390. this.refSet = null;
  5391. const {
  5392. manager
  5393. } = this.xref.stream;
  5394. return manager.requestAllChunks();
  5395. }
  5396. nodesToRevisit.push(currentNode);
  5397. pendingRequests.push({
  5398. begin: ex.begin,
  5399. end: ex.end
  5400. });
  5401. }
  5402. }
  5403. if (currentNode && currentNode.getBaseStreams) {
  5404. const baseStreams = currentNode.getBaseStreams();
  5405. let foundMissingData = false;
  5406. for (let i = 0, ii = baseStreams.length; i < ii; i++) {
  5407. const stream = baseStreams[i];
  5408. if (stream.allChunksLoaded && !stream.allChunksLoaded()) {
  5409. foundMissingData = true;
  5410. pendingRequests.push({
  5411. begin: stream.start,
  5412. end: stream.end
  5413. });
  5414. }
  5415. }
  5416. if (foundMissingData) {
  5417. nodesToRevisit.push(currentNode);
  5418. }
  5419. }
  5420. addChildren(currentNode, nodesToVisit);
  5421. }
  5422. if (pendingRequests.length) {
  5423. await this.xref.stream.manager.requestRanges(pendingRequests);
  5424. for (let i = 0, ii = nodesToRevisit.length; i < ii; i++) {
  5425. const node = nodesToRevisit[i];
  5426. if (node instanceof _primitives.Ref) {
  5427. this.refSet.remove(node);
  5428. }
  5429. }
  5430. return this._walk(nodesToRevisit);
  5431. }
  5432. this.refSet = null;
  5433. return undefined;
  5434. }
  5435. };
  5436. return ObjectLoader;
  5437. }();
  5438. exports.ObjectLoader = ObjectLoader;
  5439. /***/ }),
  5440. /* 11 */
  5441. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  5442. Object.defineProperty(exports, "__esModule", ({
  5443. value: true
  5444. }));
  5445. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  5446. var _stream = __w_pdfjs_require__(12);
  5447. var _util = __w_pdfjs_require__(2);
  5448. var _primitives = __w_pdfjs_require__(5);
  5449. var _core_utils = __w_pdfjs_require__(8);
  5450. var _ccitt_stream = __w_pdfjs_require__(13);
  5451. var _jbig2_stream = __w_pdfjs_require__(15);
  5452. var _jpeg_stream = __w_pdfjs_require__(18);
  5453. var _jpx_stream = __w_pdfjs_require__(20);
  5454. const MAX_LENGTH_TO_CACHE = 1000;
  5455. const MAX_ADLER32_LENGTH = 5552;
  5456. function computeAdler32(bytes) {
  5457. const bytesLength = bytes.length;
  5458. let a = 1,
  5459. b = 0;
  5460. for (let i = 0; i < bytesLength; ++i) {
  5461. a += bytes[i] & 0xff;
  5462. b += a;
  5463. }
  5464. return b % 65521 << 16 | a % 65521;
  5465. }
  5466. class Parser {
  5467. constructor({
  5468. lexer,
  5469. xref,
  5470. allowStreams = false,
  5471. recoveryMode = false
  5472. }) {
  5473. this.lexer = lexer;
  5474. this.xref = xref;
  5475. this.allowStreams = allowStreams;
  5476. this.recoveryMode = recoveryMode;
  5477. this.imageCache = Object.create(null);
  5478. this.refill();
  5479. }
  5480. refill() {
  5481. this.buf1 = this.lexer.getObj();
  5482. this.buf2 = this.lexer.getObj();
  5483. }
  5484. shift() {
  5485. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  5486. this.buf1 = this.buf2;
  5487. this.buf2 = null;
  5488. } else {
  5489. this.buf1 = this.buf2;
  5490. this.buf2 = this.lexer.getObj();
  5491. }
  5492. }
  5493. tryShift() {
  5494. try {
  5495. this.shift();
  5496. return true;
  5497. } catch (e) {
  5498. if (e instanceof _core_utils.MissingDataException) {
  5499. throw e;
  5500. }
  5501. return false;
  5502. }
  5503. }
  5504. getObj(cipherTransform = null) {
  5505. const buf1 = this.buf1;
  5506. this.shift();
  5507. if (buf1 instanceof _primitives.Cmd) {
  5508. switch (buf1.cmd) {
  5509. case "BI":
  5510. return this.makeInlineImage(cipherTransform);
  5511. case "[":
  5512. const array = [];
  5513. while (!(0, _primitives.isCmd)(this.buf1, "]") && !(0, _primitives.isEOF)(this.buf1)) {
  5514. array.push(this.getObj(cipherTransform));
  5515. }
  5516. if ((0, _primitives.isEOF)(this.buf1)) {
  5517. if (!this.recoveryMode) {
  5518. throw new _util.FormatError("End of file inside array");
  5519. }
  5520. return array;
  5521. }
  5522. this.shift();
  5523. return array;
  5524. case "<<":
  5525. const dict = new _primitives.Dict(this.xref);
  5526. while (!(0, _primitives.isCmd)(this.buf1, ">>") && !(0, _primitives.isEOF)(this.buf1)) {
  5527. if (!(0, _primitives.isName)(this.buf1)) {
  5528. (0, _util.info)("Malformed dictionary: key must be a name object");
  5529. this.shift();
  5530. continue;
  5531. }
  5532. const key = this.buf1.name;
  5533. this.shift();
  5534. if ((0, _primitives.isEOF)(this.buf1)) {
  5535. break;
  5536. }
  5537. dict.set(key, this.getObj(cipherTransform));
  5538. }
  5539. if ((0, _primitives.isEOF)(this.buf1)) {
  5540. if (!this.recoveryMode) {
  5541. throw new _util.FormatError("End of file inside dictionary");
  5542. }
  5543. return dict;
  5544. }
  5545. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  5546. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  5547. }
  5548. this.shift();
  5549. return dict;
  5550. default:
  5551. return buf1;
  5552. }
  5553. }
  5554. if (Number.isInteger(buf1)) {
  5555. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  5556. const ref = _primitives.Ref.get(buf1, this.buf1);
  5557. this.shift();
  5558. this.shift();
  5559. return ref;
  5560. }
  5561. return buf1;
  5562. }
  5563. if (typeof buf1 === "string") {
  5564. if (cipherTransform) {
  5565. return cipherTransform.decryptString(buf1);
  5566. }
  5567. return buf1;
  5568. }
  5569. return buf1;
  5570. }
  5571. findDefaultInlineStreamEnd(stream) {
  5572. const E = 0x45,
  5573. I = 0x49,
  5574. SPACE = 0x20,
  5575. LF = 0xa,
  5576. CR = 0xd,
  5577. NUL = 0x0;
  5578. const lexer = this.lexer,
  5579. startPos = stream.pos,
  5580. n = 10;
  5581. let state = 0,
  5582. ch,
  5583. maybeEIPos;
  5584. while ((ch = stream.getByte()) !== -1) {
  5585. if (state === 0) {
  5586. state = ch === E ? 1 : 0;
  5587. } else if (state === 1) {
  5588. state = ch === I ? 2 : 0;
  5589. } else {
  5590. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  5591. if (ch === SPACE || ch === LF || ch === CR) {
  5592. maybeEIPos = stream.pos;
  5593. const followingBytes = stream.peekBytes(n);
  5594. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  5595. ch = followingBytes[i];
  5596. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  5597. continue;
  5598. }
  5599. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  5600. state = 0;
  5601. break;
  5602. }
  5603. }
  5604. if (state !== 2) {
  5605. continue;
  5606. }
  5607. if (lexer.knownCommands) {
  5608. const nextObj = lexer.peekObj();
  5609. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  5610. state = 0;
  5611. }
  5612. } else {
  5613. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  5614. }
  5615. if (state === 2) {
  5616. break;
  5617. }
  5618. } else {
  5619. state = 0;
  5620. }
  5621. }
  5622. }
  5623. if (ch === -1) {
  5624. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  5625. if (maybeEIPos) {
  5626. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  5627. stream.skip(-(stream.pos - maybeEIPos));
  5628. }
  5629. }
  5630. let endOffset = 4;
  5631. stream.skip(-endOffset);
  5632. ch = stream.peekByte();
  5633. stream.skip(endOffset);
  5634. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  5635. endOffset--;
  5636. }
  5637. return stream.pos - endOffset - startPos;
  5638. }
  5639. findDCTDecodeInlineStreamEnd(stream) {
  5640. const startPos = stream.pos;
  5641. let foundEOI = false,
  5642. b,
  5643. markerLength;
  5644. while ((b = stream.getByte()) !== -1) {
  5645. if (b !== 0xff) {
  5646. continue;
  5647. }
  5648. switch (stream.getByte()) {
  5649. case 0x00:
  5650. break;
  5651. case 0xff:
  5652. stream.skip(-1);
  5653. break;
  5654. case 0xd9:
  5655. foundEOI = true;
  5656. break;
  5657. case 0xc0:
  5658. case 0xc1:
  5659. case 0xc2:
  5660. case 0xc3:
  5661. case 0xc5:
  5662. case 0xc6:
  5663. case 0xc7:
  5664. case 0xc9:
  5665. case 0xca:
  5666. case 0xcb:
  5667. case 0xcd:
  5668. case 0xce:
  5669. case 0xcf:
  5670. case 0xc4:
  5671. case 0xcc:
  5672. case 0xda:
  5673. case 0xdb:
  5674. case 0xdc:
  5675. case 0xdd:
  5676. case 0xde:
  5677. case 0xdf:
  5678. case 0xe0:
  5679. case 0xe1:
  5680. case 0xe2:
  5681. case 0xe3:
  5682. case 0xe4:
  5683. case 0xe5:
  5684. case 0xe6:
  5685. case 0xe7:
  5686. case 0xe8:
  5687. case 0xe9:
  5688. case 0xea:
  5689. case 0xeb:
  5690. case 0xec:
  5691. case 0xed:
  5692. case 0xee:
  5693. case 0xef:
  5694. case 0xfe:
  5695. markerLength = stream.getUint16();
  5696. if (markerLength > 2) {
  5697. stream.skip(markerLength - 2);
  5698. } else {
  5699. stream.skip(-2);
  5700. }
  5701. break;
  5702. }
  5703. if (foundEOI) {
  5704. break;
  5705. }
  5706. }
  5707. const length = stream.pos - startPos;
  5708. if (b === -1) {
  5709. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  5710. stream.skip(-length);
  5711. return this.findDefaultInlineStreamEnd(stream);
  5712. }
  5713. this.inlineStreamSkipEI(stream);
  5714. return length;
  5715. }
  5716. findASCII85DecodeInlineStreamEnd(stream) {
  5717. const TILDE = 0x7e,
  5718. GT = 0x3e;
  5719. const startPos = stream.pos;
  5720. let ch;
  5721. while ((ch = stream.getByte()) !== -1) {
  5722. if (ch === TILDE) {
  5723. const tildePos = stream.pos;
  5724. ch = stream.peekByte();
  5725. while ((0, _core_utils.isWhiteSpace)(ch)) {
  5726. stream.skip();
  5727. ch = stream.peekByte();
  5728. }
  5729. if (ch === GT) {
  5730. stream.skip();
  5731. break;
  5732. }
  5733. if (stream.pos > tildePos) {
  5734. const maybeEI = stream.peekBytes(2);
  5735. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  5736. break;
  5737. }
  5738. }
  5739. }
  5740. }
  5741. const length = stream.pos - startPos;
  5742. if (ch === -1) {
  5743. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  5744. stream.skip(-length);
  5745. return this.findDefaultInlineStreamEnd(stream);
  5746. }
  5747. this.inlineStreamSkipEI(stream);
  5748. return length;
  5749. }
  5750. findASCIIHexDecodeInlineStreamEnd(stream) {
  5751. const GT = 0x3e;
  5752. const startPos = stream.pos;
  5753. let ch;
  5754. while ((ch = stream.getByte()) !== -1) {
  5755. if (ch === GT) {
  5756. break;
  5757. }
  5758. }
  5759. const length = stream.pos - startPos;
  5760. if (ch === -1) {
  5761. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  5762. stream.skip(-length);
  5763. return this.findDefaultInlineStreamEnd(stream);
  5764. }
  5765. this.inlineStreamSkipEI(stream);
  5766. return length;
  5767. }
  5768. inlineStreamSkipEI(stream) {
  5769. const E = 0x45,
  5770. I = 0x49;
  5771. let state = 0,
  5772. ch;
  5773. while ((ch = stream.getByte()) !== -1) {
  5774. if (state === 0) {
  5775. state = ch === E ? 1 : 0;
  5776. } else if (state === 1) {
  5777. state = ch === I ? 2 : 0;
  5778. } else if (state === 2) {
  5779. break;
  5780. }
  5781. }
  5782. }
  5783. makeInlineImage(cipherTransform) {
  5784. const lexer = this.lexer;
  5785. const stream = lexer.stream;
  5786. const dict = new _primitives.Dict(this.xref);
  5787. let dictLength;
  5788. while (!(0, _primitives.isCmd)(this.buf1, "ID") && !(0, _primitives.isEOF)(this.buf1)) {
  5789. if (!(0, _primitives.isName)(this.buf1)) {
  5790. throw new _util.FormatError("Dictionary key must be a name object");
  5791. }
  5792. const key = this.buf1.name;
  5793. this.shift();
  5794. if ((0, _primitives.isEOF)(this.buf1)) {
  5795. break;
  5796. }
  5797. dict.set(key, this.getObj(cipherTransform));
  5798. }
  5799. if (lexer.beginInlineImagePos !== -1) {
  5800. dictLength = stream.pos - lexer.beginInlineImagePos;
  5801. }
  5802. const filter = dict.get("Filter", "F");
  5803. let filterName;
  5804. if ((0, _primitives.isName)(filter)) {
  5805. filterName = filter.name;
  5806. } else if (Array.isArray(filter)) {
  5807. const filterZero = this.xref.fetchIfRef(filter[0]);
  5808. if ((0, _primitives.isName)(filterZero)) {
  5809. filterName = filterZero.name;
  5810. }
  5811. }
  5812. const startPos = stream.pos;
  5813. let length;
  5814. if (filterName === "DCTDecode" || filterName === "DCT") {
  5815. length = this.findDCTDecodeInlineStreamEnd(stream);
  5816. } else if (filterName === "ASCII85Decode" || filterName === "A85") {
  5817. length = this.findASCII85DecodeInlineStreamEnd(stream);
  5818. } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
  5819. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  5820. } else {
  5821. length = this.findDefaultInlineStreamEnd(stream);
  5822. }
  5823. let imageStream = stream.makeSubStream(startPos, length, dict);
  5824. let cacheKey;
  5825. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  5826. const imageBytes = imageStream.getBytes();
  5827. imageStream.reset();
  5828. const initialStreamPos = stream.pos;
  5829. stream.pos = lexer.beginInlineImagePos;
  5830. const dictBytes = stream.getBytes(dictLength);
  5831. stream.pos = initialStreamPos;
  5832. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  5833. const cacheEntry = this.imageCache[cacheKey];
  5834. if (cacheEntry !== undefined) {
  5835. this.buf2 = _primitives.Cmd.get("EI");
  5836. this.shift();
  5837. cacheEntry.reset();
  5838. return cacheEntry;
  5839. }
  5840. }
  5841. if (cipherTransform) {
  5842. imageStream = cipherTransform.createStream(imageStream, length);
  5843. }
  5844. imageStream = this.filter(imageStream, dict, length);
  5845. imageStream.dict = dict;
  5846. if (cacheKey !== undefined) {
  5847. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  5848. this.imageCache[cacheKey] = imageStream;
  5849. }
  5850. this.buf2 = _primitives.Cmd.get("EI");
  5851. this.shift();
  5852. return imageStream;
  5853. }
  5854. _findStreamLength(startPos, signature) {
  5855. const {
  5856. stream
  5857. } = this.lexer;
  5858. stream.pos = startPos;
  5859. const SCAN_BLOCK_LENGTH = 2048;
  5860. const signatureLength = signature.length;
  5861. while (stream.pos < stream.end) {
  5862. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  5863. const scanLength = scanBytes.length - signatureLength;
  5864. if (scanLength <= 0) {
  5865. break;
  5866. }
  5867. let pos = 0;
  5868. while (pos < scanLength) {
  5869. let j = 0;
  5870. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  5871. j++;
  5872. }
  5873. if (j >= signatureLength) {
  5874. stream.pos += pos;
  5875. return stream.pos - startPos;
  5876. }
  5877. pos++;
  5878. }
  5879. stream.pos += scanLength;
  5880. }
  5881. return -1;
  5882. }
  5883. makeStream(dict, cipherTransform) {
  5884. const lexer = this.lexer;
  5885. let stream = lexer.stream;
  5886. lexer.skipToNextLine();
  5887. const startPos = stream.pos - 1;
  5888. let length = dict.get("Length");
  5889. if (!Number.isInteger(length)) {
  5890. (0, _util.info)(`Bad length "${length}" in stream`);
  5891. length = 0;
  5892. }
  5893. stream.pos = startPos + length;
  5894. lexer.nextChar();
  5895. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  5896. this.shift();
  5897. } else {
  5898. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6E, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D]);
  5899. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  5900. if (actualLength < 0) {
  5901. const MAX_TRUNCATION = 1;
  5902. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  5903. const end = ENDSTREAM_SIGNATURE.length - i;
  5904. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  5905. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  5906. if (maybeLength >= 0) {
  5907. const lastByte = stream.peekBytes(end + 1)[end];
  5908. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  5909. break;
  5910. }
  5911. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  5912. actualLength = maybeLength;
  5913. break;
  5914. }
  5915. }
  5916. if (actualLength < 0) {
  5917. throw new _util.FormatError("Missing endstream command.");
  5918. }
  5919. }
  5920. length = actualLength;
  5921. lexer.nextChar();
  5922. this.shift();
  5923. this.shift();
  5924. }
  5925. this.shift();
  5926. stream = stream.makeSubStream(startPos, length, dict);
  5927. if (cipherTransform) {
  5928. stream = cipherTransform.createStream(stream, length);
  5929. }
  5930. stream = this.filter(stream, dict, length);
  5931. stream.dict = dict;
  5932. return stream;
  5933. }
  5934. filter(stream, dict, length) {
  5935. let filter = dict.get("Filter", "F");
  5936. let params = dict.get("DecodeParms", "DP");
  5937. if ((0, _primitives.isName)(filter)) {
  5938. if (Array.isArray(params)) {
  5939. (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
  5940. }
  5941. return this.makeFilter(stream, filter.name, length, params);
  5942. }
  5943. let maybeLength = length;
  5944. if (Array.isArray(filter)) {
  5945. const filterArray = filter;
  5946. const paramsArray = params;
  5947. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  5948. filter = this.xref.fetchIfRef(filterArray[i]);
  5949. if (!(0, _primitives.isName)(filter)) {
  5950. throw new _util.FormatError(`Bad filter name "${filter}"`);
  5951. }
  5952. params = null;
  5953. if (Array.isArray(paramsArray) && i in paramsArray) {
  5954. params = this.xref.fetchIfRef(paramsArray[i]);
  5955. }
  5956. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  5957. maybeLength = null;
  5958. }
  5959. }
  5960. return stream;
  5961. }
  5962. makeFilter(stream, name, maybeLength, params) {
  5963. if (maybeLength === 0) {
  5964. (0, _util.warn)(`Empty "${name}" stream.`);
  5965. return new _stream.NullStream();
  5966. }
  5967. try {
  5968. const xrefStreamStats = this.xref.stats.streamTypes;
  5969. if (name === "FlateDecode" || name === "Fl") {
  5970. xrefStreamStats[_util.StreamType.FLATE] = true;
  5971. if (params) {
  5972. return new _stream.PredictorStream(new _stream.FlateStream(stream, maybeLength), maybeLength, params);
  5973. }
  5974. return new _stream.FlateStream(stream, maybeLength);
  5975. }
  5976. if (name === "LZWDecode" || name === "LZW") {
  5977. xrefStreamStats[_util.StreamType.LZW] = true;
  5978. let earlyChange = 1;
  5979. if (params) {
  5980. if (params.has("EarlyChange")) {
  5981. earlyChange = params.get("EarlyChange");
  5982. }
  5983. return new _stream.PredictorStream(new _stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  5984. }
  5985. return new _stream.LZWStream(stream, maybeLength, earlyChange);
  5986. }
  5987. if (name === "DCTDecode" || name === "DCT") {
  5988. xrefStreamStats[_util.StreamType.DCT] = true;
  5989. return new _jpeg_stream.JpegStream(stream, maybeLength, stream.dict, params);
  5990. }
  5991. if (name === "JPXDecode" || name === "JPX") {
  5992. xrefStreamStats[_util.StreamType.JPX] = true;
  5993. return new _jpx_stream.JpxStream(stream, maybeLength, stream.dict, params);
  5994. }
  5995. if (name === "ASCII85Decode" || name === "A85") {
  5996. xrefStreamStats[_util.StreamType.A85] = true;
  5997. return new _stream.Ascii85Stream(stream, maybeLength);
  5998. }
  5999. if (name === "ASCIIHexDecode" || name === "AHx") {
  6000. xrefStreamStats[_util.StreamType.AHX] = true;
  6001. return new _stream.AsciiHexStream(stream, maybeLength);
  6002. }
  6003. if (name === "CCITTFaxDecode" || name === "CCF") {
  6004. xrefStreamStats[_util.StreamType.CCF] = true;
  6005. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  6006. }
  6007. if (name === "RunLengthDecode" || name === "RL") {
  6008. xrefStreamStats[_util.StreamType.RLX] = true;
  6009. return new _stream.RunLengthStream(stream, maybeLength);
  6010. }
  6011. if (name === "JBIG2Decode") {
  6012. xrefStreamStats[_util.StreamType.JBIG] = true;
  6013. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, stream.dict, params);
  6014. }
  6015. (0, _util.warn)(`Filter "${name}" is not supported.`);
  6016. return stream;
  6017. } catch (ex) {
  6018. if (ex instanceof _core_utils.MissingDataException) {
  6019. throw ex;
  6020. }
  6021. (0, _util.warn)(`Invalid stream: "${ex}"`);
  6022. return new _stream.NullStream();
  6023. }
  6024. }
  6025. }
  6026. exports.Parser = Parser;
  6027. 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];
  6028. function toHexDigit(ch) {
  6029. if (ch >= 0x30 && ch <= 0x39) {
  6030. return ch & 0x0f;
  6031. }
  6032. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  6033. return (ch & 0x0f) + 9;
  6034. }
  6035. return -1;
  6036. }
  6037. class Lexer {
  6038. constructor(stream, knownCommands = null) {
  6039. this.stream = stream;
  6040. this.nextChar();
  6041. this.strBuf = [];
  6042. this.knownCommands = knownCommands;
  6043. this._hexStringNumWarn = 0;
  6044. this.beginInlineImagePos = -1;
  6045. }
  6046. nextChar() {
  6047. return this.currentChar = this.stream.getByte();
  6048. }
  6049. peekChar() {
  6050. return this.stream.peekByte();
  6051. }
  6052. getNumber() {
  6053. let ch = this.currentChar;
  6054. let eNotation = false;
  6055. let divideBy = 0;
  6056. let sign = 0;
  6057. if (ch === 0x2d) {
  6058. sign = -1;
  6059. ch = this.nextChar();
  6060. if (ch === 0x2d) {
  6061. ch = this.nextChar();
  6062. }
  6063. } else if (ch === 0x2b) {
  6064. sign = 1;
  6065. ch = this.nextChar();
  6066. }
  6067. if (ch === 0x0a || ch === 0x0d) {
  6068. do {
  6069. ch = this.nextChar();
  6070. } while (ch === 0x0a || ch === 0x0d);
  6071. }
  6072. if (ch === 0x2e) {
  6073. divideBy = 10;
  6074. ch = this.nextChar();
  6075. }
  6076. if (ch < 0x30 || ch > 0x39) {
  6077. if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
  6078. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  6079. return 0;
  6080. }
  6081. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  6082. }
  6083. sign = sign || 1;
  6084. let baseValue = ch - 0x30;
  6085. let powerValue = 0;
  6086. let powerValueSign = 1;
  6087. while ((ch = this.nextChar()) >= 0) {
  6088. if (ch >= 0x30 && ch <= 0x39) {
  6089. const currentDigit = ch - 0x30;
  6090. if (eNotation) {
  6091. powerValue = powerValue * 10 + currentDigit;
  6092. } else {
  6093. if (divideBy !== 0) {
  6094. divideBy *= 10;
  6095. }
  6096. baseValue = baseValue * 10 + currentDigit;
  6097. }
  6098. } else if (ch === 0x2e) {
  6099. if (divideBy === 0) {
  6100. divideBy = 1;
  6101. } else {
  6102. break;
  6103. }
  6104. } else if (ch === 0x2d) {
  6105. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  6106. } else if (ch === 0x45 || ch === 0x65) {
  6107. ch = this.peekChar();
  6108. if (ch === 0x2b || ch === 0x2d) {
  6109. powerValueSign = ch === 0x2d ? -1 : 1;
  6110. this.nextChar();
  6111. } else if (ch < 0x30 || ch > 0x39) {
  6112. break;
  6113. }
  6114. eNotation = true;
  6115. } else {
  6116. break;
  6117. }
  6118. }
  6119. if (divideBy !== 0) {
  6120. baseValue /= divideBy;
  6121. }
  6122. if (eNotation) {
  6123. baseValue *= 10 ** (powerValueSign * powerValue);
  6124. }
  6125. return sign * baseValue;
  6126. }
  6127. getString() {
  6128. let numParen = 1;
  6129. let done = false;
  6130. const strBuf = this.strBuf;
  6131. strBuf.length = 0;
  6132. let ch = this.nextChar();
  6133. while (true) {
  6134. let charBuffered = false;
  6135. switch (ch | 0) {
  6136. case -1:
  6137. (0, _util.warn)("Unterminated string");
  6138. done = true;
  6139. break;
  6140. case 0x28:
  6141. ++numParen;
  6142. strBuf.push("(");
  6143. break;
  6144. case 0x29:
  6145. if (--numParen === 0) {
  6146. this.nextChar();
  6147. done = true;
  6148. } else {
  6149. strBuf.push(")");
  6150. }
  6151. break;
  6152. case 0x5c:
  6153. ch = this.nextChar();
  6154. switch (ch) {
  6155. case -1:
  6156. (0, _util.warn)("Unterminated string");
  6157. done = true;
  6158. break;
  6159. case 0x6e:
  6160. strBuf.push("\n");
  6161. break;
  6162. case 0x72:
  6163. strBuf.push("\r");
  6164. break;
  6165. case 0x74:
  6166. strBuf.push("\t");
  6167. break;
  6168. case 0x62:
  6169. strBuf.push("\b");
  6170. break;
  6171. case 0x66:
  6172. strBuf.push("\f");
  6173. break;
  6174. case 0x5c:
  6175. case 0x28:
  6176. case 0x29:
  6177. strBuf.push(String.fromCharCode(ch));
  6178. break;
  6179. case 0x30:
  6180. case 0x31:
  6181. case 0x32:
  6182. case 0x33:
  6183. case 0x34:
  6184. case 0x35:
  6185. case 0x36:
  6186. case 0x37:
  6187. let x = ch & 0x0f;
  6188. ch = this.nextChar();
  6189. charBuffered = true;
  6190. if (ch >= 0x30 && ch <= 0x37) {
  6191. x = (x << 3) + (ch & 0x0f);
  6192. ch = this.nextChar();
  6193. if (ch >= 0x30 && ch <= 0x37) {
  6194. charBuffered = false;
  6195. x = (x << 3) + (ch & 0x0f);
  6196. }
  6197. }
  6198. strBuf.push(String.fromCharCode(x));
  6199. break;
  6200. case 0x0d:
  6201. if (this.peekChar() === 0x0a) {
  6202. this.nextChar();
  6203. }
  6204. break;
  6205. case 0x0a:
  6206. break;
  6207. default:
  6208. strBuf.push(String.fromCharCode(ch));
  6209. break;
  6210. }
  6211. break;
  6212. default:
  6213. strBuf.push(String.fromCharCode(ch));
  6214. break;
  6215. }
  6216. if (done) {
  6217. break;
  6218. }
  6219. if (!charBuffered) {
  6220. ch = this.nextChar();
  6221. }
  6222. }
  6223. return strBuf.join("");
  6224. }
  6225. getName() {
  6226. let ch, previousCh;
  6227. const strBuf = this.strBuf;
  6228. strBuf.length = 0;
  6229. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  6230. if (ch === 0x23) {
  6231. ch = this.nextChar();
  6232. if (specialChars[ch]) {
  6233. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  6234. strBuf.push("#");
  6235. break;
  6236. }
  6237. const x = toHexDigit(ch);
  6238. if (x !== -1) {
  6239. previousCh = ch;
  6240. ch = this.nextChar();
  6241. const x2 = toHexDigit(ch);
  6242. if (x2 === -1) {
  6243. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  6244. strBuf.push("#", String.fromCharCode(previousCh));
  6245. if (specialChars[ch]) {
  6246. break;
  6247. }
  6248. strBuf.push(String.fromCharCode(ch));
  6249. continue;
  6250. }
  6251. strBuf.push(String.fromCharCode(x << 4 | x2));
  6252. } else {
  6253. strBuf.push("#", String.fromCharCode(ch));
  6254. }
  6255. } else {
  6256. strBuf.push(String.fromCharCode(ch));
  6257. }
  6258. }
  6259. if (strBuf.length > 127) {
  6260. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  6261. }
  6262. return _primitives.Name.get(strBuf.join(""));
  6263. }
  6264. _hexStringWarn(ch) {
  6265. const MAX_HEX_STRING_NUM_WARN = 5;
  6266. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  6267. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  6268. return;
  6269. }
  6270. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  6271. return;
  6272. }
  6273. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  6274. }
  6275. getHexString() {
  6276. const strBuf = this.strBuf;
  6277. strBuf.length = 0;
  6278. let ch = this.currentChar;
  6279. let isFirstHex = true;
  6280. let firstDigit, secondDigit;
  6281. this._hexStringNumWarn = 0;
  6282. while (true) {
  6283. if (ch < 0) {
  6284. (0, _util.warn)("Unterminated hex string");
  6285. break;
  6286. } else if (ch === 0x3e) {
  6287. this.nextChar();
  6288. break;
  6289. } else if (specialChars[ch] === 1) {
  6290. ch = this.nextChar();
  6291. continue;
  6292. } else {
  6293. if (isFirstHex) {
  6294. firstDigit = toHexDigit(ch);
  6295. if (firstDigit === -1) {
  6296. this._hexStringWarn(ch);
  6297. ch = this.nextChar();
  6298. continue;
  6299. }
  6300. } else {
  6301. secondDigit = toHexDigit(ch);
  6302. if (secondDigit === -1) {
  6303. this._hexStringWarn(ch);
  6304. ch = this.nextChar();
  6305. continue;
  6306. }
  6307. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  6308. }
  6309. isFirstHex = !isFirstHex;
  6310. ch = this.nextChar();
  6311. }
  6312. }
  6313. return strBuf.join("");
  6314. }
  6315. getObj() {
  6316. let comment = false;
  6317. let ch = this.currentChar;
  6318. while (true) {
  6319. if (ch < 0) {
  6320. return _primitives.EOF;
  6321. }
  6322. if (comment) {
  6323. if (ch === 0x0a || ch === 0x0d) {
  6324. comment = false;
  6325. }
  6326. } else if (ch === 0x25) {
  6327. comment = true;
  6328. } else if (specialChars[ch] !== 1) {
  6329. break;
  6330. }
  6331. ch = this.nextChar();
  6332. }
  6333. switch (ch | 0) {
  6334. case 0x30:
  6335. case 0x31:
  6336. case 0x32:
  6337. case 0x33:
  6338. case 0x34:
  6339. case 0x35:
  6340. case 0x36:
  6341. case 0x37:
  6342. case 0x38:
  6343. case 0x39:
  6344. case 0x2b:
  6345. case 0x2d:
  6346. case 0x2e:
  6347. return this.getNumber();
  6348. case 0x28:
  6349. return this.getString();
  6350. case 0x2f:
  6351. return this.getName();
  6352. case 0x5b:
  6353. this.nextChar();
  6354. return _primitives.Cmd.get("[");
  6355. case 0x5d:
  6356. this.nextChar();
  6357. return _primitives.Cmd.get("]");
  6358. case 0x3c:
  6359. ch = this.nextChar();
  6360. if (ch === 0x3c) {
  6361. this.nextChar();
  6362. return _primitives.Cmd.get("<<");
  6363. }
  6364. return this.getHexString();
  6365. case 0x3e:
  6366. ch = this.nextChar();
  6367. if (ch === 0x3e) {
  6368. this.nextChar();
  6369. return _primitives.Cmd.get(">>");
  6370. }
  6371. return _primitives.Cmd.get(">");
  6372. case 0x7b:
  6373. this.nextChar();
  6374. return _primitives.Cmd.get("{");
  6375. case 0x7d:
  6376. this.nextChar();
  6377. return _primitives.Cmd.get("}");
  6378. case 0x29:
  6379. this.nextChar();
  6380. throw new _util.FormatError(`Illegal character: ${ch}`);
  6381. }
  6382. let str = String.fromCharCode(ch);
  6383. const knownCommands = this.knownCommands;
  6384. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  6385. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  6386. const possibleCommand = str + String.fromCharCode(ch);
  6387. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  6388. break;
  6389. }
  6390. if (str.length === 128) {
  6391. throw new _util.FormatError(`Command token too long: ${str.length}`);
  6392. }
  6393. str = possibleCommand;
  6394. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  6395. }
  6396. if (str === "true") {
  6397. return true;
  6398. }
  6399. if (str === "false") {
  6400. return false;
  6401. }
  6402. if (str === "null") {
  6403. return null;
  6404. }
  6405. if (str === "BI") {
  6406. this.beginInlineImagePos = this.stream.pos;
  6407. }
  6408. return _primitives.Cmd.get(str);
  6409. }
  6410. peekObj() {
  6411. const streamPos = this.stream.pos,
  6412. currentChar = this.currentChar,
  6413. beginInlineImagePos = this.beginInlineImagePos;
  6414. let nextObj;
  6415. try {
  6416. nextObj = this.getObj();
  6417. } catch (ex) {
  6418. if (ex instanceof _core_utils.MissingDataException) {
  6419. throw ex;
  6420. }
  6421. (0, _util.warn)(`peekObj: ${ex}`);
  6422. }
  6423. this.stream.pos = streamPos;
  6424. this.currentChar = currentChar;
  6425. this.beginInlineImagePos = beginInlineImagePos;
  6426. return nextObj;
  6427. }
  6428. skipToNextLine() {
  6429. let ch = this.currentChar;
  6430. while (ch >= 0) {
  6431. if (ch === 0x0d) {
  6432. ch = this.nextChar();
  6433. if (ch === 0x0a) {
  6434. this.nextChar();
  6435. }
  6436. break;
  6437. } else if (ch === 0x0a) {
  6438. this.nextChar();
  6439. break;
  6440. }
  6441. ch = this.nextChar();
  6442. }
  6443. }
  6444. }
  6445. exports.Lexer = Lexer;
  6446. class Linearization {
  6447. static create(stream) {
  6448. function getInt(linDict, name, allowZeroValue = false) {
  6449. const obj = linDict.get(name);
  6450. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  6451. return obj;
  6452. }
  6453. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  6454. }
  6455. function getHints(linDict) {
  6456. const hints = linDict.get("H");
  6457. let hintsLength;
  6458. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  6459. for (let index = 0; index < hintsLength; index++) {
  6460. const hint = hints[index];
  6461. if (!(Number.isInteger(hint) && hint > 0)) {
  6462. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  6463. }
  6464. }
  6465. return hints;
  6466. }
  6467. throw new Error("Hint array in the linearization dictionary is invalid.");
  6468. }
  6469. const parser = new Parser({
  6470. lexer: new Lexer(stream),
  6471. xref: null
  6472. });
  6473. const obj1 = parser.getObj();
  6474. const obj2 = parser.getObj();
  6475. const obj3 = parser.getObj();
  6476. const linDict = parser.getObj();
  6477. let obj, length;
  6478. 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)) {
  6479. return null;
  6480. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  6481. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  6482. }
  6483. return {
  6484. length,
  6485. hints: getHints(linDict),
  6486. objectNumberFirst: getInt(linDict, "O"),
  6487. endFirst: getInt(linDict, "E"),
  6488. numPages: getInt(linDict, "N"),
  6489. mainXRefEntriesOffset: getInt(linDict, "T"),
  6490. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  6491. };
  6492. }
  6493. }
  6494. exports.Linearization = Linearization;
  6495. /***/ }),
  6496. /* 12 */
  6497. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  6498. Object.defineProperty(exports, "__esModule", ({
  6499. value: true
  6500. }));
  6501. 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;
  6502. var _util = __w_pdfjs_require__(2);
  6503. var _primitives = __w_pdfjs_require__(5);
  6504. var _core_utils = __w_pdfjs_require__(8);
  6505. var Stream = function StreamClosure() {
  6506. function Stream(arrayBuffer, start, length, dict) {
  6507. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  6508. this.start = start || 0;
  6509. this.pos = this.start;
  6510. this.end = start + length || this.bytes.length;
  6511. this.dict = dict;
  6512. }
  6513. Stream.prototype = {
  6514. get length() {
  6515. return this.end - this.start;
  6516. },
  6517. get isEmpty() {
  6518. return this.length === 0;
  6519. },
  6520. getByte: function Stream_getByte() {
  6521. if (this.pos >= this.end) {
  6522. return -1;
  6523. }
  6524. return this.bytes[this.pos++];
  6525. },
  6526. getUint16: function Stream_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 Stream_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 bytes = this.bytes;
  6543. var pos = this.pos;
  6544. var strEnd = this.end;
  6545. if (!length) {
  6546. const subarray = bytes.subarray(pos, strEnd);
  6547. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  6548. }
  6549. var end = pos + length;
  6550. if (end > strEnd) {
  6551. end = strEnd;
  6552. }
  6553. this.pos = end;
  6554. const subarray = bytes.subarray(pos, end);
  6555. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  6556. },
  6557. peekByte: function Stream_peekByte() {
  6558. var peekedByte = this.getByte();
  6559. if (peekedByte !== -1) {
  6560. this.pos--;
  6561. }
  6562. return peekedByte;
  6563. },
  6564. peekBytes(length, forceClamped = false) {
  6565. var bytes = this.getBytes(length, forceClamped);
  6566. this.pos -= bytes.length;
  6567. return bytes;
  6568. },
  6569. getByteRange(begin, end) {
  6570. if (begin < 0) {
  6571. begin = 0;
  6572. }
  6573. if (end > this.end) {
  6574. end = this.end;
  6575. }
  6576. return this.bytes.subarray(begin, end);
  6577. },
  6578. skip: function Stream_skip(n) {
  6579. if (!n) {
  6580. n = 1;
  6581. }
  6582. this.pos += n;
  6583. },
  6584. reset: function Stream_reset() {
  6585. this.pos = this.start;
  6586. },
  6587. moveStart: function Stream_moveStart() {
  6588. this.start = this.pos;
  6589. },
  6590. makeSubStream: function Stream_makeSubStream(start, length, dict) {
  6591. return new Stream(this.bytes.buffer, start, length, dict);
  6592. }
  6593. };
  6594. return Stream;
  6595. }();
  6596. exports.Stream = Stream;
  6597. var StringStream = function StringStreamClosure() {
  6598. function StringStream(str) {
  6599. const bytes = (0, _util.stringToBytes)(str);
  6600. Stream.call(this, bytes);
  6601. }
  6602. StringStream.prototype = Stream.prototype;
  6603. return StringStream;
  6604. }();
  6605. exports.StringStream = StringStream;
  6606. var DecodeStream = function DecodeStreamClosure() {
  6607. var emptyBuffer = new Uint8Array(0);
  6608. function DecodeStream(maybeMinBufferLength) {
  6609. this._rawMinBufferLength = maybeMinBufferLength || 0;
  6610. this.pos = 0;
  6611. this.bufferLength = 0;
  6612. this.eof = false;
  6613. this.buffer = emptyBuffer;
  6614. this.minBufferLength = 512;
  6615. if (maybeMinBufferLength) {
  6616. while (this.minBufferLength < maybeMinBufferLength) {
  6617. this.minBufferLength *= 2;
  6618. }
  6619. }
  6620. }
  6621. DecodeStream.prototype = {
  6622. get length() {
  6623. (0, _util.unreachable)("Should not access DecodeStream.length");
  6624. },
  6625. get isEmpty() {
  6626. while (!this.eof && this.bufferLength === 0) {
  6627. this.readBlock();
  6628. }
  6629. return this.bufferLength === 0;
  6630. },
  6631. ensureBuffer: function DecodeStream_ensureBuffer(requested) {
  6632. var buffer = this.buffer;
  6633. if (requested <= buffer.byteLength) {
  6634. return buffer;
  6635. }
  6636. var size = this.minBufferLength;
  6637. while (size < requested) {
  6638. size *= 2;
  6639. }
  6640. var buffer2 = new Uint8Array(size);
  6641. buffer2.set(buffer);
  6642. return this.buffer = buffer2;
  6643. },
  6644. getByte: function DecodeStream_getByte() {
  6645. var pos = this.pos;
  6646. while (this.bufferLength <= pos) {
  6647. if (this.eof) {
  6648. return -1;
  6649. }
  6650. this.readBlock();
  6651. }
  6652. return this.buffer[this.pos++];
  6653. },
  6654. getUint16: function DecodeStream_getUint16() {
  6655. var b0 = this.getByte();
  6656. var b1 = this.getByte();
  6657. if (b0 === -1 || b1 === -1) {
  6658. return -1;
  6659. }
  6660. return (b0 << 8) + b1;
  6661. },
  6662. getInt32: function DecodeStream_getInt32() {
  6663. var b0 = this.getByte();
  6664. var b1 = this.getByte();
  6665. var b2 = this.getByte();
  6666. var b3 = this.getByte();
  6667. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  6668. },
  6669. getBytes(length, forceClamped = false) {
  6670. var end,
  6671. pos = this.pos;
  6672. if (length) {
  6673. this.ensureBuffer(pos + length);
  6674. end = pos + length;
  6675. while (!this.eof && this.bufferLength < end) {
  6676. this.readBlock();
  6677. }
  6678. var bufEnd = this.bufferLength;
  6679. if (end > bufEnd) {
  6680. end = bufEnd;
  6681. }
  6682. } else {
  6683. while (!this.eof) {
  6684. this.readBlock();
  6685. }
  6686. end = this.bufferLength;
  6687. }
  6688. this.pos = end;
  6689. const subarray = this.buffer.subarray(pos, end);
  6690. return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
  6691. },
  6692. peekByte: function DecodeStream_peekByte() {
  6693. var peekedByte = this.getByte();
  6694. if (peekedByte !== -1) {
  6695. this.pos--;
  6696. }
  6697. return peekedByte;
  6698. },
  6699. peekBytes(length, forceClamped = false) {
  6700. var bytes = this.getBytes(length, forceClamped);
  6701. this.pos -= bytes.length;
  6702. return bytes;
  6703. },
  6704. makeSubStream: function DecodeStream_makeSubStream(start, length, dict) {
  6705. if (length === undefined) {
  6706. while (!this.eof) {
  6707. this.readBlock();
  6708. }
  6709. } else {
  6710. var end = start + length;
  6711. while (this.bufferLength <= end && !this.eof) {
  6712. this.readBlock();
  6713. }
  6714. }
  6715. return new Stream(this.buffer, start, length, dict);
  6716. },
  6717. getByteRange(begin, end) {
  6718. (0, _util.unreachable)("Should not call DecodeStream.getByteRange");
  6719. },
  6720. skip: function DecodeStream_skip(n) {
  6721. if (!n) {
  6722. n = 1;
  6723. }
  6724. this.pos += n;
  6725. },
  6726. reset: function DecodeStream_reset() {
  6727. this.pos = 0;
  6728. },
  6729. getBaseStreams: function DecodeStream_getBaseStreams() {
  6730. if (this.str && this.str.getBaseStreams) {
  6731. return this.str.getBaseStreams();
  6732. }
  6733. return [];
  6734. }
  6735. };
  6736. return DecodeStream;
  6737. }();
  6738. exports.DecodeStream = DecodeStream;
  6739. var StreamsSequenceStream = function StreamsSequenceStreamClosure() {
  6740. function StreamsSequenceStream(streams) {
  6741. this.streams = streams;
  6742. let maybeLength = 0;
  6743. for (let i = 0, ii = streams.length; i < ii; i++) {
  6744. const stream = streams[i];
  6745. if (stream instanceof DecodeStream) {
  6746. maybeLength += stream._rawMinBufferLength;
  6747. } else {
  6748. maybeLength += stream.length;
  6749. }
  6750. }
  6751. DecodeStream.call(this, maybeLength);
  6752. }
  6753. StreamsSequenceStream.prototype = Object.create(DecodeStream.prototype);
  6754. StreamsSequenceStream.prototype.readBlock = function streamSequenceStreamReadBlock() {
  6755. var streams = this.streams;
  6756. if (streams.length === 0) {
  6757. this.eof = true;
  6758. return;
  6759. }
  6760. var stream = streams.shift();
  6761. var chunk = stream.getBytes();
  6762. var bufferLength = this.bufferLength;
  6763. var newLength = bufferLength + chunk.length;
  6764. var buffer = this.ensureBuffer(newLength);
  6765. buffer.set(chunk, bufferLength);
  6766. this.bufferLength = newLength;
  6767. };
  6768. StreamsSequenceStream.prototype.getBaseStreams = function StreamsSequenceStream_getBaseStreams() {
  6769. var baseStreams = [];
  6770. for (var i = 0, ii = this.streams.length; i < ii; i++) {
  6771. var stream = this.streams[i];
  6772. if (stream.getBaseStreams) {
  6773. baseStreams.push(...stream.getBaseStreams());
  6774. }
  6775. }
  6776. return baseStreams;
  6777. };
  6778. return StreamsSequenceStream;
  6779. }();
  6780. exports.StreamsSequenceStream = StreamsSequenceStream;
  6781. var FlateStream = function FlateStreamClosure() {
  6782. var codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  6783. 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]);
  6784. 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]);
  6785. 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];
  6786. 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];
  6787. function FlateStream(str, maybeLength) {
  6788. this.str = str;
  6789. this.dict = str.dict;
  6790. var cmf = str.getByte();
  6791. var flg = str.getByte();
  6792. if (cmf === -1 || flg === -1) {
  6793. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  6794. }
  6795. if ((cmf & 0x0f) !== 0x08) {
  6796. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  6797. }
  6798. if (((cmf << 8) + flg) % 31 !== 0) {
  6799. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  6800. }
  6801. if (flg & 0x20) {
  6802. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  6803. }
  6804. this.codeSize = 0;
  6805. this.codeBuf = 0;
  6806. DecodeStream.call(this, maybeLength);
  6807. }
  6808. FlateStream.prototype = Object.create(DecodeStream.prototype);
  6809. FlateStream.prototype.getBits = function FlateStream_getBits(bits) {
  6810. var str = this.str;
  6811. var codeSize = this.codeSize;
  6812. var codeBuf = this.codeBuf;
  6813. var b;
  6814. while (codeSize < bits) {
  6815. if ((b = str.getByte()) === -1) {
  6816. throw new _util.FormatError("Bad encoding in flate stream");
  6817. }
  6818. codeBuf |= b << codeSize;
  6819. codeSize += 8;
  6820. }
  6821. b = codeBuf & (1 << bits) - 1;
  6822. this.codeBuf = codeBuf >> bits;
  6823. this.codeSize = codeSize -= bits;
  6824. return b;
  6825. };
  6826. FlateStream.prototype.getCode = function FlateStream_getCode(table) {
  6827. var str = this.str;
  6828. var codes = table[0];
  6829. var maxLen = table[1];
  6830. var codeSize = this.codeSize;
  6831. var codeBuf = this.codeBuf;
  6832. var b;
  6833. while (codeSize < maxLen) {
  6834. if ((b = str.getByte()) === -1) {
  6835. break;
  6836. }
  6837. codeBuf |= b << codeSize;
  6838. codeSize += 8;
  6839. }
  6840. var code = codes[codeBuf & (1 << maxLen) - 1];
  6841. var codeLen = code >> 16;
  6842. var codeVal = code & 0xffff;
  6843. if (codeLen < 1 || codeSize < codeLen) {
  6844. throw new _util.FormatError("Bad encoding in flate stream");
  6845. }
  6846. this.codeBuf = codeBuf >> codeLen;
  6847. this.codeSize = codeSize - codeLen;
  6848. return codeVal;
  6849. };
  6850. FlateStream.prototype.generateHuffmanTable = function flateStreamGenerateHuffmanTable(lengths) {
  6851. var n = lengths.length;
  6852. var maxLen = 0;
  6853. var i;
  6854. for (i = 0; i < n; ++i) {
  6855. if (lengths[i] > maxLen) {
  6856. maxLen = lengths[i];
  6857. }
  6858. }
  6859. var size = 1 << maxLen;
  6860. var codes = new Int32Array(size);
  6861. for (var len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  6862. for (var val = 0; val < n; ++val) {
  6863. if (lengths[val] === len) {
  6864. var code2 = 0;
  6865. var t = code;
  6866. for (i = 0; i < len; ++i) {
  6867. code2 = code2 << 1 | t & 1;
  6868. t >>= 1;
  6869. }
  6870. for (i = code2; i < size; i += skip) {
  6871. codes[i] = len << 16 | val;
  6872. }
  6873. ++code;
  6874. }
  6875. }
  6876. }
  6877. return [codes, maxLen];
  6878. };
  6879. FlateStream.prototype.readBlock = function FlateStream_readBlock() {
  6880. var buffer, len;
  6881. var str = this.str;
  6882. var hdr = this.getBits(3);
  6883. if (hdr & 1) {
  6884. this.eof = true;
  6885. }
  6886. hdr >>= 1;
  6887. if (hdr === 0) {
  6888. var b;
  6889. if ((b = str.getByte()) === -1) {
  6890. throw new _util.FormatError("Bad block header in flate stream");
  6891. }
  6892. var blockLen = b;
  6893. if ((b = str.getByte()) === -1) {
  6894. throw new _util.FormatError("Bad block header in flate stream");
  6895. }
  6896. blockLen |= b << 8;
  6897. if ((b = str.getByte()) === -1) {
  6898. throw new _util.FormatError("Bad block header in flate stream");
  6899. }
  6900. var check = b;
  6901. if ((b = str.getByte()) === -1) {
  6902. throw new _util.FormatError("Bad block header in flate stream");
  6903. }
  6904. check |= b << 8;
  6905. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  6906. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  6907. }
  6908. this.codeBuf = 0;
  6909. this.codeSize = 0;
  6910. const bufferLength = this.bufferLength,
  6911. end = bufferLength + blockLen;
  6912. buffer = this.ensureBuffer(end);
  6913. this.bufferLength = end;
  6914. if (blockLen === 0) {
  6915. if (str.peekByte() === -1) {
  6916. this.eof = true;
  6917. }
  6918. } else {
  6919. const block = str.getBytes(blockLen);
  6920. buffer.set(block, bufferLength);
  6921. if (block.length < blockLen) {
  6922. this.eof = true;
  6923. }
  6924. }
  6925. return;
  6926. }
  6927. var litCodeTable;
  6928. var distCodeTable;
  6929. if (hdr === 1) {
  6930. litCodeTable = fixedLitCodeTab;
  6931. distCodeTable = fixedDistCodeTab;
  6932. } else if (hdr === 2) {
  6933. var numLitCodes = this.getBits(5) + 257;
  6934. var numDistCodes = this.getBits(5) + 1;
  6935. var numCodeLenCodes = this.getBits(4) + 4;
  6936. var codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  6937. var i;
  6938. for (i = 0; i < numCodeLenCodes; ++i) {
  6939. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  6940. }
  6941. var codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  6942. len = 0;
  6943. i = 0;
  6944. var codes = numLitCodes + numDistCodes;
  6945. var codeLengths = new Uint8Array(codes);
  6946. var bitsLength, bitsOffset, what;
  6947. while (i < codes) {
  6948. var code = this.getCode(codeLenCodeTab);
  6949. if (code === 16) {
  6950. bitsLength = 2;
  6951. bitsOffset = 3;
  6952. what = len;
  6953. } else if (code === 17) {
  6954. bitsLength = 3;
  6955. bitsOffset = 3;
  6956. what = len = 0;
  6957. } else if (code === 18) {
  6958. bitsLength = 7;
  6959. bitsOffset = 11;
  6960. what = len = 0;
  6961. } else {
  6962. codeLengths[i++] = len = code;
  6963. continue;
  6964. }
  6965. var repeatLength = this.getBits(bitsLength) + bitsOffset;
  6966. while (repeatLength-- > 0) {
  6967. codeLengths[i++] = what;
  6968. }
  6969. }
  6970. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  6971. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  6972. } else {
  6973. throw new _util.FormatError("Unknown block type in flate stream");
  6974. }
  6975. buffer = this.buffer;
  6976. var limit = buffer ? buffer.length : 0;
  6977. var pos = this.bufferLength;
  6978. while (true) {
  6979. var code1 = this.getCode(litCodeTable);
  6980. if (code1 < 256) {
  6981. if (pos + 1 >= limit) {
  6982. buffer = this.ensureBuffer(pos + 1);
  6983. limit = buffer.length;
  6984. }
  6985. buffer[pos++] = code1;
  6986. continue;
  6987. }
  6988. if (code1 === 256) {
  6989. this.bufferLength = pos;
  6990. return;
  6991. }
  6992. code1 -= 257;
  6993. code1 = lengthDecode[code1];
  6994. var code2 = code1 >> 16;
  6995. if (code2 > 0) {
  6996. code2 = this.getBits(code2);
  6997. }
  6998. len = (code1 & 0xffff) + code2;
  6999. code1 = this.getCode(distCodeTable);
  7000. code1 = distDecode[code1];
  7001. code2 = code1 >> 16;
  7002. if (code2 > 0) {
  7003. code2 = this.getBits(code2);
  7004. }
  7005. var dist = (code1 & 0xffff) + code2;
  7006. if (pos + len >= limit) {
  7007. buffer = this.ensureBuffer(pos + len);
  7008. limit = buffer.length;
  7009. }
  7010. for (var k = 0; k < len; ++k, ++pos) {
  7011. buffer[pos] = buffer[pos - dist];
  7012. }
  7013. }
  7014. };
  7015. return FlateStream;
  7016. }();
  7017. exports.FlateStream = FlateStream;
  7018. var PredictorStream = function PredictorStreamClosure() {
  7019. function PredictorStream(str, maybeLength, params) {
  7020. if (!(0, _primitives.isDict)(params)) {
  7021. return str;
  7022. }
  7023. var predictor = this.predictor = params.get("Predictor") || 1;
  7024. if (predictor <= 1) {
  7025. return str;
  7026. }
  7027. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  7028. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  7029. }
  7030. if (predictor === 2) {
  7031. this.readBlock = this.readBlockTiff;
  7032. } else {
  7033. this.readBlock = this.readBlockPng;
  7034. }
  7035. this.str = str;
  7036. this.dict = str.dict;
  7037. var colors = this.colors = params.get("Colors") || 1;
  7038. var bits = this.bits = params.get("BitsPerComponent") || 8;
  7039. var columns = this.columns = params.get("Columns") || 1;
  7040. this.pixBytes = colors * bits + 7 >> 3;
  7041. this.rowBytes = columns * colors * bits + 7 >> 3;
  7042. DecodeStream.call(this, maybeLength);
  7043. return this;
  7044. }
  7045. PredictorStream.prototype = Object.create(DecodeStream.prototype);
  7046. PredictorStream.prototype.readBlockTiff = function predictorStreamReadBlockTiff() {
  7047. var rowBytes = this.rowBytes;
  7048. var bufferLength = this.bufferLength;
  7049. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  7050. var bits = this.bits;
  7051. var colors = this.colors;
  7052. var rawBytes = this.str.getBytes(rowBytes);
  7053. this.eof = !rawBytes.length;
  7054. if (this.eof) {
  7055. return;
  7056. }
  7057. var inbuf = 0,
  7058. outbuf = 0;
  7059. var inbits = 0,
  7060. outbits = 0;
  7061. var pos = bufferLength;
  7062. var i;
  7063. if (bits === 1 && colors === 1) {
  7064. for (i = 0; i < rowBytes; ++i) {
  7065. var c = rawBytes[i] ^ inbuf;
  7066. c ^= c >> 1;
  7067. c ^= c >> 2;
  7068. c ^= c >> 4;
  7069. inbuf = (c & 1) << 7;
  7070. buffer[pos++] = c;
  7071. }
  7072. } else if (bits === 8) {
  7073. for (i = 0; i < colors; ++i) {
  7074. buffer[pos++] = rawBytes[i];
  7075. }
  7076. for (; i < rowBytes; ++i) {
  7077. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  7078. pos++;
  7079. }
  7080. } else if (bits === 16) {
  7081. var bytesPerPixel = colors * 2;
  7082. for (i = 0; i < bytesPerPixel; ++i) {
  7083. buffer[pos++] = rawBytes[i];
  7084. }
  7085. for (; i < rowBytes; i += 2) {
  7086. var sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  7087. buffer[pos++] = sum >> 8 & 0xff;
  7088. buffer[pos++] = sum & 0xff;
  7089. }
  7090. } else {
  7091. var compArray = new Uint8Array(colors + 1);
  7092. var bitMask = (1 << bits) - 1;
  7093. var j = 0,
  7094. k = bufferLength;
  7095. var columns = this.columns;
  7096. for (i = 0; i < columns; ++i) {
  7097. for (var kk = 0; kk < colors; ++kk) {
  7098. if (inbits < bits) {
  7099. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  7100. inbits += 8;
  7101. }
  7102. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  7103. inbits -= bits;
  7104. outbuf = outbuf << bits | compArray[kk];
  7105. outbits += bits;
  7106. if (outbits >= 8) {
  7107. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  7108. outbits -= 8;
  7109. }
  7110. }
  7111. }
  7112. if (outbits > 0) {
  7113. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  7114. }
  7115. }
  7116. this.bufferLength += rowBytes;
  7117. };
  7118. PredictorStream.prototype.readBlockPng = function predictorStreamReadBlockPng() {
  7119. var rowBytes = this.rowBytes;
  7120. var pixBytes = this.pixBytes;
  7121. var predictor = this.str.getByte();
  7122. var rawBytes = this.str.getBytes(rowBytes);
  7123. this.eof = !rawBytes.length;
  7124. if (this.eof) {
  7125. return;
  7126. }
  7127. var bufferLength = this.bufferLength;
  7128. var buffer = this.ensureBuffer(bufferLength + rowBytes);
  7129. var prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  7130. if (prevRow.length === 0) {
  7131. prevRow = new Uint8Array(rowBytes);
  7132. }
  7133. var i,
  7134. j = bufferLength,
  7135. up,
  7136. c;
  7137. switch (predictor) {
  7138. case 0:
  7139. for (i = 0; i < rowBytes; ++i) {
  7140. buffer[j++] = rawBytes[i];
  7141. }
  7142. break;
  7143. case 1:
  7144. for (i = 0; i < pixBytes; ++i) {
  7145. buffer[j++] = rawBytes[i];
  7146. }
  7147. for (; i < rowBytes; ++i) {
  7148. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  7149. j++;
  7150. }
  7151. break;
  7152. case 2:
  7153. for (i = 0; i < rowBytes; ++i) {
  7154. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  7155. }
  7156. break;
  7157. case 3:
  7158. for (i = 0; i < pixBytes; ++i) {
  7159. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  7160. }
  7161. for (; i < rowBytes; ++i) {
  7162. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  7163. j++;
  7164. }
  7165. break;
  7166. case 4:
  7167. for (i = 0; i < pixBytes; ++i) {
  7168. up = prevRow[i];
  7169. c = rawBytes[i];
  7170. buffer[j++] = up + c;
  7171. }
  7172. for (; i < rowBytes; ++i) {
  7173. up = prevRow[i];
  7174. var upLeft = prevRow[i - pixBytes];
  7175. var left = buffer[j - pixBytes];
  7176. var p = left + up - upLeft;
  7177. var pa = p - left;
  7178. if (pa < 0) {
  7179. pa = -pa;
  7180. }
  7181. var pb = p - up;
  7182. if (pb < 0) {
  7183. pb = -pb;
  7184. }
  7185. var pc = p - upLeft;
  7186. if (pc < 0) {
  7187. pc = -pc;
  7188. }
  7189. c = rawBytes[i];
  7190. if (pa <= pb && pa <= pc) {
  7191. buffer[j++] = left + c;
  7192. } else if (pb <= pc) {
  7193. buffer[j++] = up + c;
  7194. } else {
  7195. buffer[j++] = upLeft + c;
  7196. }
  7197. }
  7198. break;
  7199. default:
  7200. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  7201. }
  7202. this.bufferLength += rowBytes;
  7203. };
  7204. return PredictorStream;
  7205. }();
  7206. exports.PredictorStream = PredictorStream;
  7207. var DecryptStream = function DecryptStreamClosure() {
  7208. function DecryptStream(str, maybeLength, decrypt) {
  7209. this.str = str;
  7210. this.dict = str.dict;
  7211. this.decrypt = decrypt;
  7212. this.nextChunk = null;
  7213. this.initialized = false;
  7214. DecodeStream.call(this, maybeLength);
  7215. }
  7216. var chunkSize = 512;
  7217. DecryptStream.prototype = Object.create(DecodeStream.prototype);
  7218. DecryptStream.prototype.readBlock = function DecryptStream_readBlock() {
  7219. var chunk;
  7220. if (this.initialized) {
  7221. chunk = this.nextChunk;
  7222. } else {
  7223. chunk = this.str.getBytes(chunkSize);
  7224. this.initialized = true;
  7225. }
  7226. if (!chunk || chunk.length === 0) {
  7227. this.eof = true;
  7228. return;
  7229. }
  7230. this.nextChunk = this.str.getBytes(chunkSize);
  7231. var hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  7232. var decrypt = this.decrypt;
  7233. chunk = decrypt(chunk, !hasMoreData);
  7234. var bufferLength = this.bufferLength;
  7235. var i,
  7236. n = chunk.length;
  7237. var buffer = this.ensureBuffer(bufferLength + n);
  7238. for (i = 0; i < n; i++) {
  7239. buffer[bufferLength++] = chunk[i];
  7240. }
  7241. this.bufferLength = bufferLength;
  7242. };
  7243. return DecryptStream;
  7244. }();
  7245. exports.DecryptStream = DecryptStream;
  7246. var Ascii85Stream = function Ascii85StreamClosure() {
  7247. function Ascii85Stream(str, maybeLength) {
  7248. this.str = str;
  7249. this.dict = str.dict;
  7250. this.input = new Uint8Array(5);
  7251. if (maybeLength) {
  7252. maybeLength = 0.8 * maybeLength;
  7253. }
  7254. DecodeStream.call(this, maybeLength);
  7255. }
  7256. Ascii85Stream.prototype = Object.create(DecodeStream.prototype);
  7257. Ascii85Stream.prototype.readBlock = function Ascii85Stream_readBlock() {
  7258. var TILDA_CHAR = 0x7e;
  7259. var Z_LOWER_CHAR = 0x7a;
  7260. var EOF = -1;
  7261. var str = this.str;
  7262. var c = str.getByte();
  7263. while ((0, _core_utils.isWhiteSpace)(c)) {
  7264. c = str.getByte();
  7265. }
  7266. if (c === EOF || c === TILDA_CHAR) {
  7267. this.eof = true;
  7268. return;
  7269. }
  7270. var bufferLength = this.bufferLength,
  7271. buffer;
  7272. var i;
  7273. if (c === Z_LOWER_CHAR) {
  7274. buffer = this.ensureBuffer(bufferLength + 4);
  7275. for (i = 0; i < 4; ++i) {
  7276. buffer[bufferLength + i] = 0;
  7277. }
  7278. this.bufferLength += 4;
  7279. } else {
  7280. var input = this.input;
  7281. input[0] = c;
  7282. for (i = 1; i < 5; ++i) {
  7283. c = str.getByte();
  7284. while ((0, _core_utils.isWhiteSpace)(c)) {
  7285. c = str.getByte();
  7286. }
  7287. input[i] = c;
  7288. if (c === EOF || c === TILDA_CHAR) {
  7289. break;
  7290. }
  7291. }
  7292. buffer = this.ensureBuffer(bufferLength + i - 1);
  7293. this.bufferLength += i - 1;
  7294. if (i < 5) {
  7295. for (; i < 5; ++i) {
  7296. input[i] = 0x21 + 84;
  7297. }
  7298. this.eof = true;
  7299. }
  7300. var t = 0;
  7301. for (i = 0; i < 5; ++i) {
  7302. t = t * 85 + (input[i] - 0x21);
  7303. }
  7304. for (i = 3; i >= 0; --i) {
  7305. buffer[bufferLength + i] = t & 0xff;
  7306. t >>= 8;
  7307. }
  7308. }
  7309. };
  7310. return Ascii85Stream;
  7311. }();
  7312. exports.Ascii85Stream = Ascii85Stream;
  7313. var AsciiHexStream = function AsciiHexStreamClosure() {
  7314. function AsciiHexStream(str, maybeLength) {
  7315. this.str = str;
  7316. this.dict = str.dict;
  7317. this.firstDigit = -1;
  7318. if (maybeLength) {
  7319. maybeLength = 0.5 * maybeLength;
  7320. }
  7321. DecodeStream.call(this, maybeLength);
  7322. }
  7323. AsciiHexStream.prototype = Object.create(DecodeStream.prototype);
  7324. AsciiHexStream.prototype.readBlock = function AsciiHexStream_readBlock() {
  7325. var UPSTREAM_BLOCK_SIZE = 8000;
  7326. var bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  7327. if (!bytes.length) {
  7328. this.eof = true;
  7329. return;
  7330. }
  7331. var maxDecodeLength = bytes.length + 1 >> 1;
  7332. var buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  7333. var bufferLength = this.bufferLength;
  7334. var firstDigit = this.firstDigit;
  7335. for (var i = 0, ii = bytes.length; i < ii; i++) {
  7336. var ch = bytes[i],
  7337. digit;
  7338. if (ch >= 0x30 && ch <= 0x39) {
  7339. digit = ch & 0x0f;
  7340. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  7341. digit = (ch & 0x0f) + 9;
  7342. } else if (ch === 0x3e) {
  7343. this.eof = true;
  7344. break;
  7345. } else {
  7346. continue;
  7347. }
  7348. if (firstDigit < 0) {
  7349. firstDigit = digit;
  7350. } else {
  7351. buffer[bufferLength++] = firstDigit << 4 | digit;
  7352. firstDigit = -1;
  7353. }
  7354. }
  7355. if (firstDigit >= 0 && this.eof) {
  7356. buffer[bufferLength++] = firstDigit << 4;
  7357. firstDigit = -1;
  7358. }
  7359. this.firstDigit = firstDigit;
  7360. this.bufferLength = bufferLength;
  7361. };
  7362. return AsciiHexStream;
  7363. }();
  7364. exports.AsciiHexStream = AsciiHexStream;
  7365. var RunLengthStream = function RunLengthStreamClosure() {
  7366. function RunLengthStream(str, maybeLength) {
  7367. this.str = str;
  7368. this.dict = str.dict;
  7369. DecodeStream.call(this, maybeLength);
  7370. }
  7371. RunLengthStream.prototype = Object.create(DecodeStream.prototype);
  7372. RunLengthStream.prototype.readBlock = function RunLengthStream_readBlock() {
  7373. var repeatHeader = this.str.getBytes(2);
  7374. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  7375. this.eof = true;
  7376. return;
  7377. }
  7378. var buffer;
  7379. var bufferLength = this.bufferLength;
  7380. var n = repeatHeader[0];
  7381. if (n < 128) {
  7382. buffer = this.ensureBuffer(bufferLength + n + 1);
  7383. buffer[bufferLength++] = repeatHeader[1];
  7384. if (n > 0) {
  7385. var source = this.str.getBytes(n);
  7386. buffer.set(source, bufferLength);
  7387. bufferLength += n;
  7388. }
  7389. } else {
  7390. n = 257 - n;
  7391. var b = repeatHeader[1];
  7392. buffer = this.ensureBuffer(bufferLength + n + 1);
  7393. for (var i = 0; i < n; i++) {
  7394. buffer[bufferLength++] = b;
  7395. }
  7396. }
  7397. this.bufferLength = bufferLength;
  7398. };
  7399. return RunLengthStream;
  7400. }();
  7401. exports.RunLengthStream = RunLengthStream;
  7402. var LZWStream = function LZWStreamClosure() {
  7403. function LZWStream(str, maybeLength, earlyChange) {
  7404. this.str = str;
  7405. this.dict = str.dict;
  7406. this.cachedData = 0;
  7407. this.bitsCached = 0;
  7408. var maxLzwDictionarySize = 4096;
  7409. var lzwState = {
  7410. earlyChange,
  7411. codeLength: 9,
  7412. nextCode: 258,
  7413. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  7414. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  7415. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  7416. currentSequence: new Uint8Array(maxLzwDictionarySize),
  7417. currentSequenceLength: 0
  7418. };
  7419. for (var i = 0; i < 256; ++i) {
  7420. lzwState.dictionaryValues[i] = i;
  7421. lzwState.dictionaryLengths[i] = 1;
  7422. }
  7423. this.lzwState = lzwState;
  7424. DecodeStream.call(this, maybeLength);
  7425. }
  7426. LZWStream.prototype = Object.create(DecodeStream.prototype);
  7427. LZWStream.prototype.readBits = function LZWStream_readBits(n) {
  7428. var bitsCached = this.bitsCached;
  7429. var cachedData = this.cachedData;
  7430. while (bitsCached < n) {
  7431. var c = this.str.getByte();
  7432. if (c === -1) {
  7433. this.eof = true;
  7434. return null;
  7435. }
  7436. cachedData = cachedData << 8 | c;
  7437. bitsCached += 8;
  7438. }
  7439. this.bitsCached = bitsCached -= n;
  7440. this.cachedData = cachedData;
  7441. this.lastCode = null;
  7442. return cachedData >>> bitsCached & (1 << n) - 1;
  7443. };
  7444. LZWStream.prototype.readBlock = function LZWStream_readBlock() {
  7445. var blockSize = 512;
  7446. var estimatedDecodedSize = blockSize * 2,
  7447. decodedSizeDelta = blockSize;
  7448. var i, j, q;
  7449. var lzwState = this.lzwState;
  7450. if (!lzwState) {
  7451. return;
  7452. }
  7453. var earlyChange = lzwState.earlyChange;
  7454. var nextCode = lzwState.nextCode;
  7455. var dictionaryValues = lzwState.dictionaryValues;
  7456. var dictionaryLengths = lzwState.dictionaryLengths;
  7457. var dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  7458. var codeLength = lzwState.codeLength;
  7459. var prevCode = lzwState.prevCode;
  7460. var currentSequence = lzwState.currentSequence;
  7461. var currentSequenceLength = lzwState.currentSequenceLength;
  7462. var decodedLength = 0;
  7463. var currentBufferLength = this.bufferLength;
  7464. var buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  7465. for (i = 0; i < blockSize; i++) {
  7466. var code = this.readBits(codeLength);
  7467. var hasPrev = currentSequenceLength > 0;
  7468. if (code < 256) {
  7469. currentSequence[0] = code;
  7470. currentSequenceLength = 1;
  7471. } else if (code >= 258) {
  7472. if (code < nextCode) {
  7473. currentSequenceLength = dictionaryLengths[code];
  7474. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  7475. currentSequence[j] = dictionaryValues[q];
  7476. q = dictionaryPrevCodes[q];
  7477. }
  7478. } else {
  7479. currentSequence[currentSequenceLength++] = currentSequence[0];
  7480. }
  7481. } else if (code === 256) {
  7482. codeLength = 9;
  7483. nextCode = 258;
  7484. currentSequenceLength = 0;
  7485. continue;
  7486. } else {
  7487. this.eof = true;
  7488. delete this.lzwState;
  7489. break;
  7490. }
  7491. if (hasPrev) {
  7492. dictionaryPrevCodes[nextCode] = prevCode;
  7493. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  7494. dictionaryValues[nextCode] = currentSequence[0];
  7495. nextCode++;
  7496. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  7497. }
  7498. prevCode = code;
  7499. decodedLength += currentSequenceLength;
  7500. if (estimatedDecodedSize < decodedLength) {
  7501. do {
  7502. estimatedDecodedSize += decodedSizeDelta;
  7503. } while (estimatedDecodedSize < decodedLength);
  7504. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  7505. }
  7506. for (j = 0; j < currentSequenceLength; j++) {
  7507. buffer[currentBufferLength++] = currentSequence[j];
  7508. }
  7509. }
  7510. lzwState.nextCode = nextCode;
  7511. lzwState.codeLength = codeLength;
  7512. lzwState.prevCode = prevCode;
  7513. lzwState.currentSequenceLength = currentSequenceLength;
  7514. this.bufferLength = currentBufferLength;
  7515. };
  7516. return LZWStream;
  7517. }();
  7518. exports.LZWStream = LZWStream;
  7519. var NullStream = function NullStreamClosure() {
  7520. function NullStream() {
  7521. Stream.call(this, new Uint8Array(0));
  7522. }
  7523. NullStream.prototype = Stream.prototype;
  7524. return NullStream;
  7525. }();
  7526. exports.NullStream = NullStream;
  7527. /***/ }),
  7528. /* 13 */
  7529. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7530. Object.defineProperty(exports, "__esModule", ({
  7531. value: true
  7532. }));
  7533. exports.CCITTFaxStream = void 0;
  7534. var _primitives = __w_pdfjs_require__(5);
  7535. var _ccitt = __w_pdfjs_require__(14);
  7536. var _stream = __w_pdfjs_require__(12);
  7537. const CCITTFaxStream = function CCITTFaxStreamClosure() {
  7538. function CCITTFaxStream(str, maybeLength, params) {
  7539. this.str = str;
  7540. this.dict = str.dict;
  7541. if (!(0, _primitives.isDict)(params)) {
  7542. params = _primitives.Dict.empty;
  7543. }
  7544. const source = {
  7545. next() {
  7546. return str.getByte();
  7547. }
  7548. };
  7549. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  7550. K: params.get("K"),
  7551. EndOfLine: params.get("EndOfLine"),
  7552. EncodedByteAlign: params.get("EncodedByteAlign"),
  7553. Columns: params.get("Columns"),
  7554. Rows: params.get("Rows"),
  7555. EndOfBlock: params.get("EndOfBlock"),
  7556. BlackIs1: params.get("BlackIs1")
  7557. });
  7558. _stream.DecodeStream.call(this, maybeLength);
  7559. }
  7560. CCITTFaxStream.prototype = Object.create(_stream.DecodeStream.prototype);
  7561. CCITTFaxStream.prototype.readBlock = function () {
  7562. while (!this.eof) {
  7563. const c = this.ccittFaxDecoder.readNextChar();
  7564. if (c === -1) {
  7565. this.eof = true;
  7566. return;
  7567. }
  7568. this.ensureBuffer(this.bufferLength + 1);
  7569. this.buffer[this.bufferLength++] = c;
  7570. }
  7571. };
  7572. return CCITTFaxStream;
  7573. }();
  7574. exports.CCITTFaxStream = CCITTFaxStream;
  7575. /***/ }),
  7576. /* 14 */
  7577. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  7578. Object.defineProperty(exports, "__esModule", ({
  7579. value: true
  7580. }));
  7581. exports.CCITTFaxDecoder = void 0;
  7582. var _util = __w_pdfjs_require__(2);
  7583. const CCITTFaxDecoder = function CCITTFaxDecoder() {
  7584. const ccittEOL = -2;
  7585. const ccittEOF = -1;
  7586. const twoDimPass = 0;
  7587. const twoDimHoriz = 1;
  7588. const twoDimVert0 = 2;
  7589. const twoDimVertR1 = 3;
  7590. const twoDimVertL1 = 4;
  7591. const twoDimVertR2 = 5;
  7592. const twoDimVertL2 = 6;
  7593. const twoDimVertR3 = 7;
  7594. const twoDimVertL3 = 8;
  7595. 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]];
  7596. 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]];
  7597. 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]];
  7598. 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]];
  7599. 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]];
  7600. 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]];
  7601. function CCITTFaxDecoder(source, options = {}) {
  7602. if (!source || typeof source.next !== "function") {
  7603. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  7604. }
  7605. this.source = source;
  7606. this.eof = false;
  7607. this.encoding = options.K || 0;
  7608. this.eoline = options.EndOfLine || false;
  7609. this.byteAlign = options.EncodedByteAlign || false;
  7610. this.columns = options.Columns || 1728;
  7611. this.rows = options.Rows || 0;
  7612. let eoblock = options.EndOfBlock;
  7613. if (eoblock === null || eoblock === undefined) {
  7614. eoblock = true;
  7615. }
  7616. this.eoblock = eoblock;
  7617. this.black = options.BlackIs1 || false;
  7618. this.codingLine = new Uint32Array(this.columns + 1);
  7619. this.refLine = new Uint32Array(this.columns + 2);
  7620. this.codingLine[0] = this.columns;
  7621. this.codingPos = 0;
  7622. this.row = 0;
  7623. this.nextLine2D = this.encoding < 0;
  7624. this.inputBits = 0;
  7625. this.inputBuf = 0;
  7626. this.outputBits = 0;
  7627. this.rowsDone = false;
  7628. let code1;
  7629. while ((code1 = this._lookBits(12)) === 0) {
  7630. this._eatBits(1);
  7631. }
  7632. if (code1 === 1) {
  7633. this._eatBits(12);
  7634. }
  7635. if (this.encoding > 0) {
  7636. this.nextLine2D = !this._lookBits(1);
  7637. this._eatBits(1);
  7638. }
  7639. }
  7640. CCITTFaxDecoder.prototype = {
  7641. readNextChar() {
  7642. if (this.eof) {
  7643. return -1;
  7644. }
  7645. const refLine = this.refLine;
  7646. const codingLine = this.codingLine;
  7647. const columns = this.columns;
  7648. let refPos, blackPixels, bits, i;
  7649. if (this.outputBits === 0) {
  7650. if (this.rowsDone) {
  7651. this.eof = true;
  7652. }
  7653. if (this.eof) {
  7654. return -1;
  7655. }
  7656. this.err = false;
  7657. let code1, code2, code3;
  7658. if (this.nextLine2D) {
  7659. for (i = 0; codingLine[i] < columns; ++i) {
  7660. refLine[i] = codingLine[i];
  7661. }
  7662. refLine[i++] = columns;
  7663. refLine[i] = columns;
  7664. codingLine[0] = 0;
  7665. this.codingPos = 0;
  7666. refPos = 0;
  7667. blackPixels = 0;
  7668. while (codingLine[this.codingPos] < columns) {
  7669. code1 = this._getTwoDimCode();
  7670. switch (code1) {
  7671. case twoDimPass:
  7672. this._addPixels(refLine[refPos + 1], blackPixels);
  7673. if (refLine[refPos + 1] < columns) {
  7674. refPos += 2;
  7675. }
  7676. break;
  7677. case twoDimHoriz:
  7678. code1 = code2 = 0;
  7679. if (blackPixels) {
  7680. do {
  7681. code1 += code3 = this._getBlackCode();
  7682. } while (code3 >= 64);
  7683. do {
  7684. code2 += code3 = this._getWhiteCode();
  7685. } while (code3 >= 64);
  7686. } else {
  7687. do {
  7688. code1 += code3 = this._getWhiteCode();
  7689. } while (code3 >= 64);
  7690. do {
  7691. code2 += code3 = this._getBlackCode();
  7692. } while (code3 >= 64);
  7693. }
  7694. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7695. if (codingLine[this.codingPos] < columns) {
  7696. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  7697. }
  7698. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7699. refPos += 2;
  7700. }
  7701. break;
  7702. case twoDimVertR3:
  7703. this._addPixels(refLine[refPos] + 3, blackPixels);
  7704. blackPixels ^= 1;
  7705. if (codingLine[this.codingPos] < columns) {
  7706. ++refPos;
  7707. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7708. refPos += 2;
  7709. }
  7710. }
  7711. break;
  7712. case twoDimVertR2:
  7713. this._addPixels(refLine[refPos] + 2, blackPixels);
  7714. blackPixels ^= 1;
  7715. if (codingLine[this.codingPos] < columns) {
  7716. ++refPos;
  7717. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7718. refPos += 2;
  7719. }
  7720. }
  7721. break;
  7722. case twoDimVertR1:
  7723. this._addPixels(refLine[refPos] + 1, blackPixels);
  7724. blackPixels ^= 1;
  7725. if (codingLine[this.codingPos] < columns) {
  7726. ++refPos;
  7727. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7728. refPos += 2;
  7729. }
  7730. }
  7731. break;
  7732. case twoDimVert0:
  7733. this._addPixels(refLine[refPos], blackPixels);
  7734. blackPixels ^= 1;
  7735. if (codingLine[this.codingPos] < columns) {
  7736. ++refPos;
  7737. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7738. refPos += 2;
  7739. }
  7740. }
  7741. break;
  7742. case twoDimVertL3:
  7743. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  7744. blackPixels ^= 1;
  7745. if (codingLine[this.codingPos] < columns) {
  7746. if (refPos > 0) {
  7747. --refPos;
  7748. } else {
  7749. ++refPos;
  7750. }
  7751. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7752. refPos += 2;
  7753. }
  7754. }
  7755. break;
  7756. case twoDimVertL2:
  7757. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  7758. blackPixels ^= 1;
  7759. if (codingLine[this.codingPos] < columns) {
  7760. if (refPos > 0) {
  7761. --refPos;
  7762. } else {
  7763. ++refPos;
  7764. }
  7765. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7766. refPos += 2;
  7767. }
  7768. }
  7769. break;
  7770. case twoDimVertL1:
  7771. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  7772. blackPixels ^= 1;
  7773. if (codingLine[this.codingPos] < columns) {
  7774. if (refPos > 0) {
  7775. --refPos;
  7776. } else {
  7777. ++refPos;
  7778. }
  7779. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  7780. refPos += 2;
  7781. }
  7782. }
  7783. break;
  7784. case ccittEOF:
  7785. this._addPixels(columns, 0);
  7786. this.eof = true;
  7787. break;
  7788. default:
  7789. (0, _util.info)("bad 2d code");
  7790. this._addPixels(columns, 0);
  7791. this.err = true;
  7792. }
  7793. }
  7794. } else {
  7795. codingLine[0] = 0;
  7796. this.codingPos = 0;
  7797. blackPixels = 0;
  7798. while (codingLine[this.codingPos] < columns) {
  7799. code1 = 0;
  7800. if (blackPixels) {
  7801. do {
  7802. code1 += code3 = this._getBlackCode();
  7803. } while (code3 >= 64);
  7804. } else {
  7805. do {
  7806. code1 += code3 = this._getWhiteCode();
  7807. } while (code3 >= 64);
  7808. }
  7809. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  7810. blackPixels ^= 1;
  7811. }
  7812. }
  7813. let gotEOL = false;
  7814. if (this.byteAlign) {
  7815. this.inputBits &= ~7;
  7816. }
  7817. if (!this.eoblock && this.row === this.rows - 1) {
  7818. this.rowsDone = true;
  7819. } else {
  7820. code1 = this._lookBits(12);
  7821. if (this.eoline) {
  7822. while (code1 !== ccittEOF && code1 !== 1) {
  7823. this._eatBits(1);
  7824. code1 = this._lookBits(12);
  7825. }
  7826. } else {
  7827. while (code1 === 0) {
  7828. this._eatBits(1);
  7829. code1 = this._lookBits(12);
  7830. }
  7831. }
  7832. if (code1 === 1) {
  7833. this._eatBits(12);
  7834. gotEOL = true;
  7835. } else if (code1 === ccittEOF) {
  7836. this.eof = true;
  7837. }
  7838. }
  7839. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  7840. this.nextLine2D = !this._lookBits(1);
  7841. this._eatBits(1);
  7842. }
  7843. if (this.eoblock && gotEOL && this.byteAlign) {
  7844. code1 = this._lookBits(12);
  7845. if (code1 === 1) {
  7846. this._eatBits(12);
  7847. if (this.encoding > 0) {
  7848. this._lookBits(1);
  7849. this._eatBits(1);
  7850. }
  7851. if (this.encoding >= 0) {
  7852. for (i = 0; i < 4; ++i) {
  7853. code1 = this._lookBits(12);
  7854. if (code1 !== 1) {
  7855. (0, _util.info)("bad rtc code: " + code1);
  7856. }
  7857. this._eatBits(12);
  7858. if (this.encoding > 0) {
  7859. this._lookBits(1);
  7860. this._eatBits(1);
  7861. }
  7862. }
  7863. }
  7864. this.eof = true;
  7865. }
  7866. } else if (this.err && this.eoline) {
  7867. while (true) {
  7868. code1 = this._lookBits(13);
  7869. if (code1 === ccittEOF) {
  7870. this.eof = true;
  7871. return -1;
  7872. }
  7873. if (code1 >> 1 === 1) {
  7874. break;
  7875. }
  7876. this._eatBits(1);
  7877. }
  7878. this._eatBits(12);
  7879. if (this.encoding > 0) {
  7880. this._eatBits(1);
  7881. this.nextLine2D = !(code1 & 1);
  7882. }
  7883. }
  7884. if (codingLine[0] > 0) {
  7885. this.outputBits = codingLine[this.codingPos = 0];
  7886. } else {
  7887. this.outputBits = codingLine[this.codingPos = 1];
  7888. }
  7889. this.row++;
  7890. }
  7891. let c;
  7892. if (this.outputBits >= 8) {
  7893. c = this.codingPos & 1 ? 0 : 0xff;
  7894. this.outputBits -= 8;
  7895. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  7896. this.codingPos++;
  7897. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7898. }
  7899. } else {
  7900. bits = 8;
  7901. c = 0;
  7902. do {
  7903. if (this.outputBits > bits) {
  7904. c <<= bits;
  7905. if (!(this.codingPos & 1)) {
  7906. c |= 0xff >> 8 - bits;
  7907. }
  7908. this.outputBits -= bits;
  7909. bits = 0;
  7910. } else {
  7911. c <<= this.outputBits;
  7912. if (!(this.codingPos & 1)) {
  7913. c |= 0xff >> 8 - this.outputBits;
  7914. }
  7915. bits -= this.outputBits;
  7916. this.outputBits = 0;
  7917. if (codingLine[this.codingPos] < columns) {
  7918. this.codingPos++;
  7919. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  7920. } else if (bits > 0) {
  7921. c <<= bits;
  7922. bits = 0;
  7923. }
  7924. }
  7925. } while (bits);
  7926. }
  7927. if (this.black) {
  7928. c ^= 0xff;
  7929. }
  7930. return c;
  7931. },
  7932. _addPixels(a1, blackPixels) {
  7933. const codingLine = this.codingLine;
  7934. let codingPos = this.codingPos;
  7935. if (a1 > codingLine[codingPos]) {
  7936. if (a1 > this.columns) {
  7937. (0, _util.info)("row is wrong length");
  7938. this.err = true;
  7939. a1 = this.columns;
  7940. }
  7941. if (codingPos & 1 ^ blackPixels) {
  7942. ++codingPos;
  7943. }
  7944. codingLine[codingPos] = a1;
  7945. }
  7946. this.codingPos = codingPos;
  7947. },
  7948. _addPixelsNeg(a1, blackPixels) {
  7949. const codingLine = this.codingLine;
  7950. let codingPos = this.codingPos;
  7951. if (a1 > codingLine[codingPos]) {
  7952. if (a1 > this.columns) {
  7953. (0, _util.info)("row is wrong length");
  7954. this.err = true;
  7955. a1 = this.columns;
  7956. }
  7957. if (codingPos & 1 ^ blackPixels) {
  7958. ++codingPos;
  7959. }
  7960. codingLine[codingPos] = a1;
  7961. } else if (a1 < codingLine[codingPos]) {
  7962. if (a1 < 0) {
  7963. (0, _util.info)("invalid code");
  7964. this.err = true;
  7965. a1 = 0;
  7966. }
  7967. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  7968. --codingPos;
  7969. }
  7970. codingLine[codingPos] = a1;
  7971. }
  7972. this.codingPos = codingPos;
  7973. },
  7974. _findTableCode(start, end, table, limit) {
  7975. const limitValue = limit || 0;
  7976. for (let i = start; i <= end; ++i) {
  7977. let code = this._lookBits(i);
  7978. if (code === ccittEOF) {
  7979. return [true, 1, false];
  7980. }
  7981. if (i < end) {
  7982. code <<= end - i;
  7983. }
  7984. if (!limitValue || code >= limitValue) {
  7985. const p = table[code - limitValue];
  7986. if (p[0] === i) {
  7987. this._eatBits(i);
  7988. return [true, p[1], true];
  7989. }
  7990. }
  7991. }
  7992. return [false, 0, false];
  7993. },
  7994. _getTwoDimCode() {
  7995. let code = 0;
  7996. let p;
  7997. if (this.eoblock) {
  7998. code = this._lookBits(7);
  7999. p = twoDimTable[code];
  8000. if (p && p[0] > 0) {
  8001. this._eatBits(p[0]);
  8002. return p[1];
  8003. }
  8004. } else {
  8005. const result = this._findTableCode(1, 7, twoDimTable);
  8006. if (result[0] && result[2]) {
  8007. return result[1];
  8008. }
  8009. }
  8010. (0, _util.info)("Bad two dim code");
  8011. return ccittEOF;
  8012. },
  8013. _getWhiteCode() {
  8014. let code = 0;
  8015. let p;
  8016. if (this.eoblock) {
  8017. code = this._lookBits(12);
  8018. if (code === ccittEOF) {
  8019. return 1;
  8020. }
  8021. if (code >> 5 === 0) {
  8022. p = whiteTable1[code];
  8023. } else {
  8024. p = whiteTable2[code >> 3];
  8025. }
  8026. if (p[0] > 0) {
  8027. this._eatBits(p[0]);
  8028. return p[1];
  8029. }
  8030. } else {
  8031. let result = this._findTableCode(1, 9, whiteTable2);
  8032. if (result[0]) {
  8033. return result[1];
  8034. }
  8035. result = this._findTableCode(11, 12, whiteTable1);
  8036. if (result[0]) {
  8037. return result[1];
  8038. }
  8039. }
  8040. (0, _util.info)("bad white code");
  8041. this._eatBits(1);
  8042. return 1;
  8043. },
  8044. _getBlackCode() {
  8045. let code, p;
  8046. if (this.eoblock) {
  8047. code = this._lookBits(13);
  8048. if (code === ccittEOF) {
  8049. return 1;
  8050. }
  8051. if (code >> 7 === 0) {
  8052. p = blackTable1[code];
  8053. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  8054. p = blackTable2[(code >> 1) - 64];
  8055. } else {
  8056. p = blackTable3[code >> 7];
  8057. }
  8058. if (p[0] > 0) {
  8059. this._eatBits(p[0]);
  8060. return p[1];
  8061. }
  8062. } else {
  8063. let result = this._findTableCode(2, 6, blackTable3);
  8064. if (result[0]) {
  8065. return result[1];
  8066. }
  8067. result = this._findTableCode(7, 12, blackTable2, 64);
  8068. if (result[0]) {
  8069. return result[1];
  8070. }
  8071. result = this._findTableCode(10, 13, blackTable1);
  8072. if (result[0]) {
  8073. return result[1];
  8074. }
  8075. }
  8076. (0, _util.info)("bad black code");
  8077. this._eatBits(1);
  8078. return 1;
  8079. },
  8080. _lookBits(n) {
  8081. let c;
  8082. while (this.inputBits < n) {
  8083. if ((c = this.source.next()) === -1) {
  8084. if (this.inputBits === 0) {
  8085. return ccittEOF;
  8086. }
  8087. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  8088. }
  8089. this.inputBuf = this.inputBuf << 8 | c;
  8090. this.inputBits += 8;
  8091. }
  8092. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  8093. },
  8094. _eatBits(n) {
  8095. if ((this.inputBits -= n) < 0) {
  8096. this.inputBits = 0;
  8097. }
  8098. }
  8099. };
  8100. return CCITTFaxDecoder;
  8101. }();
  8102. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  8103. /***/ }),
  8104. /* 15 */
  8105. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8106. Object.defineProperty(exports, "__esModule", ({
  8107. value: true
  8108. }));
  8109. exports.Jbig2Stream = void 0;
  8110. var _primitives = __w_pdfjs_require__(5);
  8111. var _stream = __w_pdfjs_require__(12);
  8112. var _jbig = __w_pdfjs_require__(16);
  8113. var _util = __w_pdfjs_require__(2);
  8114. const Jbig2Stream = function Jbig2StreamClosure() {
  8115. function Jbig2Stream(stream, maybeLength, dict, params) {
  8116. this.stream = stream;
  8117. this.maybeLength = maybeLength;
  8118. this.dict = dict;
  8119. this.params = params;
  8120. _stream.DecodeStream.call(this, maybeLength);
  8121. }
  8122. Jbig2Stream.prototype = Object.create(_stream.DecodeStream.prototype);
  8123. Object.defineProperty(Jbig2Stream.prototype, "bytes", {
  8124. get() {
  8125. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  8126. },
  8127. configurable: true
  8128. });
  8129. Jbig2Stream.prototype.ensureBuffer = function (requested) {};
  8130. Jbig2Stream.prototype.readBlock = function () {
  8131. if (this.eof) {
  8132. return;
  8133. }
  8134. const jbig2Image = new _jbig.Jbig2Image();
  8135. const chunks = [];
  8136. if ((0, _primitives.isDict)(this.params)) {
  8137. const globalsStream = this.params.get("JBIG2Globals");
  8138. if ((0, _primitives.isStream)(globalsStream)) {
  8139. const globals = globalsStream.getBytes();
  8140. chunks.push({
  8141. data: globals,
  8142. start: 0,
  8143. end: globals.length
  8144. });
  8145. }
  8146. }
  8147. chunks.push({
  8148. data: this.bytes,
  8149. start: 0,
  8150. end: this.bytes.length
  8151. });
  8152. const data = jbig2Image.parseChunks(chunks);
  8153. const dataLength = data.length;
  8154. for (let i = 0; i < dataLength; i++) {
  8155. data[i] ^= 0xff;
  8156. }
  8157. this.buffer = data;
  8158. this.bufferLength = dataLength;
  8159. this.eof = true;
  8160. };
  8161. return Jbig2Stream;
  8162. }();
  8163. exports.Jbig2Stream = Jbig2Stream;
  8164. /***/ }),
  8165. /* 16 */
  8166. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  8167. Object.defineProperty(exports, "__esModule", ({
  8168. value: true
  8169. }));
  8170. exports.Jbig2Image = void 0;
  8171. var _util = __w_pdfjs_require__(2);
  8172. var _core_utils = __w_pdfjs_require__(8);
  8173. var _arithmetic_decoder = __w_pdfjs_require__(17);
  8174. var _ccitt = __w_pdfjs_require__(14);
  8175. class Jbig2Error extends _util.BaseException {
  8176. constructor(msg) {
  8177. super(`JBIG2 error: ${msg}`);
  8178. }
  8179. }
  8180. var Jbig2Image = function Jbig2ImageClosure() {
  8181. function ContextCache() {}
  8182. ContextCache.prototype = {
  8183. getContexts(id) {
  8184. if (id in this) {
  8185. return this[id];
  8186. }
  8187. return this[id] = new Int8Array(1 << 16);
  8188. }
  8189. };
  8190. function DecodingContext(data, start, end) {
  8191. this.data = data;
  8192. this.start = start;
  8193. this.end = end;
  8194. }
  8195. DecodingContext.prototype = {
  8196. get decoder() {
  8197. var decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  8198. return (0, _util.shadow)(this, "decoder", decoder);
  8199. },
  8200. get contextCache() {
  8201. var cache = new ContextCache();
  8202. return (0, _util.shadow)(this, "contextCache", cache);
  8203. }
  8204. };
  8205. function decodeInteger(contextCache, procedure, decoder) {
  8206. var contexts = contextCache.getContexts(procedure);
  8207. var prev = 1;
  8208. function readBits(length) {
  8209. var v = 0;
  8210. for (var i = 0; i < length; i++) {
  8211. var bit = decoder.readBit(contexts, prev);
  8212. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  8213. v = v << 1 | bit;
  8214. }
  8215. return v >>> 0;
  8216. }
  8217. var sign = readBits(1);
  8218. 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);
  8219. if (sign === 0) {
  8220. return value;
  8221. } else if (value > 0) {
  8222. return -value;
  8223. }
  8224. return null;
  8225. }
  8226. function decodeIAID(contextCache, decoder, codeLength) {
  8227. var contexts = contextCache.getContexts("IAID");
  8228. var prev = 1;
  8229. for (var i = 0; i < codeLength; i++) {
  8230. var bit = decoder.readBit(contexts, prev);
  8231. prev = prev << 1 | bit;
  8232. }
  8233. if (codeLength < 31) {
  8234. return prev & (1 << codeLength) - 1;
  8235. }
  8236. return prev & 0x7fffffff;
  8237. }
  8238. 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"];
  8239. var CodingTemplates = [[{
  8240. x: -1,
  8241. y: -2
  8242. }, {
  8243. x: 0,
  8244. y: -2
  8245. }, {
  8246. x: 1,
  8247. y: -2
  8248. }, {
  8249. x: -2,
  8250. y: -1
  8251. }, {
  8252. x: -1,
  8253. y: -1
  8254. }, {
  8255. x: 0,
  8256. y: -1
  8257. }, {
  8258. x: 1,
  8259. y: -1
  8260. }, {
  8261. x: 2,
  8262. y: -1
  8263. }, {
  8264. x: -4,
  8265. y: 0
  8266. }, {
  8267. x: -3,
  8268. y: 0
  8269. }, {
  8270. x: -2,
  8271. y: 0
  8272. }, {
  8273. x: -1,
  8274. y: 0
  8275. }], [{
  8276. x: -1,
  8277. y: -2
  8278. }, {
  8279. x: 0,
  8280. y: -2
  8281. }, {
  8282. x: 1,
  8283. y: -2
  8284. }, {
  8285. x: 2,
  8286. y: -2
  8287. }, {
  8288. x: -2,
  8289. y: -1
  8290. }, {
  8291. x: -1,
  8292. y: -1
  8293. }, {
  8294. x: 0,
  8295. y: -1
  8296. }, {
  8297. x: 1,
  8298. y: -1
  8299. }, {
  8300. x: 2,
  8301. y: -1
  8302. }, {
  8303. x: -3,
  8304. y: 0
  8305. }, {
  8306. x: -2,
  8307. y: 0
  8308. }, {
  8309. x: -1,
  8310. y: 0
  8311. }], [{
  8312. x: -1,
  8313. y: -2
  8314. }, {
  8315. x: 0,
  8316. y: -2
  8317. }, {
  8318. x: 1,
  8319. y: -2
  8320. }, {
  8321. x: -2,
  8322. y: -1
  8323. }, {
  8324. x: -1,
  8325. y: -1
  8326. }, {
  8327. x: 0,
  8328. y: -1
  8329. }, {
  8330. x: 1,
  8331. y: -1
  8332. }, {
  8333. x: -2,
  8334. y: 0
  8335. }, {
  8336. x: -1,
  8337. y: 0
  8338. }], [{
  8339. x: -3,
  8340. y: -1
  8341. }, {
  8342. x: -2,
  8343. y: -1
  8344. }, {
  8345. x: -1,
  8346. y: -1
  8347. }, {
  8348. x: 0,
  8349. y: -1
  8350. }, {
  8351. x: 1,
  8352. y: -1
  8353. }, {
  8354. x: -4,
  8355. y: 0
  8356. }, {
  8357. x: -3,
  8358. y: 0
  8359. }, {
  8360. x: -2,
  8361. y: 0
  8362. }, {
  8363. x: -1,
  8364. y: 0
  8365. }]];
  8366. var RefinementTemplates = [{
  8367. coding: [{
  8368. x: 0,
  8369. y: -1
  8370. }, {
  8371. x: 1,
  8372. y: -1
  8373. }, {
  8374. x: -1,
  8375. y: 0
  8376. }],
  8377. reference: [{
  8378. x: 0,
  8379. y: -1
  8380. }, {
  8381. x: 1,
  8382. y: -1
  8383. }, {
  8384. x: -1,
  8385. y: 0
  8386. }, {
  8387. x: 0,
  8388. y: 0
  8389. }, {
  8390. x: 1,
  8391. y: 0
  8392. }, {
  8393. x: -1,
  8394. y: 1
  8395. }, {
  8396. x: 0,
  8397. y: 1
  8398. }, {
  8399. x: 1,
  8400. y: 1
  8401. }]
  8402. }, {
  8403. coding: [{
  8404. x: -1,
  8405. y: -1
  8406. }, {
  8407. x: 0,
  8408. y: -1
  8409. }, {
  8410. x: 1,
  8411. y: -1
  8412. }, {
  8413. x: -1,
  8414. y: 0
  8415. }],
  8416. reference: [{
  8417. x: 0,
  8418. y: -1
  8419. }, {
  8420. x: -1,
  8421. y: 0
  8422. }, {
  8423. x: 0,
  8424. y: 0
  8425. }, {
  8426. x: 1,
  8427. y: 0
  8428. }, {
  8429. x: 0,
  8430. y: 1
  8431. }, {
  8432. x: 1,
  8433. y: 1
  8434. }]
  8435. }];
  8436. var ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  8437. var RefinementReusedContexts = [0x0020, 0x0008];
  8438. function decodeBitmapTemplate0(width, height, decodingContext) {
  8439. var decoder = decodingContext.decoder;
  8440. var contexts = decodingContext.contextCache.getContexts("GB");
  8441. var contextLabel,
  8442. i,
  8443. j,
  8444. pixel,
  8445. row,
  8446. row1,
  8447. row2,
  8448. bitmap = [];
  8449. var OLD_PIXEL_MASK = 0x7bf7;
  8450. for (i = 0; i < height; i++) {
  8451. row = bitmap[i] = new Uint8Array(width);
  8452. row1 = i < 1 ? row : bitmap[i - 1];
  8453. row2 = i < 2 ? row : bitmap[i - 2];
  8454. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  8455. for (j = 0; j < width; j++) {
  8456. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  8457. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  8458. }
  8459. }
  8460. return bitmap;
  8461. }
  8462. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  8463. if (mmr) {
  8464. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  8465. return decodeMMRBitmap(input, width, height, false);
  8466. }
  8467. 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) {
  8468. return decodeBitmapTemplate0(width, height, decodingContext);
  8469. }
  8470. var useskip = !!skip;
  8471. var template = CodingTemplates[templateIndex].concat(at);
  8472. template.sort(function (a, b) {
  8473. return a.y - b.y || a.x - b.x;
  8474. });
  8475. var templateLength = template.length;
  8476. var templateX = new Int8Array(templateLength);
  8477. var templateY = new Int8Array(templateLength);
  8478. var changingTemplateEntries = [];
  8479. var reuseMask = 0,
  8480. minX = 0,
  8481. maxX = 0,
  8482. minY = 0;
  8483. var c, k;
  8484. for (k = 0; k < templateLength; k++) {
  8485. templateX[k] = template[k].x;
  8486. templateY[k] = template[k].y;
  8487. minX = Math.min(minX, template[k].x);
  8488. maxX = Math.max(maxX, template[k].x);
  8489. minY = Math.min(minY, template[k].y);
  8490. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  8491. reuseMask |= 1 << templateLength - 1 - k;
  8492. } else {
  8493. changingTemplateEntries.push(k);
  8494. }
  8495. }
  8496. var changingEntriesLength = changingTemplateEntries.length;
  8497. var changingTemplateX = new Int8Array(changingEntriesLength);
  8498. var changingTemplateY = new Int8Array(changingEntriesLength);
  8499. var changingTemplateBit = new Uint16Array(changingEntriesLength);
  8500. for (c = 0; c < changingEntriesLength; c++) {
  8501. k = changingTemplateEntries[c];
  8502. changingTemplateX[c] = template[k].x;
  8503. changingTemplateY[c] = template[k].y;
  8504. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  8505. }
  8506. var sbb_left = -minX;
  8507. var sbb_top = -minY;
  8508. var sbb_right = width - maxX;
  8509. var pseudoPixelContext = ReusedContexts[templateIndex];
  8510. var row = new Uint8Array(width);
  8511. var bitmap = [];
  8512. var decoder = decodingContext.decoder;
  8513. var contexts = decodingContext.contextCache.getContexts("GB");
  8514. var ltp = 0,
  8515. j,
  8516. i0,
  8517. j0,
  8518. contextLabel = 0,
  8519. bit,
  8520. shift;
  8521. for (var i = 0; i < height; i++) {
  8522. if (prediction) {
  8523. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  8524. ltp ^= sltp;
  8525. if (ltp) {
  8526. bitmap.push(row);
  8527. continue;
  8528. }
  8529. }
  8530. row = new Uint8Array(row);
  8531. bitmap.push(row);
  8532. for (j = 0; j < width; j++) {
  8533. if (useskip && skip[i][j]) {
  8534. row[j] = 0;
  8535. continue;
  8536. }
  8537. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  8538. contextLabel = contextLabel << 1 & reuseMask;
  8539. for (k = 0; k < changingEntriesLength; k++) {
  8540. i0 = i + changingTemplateY[k];
  8541. j0 = j + changingTemplateX[k];
  8542. bit = bitmap[i0][j0];
  8543. if (bit) {
  8544. bit = changingTemplateBit[k];
  8545. contextLabel |= bit;
  8546. }
  8547. }
  8548. } else {
  8549. contextLabel = 0;
  8550. shift = templateLength - 1;
  8551. for (k = 0; k < templateLength; k++, shift--) {
  8552. j0 = j + templateX[k];
  8553. if (j0 >= 0 && j0 < width) {
  8554. i0 = i + templateY[k];
  8555. if (i0 >= 0) {
  8556. bit = bitmap[i0][j0];
  8557. if (bit) {
  8558. contextLabel |= bit << shift;
  8559. }
  8560. }
  8561. }
  8562. }
  8563. }
  8564. var pixel = decoder.readBit(contexts, contextLabel);
  8565. row[j] = pixel;
  8566. }
  8567. }
  8568. return bitmap;
  8569. }
  8570. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  8571. var codingTemplate = RefinementTemplates[templateIndex].coding;
  8572. if (templateIndex === 0) {
  8573. codingTemplate = codingTemplate.concat([at[0]]);
  8574. }
  8575. var codingTemplateLength = codingTemplate.length;
  8576. var codingTemplateX = new Int32Array(codingTemplateLength);
  8577. var codingTemplateY = new Int32Array(codingTemplateLength);
  8578. var k;
  8579. for (k = 0; k < codingTemplateLength; k++) {
  8580. codingTemplateX[k] = codingTemplate[k].x;
  8581. codingTemplateY[k] = codingTemplate[k].y;
  8582. }
  8583. var referenceTemplate = RefinementTemplates[templateIndex].reference;
  8584. if (templateIndex === 0) {
  8585. referenceTemplate = referenceTemplate.concat([at[1]]);
  8586. }
  8587. var referenceTemplateLength = referenceTemplate.length;
  8588. var referenceTemplateX = new Int32Array(referenceTemplateLength);
  8589. var referenceTemplateY = new Int32Array(referenceTemplateLength);
  8590. for (k = 0; k < referenceTemplateLength; k++) {
  8591. referenceTemplateX[k] = referenceTemplate[k].x;
  8592. referenceTemplateY[k] = referenceTemplate[k].y;
  8593. }
  8594. var referenceWidth = referenceBitmap[0].length;
  8595. var referenceHeight = referenceBitmap.length;
  8596. var pseudoPixelContext = RefinementReusedContexts[templateIndex];
  8597. var bitmap = [];
  8598. var decoder = decodingContext.decoder;
  8599. var contexts = decodingContext.contextCache.getContexts("GR");
  8600. var ltp = 0;
  8601. for (var i = 0; i < height; i++) {
  8602. if (prediction) {
  8603. var sltp = decoder.readBit(contexts, pseudoPixelContext);
  8604. ltp ^= sltp;
  8605. if (ltp) {
  8606. throw new Jbig2Error("prediction is not supported");
  8607. }
  8608. }
  8609. var row = new Uint8Array(width);
  8610. bitmap.push(row);
  8611. for (var j = 0; j < width; j++) {
  8612. var i0, j0;
  8613. var contextLabel = 0;
  8614. for (k = 0; k < codingTemplateLength; k++) {
  8615. i0 = i + codingTemplateY[k];
  8616. j0 = j + codingTemplateX[k];
  8617. if (i0 < 0 || j0 < 0 || j0 >= width) {
  8618. contextLabel <<= 1;
  8619. } else {
  8620. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  8621. }
  8622. }
  8623. for (k = 0; k < referenceTemplateLength; k++) {
  8624. i0 = i + referenceTemplateY[k] - offsetY;
  8625. j0 = j + referenceTemplateX[k] - offsetX;
  8626. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  8627. contextLabel <<= 1;
  8628. } else {
  8629. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  8630. }
  8631. }
  8632. var pixel = decoder.readBit(contexts, contextLabel);
  8633. row[j] = pixel;
  8634. }
  8635. }
  8636. return bitmap;
  8637. }
  8638. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  8639. if (huffman && refinement) {
  8640. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  8641. }
  8642. var newSymbols = [];
  8643. var currentHeight = 0;
  8644. var symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  8645. var decoder = decodingContext.decoder;
  8646. var contextCache = decodingContext.contextCache;
  8647. let tableB1, symbolWidths;
  8648. if (huffman) {
  8649. tableB1 = getStandardTable(1);
  8650. symbolWidths = [];
  8651. symbolCodeLength = Math.max(symbolCodeLength, 1);
  8652. }
  8653. while (newSymbols.length < numberOfNewSymbols) {
  8654. var deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  8655. currentHeight += deltaHeight;
  8656. let currentWidth = 0,
  8657. totalWidth = 0;
  8658. const firstSymbol = huffman ? symbolWidths.length : 0;
  8659. while (true) {
  8660. var deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  8661. if (deltaWidth === null) {
  8662. break;
  8663. }
  8664. currentWidth += deltaWidth;
  8665. totalWidth += currentWidth;
  8666. var bitmap;
  8667. if (refinement) {
  8668. var numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  8669. if (numberOfInstances > 1) {
  8670. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  8671. } else {
  8672. var symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  8673. var rdx = decodeInteger(contextCache, "IARDX", decoder);
  8674. var rdy = decodeInteger(contextCache, "IARDY", decoder);
  8675. var symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  8676. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  8677. }
  8678. newSymbols.push(bitmap);
  8679. } else if (huffman) {
  8680. symbolWidths.push(currentWidth);
  8681. } else {
  8682. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  8683. newSymbols.push(bitmap);
  8684. }
  8685. }
  8686. if (huffman && !refinement) {
  8687. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  8688. huffmanInput.byteAlign();
  8689. let collectiveBitmap;
  8690. if (bitmapSize === 0) {
  8691. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  8692. } else {
  8693. const originalEnd = huffmanInput.end;
  8694. const bitmapEnd = huffmanInput.position + bitmapSize;
  8695. huffmanInput.end = bitmapEnd;
  8696. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  8697. huffmanInput.end = originalEnd;
  8698. huffmanInput.position = bitmapEnd;
  8699. }
  8700. const numberOfSymbolsDecoded = symbolWidths.length;
  8701. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  8702. newSymbols.push(collectiveBitmap);
  8703. } else {
  8704. let i,
  8705. y,
  8706. xMin = 0,
  8707. xMax,
  8708. bitmapWidth,
  8709. symbolBitmap;
  8710. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  8711. bitmapWidth = symbolWidths[i];
  8712. xMax = xMin + bitmapWidth;
  8713. symbolBitmap = [];
  8714. for (y = 0; y < currentHeight; y++) {
  8715. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  8716. }
  8717. newSymbols.push(symbolBitmap);
  8718. xMin = xMax;
  8719. }
  8720. }
  8721. }
  8722. }
  8723. var exportedSymbols = [];
  8724. var flags = [],
  8725. currentFlag = false;
  8726. var totalSymbolsLength = symbols.length + numberOfNewSymbols;
  8727. while (flags.length < totalSymbolsLength) {
  8728. var runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  8729. while (runLength--) {
  8730. flags.push(currentFlag);
  8731. }
  8732. currentFlag = !currentFlag;
  8733. }
  8734. for (var i = 0, ii = symbols.length; i < ii; i++) {
  8735. if (flags[i]) {
  8736. exportedSymbols.push(symbols[i]);
  8737. }
  8738. }
  8739. for (var j = 0; j < numberOfNewSymbols; i++, j++) {
  8740. if (flags[i]) {
  8741. exportedSymbols.push(newSymbols[j]);
  8742. }
  8743. }
  8744. return exportedSymbols;
  8745. }
  8746. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  8747. if (huffman && refinement) {
  8748. throw new Jbig2Error("refinement with Huffman is not supported");
  8749. }
  8750. var bitmap = [];
  8751. var i, row;
  8752. for (i = 0; i < height; i++) {
  8753. row = new Uint8Array(width);
  8754. if (defaultPixelValue) {
  8755. for (var j = 0; j < width; j++) {
  8756. row[j] = defaultPixelValue;
  8757. }
  8758. }
  8759. bitmap.push(row);
  8760. }
  8761. var decoder = decodingContext.decoder;
  8762. var contextCache = decodingContext.contextCache;
  8763. var stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  8764. var firstS = 0;
  8765. i = 0;
  8766. while (i < numberOfSymbolInstances) {
  8767. var deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  8768. stripT += deltaT;
  8769. var deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  8770. firstS += deltaFirstS;
  8771. var currentS = firstS;
  8772. do {
  8773. let currentT = 0;
  8774. if (stripSize > 1) {
  8775. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  8776. }
  8777. var t = stripSize * stripT + currentT;
  8778. var symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  8779. var applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  8780. var symbolBitmap = inputSymbols[symbolId];
  8781. var symbolWidth = symbolBitmap[0].length;
  8782. var symbolHeight = symbolBitmap.length;
  8783. if (applyRefinement) {
  8784. var rdw = decodeInteger(contextCache, "IARDW", decoder);
  8785. var rdh = decodeInteger(contextCache, "IARDH", decoder);
  8786. var rdx = decodeInteger(contextCache, "IARDX", decoder);
  8787. var rdy = decodeInteger(contextCache, "IARDY", decoder);
  8788. symbolWidth += rdw;
  8789. symbolHeight += rdh;
  8790. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  8791. }
  8792. var offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  8793. var offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  8794. var s2, t2, symbolRow;
  8795. if (transposed) {
  8796. for (s2 = 0; s2 < symbolHeight; s2++) {
  8797. row = bitmap[offsetS + s2];
  8798. if (!row) {
  8799. continue;
  8800. }
  8801. symbolRow = symbolBitmap[s2];
  8802. var maxWidth = Math.min(width - offsetT, symbolWidth);
  8803. switch (combinationOperator) {
  8804. case 0:
  8805. for (t2 = 0; t2 < maxWidth; t2++) {
  8806. row[offsetT + t2] |= symbolRow[t2];
  8807. }
  8808. break;
  8809. case 2:
  8810. for (t2 = 0; t2 < maxWidth; t2++) {
  8811. row[offsetT + t2] ^= symbolRow[t2];
  8812. }
  8813. break;
  8814. default:
  8815. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  8816. }
  8817. }
  8818. currentS += symbolHeight - 1;
  8819. } else {
  8820. for (t2 = 0; t2 < symbolHeight; t2++) {
  8821. row = bitmap[offsetT + t2];
  8822. if (!row) {
  8823. continue;
  8824. }
  8825. symbolRow = symbolBitmap[t2];
  8826. switch (combinationOperator) {
  8827. case 0:
  8828. for (s2 = 0; s2 < symbolWidth; s2++) {
  8829. row[offsetS + s2] |= symbolRow[s2];
  8830. }
  8831. break;
  8832. case 2:
  8833. for (s2 = 0; s2 < symbolWidth; s2++) {
  8834. row[offsetS + s2] ^= symbolRow[s2];
  8835. }
  8836. break;
  8837. default:
  8838. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  8839. }
  8840. }
  8841. currentS += symbolWidth - 1;
  8842. }
  8843. i++;
  8844. var deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  8845. if (deltaS === null) {
  8846. break;
  8847. }
  8848. currentS += deltaS + dsOffset;
  8849. } while (true);
  8850. }
  8851. return bitmap;
  8852. }
  8853. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  8854. const at = [];
  8855. if (!mmr) {
  8856. at.push({
  8857. x: -patternWidth,
  8858. y: 0
  8859. });
  8860. if (template === 0) {
  8861. at.push({
  8862. x: -3,
  8863. y: -1
  8864. });
  8865. at.push({
  8866. x: 2,
  8867. y: -2
  8868. });
  8869. at.push({
  8870. x: -2,
  8871. y: -2
  8872. });
  8873. }
  8874. }
  8875. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  8876. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  8877. const patterns = [];
  8878. for (let i = 0; i <= maxPatternIndex; i++) {
  8879. const patternBitmap = [];
  8880. const xMin = patternWidth * i;
  8881. const xMax = xMin + patternWidth;
  8882. for (let y = 0; y < patternHeight; y++) {
  8883. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  8884. }
  8885. patterns.push(patternBitmap);
  8886. }
  8887. return patterns;
  8888. }
  8889. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  8890. const skip = null;
  8891. if (enableSkip) {
  8892. throw new Jbig2Error("skip is not supported");
  8893. }
  8894. if (combinationOperator !== 0) {
  8895. throw new Jbig2Error("operator " + combinationOperator + " is not supported in halftone region");
  8896. }
  8897. const regionBitmap = [];
  8898. let i, j, row;
  8899. for (i = 0; i < regionHeight; i++) {
  8900. row = new Uint8Array(regionWidth);
  8901. if (defaultPixelValue) {
  8902. for (j = 0; j < regionWidth; j++) {
  8903. row[j] = defaultPixelValue;
  8904. }
  8905. }
  8906. regionBitmap.push(row);
  8907. }
  8908. const numberOfPatterns = patterns.length;
  8909. const pattern0 = patterns[0];
  8910. const patternWidth = pattern0[0].length,
  8911. patternHeight = pattern0.length;
  8912. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  8913. const at = [];
  8914. if (!mmr) {
  8915. at.push({
  8916. x: template <= 1 ? 3 : 2,
  8917. y: -1
  8918. });
  8919. if (template === 0) {
  8920. at.push({
  8921. x: -3,
  8922. y: -1
  8923. });
  8924. at.push({
  8925. x: 2,
  8926. y: -2
  8927. });
  8928. at.push({
  8929. x: -2,
  8930. y: -2
  8931. });
  8932. }
  8933. }
  8934. const grayScaleBitPlanes = [];
  8935. let mmrInput, bitmap;
  8936. if (mmr) {
  8937. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  8938. }
  8939. for (i = bitsPerValue - 1; i >= 0; i--) {
  8940. if (mmr) {
  8941. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  8942. } else {
  8943. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  8944. }
  8945. grayScaleBitPlanes[i] = bitmap;
  8946. }
  8947. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  8948. for (mg = 0; mg < gridHeight; mg++) {
  8949. for (ng = 0; ng < gridWidth; ng++) {
  8950. bit = 0;
  8951. patternIndex = 0;
  8952. for (j = bitsPerValue - 1; j >= 0; j--) {
  8953. bit = grayScaleBitPlanes[j][mg][ng] ^ bit;
  8954. patternIndex |= bit << j;
  8955. }
  8956. patternBitmap = patterns[patternIndex];
  8957. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  8958. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  8959. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  8960. for (i = 0; i < patternHeight; i++) {
  8961. regionRow = regionBitmap[y + i];
  8962. patternRow = patternBitmap[i];
  8963. for (j = 0; j < patternWidth; j++) {
  8964. regionRow[x + j] |= patternRow[j];
  8965. }
  8966. }
  8967. } else {
  8968. let regionX, regionY;
  8969. for (i = 0; i < patternHeight; i++) {
  8970. regionY = y + i;
  8971. if (regionY < 0 || regionY >= regionHeight) {
  8972. continue;
  8973. }
  8974. regionRow = regionBitmap[regionY];
  8975. patternRow = patternBitmap[i];
  8976. for (j = 0; j < patternWidth; j++) {
  8977. regionX = x + j;
  8978. if (regionX >= 0 && regionX < regionWidth) {
  8979. regionRow[regionX] |= patternRow[j];
  8980. }
  8981. }
  8982. }
  8983. }
  8984. }
  8985. }
  8986. return regionBitmap;
  8987. }
  8988. function readSegmentHeader(data, start) {
  8989. var segmentHeader = {};
  8990. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  8991. var flags = data[start + 4];
  8992. var segmentType = flags & 0x3f;
  8993. if (!SegmentTypes[segmentType]) {
  8994. throw new Jbig2Error("invalid segment type: " + segmentType);
  8995. }
  8996. segmentHeader.type = segmentType;
  8997. segmentHeader.typeName = SegmentTypes[segmentType];
  8998. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  8999. var pageAssociationFieldSize = !!(flags & 0x40);
  9000. var referredFlags = data[start + 5];
  9001. var referredToCount = referredFlags >> 5 & 7;
  9002. var retainBits = [referredFlags & 31];
  9003. var position = start + 6;
  9004. if (referredFlags === 7) {
  9005. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  9006. position += 3;
  9007. var bytes = referredToCount + 7 >> 3;
  9008. retainBits[0] = data[position++];
  9009. while (--bytes > 0) {
  9010. retainBits.push(data[position++]);
  9011. }
  9012. } else if (referredFlags === 5 || referredFlags === 6) {
  9013. throw new Jbig2Error("invalid referred-to flags");
  9014. }
  9015. segmentHeader.retainBits = retainBits;
  9016. let referredToSegmentNumberSize = 4;
  9017. if (segmentHeader.number <= 256) {
  9018. referredToSegmentNumberSize = 1;
  9019. } else if (segmentHeader.number <= 65536) {
  9020. referredToSegmentNumberSize = 2;
  9021. }
  9022. var referredTo = [];
  9023. var i, ii;
  9024. for (i = 0; i < referredToCount; i++) {
  9025. let number;
  9026. if (referredToSegmentNumberSize === 1) {
  9027. number = data[position];
  9028. } else if (referredToSegmentNumberSize === 2) {
  9029. number = (0, _core_utils.readUint16)(data, position);
  9030. } else {
  9031. number = (0, _core_utils.readUint32)(data, position);
  9032. }
  9033. referredTo.push(number);
  9034. position += referredToSegmentNumberSize;
  9035. }
  9036. segmentHeader.referredTo = referredTo;
  9037. if (!pageAssociationFieldSize) {
  9038. segmentHeader.pageAssociation = data[position++];
  9039. } else {
  9040. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  9041. position += 4;
  9042. }
  9043. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  9044. position += 4;
  9045. if (segmentHeader.length === 0xffffffff) {
  9046. if (segmentType === 38) {
  9047. var genericRegionInfo = readRegionSegmentInformation(data, position);
  9048. var genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  9049. var genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  9050. var searchPatternLength = 6;
  9051. var searchPattern = new Uint8Array(searchPatternLength);
  9052. if (!genericRegionMmr) {
  9053. searchPattern[0] = 0xff;
  9054. searchPattern[1] = 0xac;
  9055. }
  9056. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  9057. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  9058. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  9059. searchPattern[5] = genericRegionInfo.height & 0xff;
  9060. for (i = position, ii = data.length; i < ii; i++) {
  9061. var j = 0;
  9062. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  9063. j++;
  9064. }
  9065. if (j === searchPatternLength) {
  9066. segmentHeader.length = i + searchPatternLength;
  9067. break;
  9068. }
  9069. }
  9070. if (segmentHeader.length === 0xffffffff) {
  9071. throw new Jbig2Error("segment end was not found");
  9072. }
  9073. } else {
  9074. throw new Jbig2Error("invalid unknown segment length");
  9075. }
  9076. }
  9077. segmentHeader.headerEnd = position;
  9078. return segmentHeader;
  9079. }
  9080. function readSegments(header, data, start, end) {
  9081. var segments = [];
  9082. var position = start;
  9083. while (position < end) {
  9084. var segmentHeader = readSegmentHeader(data, position);
  9085. position = segmentHeader.headerEnd;
  9086. var segment = {
  9087. header: segmentHeader,
  9088. data
  9089. };
  9090. if (!header.randomAccess) {
  9091. segment.start = position;
  9092. position += segmentHeader.length;
  9093. segment.end = position;
  9094. }
  9095. segments.push(segment);
  9096. if (segmentHeader.type === 51) {
  9097. break;
  9098. }
  9099. }
  9100. if (header.randomAccess) {
  9101. for (var i = 0, ii = segments.length; i < ii; i++) {
  9102. segments[i].start = position;
  9103. position += segments[i].header.length;
  9104. segments[i].end = position;
  9105. }
  9106. }
  9107. return segments;
  9108. }
  9109. function readRegionSegmentInformation(data, start) {
  9110. return {
  9111. width: (0, _core_utils.readUint32)(data, start),
  9112. height: (0, _core_utils.readUint32)(data, start + 4),
  9113. x: (0, _core_utils.readUint32)(data, start + 8),
  9114. y: (0, _core_utils.readUint32)(data, start + 12),
  9115. combinationOperator: data[start + 16] & 7
  9116. };
  9117. }
  9118. var RegionSegmentInformationFieldLength = 17;
  9119. function processSegment(segment, visitor) {
  9120. var header = segment.header;
  9121. var data = segment.data,
  9122. position = segment.start,
  9123. end = segment.end;
  9124. var args, at, i, atLength;
  9125. switch (header.type) {
  9126. case 0:
  9127. var dictionary = {};
  9128. var dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  9129. dictionary.huffman = !!(dictionaryFlags & 1);
  9130. dictionary.refinement = !!(dictionaryFlags & 2);
  9131. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  9132. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  9133. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  9134. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  9135. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  9136. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  9137. dictionary.template = dictionaryFlags >> 10 & 3;
  9138. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  9139. position += 2;
  9140. if (!dictionary.huffman) {
  9141. atLength = dictionary.template === 0 ? 4 : 1;
  9142. at = [];
  9143. for (i = 0; i < atLength; i++) {
  9144. at.push({
  9145. x: (0, _core_utils.readInt8)(data, position),
  9146. y: (0, _core_utils.readInt8)(data, position + 1)
  9147. });
  9148. position += 2;
  9149. }
  9150. dictionary.at = at;
  9151. }
  9152. if (dictionary.refinement && !dictionary.refinementTemplate) {
  9153. at = [];
  9154. for (i = 0; i < 2; i++) {
  9155. at.push({
  9156. x: (0, _core_utils.readInt8)(data, position),
  9157. y: (0, _core_utils.readInt8)(data, position + 1)
  9158. });
  9159. position += 2;
  9160. }
  9161. dictionary.refinementAt = at;
  9162. }
  9163. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  9164. position += 4;
  9165. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  9166. position += 4;
  9167. args = [dictionary, header.number, header.referredTo, data, position, end];
  9168. break;
  9169. case 6:
  9170. case 7:
  9171. var textRegion = {};
  9172. textRegion.info = readRegionSegmentInformation(data, position);
  9173. position += RegionSegmentInformationFieldLength;
  9174. var textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  9175. position += 2;
  9176. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  9177. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  9178. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  9179. textRegion.stripSize = 1 << textRegion.logStripSize;
  9180. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  9181. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  9182. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  9183. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  9184. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  9185. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  9186. if (textRegion.huffman) {
  9187. var textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  9188. position += 2;
  9189. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  9190. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  9191. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  9192. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  9193. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  9194. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  9195. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  9196. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  9197. }
  9198. if (textRegion.refinement && !textRegion.refinementTemplate) {
  9199. at = [];
  9200. for (i = 0; i < 2; i++) {
  9201. at.push({
  9202. x: (0, _core_utils.readInt8)(data, position),
  9203. y: (0, _core_utils.readInt8)(data, position + 1)
  9204. });
  9205. position += 2;
  9206. }
  9207. textRegion.refinementAt = at;
  9208. }
  9209. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  9210. position += 4;
  9211. args = [textRegion, header.referredTo, data, position, end];
  9212. break;
  9213. case 16:
  9214. const patternDictionary = {};
  9215. const patternDictionaryFlags = data[position++];
  9216. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  9217. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  9218. patternDictionary.patternWidth = data[position++];
  9219. patternDictionary.patternHeight = data[position++];
  9220. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  9221. position += 4;
  9222. args = [patternDictionary, header.number, data, position, end];
  9223. break;
  9224. case 22:
  9225. case 23:
  9226. const halftoneRegion = {};
  9227. halftoneRegion.info = readRegionSegmentInformation(data, position);
  9228. position += RegionSegmentInformationFieldLength;
  9229. const halftoneRegionFlags = data[position++];
  9230. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  9231. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  9232. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  9233. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  9234. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  9235. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  9236. position += 4;
  9237. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  9238. position += 4;
  9239. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  9240. position += 4;
  9241. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  9242. position += 4;
  9243. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  9244. position += 2;
  9245. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  9246. position += 2;
  9247. args = [halftoneRegion, header.referredTo, data, position, end];
  9248. break;
  9249. case 38:
  9250. case 39:
  9251. var genericRegion = {};
  9252. genericRegion.info = readRegionSegmentInformation(data, position);
  9253. position += RegionSegmentInformationFieldLength;
  9254. var genericRegionSegmentFlags = data[position++];
  9255. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  9256. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  9257. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  9258. if (!genericRegion.mmr) {
  9259. atLength = genericRegion.template === 0 ? 4 : 1;
  9260. at = [];
  9261. for (i = 0; i < atLength; i++) {
  9262. at.push({
  9263. x: (0, _core_utils.readInt8)(data, position),
  9264. y: (0, _core_utils.readInt8)(data, position + 1)
  9265. });
  9266. position += 2;
  9267. }
  9268. genericRegion.at = at;
  9269. }
  9270. args = [genericRegion, data, position, end];
  9271. break;
  9272. case 48:
  9273. var pageInfo = {
  9274. width: (0, _core_utils.readUint32)(data, position),
  9275. height: (0, _core_utils.readUint32)(data, position + 4),
  9276. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  9277. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  9278. };
  9279. if (pageInfo.height === 0xffffffff) {
  9280. delete pageInfo.height;
  9281. }
  9282. var pageSegmentFlags = data[position + 16];
  9283. (0, _core_utils.readUint16)(data, position + 17);
  9284. pageInfo.lossless = !!(pageSegmentFlags & 1);
  9285. pageInfo.refinement = !!(pageSegmentFlags & 2);
  9286. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  9287. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  9288. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  9289. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  9290. args = [pageInfo];
  9291. break;
  9292. case 49:
  9293. break;
  9294. case 50:
  9295. break;
  9296. case 51:
  9297. break;
  9298. case 53:
  9299. args = [header.number, data, position, end];
  9300. break;
  9301. case 62:
  9302. break;
  9303. default:
  9304. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  9305. }
  9306. var callbackName = "on" + header.typeName;
  9307. if (callbackName in visitor) {
  9308. visitor[callbackName].apply(visitor, args);
  9309. }
  9310. }
  9311. function processSegments(segments, visitor) {
  9312. for (var i = 0, ii = segments.length; i < ii; i++) {
  9313. processSegment(segments[i], visitor);
  9314. }
  9315. }
  9316. function parseJbig2Chunks(chunks) {
  9317. var visitor = new SimpleSegmentVisitor();
  9318. for (var i = 0, ii = chunks.length; i < ii; i++) {
  9319. var chunk = chunks[i];
  9320. var segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  9321. processSegments(segments, visitor);
  9322. }
  9323. return visitor.buffer;
  9324. }
  9325. function parseJbig2(data) {
  9326. const end = data.length;
  9327. let position = 0;
  9328. 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) {
  9329. throw new Jbig2Error("parseJbig2 - invalid header.");
  9330. }
  9331. const header = Object.create(null);
  9332. position += 8;
  9333. const flags = data[position++];
  9334. header.randomAccess = !(flags & 1);
  9335. if (!(flags & 2)) {
  9336. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  9337. position += 4;
  9338. }
  9339. const segments = readSegments(header, data, position, end);
  9340. const visitor = new SimpleSegmentVisitor();
  9341. processSegments(segments, visitor);
  9342. const {
  9343. width,
  9344. height
  9345. } = visitor.currentPageInfo;
  9346. const bitPacked = visitor.buffer;
  9347. const imgData = new Uint8ClampedArray(width * height);
  9348. let q = 0,
  9349. k = 0;
  9350. for (let i = 0; i < height; i++) {
  9351. let mask = 0,
  9352. buffer;
  9353. for (let j = 0; j < width; j++) {
  9354. if (!mask) {
  9355. mask = 128;
  9356. buffer = bitPacked[k++];
  9357. }
  9358. imgData[q++] = buffer & mask ? 0 : 255;
  9359. mask >>= 1;
  9360. }
  9361. }
  9362. return {
  9363. imgData,
  9364. width,
  9365. height
  9366. };
  9367. }
  9368. function SimpleSegmentVisitor() {}
  9369. SimpleSegmentVisitor.prototype = {
  9370. onPageInformation: function SimpleSegmentVisitor_onPageInformation(info) {
  9371. this.currentPageInfo = info;
  9372. var rowSize = info.width + 7 >> 3;
  9373. var buffer = new Uint8ClampedArray(rowSize * info.height);
  9374. if (info.defaultPixelValue) {
  9375. for (var i = 0, ii = buffer.length; i < ii; i++) {
  9376. buffer[i] = 0xff;
  9377. }
  9378. }
  9379. this.buffer = buffer;
  9380. },
  9381. drawBitmap: function SimpleSegmentVisitor_drawBitmap(regionInfo, bitmap) {
  9382. var pageInfo = this.currentPageInfo;
  9383. var width = regionInfo.width,
  9384. height = regionInfo.height;
  9385. var rowSize = pageInfo.width + 7 >> 3;
  9386. var combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  9387. var buffer = this.buffer;
  9388. var mask0 = 128 >> (regionInfo.x & 7);
  9389. var offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  9390. var i, j, mask, offset;
  9391. switch (combinationOperator) {
  9392. case 0:
  9393. for (i = 0; i < height; i++) {
  9394. mask = mask0;
  9395. offset = offset0;
  9396. for (j = 0; j < width; j++) {
  9397. if (bitmap[i][j]) {
  9398. buffer[offset] |= mask;
  9399. }
  9400. mask >>= 1;
  9401. if (!mask) {
  9402. mask = 128;
  9403. offset++;
  9404. }
  9405. }
  9406. offset0 += rowSize;
  9407. }
  9408. break;
  9409. case 2:
  9410. for (i = 0; i < height; i++) {
  9411. mask = mask0;
  9412. offset = offset0;
  9413. for (j = 0; j < width; j++) {
  9414. if (bitmap[i][j]) {
  9415. buffer[offset] ^= mask;
  9416. }
  9417. mask >>= 1;
  9418. if (!mask) {
  9419. mask = 128;
  9420. offset++;
  9421. }
  9422. }
  9423. offset0 += rowSize;
  9424. }
  9425. break;
  9426. default:
  9427. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  9428. }
  9429. },
  9430. onImmediateGenericRegion: function SimpleSegmentVisitor_onImmediateGenericRegion(region, data, start, end) {
  9431. var regionInfo = region.info;
  9432. var decodingContext = new DecodingContext(data, start, end);
  9433. var bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  9434. this.drawBitmap(regionInfo, bitmap);
  9435. },
  9436. onImmediateLosslessGenericRegion: function SimpleSegmentVisitor_onImmediateLosslessGenericRegion() {
  9437. this.onImmediateGenericRegion.apply(this, arguments);
  9438. },
  9439. onSymbolDictionary: function SimpleSegmentVisitor_onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  9440. let huffmanTables, huffmanInput;
  9441. if (dictionary.huffman) {
  9442. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  9443. huffmanInput = new Reader(data, start, end);
  9444. }
  9445. var symbols = this.symbols;
  9446. if (!symbols) {
  9447. this.symbols = symbols = {};
  9448. }
  9449. var inputSymbols = [];
  9450. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  9451. const referredSymbols = symbols[referredSegments[i]];
  9452. if (referredSymbols) {
  9453. inputSymbols = inputSymbols.concat(referredSymbols);
  9454. }
  9455. }
  9456. var decodingContext = new DecodingContext(data, start, end);
  9457. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  9458. },
  9459. onImmediateTextRegion: function SimpleSegmentVisitor_onImmediateTextRegion(region, referredSegments, data, start, end) {
  9460. var regionInfo = region.info;
  9461. let huffmanTables, huffmanInput;
  9462. var symbols = this.symbols;
  9463. var inputSymbols = [];
  9464. for (var i = 0, ii = referredSegments.length; i < ii; i++) {
  9465. const referredSymbols = symbols[referredSegments[i]];
  9466. if (referredSymbols) {
  9467. inputSymbols = inputSymbols.concat(referredSymbols);
  9468. }
  9469. }
  9470. var symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  9471. if (region.huffman) {
  9472. huffmanInput = new Reader(data, start, end);
  9473. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  9474. }
  9475. var decodingContext = new DecodingContext(data, start, end);
  9476. 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);
  9477. this.drawBitmap(regionInfo, bitmap);
  9478. },
  9479. onImmediateLosslessTextRegion: function SimpleSegmentVisitor_onImmediateLosslessTextRegion() {
  9480. this.onImmediateTextRegion.apply(this, arguments);
  9481. },
  9482. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  9483. let patterns = this.patterns;
  9484. if (!patterns) {
  9485. this.patterns = patterns = {};
  9486. }
  9487. const decodingContext = new DecodingContext(data, start, end);
  9488. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  9489. },
  9490. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  9491. const patterns = this.patterns[referredSegments[0]];
  9492. const regionInfo = region.info;
  9493. const decodingContext = new DecodingContext(data, start, end);
  9494. 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);
  9495. this.drawBitmap(regionInfo, bitmap);
  9496. },
  9497. onImmediateLosslessHalftoneRegion() {
  9498. this.onImmediateHalftoneRegion.apply(this, arguments);
  9499. },
  9500. onTables(currentSegment, data, start, end) {
  9501. let customTables = this.customTables;
  9502. if (!customTables) {
  9503. this.customTables = customTables = {};
  9504. }
  9505. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  9506. }
  9507. };
  9508. function HuffmanLine(lineData) {
  9509. if (lineData.length === 2) {
  9510. this.isOOB = true;
  9511. this.rangeLow = 0;
  9512. this.prefixLength = lineData[0];
  9513. this.rangeLength = 0;
  9514. this.prefixCode = lineData[1];
  9515. this.isLowerRange = false;
  9516. } else {
  9517. this.isOOB = false;
  9518. this.rangeLow = lineData[0];
  9519. this.prefixLength = lineData[1];
  9520. this.rangeLength = lineData[2];
  9521. this.prefixCode = lineData[3];
  9522. this.isLowerRange = lineData[4] === "lower";
  9523. }
  9524. }
  9525. function HuffmanTreeNode(line) {
  9526. this.children = [];
  9527. if (line) {
  9528. this.isLeaf = true;
  9529. this.rangeLength = line.rangeLength;
  9530. this.rangeLow = line.rangeLow;
  9531. this.isLowerRange = line.isLowerRange;
  9532. this.isOOB = line.isOOB;
  9533. } else {
  9534. this.isLeaf = false;
  9535. }
  9536. }
  9537. HuffmanTreeNode.prototype = {
  9538. buildTree(line, shift) {
  9539. const bit = line.prefixCode >> shift & 1;
  9540. if (shift <= 0) {
  9541. this.children[bit] = new HuffmanTreeNode(line);
  9542. } else {
  9543. let node = this.children[bit];
  9544. if (!node) {
  9545. this.children[bit] = node = new HuffmanTreeNode(null);
  9546. }
  9547. node.buildTree(line, shift - 1);
  9548. }
  9549. },
  9550. decodeNode(reader) {
  9551. if (this.isLeaf) {
  9552. if (this.isOOB) {
  9553. return null;
  9554. }
  9555. const htOffset = reader.readBits(this.rangeLength);
  9556. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  9557. }
  9558. const node = this.children[reader.readBit()];
  9559. if (!node) {
  9560. throw new Jbig2Error("invalid Huffman data");
  9561. }
  9562. return node.decodeNode(reader);
  9563. }
  9564. };
  9565. function HuffmanTable(lines, prefixCodesDone) {
  9566. if (!prefixCodesDone) {
  9567. this.assignPrefixCodes(lines);
  9568. }
  9569. this.rootNode = new HuffmanTreeNode(null);
  9570. for (let i = 0, ii = lines.length; i < ii; i++) {
  9571. const line = lines[i];
  9572. if (line.prefixLength > 0) {
  9573. this.rootNode.buildTree(line, line.prefixLength - 1);
  9574. }
  9575. }
  9576. }
  9577. HuffmanTable.prototype = {
  9578. decode(reader) {
  9579. return this.rootNode.decodeNode(reader);
  9580. },
  9581. assignPrefixCodes(lines) {
  9582. const linesLength = lines.length;
  9583. let prefixLengthMax = 0;
  9584. for (let i = 0; i < linesLength; i++) {
  9585. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  9586. }
  9587. const histogram = new Uint32Array(prefixLengthMax + 1);
  9588. for (let i = 0; i < linesLength; i++) {
  9589. histogram[lines[i].prefixLength]++;
  9590. }
  9591. let currentLength = 1,
  9592. firstCode = 0,
  9593. currentCode,
  9594. currentTemp,
  9595. line;
  9596. histogram[0] = 0;
  9597. while (currentLength <= prefixLengthMax) {
  9598. firstCode = firstCode + histogram[currentLength - 1] << 1;
  9599. currentCode = firstCode;
  9600. currentTemp = 0;
  9601. while (currentTemp < linesLength) {
  9602. line = lines[currentTemp];
  9603. if (line.prefixLength === currentLength) {
  9604. line.prefixCode = currentCode;
  9605. currentCode++;
  9606. }
  9607. currentTemp++;
  9608. }
  9609. currentLength++;
  9610. }
  9611. }
  9612. };
  9613. function decodeTablesSegment(data, start, end) {
  9614. const flags = data[start];
  9615. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  9616. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  9617. const reader = new Reader(data, start + 9, end);
  9618. const prefixSizeBits = (flags >> 1 & 7) + 1;
  9619. const rangeSizeBits = (flags >> 4 & 7) + 1;
  9620. const lines = [];
  9621. let prefixLength,
  9622. rangeLength,
  9623. currentRangeLow = lowestValue;
  9624. do {
  9625. prefixLength = reader.readBits(prefixSizeBits);
  9626. rangeLength = reader.readBits(rangeSizeBits);
  9627. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  9628. currentRangeLow += 1 << rangeLength;
  9629. } while (currentRangeLow < highestValue);
  9630. prefixLength = reader.readBits(prefixSizeBits);
  9631. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  9632. prefixLength = reader.readBits(prefixSizeBits);
  9633. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  9634. if (flags & 1) {
  9635. prefixLength = reader.readBits(prefixSizeBits);
  9636. lines.push(new HuffmanLine([prefixLength, 0]));
  9637. }
  9638. return new HuffmanTable(lines, false);
  9639. }
  9640. const standardTablesCache = {};
  9641. function getStandardTable(number) {
  9642. let table = standardTablesCache[number];
  9643. if (table) {
  9644. return table;
  9645. }
  9646. let lines;
  9647. switch (number) {
  9648. case 1:
  9649. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  9650. break;
  9651. case 2:
  9652. 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]];
  9653. break;
  9654. case 3:
  9655. 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]];
  9656. break;
  9657. case 4:
  9658. 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]];
  9659. break;
  9660. case 5:
  9661. 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]];
  9662. break;
  9663. case 6:
  9664. 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]];
  9665. break;
  9666. case 7:
  9667. 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]];
  9668. break;
  9669. case 8:
  9670. 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]];
  9671. break;
  9672. case 9:
  9673. 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]];
  9674. break;
  9675. case 10:
  9676. 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]];
  9677. break;
  9678. case 11:
  9679. 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]];
  9680. break;
  9681. case 12:
  9682. 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]];
  9683. break;
  9684. case 13:
  9685. 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]];
  9686. break;
  9687. case 14:
  9688. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  9689. break;
  9690. case 15:
  9691. 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]];
  9692. break;
  9693. default:
  9694. throw new Jbig2Error(`standard table B.${number} does not exist`);
  9695. }
  9696. for (let i = 0, ii = lines.length; i < ii; i++) {
  9697. lines[i] = new HuffmanLine(lines[i]);
  9698. }
  9699. table = new HuffmanTable(lines, true);
  9700. standardTablesCache[number] = table;
  9701. return table;
  9702. }
  9703. function Reader(data, start, end) {
  9704. this.data = data;
  9705. this.start = start;
  9706. this.end = end;
  9707. this.position = start;
  9708. this.shift = -1;
  9709. this.currentByte = 0;
  9710. }
  9711. Reader.prototype = {
  9712. readBit() {
  9713. if (this.shift < 0) {
  9714. if (this.position >= this.end) {
  9715. throw new Jbig2Error("end of data while reading bit");
  9716. }
  9717. this.currentByte = this.data[this.position++];
  9718. this.shift = 7;
  9719. }
  9720. const bit = this.currentByte >> this.shift & 1;
  9721. this.shift--;
  9722. return bit;
  9723. },
  9724. readBits(numBits) {
  9725. let result = 0,
  9726. i;
  9727. for (i = numBits - 1; i >= 0; i--) {
  9728. result |= this.readBit() << i;
  9729. }
  9730. return result;
  9731. },
  9732. byteAlign() {
  9733. this.shift = -1;
  9734. },
  9735. next() {
  9736. if (this.position >= this.end) {
  9737. return -1;
  9738. }
  9739. return this.data[this.position++];
  9740. }
  9741. };
  9742. function getCustomHuffmanTable(index, referredTo, customTables) {
  9743. let currentIndex = 0;
  9744. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  9745. const table = customTables[referredTo[i]];
  9746. if (table) {
  9747. if (index === currentIndex) {
  9748. return table;
  9749. }
  9750. currentIndex++;
  9751. }
  9752. }
  9753. throw new Jbig2Error("can't find custom Huffman table");
  9754. }
  9755. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  9756. const codes = [];
  9757. for (let i = 0; i <= 34; i++) {
  9758. const codeLength = reader.readBits(4);
  9759. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  9760. }
  9761. const runCodesTable = new HuffmanTable(codes, false);
  9762. codes.length = 0;
  9763. for (let i = 0; i < numberOfSymbols;) {
  9764. const codeLength = runCodesTable.decode(reader);
  9765. if (codeLength >= 32) {
  9766. let repeatedLength, numberOfRepeats, j;
  9767. switch (codeLength) {
  9768. case 32:
  9769. if (i === 0) {
  9770. throw new Jbig2Error("no previous value in symbol ID table");
  9771. }
  9772. numberOfRepeats = reader.readBits(2) + 3;
  9773. repeatedLength = codes[i - 1].prefixLength;
  9774. break;
  9775. case 33:
  9776. numberOfRepeats = reader.readBits(3) + 3;
  9777. repeatedLength = 0;
  9778. break;
  9779. case 34:
  9780. numberOfRepeats = reader.readBits(7) + 11;
  9781. repeatedLength = 0;
  9782. break;
  9783. default:
  9784. throw new Jbig2Error("invalid code length in symbol ID table");
  9785. }
  9786. for (j = 0; j < numberOfRepeats; j++) {
  9787. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  9788. i++;
  9789. }
  9790. } else {
  9791. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  9792. i++;
  9793. }
  9794. }
  9795. reader.byteAlign();
  9796. const symbolIDTable = new HuffmanTable(codes, false);
  9797. let customIndex = 0,
  9798. tableFirstS,
  9799. tableDeltaS,
  9800. tableDeltaT;
  9801. switch (textRegion.huffmanFS) {
  9802. case 0:
  9803. case 1:
  9804. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  9805. break;
  9806. case 3:
  9807. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9808. customIndex++;
  9809. break;
  9810. default:
  9811. throw new Jbig2Error("invalid Huffman FS selector");
  9812. }
  9813. switch (textRegion.huffmanDS) {
  9814. case 0:
  9815. case 1:
  9816. case 2:
  9817. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  9818. break;
  9819. case 3:
  9820. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9821. customIndex++;
  9822. break;
  9823. default:
  9824. throw new Jbig2Error("invalid Huffman DS selector");
  9825. }
  9826. switch (textRegion.huffmanDT) {
  9827. case 0:
  9828. case 1:
  9829. case 2:
  9830. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  9831. break;
  9832. case 3:
  9833. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9834. customIndex++;
  9835. break;
  9836. default:
  9837. throw new Jbig2Error("invalid Huffman DT selector");
  9838. }
  9839. if (textRegion.refinement) {
  9840. throw new Jbig2Error("refinement with Huffman is not supported");
  9841. }
  9842. return {
  9843. symbolIDTable,
  9844. tableFirstS,
  9845. tableDeltaS,
  9846. tableDeltaT
  9847. };
  9848. }
  9849. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  9850. let customIndex = 0,
  9851. tableDeltaHeight,
  9852. tableDeltaWidth;
  9853. switch (dictionary.huffmanDHSelector) {
  9854. case 0:
  9855. case 1:
  9856. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  9857. break;
  9858. case 3:
  9859. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9860. customIndex++;
  9861. break;
  9862. default:
  9863. throw new Jbig2Error("invalid Huffman DH selector");
  9864. }
  9865. switch (dictionary.huffmanDWSelector) {
  9866. case 0:
  9867. case 1:
  9868. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  9869. break;
  9870. case 3:
  9871. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9872. customIndex++;
  9873. break;
  9874. default:
  9875. throw new Jbig2Error("invalid Huffman DW selector");
  9876. }
  9877. let tableBitmapSize, tableAggregateInstances;
  9878. if (dictionary.bitmapSizeSelector) {
  9879. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9880. customIndex++;
  9881. } else {
  9882. tableBitmapSize = getStandardTable(1);
  9883. }
  9884. if (dictionary.aggregationInstancesSelector) {
  9885. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  9886. } else {
  9887. tableAggregateInstances = getStandardTable(1);
  9888. }
  9889. return {
  9890. tableDeltaHeight,
  9891. tableDeltaWidth,
  9892. tableBitmapSize,
  9893. tableAggregateInstances
  9894. };
  9895. }
  9896. function readUncompressedBitmap(reader, width, height) {
  9897. const bitmap = [];
  9898. for (let y = 0; y < height; y++) {
  9899. const row = new Uint8Array(width);
  9900. bitmap.push(row);
  9901. for (let x = 0; x < width; x++) {
  9902. row[x] = reader.readBit();
  9903. }
  9904. reader.byteAlign();
  9905. }
  9906. return bitmap;
  9907. }
  9908. function decodeMMRBitmap(input, width, height, endOfBlock) {
  9909. const params = {
  9910. K: -1,
  9911. Columns: width,
  9912. Rows: height,
  9913. BlackIs1: true,
  9914. EndOfBlock: endOfBlock
  9915. };
  9916. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  9917. const bitmap = [];
  9918. let currentByte,
  9919. eof = false;
  9920. for (let y = 0; y < height; y++) {
  9921. const row = new Uint8Array(width);
  9922. bitmap.push(row);
  9923. let shift = -1;
  9924. for (let x = 0; x < width; x++) {
  9925. if (shift < 0) {
  9926. currentByte = decoder.readNextChar();
  9927. if (currentByte === -1) {
  9928. currentByte = 0;
  9929. eof = true;
  9930. }
  9931. shift = 7;
  9932. }
  9933. row[x] = currentByte >> shift & 1;
  9934. shift--;
  9935. }
  9936. }
  9937. if (endOfBlock && !eof) {
  9938. const lookForEOFLimit = 5;
  9939. for (let i = 0; i < lookForEOFLimit; i++) {
  9940. if (decoder.readNextChar() === -1) {
  9941. break;
  9942. }
  9943. }
  9944. }
  9945. return bitmap;
  9946. }
  9947. function Jbig2Image() {}
  9948. Jbig2Image.prototype = {
  9949. parseChunks(chunks) {
  9950. return parseJbig2Chunks(chunks);
  9951. },
  9952. parse(data) {
  9953. const {
  9954. imgData,
  9955. width,
  9956. height
  9957. } = parseJbig2(data);
  9958. this.width = width;
  9959. this.height = height;
  9960. return imgData;
  9961. }
  9962. };
  9963. return Jbig2Image;
  9964. }();
  9965. exports.Jbig2Image = Jbig2Image;
  9966. /***/ }),
  9967. /* 17 */
  9968. /***/ ((__unused_webpack_module, exports) => {
  9969. Object.defineProperty(exports, "__esModule", ({
  9970. value: true
  9971. }));
  9972. exports.ArithmeticDecoder = void 0;
  9973. const QeTable = [{
  9974. qe: 0x5601,
  9975. nmps: 1,
  9976. nlps: 1,
  9977. switchFlag: 1
  9978. }, {
  9979. qe: 0x3401,
  9980. nmps: 2,
  9981. nlps: 6,
  9982. switchFlag: 0
  9983. }, {
  9984. qe: 0x1801,
  9985. nmps: 3,
  9986. nlps: 9,
  9987. switchFlag: 0
  9988. }, {
  9989. qe: 0x0ac1,
  9990. nmps: 4,
  9991. nlps: 12,
  9992. switchFlag: 0
  9993. }, {
  9994. qe: 0x0521,
  9995. nmps: 5,
  9996. nlps: 29,
  9997. switchFlag: 0
  9998. }, {
  9999. qe: 0x0221,
  10000. nmps: 38,
  10001. nlps: 33,
  10002. switchFlag: 0
  10003. }, {
  10004. qe: 0x5601,
  10005. nmps: 7,
  10006. nlps: 6,
  10007. switchFlag: 1
  10008. }, {
  10009. qe: 0x5401,
  10010. nmps: 8,
  10011. nlps: 14,
  10012. switchFlag: 0
  10013. }, {
  10014. qe: 0x4801,
  10015. nmps: 9,
  10016. nlps: 14,
  10017. switchFlag: 0
  10018. }, {
  10019. qe: 0x3801,
  10020. nmps: 10,
  10021. nlps: 14,
  10022. switchFlag: 0
  10023. }, {
  10024. qe: 0x3001,
  10025. nmps: 11,
  10026. nlps: 17,
  10027. switchFlag: 0
  10028. }, {
  10029. qe: 0x2401,
  10030. nmps: 12,
  10031. nlps: 18,
  10032. switchFlag: 0
  10033. }, {
  10034. qe: 0x1c01,
  10035. nmps: 13,
  10036. nlps: 20,
  10037. switchFlag: 0
  10038. }, {
  10039. qe: 0x1601,
  10040. nmps: 29,
  10041. nlps: 21,
  10042. switchFlag: 0
  10043. }, {
  10044. qe: 0x5601,
  10045. nmps: 15,
  10046. nlps: 14,
  10047. switchFlag: 1
  10048. }, {
  10049. qe: 0x5401,
  10050. nmps: 16,
  10051. nlps: 14,
  10052. switchFlag: 0
  10053. }, {
  10054. qe: 0x5101,
  10055. nmps: 17,
  10056. nlps: 15,
  10057. switchFlag: 0
  10058. }, {
  10059. qe: 0x4801,
  10060. nmps: 18,
  10061. nlps: 16,
  10062. switchFlag: 0
  10063. }, {
  10064. qe: 0x3801,
  10065. nmps: 19,
  10066. nlps: 17,
  10067. switchFlag: 0
  10068. }, {
  10069. qe: 0x3401,
  10070. nmps: 20,
  10071. nlps: 18,
  10072. switchFlag: 0
  10073. }, {
  10074. qe: 0x3001,
  10075. nmps: 21,
  10076. nlps: 19,
  10077. switchFlag: 0
  10078. }, {
  10079. qe: 0x2801,
  10080. nmps: 22,
  10081. nlps: 19,
  10082. switchFlag: 0
  10083. }, {
  10084. qe: 0x2401,
  10085. nmps: 23,
  10086. nlps: 20,
  10087. switchFlag: 0
  10088. }, {
  10089. qe: 0x2201,
  10090. nmps: 24,
  10091. nlps: 21,
  10092. switchFlag: 0
  10093. }, {
  10094. qe: 0x1c01,
  10095. nmps: 25,
  10096. nlps: 22,
  10097. switchFlag: 0
  10098. }, {
  10099. qe: 0x1801,
  10100. nmps: 26,
  10101. nlps: 23,
  10102. switchFlag: 0
  10103. }, {
  10104. qe: 0x1601,
  10105. nmps: 27,
  10106. nlps: 24,
  10107. switchFlag: 0
  10108. }, {
  10109. qe: 0x1401,
  10110. nmps: 28,
  10111. nlps: 25,
  10112. switchFlag: 0
  10113. }, {
  10114. qe: 0x1201,
  10115. nmps: 29,
  10116. nlps: 26,
  10117. switchFlag: 0
  10118. }, {
  10119. qe: 0x1101,
  10120. nmps: 30,
  10121. nlps: 27,
  10122. switchFlag: 0
  10123. }, {
  10124. qe: 0x0ac1,
  10125. nmps: 31,
  10126. nlps: 28,
  10127. switchFlag: 0
  10128. }, {
  10129. qe: 0x09c1,
  10130. nmps: 32,
  10131. nlps: 29,
  10132. switchFlag: 0
  10133. }, {
  10134. qe: 0x08a1,
  10135. nmps: 33,
  10136. nlps: 30,
  10137. switchFlag: 0
  10138. }, {
  10139. qe: 0x0521,
  10140. nmps: 34,
  10141. nlps: 31,
  10142. switchFlag: 0
  10143. }, {
  10144. qe: 0x0441,
  10145. nmps: 35,
  10146. nlps: 32,
  10147. switchFlag: 0
  10148. }, {
  10149. qe: 0x02a1,
  10150. nmps: 36,
  10151. nlps: 33,
  10152. switchFlag: 0
  10153. }, {
  10154. qe: 0x0221,
  10155. nmps: 37,
  10156. nlps: 34,
  10157. switchFlag: 0
  10158. }, {
  10159. qe: 0x0141,
  10160. nmps: 38,
  10161. nlps: 35,
  10162. switchFlag: 0
  10163. }, {
  10164. qe: 0x0111,
  10165. nmps: 39,
  10166. nlps: 36,
  10167. switchFlag: 0
  10168. }, {
  10169. qe: 0x0085,
  10170. nmps: 40,
  10171. nlps: 37,
  10172. switchFlag: 0
  10173. }, {
  10174. qe: 0x0049,
  10175. nmps: 41,
  10176. nlps: 38,
  10177. switchFlag: 0
  10178. }, {
  10179. qe: 0x0025,
  10180. nmps: 42,
  10181. nlps: 39,
  10182. switchFlag: 0
  10183. }, {
  10184. qe: 0x0015,
  10185. nmps: 43,
  10186. nlps: 40,
  10187. switchFlag: 0
  10188. }, {
  10189. qe: 0x0009,
  10190. nmps: 44,
  10191. nlps: 41,
  10192. switchFlag: 0
  10193. }, {
  10194. qe: 0x0005,
  10195. nmps: 45,
  10196. nlps: 42,
  10197. switchFlag: 0
  10198. }, {
  10199. qe: 0x0001,
  10200. nmps: 45,
  10201. nlps: 43,
  10202. switchFlag: 0
  10203. }, {
  10204. qe: 0x5601,
  10205. nmps: 46,
  10206. nlps: 46,
  10207. switchFlag: 0
  10208. }];
  10209. class ArithmeticDecoder {
  10210. constructor(data, start, end) {
  10211. this.data = data;
  10212. this.bp = start;
  10213. this.dataEnd = end;
  10214. this.chigh = data[start];
  10215. this.clow = 0;
  10216. this.byteIn();
  10217. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  10218. this.clow = this.clow << 7 & 0xffff;
  10219. this.ct -= 7;
  10220. this.a = 0x8000;
  10221. }
  10222. byteIn() {
  10223. const data = this.data;
  10224. let bp = this.bp;
  10225. if (data[bp] === 0xff) {
  10226. if (data[bp + 1] > 0x8f) {
  10227. this.clow += 0xff00;
  10228. this.ct = 8;
  10229. } else {
  10230. bp++;
  10231. this.clow += data[bp] << 9;
  10232. this.ct = 7;
  10233. this.bp = bp;
  10234. }
  10235. } else {
  10236. bp++;
  10237. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  10238. this.ct = 8;
  10239. this.bp = bp;
  10240. }
  10241. if (this.clow > 0xffff) {
  10242. this.chigh += this.clow >> 16;
  10243. this.clow &= 0xffff;
  10244. }
  10245. }
  10246. readBit(contexts, pos) {
  10247. let cx_index = contexts[pos] >> 1,
  10248. cx_mps = contexts[pos] & 1;
  10249. const qeTableIcx = QeTable[cx_index];
  10250. const qeIcx = qeTableIcx.qe;
  10251. let d;
  10252. let a = this.a - qeIcx;
  10253. if (this.chigh < qeIcx) {
  10254. if (a < qeIcx) {
  10255. a = qeIcx;
  10256. d = cx_mps;
  10257. cx_index = qeTableIcx.nmps;
  10258. } else {
  10259. a = qeIcx;
  10260. d = 1 ^ cx_mps;
  10261. if (qeTableIcx.switchFlag === 1) {
  10262. cx_mps = d;
  10263. }
  10264. cx_index = qeTableIcx.nlps;
  10265. }
  10266. } else {
  10267. this.chigh -= qeIcx;
  10268. if ((a & 0x8000) !== 0) {
  10269. this.a = a;
  10270. return cx_mps;
  10271. }
  10272. if (a < qeIcx) {
  10273. d = 1 ^ cx_mps;
  10274. if (qeTableIcx.switchFlag === 1) {
  10275. cx_mps = d;
  10276. }
  10277. cx_index = qeTableIcx.nlps;
  10278. } else {
  10279. d = cx_mps;
  10280. cx_index = qeTableIcx.nmps;
  10281. }
  10282. }
  10283. do {
  10284. if (this.ct === 0) {
  10285. this.byteIn();
  10286. }
  10287. a <<= 1;
  10288. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  10289. this.clow = this.clow << 1 & 0xffff;
  10290. this.ct--;
  10291. } while ((a & 0x8000) === 0);
  10292. this.a = a;
  10293. contexts[pos] = cx_index << 1 | cx_mps;
  10294. return d;
  10295. }
  10296. }
  10297. exports.ArithmeticDecoder = ArithmeticDecoder;
  10298. /***/ }),
  10299. /* 18 */
  10300. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10301. Object.defineProperty(exports, "__esModule", ({
  10302. value: true
  10303. }));
  10304. exports.JpegStream = void 0;
  10305. var _stream = __w_pdfjs_require__(12);
  10306. var _primitives = __w_pdfjs_require__(5);
  10307. var _jpg = __w_pdfjs_require__(19);
  10308. var _util = __w_pdfjs_require__(2);
  10309. const JpegStream = function JpegStreamClosure() {
  10310. function JpegStream(stream, maybeLength, dict, params) {
  10311. let ch;
  10312. while ((ch = stream.getByte()) !== -1) {
  10313. if (ch === 0xff) {
  10314. stream.skip(-1);
  10315. break;
  10316. }
  10317. }
  10318. this.stream = stream;
  10319. this.maybeLength = maybeLength;
  10320. this.dict = dict;
  10321. this.params = params;
  10322. _stream.DecodeStream.call(this, maybeLength);
  10323. }
  10324. JpegStream.prototype = Object.create(_stream.DecodeStream.prototype);
  10325. Object.defineProperty(JpegStream.prototype, "bytes", {
  10326. get: function JpegStream_bytes() {
  10327. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  10328. },
  10329. configurable: true
  10330. });
  10331. JpegStream.prototype.ensureBuffer = function (requested) {};
  10332. JpegStream.prototype.readBlock = function () {
  10333. if (this.eof) {
  10334. return;
  10335. }
  10336. const jpegOptions = {
  10337. decodeTransform: undefined,
  10338. colorTransform: undefined
  10339. };
  10340. const decodeArr = this.dict.getArray("Decode", "D");
  10341. if (this.forceRGB && Array.isArray(decodeArr)) {
  10342. const bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
  10343. const decodeArrLength = decodeArr.length;
  10344. const transform = new Int32Array(decodeArrLength);
  10345. let transformNeeded = false;
  10346. const maxValue = (1 << bitsPerComponent) - 1;
  10347. for (let i = 0; i < decodeArrLength; i += 2) {
  10348. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  10349. transform[i + 1] = decodeArr[i] * maxValue | 0;
  10350. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  10351. transformNeeded = true;
  10352. }
  10353. }
  10354. if (transformNeeded) {
  10355. jpegOptions.decodeTransform = transform;
  10356. }
  10357. }
  10358. if ((0, _primitives.isDict)(this.params)) {
  10359. const colorTransform = this.params.get("ColorTransform");
  10360. if (Number.isInteger(colorTransform)) {
  10361. jpegOptions.colorTransform = colorTransform;
  10362. }
  10363. }
  10364. const jpegImage = new _jpg.JpegImage(jpegOptions);
  10365. jpegImage.parse(this.bytes);
  10366. const data = jpegImage.getData({
  10367. width: this.drawWidth,
  10368. height: this.drawHeight,
  10369. forceRGB: this.forceRGB,
  10370. isSourcePDF: true
  10371. });
  10372. this.buffer = data;
  10373. this.bufferLength = data.length;
  10374. this.eof = true;
  10375. };
  10376. return JpegStream;
  10377. }();
  10378. exports.JpegStream = JpegStream;
  10379. /***/ }),
  10380. /* 19 */
  10381. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  10382. Object.defineProperty(exports, "__esModule", ({
  10383. value: true
  10384. }));
  10385. exports.JpegImage = void 0;
  10386. var _util = __w_pdfjs_require__(2);
  10387. var _core_utils = __w_pdfjs_require__(8);
  10388. class JpegError extends _util.BaseException {
  10389. constructor(msg) {
  10390. super(`JPEG error: ${msg}`);
  10391. }
  10392. }
  10393. class DNLMarkerError extends _util.BaseException {
  10394. constructor(message, scanLines) {
  10395. super(message);
  10396. this.scanLines = scanLines;
  10397. }
  10398. }
  10399. class EOIMarkerError extends _util.BaseException {}
  10400. var JpegImage = function JpegImageClosure() {
  10401. 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]);
  10402. var dctCos1 = 4017;
  10403. var dctSin1 = 799;
  10404. var dctCos3 = 3406;
  10405. var dctSin3 = 2276;
  10406. var dctCos6 = 1567;
  10407. var dctSin6 = 3784;
  10408. var dctSqrt2 = 5793;
  10409. var dctSqrt1d2 = 2896;
  10410. function JpegImage({
  10411. decodeTransform = null,
  10412. colorTransform = -1
  10413. } = {}) {
  10414. this._decodeTransform = decodeTransform;
  10415. this._colorTransform = colorTransform;
  10416. }
  10417. function buildHuffmanTable(codeLengths, values) {
  10418. var k = 0,
  10419. code = [],
  10420. i,
  10421. j,
  10422. length = 16;
  10423. while (length > 0 && !codeLengths[length - 1]) {
  10424. length--;
  10425. }
  10426. code.push({
  10427. children: [],
  10428. index: 0
  10429. });
  10430. var p = code[0],
  10431. q;
  10432. for (i = 0; i < length; i++) {
  10433. for (j = 0; j < codeLengths[i]; j++) {
  10434. p = code.pop();
  10435. p.children[p.index] = values[k];
  10436. while (p.index > 0) {
  10437. p = code.pop();
  10438. }
  10439. p.index++;
  10440. code.push(p);
  10441. while (code.length <= i) {
  10442. code.push(q = {
  10443. children: [],
  10444. index: 0
  10445. });
  10446. p.children[p.index] = q.children;
  10447. p = q;
  10448. }
  10449. k++;
  10450. }
  10451. if (i + 1 < length) {
  10452. code.push(q = {
  10453. children: [],
  10454. index: 0
  10455. });
  10456. p.children[p.index] = q.children;
  10457. p = q;
  10458. }
  10459. }
  10460. return code[0].children;
  10461. }
  10462. function getBlockBufferOffset(component, row, col) {
  10463. return 64 * ((component.blocksPerLine + 1) * row + col);
  10464. }
  10465. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  10466. var mcusPerLine = frame.mcusPerLine;
  10467. var progressive = frame.progressive;
  10468. const startOffset = offset;
  10469. let bitsData = 0,
  10470. bitsCount = 0;
  10471. function readBit() {
  10472. if (bitsCount > 0) {
  10473. bitsCount--;
  10474. return bitsData >> bitsCount & 1;
  10475. }
  10476. bitsData = data[offset++];
  10477. if (bitsData === 0xff) {
  10478. var nextByte = data[offset++];
  10479. if (nextByte) {
  10480. if (nextByte === 0xdc && parseDNLMarker) {
  10481. offset += 2;
  10482. const scanLines = (0, _core_utils.readUint16)(data, offset);
  10483. offset += 2;
  10484. if (scanLines > 0 && scanLines !== frame.scanLines) {
  10485. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  10486. }
  10487. } else if (nextByte === 0xd9) {
  10488. if (parseDNLMarker) {
  10489. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  10490. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  10491. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  10492. }
  10493. }
  10494. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  10495. }
  10496. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  10497. }
  10498. }
  10499. bitsCount = 7;
  10500. return bitsData >>> 7;
  10501. }
  10502. function decodeHuffman(tree) {
  10503. var node = tree;
  10504. while (true) {
  10505. node = node[readBit()];
  10506. switch (typeof node) {
  10507. case "number":
  10508. return node;
  10509. case "object":
  10510. continue;
  10511. }
  10512. throw new JpegError("invalid huffman sequence");
  10513. }
  10514. }
  10515. function receive(length) {
  10516. var n = 0;
  10517. while (length > 0) {
  10518. n = n << 1 | readBit();
  10519. length--;
  10520. }
  10521. return n;
  10522. }
  10523. function receiveAndExtend(length) {
  10524. if (length === 1) {
  10525. return readBit() === 1 ? 1 : -1;
  10526. }
  10527. var n = receive(length);
  10528. if (n >= 1 << length - 1) {
  10529. return n;
  10530. }
  10531. return n + (-1 << length) + 1;
  10532. }
  10533. function decodeBaseline(component, blockOffset) {
  10534. var t = decodeHuffman(component.huffmanTableDC);
  10535. var diff = t === 0 ? 0 : receiveAndExtend(t);
  10536. component.blockData[blockOffset] = component.pred += diff;
  10537. var k = 1;
  10538. while (k < 64) {
  10539. var rs = decodeHuffman(component.huffmanTableAC);
  10540. var s = rs & 15,
  10541. r = rs >> 4;
  10542. if (s === 0) {
  10543. if (r < 15) {
  10544. break;
  10545. }
  10546. k += 16;
  10547. continue;
  10548. }
  10549. k += r;
  10550. var z = dctZigZag[k];
  10551. component.blockData[blockOffset + z] = receiveAndExtend(s);
  10552. k++;
  10553. }
  10554. }
  10555. function decodeDCFirst(component, blockOffset) {
  10556. var t = decodeHuffman(component.huffmanTableDC);
  10557. var diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  10558. component.blockData[blockOffset] = component.pred += diff;
  10559. }
  10560. function decodeDCSuccessive(component, blockOffset) {
  10561. component.blockData[blockOffset] |= readBit() << successive;
  10562. }
  10563. var eobrun = 0;
  10564. function decodeACFirst(component, blockOffset) {
  10565. if (eobrun > 0) {
  10566. eobrun--;
  10567. return;
  10568. }
  10569. var k = spectralStart,
  10570. e = spectralEnd;
  10571. while (k <= e) {
  10572. var rs = decodeHuffman(component.huffmanTableAC);
  10573. var s = rs & 15,
  10574. r = rs >> 4;
  10575. if (s === 0) {
  10576. if (r < 15) {
  10577. eobrun = receive(r) + (1 << r) - 1;
  10578. break;
  10579. }
  10580. k += 16;
  10581. continue;
  10582. }
  10583. k += r;
  10584. var z = dctZigZag[k];
  10585. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  10586. k++;
  10587. }
  10588. }
  10589. var successiveACState = 0,
  10590. successiveACNextValue;
  10591. function decodeACSuccessive(component, blockOffset) {
  10592. var k = spectralStart;
  10593. var e = spectralEnd;
  10594. var r = 0;
  10595. var s;
  10596. var rs;
  10597. while (k <= e) {
  10598. const offsetZ = blockOffset + dctZigZag[k];
  10599. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  10600. switch (successiveACState) {
  10601. case 0:
  10602. rs = decodeHuffman(component.huffmanTableAC);
  10603. s = rs & 15;
  10604. r = rs >> 4;
  10605. if (s === 0) {
  10606. if (r < 15) {
  10607. eobrun = receive(r) + (1 << r);
  10608. successiveACState = 4;
  10609. } else {
  10610. r = 16;
  10611. successiveACState = 1;
  10612. }
  10613. } else {
  10614. if (s !== 1) {
  10615. throw new JpegError("invalid ACn encoding");
  10616. }
  10617. successiveACNextValue = receiveAndExtend(s);
  10618. successiveACState = r ? 2 : 3;
  10619. }
  10620. continue;
  10621. case 1:
  10622. case 2:
  10623. if (component.blockData[offsetZ]) {
  10624. component.blockData[offsetZ] += sign * (readBit() << successive);
  10625. } else {
  10626. r--;
  10627. if (r === 0) {
  10628. successiveACState = successiveACState === 2 ? 3 : 0;
  10629. }
  10630. }
  10631. break;
  10632. case 3:
  10633. if (component.blockData[offsetZ]) {
  10634. component.blockData[offsetZ] += sign * (readBit() << successive);
  10635. } else {
  10636. component.blockData[offsetZ] = successiveACNextValue << successive;
  10637. successiveACState = 0;
  10638. }
  10639. break;
  10640. case 4:
  10641. if (component.blockData[offsetZ]) {
  10642. component.blockData[offsetZ] += sign * (readBit() << successive);
  10643. }
  10644. break;
  10645. }
  10646. k++;
  10647. }
  10648. if (successiveACState === 4) {
  10649. eobrun--;
  10650. if (eobrun === 0) {
  10651. successiveACState = 0;
  10652. }
  10653. }
  10654. }
  10655. let blockRow = 0;
  10656. function decodeMcu(component, decode, mcu, row, col) {
  10657. var mcuRow = mcu / mcusPerLine | 0;
  10658. var mcuCol = mcu % mcusPerLine;
  10659. blockRow = mcuRow * component.v + row;
  10660. var blockCol = mcuCol * component.h + col;
  10661. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  10662. decode(component, blockOffset);
  10663. }
  10664. function decodeBlock(component, decode, mcu) {
  10665. blockRow = mcu / component.blocksPerLine | 0;
  10666. var blockCol = mcu % component.blocksPerLine;
  10667. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  10668. decode(component, blockOffset);
  10669. }
  10670. var componentsLength = components.length;
  10671. var component, i, j, k, n;
  10672. var decodeFn;
  10673. if (progressive) {
  10674. if (spectralStart === 0) {
  10675. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  10676. } else {
  10677. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  10678. }
  10679. } else {
  10680. decodeFn = decodeBaseline;
  10681. }
  10682. var mcu = 0,
  10683. fileMarker;
  10684. var mcuExpected;
  10685. if (componentsLength === 1) {
  10686. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  10687. } else {
  10688. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  10689. }
  10690. var h, v;
  10691. while (mcu <= mcuExpected) {
  10692. var mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  10693. if (mcuToRead > 0) {
  10694. for (i = 0; i < componentsLength; i++) {
  10695. components[i].pred = 0;
  10696. }
  10697. eobrun = 0;
  10698. if (componentsLength === 1) {
  10699. component = components[0];
  10700. for (n = 0; n < mcuToRead; n++) {
  10701. decodeBlock(component, decodeFn, mcu);
  10702. mcu++;
  10703. }
  10704. } else {
  10705. for (n = 0; n < mcuToRead; n++) {
  10706. for (i = 0; i < componentsLength; i++) {
  10707. component = components[i];
  10708. h = component.h;
  10709. v = component.v;
  10710. for (j = 0; j < v; j++) {
  10711. for (k = 0; k < h; k++) {
  10712. decodeMcu(component, decodeFn, mcu, j, k);
  10713. }
  10714. }
  10715. }
  10716. mcu++;
  10717. }
  10718. }
  10719. }
  10720. bitsCount = 0;
  10721. fileMarker = findNextFileMarker(data, offset);
  10722. if (!fileMarker) {
  10723. break;
  10724. }
  10725. if (fileMarker.invalid) {
  10726. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  10727. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  10728. offset = fileMarker.offset;
  10729. }
  10730. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  10731. offset += 2;
  10732. } else {
  10733. break;
  10734. }
  10735. }
  10736. return offset - startOffset;
  10737. }
  10738. function quantizeAndInverse(component, blockBufferOffset, p) {
  10739. var qt = component.quantizationTable,
  10740. blockData = component.blockData;
  10741. var v0, v1, v2, v3, v4, v5, v6, v7;
  10742. var p0, p1, p2, p3, p4, p5, p6, p7;
  10743. var t;
  10744. if (!qt) {
  10745. throw new JpegError("missing required Quantization Table.");
  10746. }
  10747. for (var row = 0; row < 64; row += 8) {
  10748. p0 = blockData[blockBufferOffset + row];
  10749. p1 = blockData[blockBufferOffset + row + 1];
  10750. p2 = blockData[blockBufferOffset + row + 2];
  10751. p3 = blockData[blockBufferOffset + row + 3];
  10752. p4 = blockData[blockBufferOffset + row + 4];
  10753. p5 = blockData[blockBufferOffset + row + 5];
  10754. p6 = blockData[blockBufferOffset + row + 6];
  10755. p7 = blockData[blockBufferOffset + row + 7];
  10756. p0 *= qt[row];
  10757. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  10758. t = dctSqrt2 * p0 + 512 >> 10;
  10759. p[row] = t;
  10760. p[row + 1] = t;
  10761. p[row + 2] = t;
  10762. p[row + 3] = t;
  10763. p[row + 4] = t;
  10764. p[row + 5] = t;
  10765. p[row + 6] = t;
  10766. p[row + 7] = t;
  10767. continue;
  10768. }
  10769. p1 *= qt[row + 1];
  10770. p2 *= qt[row + 2];
  10771. p3 *= qt[row + 3];
  10772. p4 *= qt[row + 4];
  10773. p5 *= qt[row + 5];
  10774. p6 *= qt[row + 6];
  10775. p7 *= qt[row + 7];
  10776. v0 = dctSqrt2 * p0 + 128 >> 8;
  10777. v1 = dctSqrt2 * p4 + 128 >> 8;
  10778. v2 = p2;
  10779. v3 = p6;
  10780. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  10781. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  10782. v5 = p3 << 4;
  10783. v6 = p5 << 4;
  10784. v0 = v0 + v1 + 1 >> 1;
  10785. v1 = v0 - v1;
  10786. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  10787. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  10788. v3 = t;
  10789. v4 = v4 + v6 + 1 >> 1;
  10790. v6 = v4 - v6;
  10791. v7 = v7 + v5 + 1 >> 1;
  10792. v5 = v7 - v5;
  10793. v0 = v0 + v3 + 1 >> 1;
  10794. v3 = v0 - v3;
  10795. v1 = v1 + v2 + 1 >> 1;
  10796. v2 = v1 - v2;
  10797. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  10798. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  10799. v7 = t;
  10800. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  10801. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  10802. v6 = t;
  10803. p[row] = v0 + v7;
  10804. p[row + 7] = v0 - v7;
  10805. p[row + 1] = v1 + v6;
  10806. p[row + 6] = v1 - v6;
  10807. p[row + 2] = v2 + v5;
  10808. p[row + 5] = v2 - v5;
  10809. p[row + 3] = v3 + v4;
  10810. p[row + 4] = v3 - v4;
  10811. }
  10812. for (var col = 0; col < 8; ++col) {
  10813. p0 = p[col];
  10814. p1 = p[col + 8];
  10815. p2 = p[col + 16];
  10816. p3 = p[col + 24];
  10817. p4 = p[col + 32];
  10818. p5 = p[col + 40];
  10819. p6 = p[col + 48];
  10820. p7 = p[col + 56];
  10821. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  10822. t = dctSqrt2 * p0 + 8192 >> 14;
  10823. if (t < -2040) {
  10824. t = 0;
  10825. } else if (t >= 2024) {
  10826. t = 255;
  10827. } else {
  10828. t = t + 2056 >> 4;
  10829. }
  10830. blockData[blockBufferOffset + col] = t;
  10831. blockData[blockBufferOffset + col + 8] = t;
  10832. blockData[blockBufferOffset + col + 16] = t;
  10833. blockData[blockBufferOffset + col + 24] = t;
  10834. blockData[blockBufferOffset + col + 32] = t;
  10835. blockData[blockBufferOffset + col + 40] = t;
  10836. blockData[blockBufferOffset + col + 48] = t;
  10837. blockData[blockBufferOffset + col + 56] = t;
  10838. continue;
  10839. }
  10840. v0 = dctSqrt2 * p0 + 2048 >> 12;
  10841. v1 = dctSqrt2 * p4 + 2048 >> 12;
  10842. v2 = p2;
  10843. v3 = p6;
  10844. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  10845. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  10846. v5 = p3;
  10847. v6 = p5;
  10848. v0 = (v0 + v1 + 1 >> 1) + 4112;
  10849. v1 = v0 - v1;
  10850. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  10851. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  10852. v3 = t;
  10853. v4 = v4 + v6 + 1 >> 1;
  10854. v6 = v4 - v6;
  10855. v7 = v7 + v5 + 1 >> 1;
  10856. v5 = v7 - v5;
  10857. v0 = v0 + v3 + 1 >> 1;
  10858. v3 = v0 - v3;
  10859. v1 = v1 + v2 + 1 >> 1;
  10860. v2 = v1 - v2;
  10861. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  10862. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  10863. v7 = t;
  10864. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  10865. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  10866. v6 = t;
  10867. p0 = v0 + v7;
  10868. p7 = v0 - v7;
  10869. p1 = v1 + v6;
  10870. p6 = v1 - v6;
  10871. p2 = v2 + v5;
  10872. p5 = v2 - v5;
  10873. p3 = v3 + v4;
  10874. p4 = v3 - v4;
  10875. if (p0 < 16) {
  10876. p0 = 0;
  10877. } else if (p0 >= 4080) {
  10878. p0 = 255;
  10879. } else {
  10880. p0 >>= 4;
  10881. }
  10882. if (p1 < 16) {
  10883. p1 = 0;
  10884. } else if (p1 >= 4080) {
  10885. p1 = 255;
  10886. } else {
  10887. p1 >>= 4;
  10888. }
  10889. if (p2 < 16) {
  10890. p2 = 0;
  10891. } else if (p2 >= 4080) {
  10892. p2 = 255;
  10893. } else {
  10894. p2 >>= 4;
  10895. }
  10896. if (p3 < 16) {
  10897. p3 = 0;
  10898. } else if (p3 >= 4080) {
  10899. p3 = 255;
  10900. } else {
  10901. p3 >>= 4;
  10902. }
  10903. if (p4 < 16) {
  10904. p4 = 0;
  10905. } else if (p4 >= 4080) {
  10906. p4 = 255;
  10907. } else {
  10908. p4 >>= 4;
  10909. }
  10910. if (p5 < 16) {
  10911. p5 = 0;
  10912. } else if (p5 >= 4080) {
  10913. p5 = 255;
  10914. } else {
  10915. p5 >>= 4;
  10916. }
  10917. if (p6 < 16) {
  10918. p6 = 0;
  10919. } else if (p6 >= 4080) {
  10920. p6 = 255;
  10921. } else {
  10922. p6 >>= 4;
  10923. }
  10924. if (p7 < 16) {
  10925. p7 = 0;
  10926. } else if (p7 >= 4080) {
  10927. p7 = 255;
  10928. } else {
  10929. p7 >>= 4;
  10930. }
  10931. blockData[blockBufferOffset + col] = p0;
  10932. blockData[blockBufferOffset + col + 8] = p1;
  10933. blockData[blockBufferOffset + col + 16] = p2;
  10934. blockData[blockBufferOffset + col + 24] = p3;
  10935. blockData[blockBufferOffset + col + 32] = p4;
  10936. blockData[blockBufferOffset + col + 40] = p5;
  10937. blockData[blockBufferOffset + col + 48] = p6;
  10938. blockData[blockBufferOffset + col + 56] = p7;
  10939. }
  10940. }
  10941. function buildComponentData(frame, component) {
  10942. var blocksPerLine = component.blocksPerLine;
  10943. var blocksPerColumn = component.blocksPerColumn;
  10944. var computationBuffer = new Int16Array(64);
  10945. for (var blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  10946. for (var blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  10947. var offset = getBlockBufferOffset(component, blockRow, blockCol);
  10948. quantizeAndInverse(component, offset, computationBuffer);
  10949. }
  10950. }
  10951. return component.blockData;
  10952. }
  10953. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  10954. const maxPos = data.length - 1;
  10955. var newPos = startPos < currentPos ? startPos : currentPos;
  10956. if (currentPos >= maxPos) {
  10957. return null;
  10958. }
  10959. var currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  10960. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  10961. return {
  10962. invalid: null,
  10963. marker: currentMarker,
  10964. offset: currentPos
  10965. };
  10966. }
  10967. var newMarker = (0, _core_utils.readUint16)(data, newPos);
  10968. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  10969. if (++newPos >= maxPos) {
  10970. return null;
  10971. }
  10972. newMarker = (0, _core_utils.readUint16)(data, newPos);
  10973. }
  10974. return {
  10975. invalid: currentMarker.toString(16),
  10976. marker: newMarker,
  10977. offset: newPos
  10978. };
  10979. }
  10980. JpegImage.prototype = {
  10981. parse(data, {
  10982. dnlScanLines = null
  10983. } = {}) {
  10984. function readDataBlock() {
  10985. const length = (0, _core_utils.readUint16)(data, offset);
  10986. offset += 2;
  10987. let endOffset = offset + length - 2;
  10988. var fileMarker = findNextFileMarker(data, endOffset, offset);
  10989. if (fileMarker && fileMarker.invalid) {
  10990. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  10991. endOffset = fileMarker.offset;
  10992. }
  10993. var array = data.subarray(offset, endOffset);
  10994. offset += array.length;
  10995. return array;
  10996. }
  10997. function prepareComponents(frame) {
  10998. var mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  10999. var mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  11000. for (var i = 0; i < frame.components.length; i++) {
  11001. component = frame.components[i];
  11002. var blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  11003. var blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  11004. var blocksPerLineForMcu = mcusPerLine * component.h;
  11005. var blocksPerColumnForMcu = mcusPerColumn * component.v;
  11006. var blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  11007. component.blockData = new Int16Array(blocksBufferSize);
  11008. component.blocksPerLine = blocksPerLine;
  11009. component.blocksPerColumn = blocksPerColumn;
  11010. }
  11011. frame.mcusPerLine = mcusPerLine;
  11012. frame.mcusPerColumn = mcusPerColumn;
  11013. }
  11014. var offset = 0;
  11015. var jfif = null;
  11016. var adobe = null;
  11017. var frame, resetInterval;
  11018. let numSOSMarkers = 0;
  11019. var quantizationTables = [];
  11020. var huffmanTablesAC = [],
  11021. huffmanTablesDC = [];
  11022. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  11023. offset += 2;
  11024. if (fileMarker !== 0xffd8) {
  11025. throw new JpegError("SOI not found");
  11026. }
  11027. fileMarker = (0, _core_utils.readUint16)(data, offset);
  11028. offset += 2;
  11029. markerLoop: while (fileMarker !== 0xffd9) {
  11030. var i, j, l;
  11031. switch (fileMarker) {
  11032. case 0xffe0:
  11033. case 0xffe1:
  11034. case 0xffe2:
  11035. case 0xffe3:
  11036. case 0xffe4:
  11037. case 0xffe5:
  11038. case 0xffe6:
  11039. case 0xffe7:
  11040. case 0xffe8:
  11041. case 0xffe9:
  11042. case 0xffea:
  11043. case 0xffeb:
  11044. case 0xffec:
  11045. case 0xffed:
  11046. case 0xffee:
  11047. case 0xffef:
  11048. case 0xfffe:
  11049. var appData = readDataBlock();
  11050. if (fileMarker === 0xffe0) {
  11051. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  11052. jfif = {
  11053. version: {
  11054. major: appData[5],
  11055. minor: appData[6]
  11056. },
  11057. densityUnits: appData[7],
  11058. xDensity: appData[8] << 8 | appData[9],
  11059. yDensity: appData[10] << 8 | appData[11],
  11060. thumbWidth: appData[12],
  11061. thumbHeight: appData[13],
  11062. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  11063. };
  11064. }
  11065. }
  11066. if (fileMarker === 0xffee) {
  11067. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  11068. adobe = {
  11069. version: appData[5] << 8 | appData[6],
  11070. flags0: appData[7] << 8 | appData[8],
  11071. flags1: appData[9] << 8 | appData[10],
  11072. transformCode: appData[11]
  11073. };
  11074. }
  11075. }
  11076. break;
  11077. case 0xffdb:
  11078. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  11079. offset += 2;
  11080. var quantizationTablesEnd = quantizationTablesLength + offset - 2;
  11081. var z;
  11082. while (offset < quantizationTablesEnd) {
  11083. var quantizationTableSpec = data[offset++];
  11084. var tableData = new Uint16Array(64);
  11085. if (quantizationTableSpec >> 4 === 0) {
  11086. for (j = 0; j < 64; j++) {
  11087. z = dctZigZag[j];
  11088. tableData[z] = data[offset++];
  11089. }
  11090. } else if (quantizationTableSpec >> 4 === 1) {
  11091. for (j = 0; j < 64; j++) {
  11092. z = dctZigZag[j];
  11093. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  11094. offset += 2;
  11095. }
  11096. } else {
  11097. throw new JpegError("DQT - invalid table spec");
  11098. }
  11099. quantizationTables[quantizationTableSpec & 15] = tableData;
  11100. }
  11101. break;
  11102. case 0xffc0:
  11103. case 0xffc1:
  11104. case 0xffc2:
  11105. if (frame) {
  11106. throw new JpegError("Only single frame JPEGs supported");
  11107. }
  11108. offset += 2;
  11109. frame = {};
  11110. frame.extended = fileMarker === 0xffc1;
  11111. frame.progressive = fileMarker === 0xffc2;
  11112. frame.precision = data[offset++];
  11113. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  11114. offset += 2;
  11115. frame.scanLines = dnlScanLines || sofScanLines;
  11116. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  11117. offset += 2;
  11118. frame.components = [];
  11119. frame.componentIds = {};
  11120. var componentsCount = data[offset++],
  11121. componentId;
  11122. var maxH = 0,
  11123. maxV = 0;
  11124. for (i = 0; i < componentsCount; i++) {
  11125. componentId = data[offset];
  11126. var h = data[offset + 1] >> 4;
  11127. var v = data[offset + 1] & 15;
  11128. if (maxH < h) {
  11129. maxH = h;
  11130. }
  11131. if (maxV < v) {
  11132. maxV = v;
  11133. }
  11134. var qId = data[offset + 2];
  11135. l = frame.components.push({
  11136. h,
  11137. v,
  11138. quantizationId: qId,
  11139. quantizationTable: null
  11140. });
  11141. frame.componentIds[componentId] = l - 1;
  11142. offset += 3;
  11143. }
  11144. frame.maxH = maxH;
  11145. frame.maxV = maxV;
  11146. prepareComponents(frame);
  11147. break;
  11148. case 0xffc4:
  11149. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  11150. offset += 2;
  11151. for (i = 2; i < huffmanLength;) {
  11152. var huffmanTableSpec = data[offset++];
  11153. var codeLengths = new Uint8Array(16);
  11154. var codeLengthSum = 0;
  11155. for (j = 0; j < 16; j++, offset++) {
  11156. codeLengthSum += codeLengths[j] = data[offset];
  11157. }
  11158. var huffmanValues = new Uint8Array(codeLengthSum);
  11159. for (j = 0; j < codeLengthSum; j++, offset++) {
  11160. huffmanValues[j] = data[offset];
  11161. }
  11162. i += 17 + codeLengthSum;
  11163. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  11164. }
  11165. break;
  11166. case 0xffdd:
  11167. offset += 2;
  11168. resetInterval = (0, _core_utils.readUint16)(data, offset);
  11169. offset += 2;
  11170. break;
  11171. case 0xffda:
  11172. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  11173. offset += 2;
  11174. var selectorsCount = data[offset++];
  11175. var components = [],
  11176. component;
  11177. for (i = 0; i < selectorsCount; i++) {
  11178. const index = data[offset++];
  11179. var componentIndex = frame.componentIds[index];
  11180. component = frame.components[componentIndex];
  11181. component.index = index;
  11182. var tableSpec = data[offset++];
  11183. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  11184. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  11185. components.push(component);
  11186. }
  11187. var spectralStart = data[offset++];
  11188. var spectralEnd = data[offset++];
  11189. var successiveApproximation = data[offset++];
  11190. try {
  11191. var processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  11192. offset += processed;
  11193. } catch (ex) {
  11194. if (ex instanceof DNLMarkerError) {
  11195. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  11196. return this.parse(data, {
  11197. dnlScanLines: ex.scanLines
  11198. });
  11199. } else if (ex instanceof EOIMarkerError) {
  11200. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  11201. break markerLoop;
  11202. }
  11203. throw ex;
  11204. }
  11205. break;
  11206. case 0xffdc:
  11207. offset += 4;
  11208. break;
  11209. case 0xffff:
  11210. if (data[offset] !== 0xff) {
  11211. offset--;
  11212. }
  11213. break;
  11214. default:
  11215. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  11216. if (nextFileMarker && nextFileMarker.invalid) {
  11217. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  11218. offset = nextFileMarker.offset;
  11219. break;
  11220. }
  11221. if (!nextFileMarker || offset >= data.length - 1) {
  11222. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  11223. break markerLoop;
  11224. }
  11225. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  11226. }
  11227. fileMarker = (0, _core_utils.readUint16)(data, offset);
  11228. offset += 2;
  11229. }
  11230. this.width = frame.samplesPerLine;
  11231. this.height = frame.scanLines;
  11232. this.jfif = jfif;
  11233. this.adobe = adobe;
  11234. this.components = [];
  11235. for (i = 0; i < frame.components.length; i++) {
  11236. component = frame.components[i];
  11237. var quantizationTable = quantizationTables[component.quantizationId];
  11238. if (quantizationTable) {
  11239. component.quantizationTable = quantizationTable;
  11240. }
  11241. this.components.push({
  11242. index: component.index,
  11243. output: buildComponentData(frame, component),
  11244. scaleX: component.h / frame.maxH,
  11245. scaleY: component.v / frame.maxV,
  11246. blocksPerLine: component.blocksPerLine,
  11247. blocksPerColumn: component.blocksPerColumn
  11248. });
  11249. }
  11250. this.numComponents = this.components.length;
  11251. return undefined;
  11252. },
  11253. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  11254. var scaleX = this.width / width,
  11255. scaleY = this.height / height;
  11256. var component, componentScaleX, componentScaleY, blocksPerScanline;
  11257. var x, y, i, j, k;
  11258. var index;
  11259. var offset = 0;
  11260. var output;
  11261. var numComponents = this.components.length;
  11262. var dataLength = width * height * numComponents;
  11263. var data = new Uint8ClampedArray(dataLength);
  11264. var xScaleBlockOffset = new Uint32Array(width);
  11265. var mask3LSB = 0xfffffff8;
  11266. let lastComponentScaleX;
  11267. for (i = 0; i < numComponents; i++) {
  11268. component = this.components[i];
  11269. componentScaleX = component.scaleX * scaleX;
  11270. componentScaleY = component.scaleY * scaleY;
  11271. offset = i;
  11272. output = component.output;
  11273. blocksPerScanline = component.blocksPerLine + 1 << 3;
  11274. if (componentScaleX !== lastComponentScaleX) {
  11275. for (x = 0; x < width; x++) {
  11276. j = 0 | x * componentScaleX;
  11277. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  11278. }
  11279. lastComponentScaleX = componentScaleX;
  11280. }
  11281. for (y = 0; y < height; y++) {
  11282. j = 0 | y * componentScaleY;
  11283. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  11284. for (x = 0; x < width; x++) {
  11285. data[offset] = output[index + xScaleBlockOffset[x]];
  11286. offset += numComponents;
  11287. }
  11288. }
  11289. }
  11290. let transform = this._decodeTransform;
  11291. if (!isSourcePDF && numComponents === 4 && !transform) {
  11292. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  11293. }
  11294. if (transform) {
  11295. for (i = 0; i < dataLength;) {
  11296. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  11297. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  11298. }
  11299. }
  11300. }
  11301. return data;
  11302. },
  11303. get _isColorConversionNeeded() {
  11304. if (this.adobe) {
  11305. return !!this.adobe.transformCode;
  11306. }
  11307. if (this.numComponents === 3) {
  11308. if (this._colorTransform === 0) {
  11309. return false;
  11310. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  11311. return false;
  11312. }
  11313. return true;
  11314. }
  11315. if (this._colorTransform === 1) {
  11316. return true;
  11317. }
  11318. return false;
  11319. },
  11320. _convertYccToRgb: function convertYccToRgb(data) {
  11321. var Y, Cb, Cr;
  11322. for (var i = 0, length = data.length; i < length; i += 3) {
  11323. Y = data[i];
  11324. Cb = data[i + 1];
  11325. Cr = data[i + 2];
  11326. data[i] = Y - 179.456 + 1.402 * Cr;
  11327. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  11328. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  11329. }
  11330. return data;
  11331. },
  11332. _convertYcckToRgb: function convertYcckToRgb(data) {
  11333. var Y, Cb, Cr, k;
  11334. var offset = 0;
  11335. for (var i = 0, length = data.length; i < length; i += 4) {
  11336. Y = data[i];
  11337. Cb = data[i + 1];
  11338. Cr = data[i + 2];
  11339. k = data[i + 3];
  11340. 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);
  11341. 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);
  11342. 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);
  11343. }
  11344. return data.subarray(0, offset);
  11345. },
  11346. _convertYcckToCmyk: function convertYcckToCmyk(data) {
  11347. var Y, Cb, Cr;
  11348. for (var i = 0, length = data.length; i < length; i += 4) {
  11349. Y = data[i];
  11350. Cb = data[i + 1];
  11351. Cr = data[i + 2];
  11352. data[i] = 434.456 - Y - 1.402 * Cr;
  11353. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  11354. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  11355. }
  11356. return data;
  11357. },
  11358. _convertCmykToRgb: function convertCmykToRgb(data) {
  11359. var c, m, y, k;
  11360. var offset = 0;
  11361. for (var i = 0, length = data.length; i < length; i += 4) {
  11362. c = data[i];
  11363. m = data[i + 1];
  11364. y = data[i + 2];
  11365. k = data[i + 3];
  11366. 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);
  11367. 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);
  11368. 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);
  11369. }
  11370. return data.subarray(0, offset);
  11371. },
  11372. getData({
  11373. width,
  11374. height,
  11375. forceRGB = false,
  11376. isSourcePDF = false
  11377. }) {
  11378. if (this.numComponents > 4) {
  11379. throw new JpegError("Unsupported color mode");
  11380. }
  11381. var data = this._getLinearizedBlockData(width, height, isSourcePDF);
  11382. if (this.numComponents === 1 && forceRGB) {
  11383. var dataLength = data.length;
  11384. var rgbData = new Uint8ClampedArray(dataLength * 3);
  11385. var offset = 0;
  11386. for (var i = 0; i < dataLength; i++) {
  11387. var grayColor = data[i];
  11388. rgbData[offset++] = grayColor;
  11389. rgbData[offset++] = grayColor;
  11390. rgbData[offset++] = grayColor;
  11391. }
  11392. return rgbData;
  11393. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  11394. return this._convertYccToRgb(data);
  11395. } else if (this.numComponents === 4) {
  11396. if (this._isColorConversionNeeded) {
  11397. if (forceRGB) {
  11398. return this._convertYcckToRgb(data);
  11399. }
  11400. return this._convertYcckToCmyk(data);
  11401. } else if (forceRGB) {
  11402. return this._convertCmykToRgb(data);
  11403. }
  11404. }
  11405. return data;
  11406. }
  11407. };
  11408. return JpegImage;
  11409. }();
  11410. exports.JpegImage = JpegImage;
  11411. /***/ }),
  11412. /* 20 */
  11413. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11414. Object.defineProperty(exports, "__esModule", ({
  11415. value: true
  11416. }));
  11417. exports.JpxStream = void 0;
  11418. var _stream = __w_pdfjs_require__(12);
  11419. var _jpx = __w_pdfjs_require__(21);
  11420. var _util = __w_pdfjs_require__(2);
  11421. const JpxStream = function JpxStreamClosure() {
  11422. function JpxStream(stream, maybeLength, dict, params) {
  11423. this.stream = stream;
  11424. this.maybeLength = maybeLength;
  11425. this.dict = dict;
  11426. this.params = params;
  11427. _stream.DecodeStream.call(this, maybeLength);
  11428. }
  11429. JpxStream.prototype = Object.create(_stream.DecodeStream.prototype);
  11430. Object.defineProperty(JpxStream.prototype, "bytes", {
  11431. get: function JpxStream_bytes() {
  11432. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  11433. },
  11434. configurable: true
  11435. });
  11436. JpxStream.prototype.ensureBuffer = function (requested) {};
  11437. JpxStream.prototype.readBlock = function () {
  11438. if (this.eof) {
  11439. return;
  11440. }
  11441. const jpxImage = new _jpx.JpxImage();
  11442. jpxImage.parse(this.bytes);
  11443. const width = jpxImage.width;
  11444. const height = jpxImage.height;
  11445. const componentsCount = jpxImage.componentsCount;
  11446. const tileCount = jpxImage.tiles.length;
  11447. if (tileCount === 1) {
  11448. this.buffer = jpxImage.tiles[0].items;
  11449. } else {
  11450. const data = new Uint8ClampedArray(width * height * componentsCount);
  11451. for (let k = 0; k < tileCount; k++) {
  11452. const tileComponents = jpxImage.tiles[k];
  11453. const tileWidth = tileComponents.width;
  11454. const tileHeight = tileComponents.height;
  11455. const tileLeft = tileComponents.left;
  11456. const tileTop = tileComponents.top;
  11457. const src = tileComponents.items;
  11458. let srcPosition = 0;
  11459. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  11460. const imgRowSize = width * componentsCount;
  11461. const tileRowSize = tileWidth * componentsCount;
  11462. for (let j = 0; j < tileHeight; j++) {
  11463. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  11464. data.set(rowBytes, dataPosition);
  11465. srcPosition += tileRowSize;
  11466. dataPosition += imgRowSize;
  11467. }
  11468. }
  11469. this.buffer = data;
  11470. }
  11471. this.bufferLength = this.buffer.length;
  11472. this.eof = true;
  11473. };
  11474. return JpxStream;
  11475. }();
  11476. exports.JpxStream = JpxStream;
  11477. /***/ }),
  11478. /* 21 */
  11479. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  11480. Object.defineProperty(exports, "__esModule", ({
  11481. value: true
  11482. }));
  11483. exports.JpxImage = void 0;
  11484. var _util = __w_pdfjs_require__(2);
  11485. var _core_utils = __w_pdfjs_require__(8);
  11486. var _arithmetic_decoder = __w_pdfjs_require__(17);
  11487. class JpxError extends _util.BaseException {
  11488. constructor(msg) {
  11489. super(`JPX error: ${msg}`);
  11490. }
  11491. }
  11492. var JpxImage = function JpxImageClosure() {
  11493. var SubbandsGainLog2 = {
  11494. LL: 0,
  11495. LH: 1,
  11496. HL: 1,
  11497. HH: 2
  11498. };
  11499. function JpxImage() {
  11500. this.failOnCorruptedImage = false;
  11501. }
  11502. JpxImage.prototype = {
  11503. parse: function JpxImage_parse(data) {
  11504. var head = (0, _core_utils.readUint16)(data, 0);
  11505. if (head === 0xff4f) {
  11506. this.parseCodestream(data, 0, data.length);
  11507. return;
  11508. }
  11509. var position = 0,
  11510. length = data.length;
  11511. while (position < length) {
  11512. var headerSize = 8;
  11513. var lbox = (0, _core_utils.readUint32)(data, position);
  11514. var tbox = (0, _core_utils.readUint32)(data, position + 4);
  11515. position += headerSize;
  11516. if (lbox === 1) {
  11517. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  11518. position += 8;
  11519. headerSize += 8;
  11520. }
  11521. if (lbox === 0) {
  11522. lbox = length - position + headerSize;
  11523. }
  11524. if (lbox < headerSize) {
  11525. throw new JpxError("Invalid box field size");
  11526. }
  11527. var dataLength = lbox - headerSize;
  11528. var jumpDataLength = true;
  11529. switch (tbox) {
  11530. case 0x6a703268:
  11531. jumpDataLength = false;
  11532. break;
  11533. case 0x636f6c72:
  11534. var method = data[position];
  11535. if (method === 1) {
  11536. var colorspace = (0, _core_utils.readUint32)(data, position + 3);
  11537. switch (colorspace) {
  11538. case 16:
  11539. case 17:
  11540. case 18:
  11541. break;
  11542. default:
  11543. (0, _util.warn)("Unknown colorspace " + colorspace);
  11544. break;
  11545. }
  11546. } else if (method === 2) {
  11547. (0, _util.info)("ICC profile not supported");
  11548. }
  11549. break;
  11550. case 0x6a703263:
  11551. this.parseCodestream(data, position, position + dataLength);
  11552. break;
  11553. case 0x6a502020:
  11554. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  11555. (0, _util.warn)("Invalid JP2 signature");
  11556. }
  11557. break;
  11558. case 0x6a501a1a:
  11559. case 0x66747970:
  11560. case 0x72726571:
  11561. case 0x72657320:
  11562. case 0x69686472:
  11563. break;
  11564. default:
  11565. var headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  11566. (0, _util.warn)("Unsupported header type " + tbox + " (" + headerType + ")");
  11567. break;
  11568. }
  11569. if (jumpDataLength) {
  11570. position += dataLength;
  11571. }
  11572. }
  11573. },
  11574. parseImageProperties: function JpxImage_parseImageProperties(stream) {
  11575. var newByte = stream.getByte();
  11576. while (newByte >= 0) {
  11577. var oldByte = newByte;
  11578. newByte = stream.getByte();
  11579. var code = oldByte << 8 | newByte;
  11580. if (code === 0xff51) {
  11581. stream.skip(4);
  11582. var Xsiz = stream.getInt32() >>> 0;
  11583. var Ysiz = stream.getInt32() >>> 0;
  11584. var XOsiz = stream.getInt32() >>> 0;
  11585. var YOsiz = stream.getInt32() >>> 0;
  11586. stream.skip(16);
  11587. var Csiz = stream.getUint16();
  11588. this.width = Xsiz - XOsiz;
  11589. this.height = Ysiz - YOsiz;
  11590. this.componentsCount = Csiz;
  11591. this.bitsPerComponent = 8;
  11592. return;
  11593. }
  11594. }
  11595. throw new JpxError("No size marker found in JPX stream");
  11596. },
  11597. parseCodestream: function JpxImage_parseCodestream(data, start, end) {
  11598. var context = {};
  11599. var doNotRecover = false;
  11600. try {
  11601. var position = start;
  11602. while (position + 1 < end) {
  11603. var code = (0, _core_utils.readUint16)(data, position);
  11604. position += 2;
  11605. var length = 0,
  11606. j,
  11607. sqcd,
  11608. spqcds,
  11609. spqcdSize,
  11610. scalarExpounded,
  11611. tile;
  11612. switch (code) {
  11613. case 0xff4f:
  11614. context.mainHeader = true;
  11615. break;
  11616. case 0xffd9:
  11617. break;
  11618. case 0xff51:
  11619. length = (0, _core_utils.readUint16)(data, position);
  11620. var siz = {};
  11621. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  11622. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  11623. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  11624. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  11625. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  11626. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  11627. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  11628. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  11629. var componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  11630. siz.Csiz = componentsCount;
  11631. var components = [];
  11632. j = position + 38;
  11633. for (var i = 0; i < componentsCount; i++) {
  11634. var component = {
  11635. precision: (data[j] & 0x7f) + 1,
  11636. isSigned: !!(data[j] & 0x80),
  11637. XRsiz: data[j + 1],
  11638. YRsiz: data[j + 2]
  11639. };
  11640. j += 3;
  11641. calculateComponentDimensions(component, siz);
  11642. components.push(component);
  11643. }
  11644. context.SIZ = siz;
  11645. context.components = components;
  11646. calculateTileGrids(context, components);
  11647. context.QCC = [];
  11648. context.COC = [];
  11649. break;
  11650. case 0xff5c:
  11651. length = (0, _core_utils.readUint16)(data, position);
  11652. var qcd = {};
  11653. j = position + 2;
  11654. sqcd = data[j++];
  11655. switch (sqcd & 0x1f) {
  11656. case 0:
  11657. spqcdSize = 8;
  11658. scalarExpounded = true;
  11659. break;
  11660. case 1:
  11661. spqcdSize = 16;
  11662. scalarExpounded = false;
  11663. break;
  11664. case 2:
  11665. spqcdSize = 16;
  11666. scalarExpounded = true;
  11667. break;
  11668. default:
  11669. throw new Error("Invalid SQcd value " + sqcd);
  11670. }
  11671. qcd.noQuantization = spqcdSize === 8;
  11672. qcd.scalarExpounded = scalarExpounded;
  11673. qcd.guardBits = sqcd >> 5;
  11674. spqcds = [];
  11675. while (j < length + position) {
  11676. var spqcd = {};
  11677. if (spqcdSize === 8) {
  11678. spqcd.epsilon = data[j++] >> 3;
  11679. spqcd.mu = 0;
  11680. } else {
  11681. spqcd.epsilon = data[j] >> 3;
  11682. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  11683. j += 2;
  11684. }
  11685. spqcds.push(spqcd);
  11686. }
  11687. qcd.SPqcds = spqcds;
  11688. if (context.mainHeader) {
  11689. context.QCD = qcd;
  11690. } else {
  11691. context.currentTile.QCD = qcd;
  11692. context.currentTile.QCC = [];
  11693. }
  11694. break;
  11695. case 0xff5d:
  11696. length = (0, _core_utils.readUint16)(data, position);
  11697. var qcc = {};
  11698. j = position + 2;
  11699. var cqcc;
  11700. if (context.SIZ.Csiz < 257) {
  11701. cqcc = data[j++];
  11702. } else {
  11703. cqcc = (0, _core_utils.readUint16)(data, j);
  11704. j += 2;
  11705. }
  11706. sqcd = data[j++];
  11707. switch (sqcd & 0x1f) {
  11708. case 0:
  11709. spqcdSize = 8;
  11710. scalarExpounded = true;
  11711. break;
  11712. case 1:
  11713. spqcdSize = 16;
  11714. scalarExpounded = false;
  11715. break;
  11716. case 2:
  11717. spqcdSize = 16;
  11718. scalarExpounded = true;
  11719. break;
  11720. default:
  11721. throw new Error("Invalid SQcd value " + sqcd);
  11722. }
  11723. qcc.noQuantization = spqcdSize === 8;
  11724. qcc.scalarExpounded = scalarExpounded;
  11725. qcc.guardBits = sqcd >> 5;
  11726. spqcds = [];
  11727. while (j < length + position) {
  11728. spqcd = {};
  11729. if (spqcdSize === 8) {
  11730. spqcd.epsilon = data[j++] >> 3;
  11731. spqcd.mu = 0;
  11732. } else {
  11733. spqcd.epsilon = data[j] >> 3;
  11734. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  11735. j += 2;
  11736. }
  11737. spqcds.push(spqcd);
  11738. }
  11739. qcc.SPqcds = spqcds;
  11740. if (context.mainHeader) {
  11741. context.QCC[cqcc] = qcc;
  11742. } else {
  11743. context.currentTile.QCC[cqcc] = qcc;
  11744. }
  11745. break;
  11746. case 0xff52:
  11747. length = (0, _core_utils.readUint16)(data, position);
  11748. var cod = {};
  11749. j = position + 2;
  11750. var scod = data[j++];
  11751. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  11752. cod.sopMarkerUsed = !!(scod & 2);
  11753. cod.ephMarkerUsed = !!(scod & 4);
  11754. cod.progressionOrder = data[j++];
  11755. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  11756. j += 2;
  11757. cod.multipleComponentTransform = data[j++];
  11758. cod.decompositionLevelsCount = data[j++];
  11759. cod.xcb = (data[j++] & 0xf) + 2;
  11760. cod.ycb = (data[j++] & 0xf) + 2;
  11761. var blockStyle = data[j++];
  11762. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  11763. cod.resetContextProbabilities = !!(blockStyle & 2);
  11764. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  11765. cod.verticallyStripe = !!(blockStyle & 8);
  11766. cod.predictableTermination = !!(blockStyle & 16);
  11767. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  11768. cod.reversibleTransformation = data[j++];
  11769. if (cod.entropyCoderWithCustomPrecincts) {
  11770. var precinctsSizes = [];
  11771. while (j < length + position) {
  11772. var precinctsSize = data[j++];
  11773. precinctsSizes.push({
  11774. PPx: precinctsSize & 0xf,
  11775. PPy: precinctsSize >> 4
  11776. });
  11777. }
  11778. cod.precinctsSizes = precinctsSizes;
  11779. }
  11780. var unsupported = [];
  11781. if (cod.selectiveArithmeticCodingBypass) {
  11782. unsupported.push("selectiveArithmeticCodingBypass");
  11783. }
  11784. if (cod.resetContextProbabilities) {
  11785. unsupported.push("resetContextProbabilities");
  11786. }
  11787. if (cod.terminationOnEachCodingPass) {
  11788. unsupported.push("terminationOnEachCodingPass");
  11789. }
  11790. if (cod.verticallyStripe) {
  11791. unsupported.push("verticallyStripe");
  11792. }
  11793. if (cod.predictableTermination) {
  11794. unsupported.push("predictableTermination");
  11795. }
  11796. if (unsupported.length > 0) {
  11797. doNotRecover = true;
  11798. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  11799. }
  11800. if (context.mainHeader) {
  11801. context.COD = cod;
  11802. } else {
  11803. context.currentTile.COD = cod;
  11804. context.currentTile.COC = [];
  11805. }
  11806. break;
  11807. case 0xff90:
  11808. length = (0, _core_utils.readUint16)(data, position);
  11809. tile = {};
  11810. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  11811. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  11812. tile.dataEnd = tile.length + position - 2;
  11813. tile.partIndex = data[position + 8];
  11814. tile.partsCount = data[position + 9];
  11815. context.mainHeader = false;
  11816. if (tile.partIndex === 0) {
  11817. tile.COD = context.COD;
  11818. tile.COC = context.COC.slice(0);
  11819. tile.QCD = context.QCD;
  11820. tile.QCC = context.QCC.slice(0);
  11821. }
  11822. context.currentTile = tile;
  11823. break;
  11824. case 0xff93:
  11825. tile = context.currentTile;
  11826. if (tile.partIndex === 0) {
  11827. initializeTile(context, tile.index);
  11828. buildPackets(context);
  11829. }
  11830. length = tile.dataEnd - position;
  11831. parseTilePackets(context, data, position, length);
  11832. break;
  11833. case 0xff53:
  11834. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  11835. case 0xff55:
  11836. case 0xff57:
  11837. case 0xff58:
  11838. case 0xff64:
  11839. length = (0, _core_utils.readUint16)(data, position);
  11840. break;
  11841. default:
  11842. throw new Error("Unknown codestream code: " + code.toString(16));
  11843. }
  11844. position += length;
  11845. }
  11846. } catch (e) {
  11847. if (doNotRecover || this.failOnCorruptedImage) {
  11848. throw new JpxError(e.message);
  11849. } else {
  11850. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  11851. }
  11852. }
  11853. this.tiles = transformComponents(context);
  11854. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  11855. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  11856. this.componentsCount = context.SIZ.Csiz;
  11857. }
  11858. };
  11859. function calculateComponentDimensions(component, siz) {
  11860. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  11861. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  11862. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  11863. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  11864. component.width = component.x1 - component.x0;
  11865. component.height = component.y1 - component.y0;
  11866. }
  11867. function calculateTileGrids(context, components) {
  11868. var siz = context.SIZ;
  11869. var tile,
  11870. tiles = [];
  11871. var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  11872. var numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  11873. for (var q = 0; q < numYtiles; q++) {
  11874. for (var p = 0; p < numXtiles; p++) {
  11875. tile = {};
  11876. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  11877. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  11878. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  11879. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  11880. tile.width = tile.tx1 - tile.tx0;
  11881. tile.height = tile.ty1 - tile.ty0;
  11882. tile.components = [];
  11883. tiles.push(tile);
  11884. }
  11885. }
  11886. context.tiles = tiles;
  11887. var componentsCount = siz.Csiz;
  11888. for (var i = 0, ii = componentsCount; i < ii; i++) {
  11889. var component = components[i];
  11890. for (var j = 0, jj = tiles.length; j < jj; j++) {
  11891. var tileComponent = {};
  11892. tile = tiles[j];
  11893. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  11894. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  11895. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  11896. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  11897. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  11898. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  11899. tile.components[i] = tileComponent;
  11900. }
  11901. }
  11902. }
  11903. function getBlocksDimensions(context, component, r) {
  11904. var codOrCoc = component.codingStyleParameters;
  11905. var result = {};
  11906. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  11907. result.PPx = 15;
  11908. result.PPy = 15;
  11909. } else {
  11910. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  11911. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  11912. }
  11913. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  11914. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  11915. return result;
  11916. }
  11917. function buildPrecincts(context, resolution, dimensions) {
  11918. var precinctWidth = 1 << dimensions.PPx;
  11919. var precinctHeight = 1 << dimensions.PPy;
  11920. var isZeroRes = resolution.resLevel === 0;
  11921. var precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  11922. var precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  11923. var numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  11924. var numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  11925. var numprecincts = numprecinctswide * numprecinctshigh;
  11926. resolution.precinctParameters = {
  11927. precinctWidth,
  11928. precinctHeight,
  11929. numprecinctswide,
  11930. numprecinctshigh,
  11931. numprecincts,
  11932. precinctWidthInSubband,
  11933. precinctHeightInSubband
  11934. };
  11935. }
  11936. function buildCodeblocks(context, subband, dimensions) {
  11937. var xcb_ = dimensions.xcb_;
  11938. var ycb_ = dimensions.ycb_;
  11939. var codeblockWidth = 1 << xcb_;
  11940. var codeblockHeight = 1 << ycb_;
  11941. var cbx0 = subband.tbx0 >> xcb_;
  11942. var cby0 = subband.tby0 >> ycb_;
  11943. var cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  11944. var cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  11945. var precinctParameters = subband.resolution.precinctParameters;
  11946. var codeblocks = [];
  11947. var precincts = [];
  11948. var i, j, codeblock, precinctNumber;
  11949. for (j = cby0; j < cby1; j++) {
  11950. for (i = cbx0; i < cbx1; i++) {
  11951. codeblock = {
  11952. cbx: i,
  11953. cby: j,
  11954. tbx0: codeblockWidth * i,
  11955. tby0: codeblockHeight * j,
  11956. tbx1: codeblockWidth * (i + 1),
  11957. tby1: codeblockHeight * (j + 1)
  11958. };
  11959. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  11960. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  11961. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  11962. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  11963. var pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  11964. var pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  11965. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  11966. codeblock.precinctNumber = precinctNumber;
  11967. codeblock.subbandType = subband.type;
  11968. codeblock.Lblock = 3;
  11969. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  11970. continue;
  11971. }
  11972. codeblocks.push(codeblock);
  11973. var precinct = precincts[precinctNumber];
  11974. if (precinct !== undefined) {
  11975. if (i < precinct.cbxMin) {
  11976. precinct.cbxMin = i;
  11977. } else if (i > precinct.cbxMax) {
  11978. precinct.cbxMax = i;
  11979. }
  11980. if (j < precinct.cbyMin) {
  11981. precinct.cbxMin = j;
  11982. } else if (j > precinct.cbyMax) {
  11983. precinct.cbyMax = j;
  11984. }
  11985. } else {
  11986. precincts[precinctNumber] = precinct = {
  11987. cbxMin: i,
  11988. cbyMin: j,
  11989. cbxMax: i,
  11990. cbyMax: j
  11991. };
  11992. }
  11993. codeblock.precinct = precinct;
  11994. }
  11995. }
  11996. subband.codeblockParameters = {
  11997. codeblockWidth: xcb_,
  11998. codeblockHeight: ycb_,
  11999. numcodeblockwide: cbx1 - cbx0 + 1,
  12000. numcodeblockhigh: cby1 - cby0 + 1
  12001. };
  12002. subband.codeblocks = codeblocks;
  12003. subband.precincts = precincts;
  12004. }
  12005. function createPacket(resolution, precinctNumber, layerNumber) {
  12006. var precinctCodeblocks = [];
  12007. var subbands = resolution.subbands;
  12008. for (var i = 0, ii = subbands.length; i < ii; i++) {
  12009. var subband = subbands[i];
  12010. var codeblocks = subband.codeblocks;
  12011. for (var j = 0, jj = codeblocks.length; j < jj; j++) {
  12012. var codeblock = codeblocks[j];
  12013. if (codeblock.precinctNumber !== precinctNumber) {
  12014. continue;
  12015. }
  12016. precinctCodeblocks.push(codeblock);
  12017. }
  12018. }
  12019. return {
  12020. layerNumber,
  12021. codeblocks: precinctCodeblocks
  12022. };
  12023. }
  12024. function LayerResolutionComponentPositionIterator(context) {
  12025. var siz = context.SIZ;
  12026. var tileIndex = context.currentTile.index;
  12027. var tile = context.tiles[tileIndex];
  12028. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  12029. var componentsCount = siz.Csiz;
  12030. var maxDecompositionLevelsCount = 0;
  12031. for (var q = 0; q < componentsCount; q++) {
  12032. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  12033. }
  12034. var l = 0,
  12035. r = 0,
  12036. i = 0,
  12037. k = 0;
  12038. this.nextPacket = function JpxImage_nextPacket() {
  12039. for (; l < layersCount; l++) {
  12040. for (; r <= maxDecompositionLevelsCount; r++) {
  12041. for (; i < componentsCount; i++) {
  12042. var component = tile.components[i];
  12043. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  12044. continue;
  12045. }
  12046. var resolution = component.resolutions[r];
  12047. var numprecincts = resolution.precinctParameters.numprecincts;
  12048. for (; k < numprecincts;) {
  12049. var packet = createPacket(resolution, k, l);
  12050. k++;
  12051. return packet;
  12052. }
  12053. k = 0;
  12054. }
  12055. i = 0;
  12056. }
  12057. r = 0;
  12058. }
  12059. throw new JpxError("Out of packets");
  12060. };
  12061. }
  12062. function ResolutionLayerComponentPositionIterator(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 maxDecompositionLevelsCount = 0;
  12069. for (var q = 0; q < componentsCount; q++) {
  12070. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  12071. }
  12072. var r = 0,
  12073. l = 0,
  12074. i = 0,
  12075. k = 0;
  12076. this.nextPacket = function JpxImage_nextPacket() {
  12077. for (; r <= maxDecompositionLevelsCount; r++) {
  12078. for (; l < layersCount; l++) {
  12079. for (; i < componentsCount; i++) {
  12080. var component = tile.components[i];
  12081. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  12082. continue;
  12083. }
  12084. var resolution = component.resolutions[r];
  12085. var numprecincts = resolution.precinctParameters.numprecincts;
  12086. for (; k < numprecincts;) {
  12087. var packet = createPacket(resolution, k, l);
  12088. k++;
  12089. return packet;
  12090. }
  12091. k = 0;
  12092. }
  12093. i = 0;
  12094. }
  12095. l = 0;
  12096. }
  12097. throw new JpxError("Out of packets");
  12098. };
  12099. }
  12100. function ResolutionPositionComponentLayerIterator(context) {
  12101. var siz = context.SIZ;
  12102. var tileIndex = context.currentTile.index;
  12103. var tile = context.tiles[tileIndex];
  12104. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  12105. var componentsCount = siz.Csiz;
  12106. var l, r, c, p;
  12107. var maxDecompositionLevelsCount = 0;
  12108. for (c = 0; c < componentsCount; c++) {
  12109. const component = tile.components[c];
  12110. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  12111. }
  12112. var maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  12113. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  12114. var maxNumPrecincts = 0;
  12115. for (c = 0; c < componentsCount; ++c) {
  12116. var resolutions = tile.components[c].resolutions;
  12117. if (r < resolutions.length) {
  12118. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  12119. }
  12120. }
  12121. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  12122. }
  12123. l = 0;
  12124. r = 0;
  12125. c = 0;
  12126. p = 0;
  12127. this.nextPacket = function JpxImage_nextPacket() {
  12128. for (; r <= maxDecompositionLevelsCount; r++) {
  12129. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  12130. for (; c < componentsCount; c++) {
  12131. const component = tile.components[c];
  12132. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  12133. continue;
  12134. }
  12135. var resolution = component.resolutions[r];
  12136. var numprecincts = resolution.precinctParameters.numprecincts;
  12137. if (p >= numprecincts) {
  12138. continue;
  12139. }
  12140. for (; l < layersCount;) {
  12141. var packet = createPacket(resolution, p, l);
  12142. l++;
  12143. return packet;
  12144. }
  12145. l = 0;
  12146. }
  12147. c = 0;
  12148. }
  12149. p = 0;
  12150. }
  12151. throw new JpxError("Out of packets");
  12152. };
  12153. }
  12154. function PositionComponentResolutionLayerIterator(context) {
  12155. var siz = context.SIZ;
  12156. var tileIndex = context.currentTile.index;
  12157. var tile = context.tiles[tileIndex];
  12158. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  12159. var componentsCount = siz.Csiz;
  12160. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  12161. var precinctsIterationSizes = precinctsSizes;
  12162. var l = 0,
  12163. r = 0,
  12164. c = 0,
  12165. px = 0,
  12166. py = 0;
  12167. this.nextPacket = function JpxImage_nextPacket() {
  12168. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  12169. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  12170. for (; c < componentsCount; c++) {
  12171. var component = tile.components[c];
  12172. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  12173. for (; r <= decompositionLevelsCount; r++) {
  12174. var resolution = component.resolutions[r];
  12175. var sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  12176. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  12177. if (k === null) {
  12178. continue;
  12179. }
  12180. for (; l < layersCount;) {
  12181. var packet = createPacket(resolution, k, l);
  12182. l++;
  12183. return packet;
  12184. }
  12185. l = 0;
  12186. }
  12187. r = 0;
  12188. }
  12189. c = 0;
  12190. }
  12191. px = 0;
  12192. }
  12193. throw new JpxError("Out of packets");
  12194. };
  12195. }
  12196. function ComponentPositionResolutionLayerIterator(context) {
  12197. var siz = context.SIZ;
  12198. var tileIndex = context.currentTile.index;
  12199. var tile = context.tiles[tileIndex];
  12200. var layersCount = tile.codingStyleDefaultParameters.layersCount;
  12201. var componentsCount = siz.Csiz;
  12202. var precinctsSizes = getPrecinctSizesInImageScale(tile);
  12203. var l = 0,
  12204. r = 0,
  12205. c = 0,
  12206. px = 0,
  12207. py = 0;
  12208. this.nextPacket = function JpxImage_nextPacket() {
  12209. for (; c < componentsCount; ++c) {
  12210. var component = tile.components[c];
  12211. var precinctsIterationSizes = precinctsSizes.components[c];
  12212. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  12213. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  12214. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  12215. for (; r <= decompositionLevelsCount; r++) {
  12216. var resolution = component.resolutions[r];
  12217. var sizeInImageScale = precinctsIterationSizes.resolutions[r];
  12218. var k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  12219. if (k === null) {
  12220. continue;
  12221. }
  12222. for (; l < layersCount;) {
  12223. var packet = createPacket(resolution, k, l);
  12224. l++;
  12225. return packet;
  12226. }
  12227. l = 0;
  12228. }
  12229. r = 0;
  12230. }
  12231. px = 0;
  12232. }
  12233. py = 0;
  12234. }
  12235. throw new JpxError("Out of packets");
  12236. };
  12237. }
  12238. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  12239. var posX = pxIndex * precinctIterationSizes.minWidth;
  12240. var posY = pyIndex * precinctIterationSizes.minHeight;
  12241. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  12242. return null;
  12243. }
  12244. var startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  12245. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  12246. }
  12247. function getPrecinctSizesInImageScale(tile) {
  12248. var componentsCount = tile.components.length;
  12249. var minWidth = Number.MAX_VALUE;
  12250. var minHeight = Number.MAX_VALUE;
  12251. var maxNumWide = 0;
  12252. var maxNumHigh = 0;
  12253. var sizePerComponent = new Array(componentsCount);
  12254. for (var c = 0; c < componentsCount; c++) {
  12255. var component = tile.components[c];
  12256. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  12257. var sizePerResolution = new Array(decompositionLevelsCount + 1);
  12258. var minWidthCurrentComponent = Number.MAX_VALUE;
  12259. var minHeightCurrentComponent = Number.MAX_VALUE;
  12260. var maxNumWideCurrentComponent = 0;
  12261. var maxNumHighCurrentComponent = 0;
  12262. var scale = 1;
  12263. for (var r = decompositionLevelsCount; r >= 0; --r) {
  12264. var resolution = component.resolutions[r];
  12265. var widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  12266. var heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  12267. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  12268. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  12269. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  12270. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  12271. sizePerResolution[r] = {
  12272. width: widthCurrentResolution,
  12273. height: heightCurrentResolution
  12274. };
  12275. scale <<= 1;
  12276. }
  12277. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  12278. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  12279. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  12280. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  12281. sizePerComponent[c] = {
  12282. resolutions: sizePerResolution,
  12283. minWidth: minWidthCurrentComponent,
  12284. minHeight: minHeightCurrentComponent,
  12285. maxNumWide: maxNumWideCurrentComponent,
  12286. maxNumHigh: maxNumHighCurrentComponent
  12287. };
  12288. }
  12289. return {
  12290. components: sizePerComponent,
  12291. minWidth,
  12292. minHeight,
  12293. maxNumWide,
  12294. maxNumHigh
  12295. };
  12296. }
  12297. function buildPackets(context) {
  12298. var siz = context.SIZ;
  12299. var tileIndex = context.currentTile.index;
  12300. var tile = context.tiles[tileIndex];
  12301. var componentsCount = siz.Csiz;
  12302. for (var c = 0; c < componentsCount; c++) {
  12303. var component = tile.components[c];
  12304. var decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  12305. var resolutions = [];
  12306. var subbands = [];
  12307. for (var r = 0; r <= decompositionLevelsCount; r++) {
  12308. var blocksDimensions = getBlocksDimensions(context, component, r);
  12309. var resolution = {};
  12310. var scale = 1 << decompositionLevelsCount - r;
  12311. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  12312. resolution.try0 = Math.ceil(component.tcy0 / scale);
  12313. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  12314. resolution.try1 = Math.ceil(component.tcy1 / scale);
  12315. resolution.resLevel = r;
  12316. buildPrecincts(context, resolution, blocksDimensions);
  12317. resolutions.push(resolution);
  12318. var subband;
  12319. if (r === 0) {
  12320. subband = {};
  12321. subband.type = "LL";
  12322. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  12323. subband.tby0 = Math.ceil(component.tcy0 / scale);
  12324. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  12325. subband.tby1 = Math.ceil(component.tcy1 / scale);
  12326. subband.resolution = resolution;
  12327. buildCodeblocks(context, subband, blocksDimensions);
  12328. subbands.push(subband);
  12329. resolution.subbands = [subband];
  12330. } else {
  12331. var bscale = 1 << decompositionLevelsCount - r + 1;
  12332. var resolutionSubbands = [];
  12333. subband = {};
  12334. subband.type = "HL";
  12335. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  12336. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  12337. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  12338. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  12339. subband.resolution = resolution;
  12340. buildCodeblocks(context, subband, blocksDimensions);
  12341. subbands.push(subband);
  12342. resolutionSubbands.push(subband);
  12343. subband = {};
  12344. subband.type = "LH";
  12345. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  12346. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  12347. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  12348. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  12349. subband.resolution = resolution;
  12350. buildCodeblocks(context, subband, blocksDimensions);
  12351. subbands.push(subband);
  12352. resolutionSubbands.push(subband);
  12353. subband = {};
  12354. subband.type = "HH";
  12355. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  12356. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  12357. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  12358. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  12359. subband.resolution = resolution;
  12360. buildCodeblocks(context, subband, blocksDimensions);
  12361. subbands.push(subband);
  12362. resolutionSubbands.push(subband);
  12363. resolution.subbands = resolutionSubbands;
  12364. }
  12365. }
  12366. component.resolutions = resolutions;
  12367. component.subbands = subbands;
  12368. }
  12369. var progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  12370. switch (progressionOrder) {
  12371. case 0:
  12372. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  12373. break;
  12374. case 1:
  12375. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  12376. break;
  12377. case 2:
  12378. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  12379. break;
  12380. case 3:
  12381. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  12382. break;
  12383. case 4:
  12384. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  12385. break;
  12386. default:
  12387. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  12388. }
  12389. }
  12390. function parseTilePackets(context, data, offset, dataLength) {
  12391. var position = 0;
  12392. var buffer,
  12393. bufferSize = 0,
  12394. skipNextBit = false;
  12395. function readBits(count) {
  12396. while (bufferSize < count) {
  12397. var b = data[offset + position];
  12398. position++;
  12399. if (skipNextBit) {
  12400. buffer = buffer << 7 | b;
  12401. bufferSize += 7;
  12402. skipNextBit = false;
  12403. } else {
  12404. buffer = buffer << 8 | b;
  12405. bufferSize += 8;
  12406. }
  12407. if (b === 0xff) {
  12408. skipNextBit = true;
  12409. }
  12410. }
  12411. bufferSize -= count;
  12412. return buffer >>> bufferSize & (1 << count) - 1;
  12413. }
  12414. function skipMarkerIfEqual(value) {
  12415. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  12416. skipBytes(1);
  12417. return true;
  12418. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  12419. skipBytes(2);
  12420. return true;
  12421. }
  12422. return false;
  12423. }
  12424. function skipBytes(count) {
  12425. position += count;
  12426. }
  12427. function alignToByte() {
  12428. bufferSize = 0;
  12429. if (skipNextBit) {
  12430. position++;
  12431. skipNextBit = false;
  12432. }
  12433. }
  12434. function readCodingpasses() {
  12435. if (readBits(1) === 0) {
  12436. return 1;
  12437. }
  12438. if (readBits(1) === 0) {
  12439. return 2;
  12440. }
  12441. var value = readBits(2);
  12442. if (value < 3) {
  12443. return value + 3;
  12444. }
  12445. value = readBits(5);
  12446. if (value < 31) {
  12447. return value + 6;
  12448. }
  12449. value = readBits(7);
  12450. return value + 37;
  12451. }
  12452. var tileIndex = context.currentTile.index;
  12453. var tile = context.tiles[tileIndex];
  12454. var sopMarkerUsed = context.COD.sopMarkerUsed;
  12455. var ephMarkerUsed = context.COD.ephMarkerUsed;
  12456. var packetsIterator = tile.packetsIterator;
  12457. while (position < dataLength) {
  12458. alignToByte();
  12459. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  12460. skipBytes(4);
  12461. }
  12462. var packet = packetsIterator.nextPacket();
  12463. if (!readBits(1)) {
  12464. continue;
  12465. }
  12466. var layerNumber = packet.layerNumber;
  12467. var queue = [],
  12468. codeblock;
  12469. for (var i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  12470. codeblock = packet.codeblocks[i];
  12471. var precinct = codeblock.precinct;
  12472. var codeblockColumn = codeblock.cbx - precinct.cbxMin;
  12473. var codeblockRow = codeblock.cby - precinct.cbyMin;
  12474. var codeblockIncluded = false;
  12475. var firstTimeInclusion = false;
  12476. var valueReady;
  12477. if (codeblock.included !== undefined) {
  12478. codeblockIncluded = !!readBits(1);
  12479. } else {
  12480. precinct = codeblock.precinct;
  12481. var inclusionTree, zeroBitPlanesTree;
  12482. if (precinct.inclusionTree !== undefined) {
  12483. inclusionTree = precinct.inclusionTree;
  12484. } else {
  12485. var width = precinct.cbxMax - precinct.cbxMin + 1;
  12486. var height = precinct.cbyMax - precinct.cbyMin + 1;
  12487. inclusionTree = new InclusionTree(width, height, layerNumber);
  12488. zeroBitPlanesTree = new TagTree(width, height);
  12489. precinct.inclusionTree = inclusionTree;
  12490. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  12491. }
  12492. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  12493. while (true) {
  12494. if (readBits(1)) {
  12495. valueReady = !inclusionTree.nextLevel();
  12496. if (valueReady) {
  12497. codeblock.included = true;
  12498. codeblockIncluded = firstTimeInclusion = true;
  12499. break;
  12500. }
  12501. } else {
  12502. inclusionTree.incrementValue(layerNumber);
  12503. break;
  12504. }
  12505. }
  12506. }
  12507. }
  12508. if (!codeblockIncluded) {
  12509. continue;
  12510. }
  12511. if (firstTimeInclusion) {
  12512. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  12513. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  12514. while (true) {
  12515. if (readBits(1)) {
  12516. valueReady = !zeroBitPlanesTree.nextLevel();
  12517. if (valueReady) {
  12518. break;
  12519. }
  12520. } else {
  12521. zeroBitPlanesTree.incrementValue();
  12522. }
  12523. }
  12524. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  12525. }
  12526. var codingpasses = readCodingpasses();
  12527. while (readBits(1)) {
  12528. codeblock.Lblock++;
  12529. }
  12530. var codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  12531. var bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  12532. var codedDataLength = readBits(bits);
  12533. queue.push({
  12534. codeblock,
  12535. codingpasses,
  12536. dataLength: codedDataLength
  12537. });
  12538. }
  12539. alignToByte();
  12540. if (ephMarkerUsed) {
  12541. skipMarkerIfEqual(0x92);
  12542. }
  12543. while (queue.length > 0) {
  12544. var packetItem = queue.shift();
  12545. codeblock = packetItem.codeblock;
  12546. if (codeblock.data === undefined) {
  12547. codeblock.data = [];
  12548. }
  12549. codeblock.data.push({
  12550. data,
  12551. start: offset + position,
  12552. end: offset + position + packetItem.dataLength,
  12553. codingpasses: packetItem.codingpasses
  12554. });
  12555. position += packetItem.dataLength;
  12556. }
  12557. }
  12558. return position;
  12559. }
  12560. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  12561. var x0 = subband.tbx0;
  12562. var y0 = subband.tby0;
  12563. var width = subband.tbx1 - subband.tbx0;
  12564. var codeblocks = subband.codeblocks;
  12565. var right = subband.type.charAt(0) === "H" ? 1 : 0;
  12566. var bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  12567. for (var i = 0, ii = codeblocks.length; i < ii; ++i) {
  12568. var codeblock = codeblocks[i];
  12569. var blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  12570. var blockHeight = codeblock.tby1_ - codeblock.tby0_;
  12571. if (blockWidth === 0 || blockHeight === 0) {
  12572. continue;
  12573. }
  12574. if (codeblock.data === undefined) {
  12575. continue;
  12576. }
  12577. var bitModel, currentCodingpassType;
  12578. bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  12579. currentCodingpassType = 2;
  12580. var data = codeblock.data,
  12581. totalLength = 0,
  12582. codingpasses = 0;
  12583. var j, jj, dataItem;
  12584. for (j = 0, jj = data.length; j < jj; j++) {
  12585. dataItem = data[j];
  12586. totalLength += dataItem.end - dataItem.start;
  12587. codingpasses += dataItem.codingpasses;
  12588. }
  12589. var encodedData = new Uint8Array(totalLength);
  12590. var position = 0;
  12591. for (j = 0, jj = data.length; j < jj; j++) {
  12592. dataItem = data[j];
  12593. var chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  12594. encodedData.set(chunk, position);
  12595. position += chunk.length;
  12596. }
  12597. var decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  12598. bitModel.setDecoder(decoder);
  12599. for (j = 0; j < codingpasses; j++) {
  12600. switch (currentCodingpassType) {
  12601. case 0:
  12602. bitModel.runSignificancePropagationPass();
  12603. break;
  12604. case 1:
  12605. bitModel.runMagnitudeRefinementPass();
  12606. break;
  12607. case 2:
  12608. bitModel.runCleanupPass();
  12609. if (segmentationSymbolUsed) {
  12610. bitModel.checkSegmentationSymbol();
  12611. }
  12612. break;
  12613. }
  12614. currentCodingpassType = (currentCodingpassType + 1) % 3;
  12615. }
  12616. var offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  12617. var sign = bitModel.coefficentsSign;
  12618. var magnitude = bitModel.coefficentsMagnitude;
  12619. var bitsDecoded = bitModel.bitsDecoded;
  12620. var magnitudeCorrection = reversible ? 0 : 0.5;
  12621. var k, n, nb;
  12622. position = 0;
  12623. var interleave = subband.type !== "LL";
  12624. for (j = 0; j < blockHeight; j++) {
  12625. var row = offset / width | 0;
  12626. var levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  12627. for (k = 0; k < blockWidth; k++) {
  12628. n = magnitude[position];
  12629. if (n !== 0) {
  12630. n = (n + magnitudeCorrection) * delta;
  12631. if (sign[position] !== 0) {
  12632. n = -n;
  12633. }
  12634. nb = bitsDecoded[position];
  12635. var pos = interleave ? levelOffset + (offset << 1) : offset;
  12636. if (reversible && nb >= mb) {
  12637. coefficients[pos] = n;
  12638. } else {
  12639. coefficients[pos] = n * (1 << mb - nb);
  12640. }
  12641. }
  12642. offset++;
  12643. position++;
  12644. }
  12645. offset += width - blockWidth;
  12646. }
  12647. }
  12648. }
  12649. function transformTile(context, tile, c) {
  12650. var component = tile.components[c];
  12651. var codingStyleParameters = component.codingStyleParameters;
  12652. var quantizationParameters = component.quantizationParameters;
  12653. var decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  12654. var spqcds = quantizationParameters.SPqcds;
  12655. var scalarExpounded = quantizationParameters.scalarExpounded;
  12656. var guardBits = quantizationParameters.guardBits;
  12657. var segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  12658. var precision = context.components[c].precision;
  12659. var reversible = codingStyleParameters.reversibleTransformation;
  12660. var transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  12661. var subbandCoefficients = [];
  12662. var b = 0;
  12663. for (var i = 0; i <= decompositionLevelsCount; i++) {
  12664. var resolution = component.resolutions[i];
  12665. var width = resolution.trx1 - resolution.trx0;
  12666. var height = resolution.try1 - resolution.try0;
  12667. var coefficients = new Float32Array(width * height);
  12668. for (var j = 0, jj = resolution.subbands.length; j < jj; j++) {
  12669. var mu, epsilon;
  12670. if (!scalarExpounded) {
  12671. mu = spqcds[0].mu;
  12672. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  12673. } else {
  12674. mu = spqcds[b].mu;
  12675. epsilon = spqcds[b].epsilon;
  12676. b++;
  12677. }
  12678. var subband = resolution.subbands[j];
  12679. var gainLog2 = SubbandsGainLog2[subband.type];
  12680. var delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  12681. var mb = guardBits + epsilon - 1;
  12682. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  12683. }
  12684. subbandCoefficients.push({
  12685. width,
  12686. height,
  12687. items: coefficients
  12688. });
  12689. }
  12690. var result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  12691. return {
  12692. left: component.tcx0,
  12693. top: component.tcy0,
  12694. width: result.width,
  12695. height: result.height,
  12696. items: result.items
  12697. };
  12698. }
  12699. function transformComponents(context) {
  12700. var siz = context.SIZ;
  12701. var components = context.components;
  12702. var componentsCount = siz.Csiz;
  12703. var resultImages = [];
  12704. for (var i = 0, ii = context.tiles.length; i < ii; i++) {
  12705. var tile = context.tiles[i];
  12706. var transformedTiles = [];
  12707. var c;
  12708. for (c = 0; c < componentsCount; c++) {
  12709. transformedTiles[c] = transformTile(context, tile, c);
  12710. }
  12711. var tile0 = transformedTiles[0];
  12712. var out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  12713. var result = {
  12714. left: tile0.left,
  12715. top: tile0.top,
  12716. width: tile0.width,
  12717. height: tile0.height,
  12718. items: out
  12719. };
  12720. var shift, offset;
  12721. var pos = 0,
  12722. j,
  12723. jj,
  12724. y0,
  12725. y1,
  12726. y2;
  12727. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  12728. var fourComponents = componentsCount === 4;
  12729. var y0items = transformedTiles[0].items;
  12730. var y1items = transformedTiles[1].items;
  12731. var y2items = transformedTiles[2].items;
  12732. var y3items = fourComponents ? transformedTiles[3].items : null;
  12733. shift = components[0].precision - 8;
  12734. offset = (128 << shift) + 0.5;
  12735. var component0 = tile.components[0];
  12736. var alpha01 = componentsCount - 3;
  12737. jj = y0items.length;
  12738. if (!component0.codingStyleParameters.reversibleTransformation) {
  12739. for (j = 0; j < jj; j++, pos += alpha01) {
  12740. y0 = y0items[j] + offset;
  12741. y1 = y1items[j];
  12742. y2 = y2items[j];
  12743. out[pos++] = y0 + 1.402 * y2 >> shift;
  12744. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  12745. out[pos++] = y0 + 1.772 * y1 >> shift;
  12746. }
  12747. } else {
  12748. for (j = 0; j < jj; j++, pos += alpha01) {
  12749. y0 = y0items[j] + offset;
  12750. y1 = y1items[j];
  12751. y2 = y2items[j];
  12752. const g = y0 - (y2 + y1 >> 2);
  12753. out[pos++] = g + y2 >> shift;
  12754. out[pos++] = g >> shift;
  12755. out[pos++] = g + y1 >> shift;
  12756. }
  12757. }
  12758. if (fourComponents) {
  12759. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  12760. out[pos] = y3items[j] + offset >> shift;
  12761. }
  12762. }
  12763. } else {
  12764. for (c = 0; c < componentsCount; c++) {
  12765. var items = transformedTiles[c].items;
  12766. shift = components[c].precision - 8;
  12767. offset = (128 << shift) + 0.5;
  12768. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  12769. out[pos] = items[j] + offset >> shift;
  12770. pos += componentsCount;
  12771. }
  12772. }
  12773. }
  12774. resultImages.push(result);
  12775. }
  12776. return resultImages;
  12777. }
  12778. function initializeTile(context, tileIndex) {
  12779. var siz = context.SIZ;
  12780. var componentsCount = siz.Csiz;
  12781. var tile = context.tiles[tileIndex];
  12782. for (var c = 0; c < componentsCount; c++) {
  12783. var component = tile.components[c];
  12784. var qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  12785. component.quantizationParameters = qcdOrQcc;
  12786. var codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  12787. component.codingStyleParameters = codOrCoc;
  12788. }
  12789. tile.codingStyleDefaultParameters = context.currentTile.COD;
  12790. }
  12791. var TagTree = function TagTreeClosure() {
  12792. function TagTree(width, height) {
  12793. var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  12794. this.levels = [];
  12795. for (var i = 0; i < levelsLength; i++) {
  12796. var level = {
  12797. width,
  12798. height,
  12799. items: []
  12800. };
  12801. this.levels.push(level);
  12802. width = Math.ceil(width / 2);
  12803. height = Math.ceil(height / 2);
  12804. }
  12805. }
  12806. TagTree.prototype = {
  12807. reset: function TagTree_reset(i, j) {
  12808. var currentLevel = 0,
  12809. value = 0,
  12810. level;
  12811. while (currentLevel < this.levels.length) {
  12812. level = this.levels[currentLevel];
  12813. var index = i + j * level.width;
  12814. if (level.items[index] !== undefined) {
  12815. value = level.items[index];
  12816. break;
  12817. }
  12818. level.index = index;
  12819. i >>= 1;
  12820. j >>= 1;
  12821. currentLevel++;
  12822. }
  12823. currentLevel--;
  12824. level = this.levels[currentLevel];
  12825. level.items[level.index] = value;
  12826. this.currentLevel = currentLevel;
  12827. delete this.value;
  12828. },
  12829. incrementValue: function TagTree_incrementValue() {
  12830. var level = this.levels[this.currentLevel];
  12831. level.items[level.index]++;
  12832. },
  12833. nextLevel: function TagTree_nextLevel() {
  12834. var currentLevel = this.currentLevel;
  12835. var level = this.levels[currentLevel];
  12836. var value = level.items[level.index];
  12837. currentLevel--;
  12838. if (currentLevel < 0) {
  12839. this.value = value;
  12840. return false;
  12841. }
  12842. this.currentLevel = currentLevel;
  12843. level = this.levels[currentLevel];
  12844. level.items[level.index] = value;
  12845. return true;
  12846. }
  12847. };
  12848. return TagTree;
  12849. }();
  12850. var InclusionTree = function InclusionTreeClosure() {
  12851. function InclusionTree(width, height, defaultValue) {
  12852. var levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  12853. this.levels = [];
  12854. for (var i = 0; i < levelsLength; i++) {
  12855. var items = new Uint8Array(width * height);
  12856. for (var j = 0, jj = items.length; j < jj; j++) {
  12857. items[j] = defaultValue;
  12858. }
  12859. var level = {
  12860. width,
  12861. height,
  12862. items
  12863. };
  12864. this.levels.push(level);
  12865. width = Math.ceil(width / 2);
  12866. height = Math.ceil(height / 2);
  12867. }
  12868. }
  12869. InclusionTree.prototype = {
  12870. reset: function InclusionTree_reset(i, j, stopValue) {
  12871. var currentLevel = 0;
  12872. while (currentLevel < this.levels.length) {
  12873. var level = this.levels[currentLevel];
  12874. var index = i + j * level.width;
  12875. level.index = index;
  12876. var value = level.items[index];
  12877. if (value === 0xff) {
  12878. break;
  12879. }
  12880. if (value > stopValue) {
  12881. this.currentLevel = currentLevel;
  12882. this.propagateValues();
  12883. return false;
  12884. }
  12885. i >>= 1;
  12886. j >>= 1;
  12887. currentLevel++;
  12888. }
  12889. this.currentLevel = currentLevel - 1;
  12890. return true;
  12891. },
  12892. incrementValue: function InclusionTree_incrementValue(stopValue) {
  12893. var level = this.levels[this.currentLevel];
  12894. level.items[level.index] = stopValue + 1;
  12895. this.propagateValues();
  12896. },
  12897. propagateValues: function InclusionTree_propagateValues() {
  12898. var levelIndex = this.currentLevel;
  12899. var level = this.levels[levelIndex];
  12900. var currentValue = level.items[level.index];
  12901. while (--levelIndex >= 0) {
  12902. level = this.levels[levelIndex];
  12903. level.items[level.index] = currentValue;
  12904. }
  12905. },
  12906. nextLevel: function InclusionTree_nextLevel() {
  12907. var currentLevel = this.currentLevel;
  12908. var level = this.levels[currentLevel];
  12909. var value = level.items[level.index];
  12910. level.items[level.index] = 0xff;
  12911. currentLevel--;
  12912. if (currentLevel < 0) {
  12913. return false;
  12914. }
  12915. this.currentLevel = currentLevel;
  12916. level = this.levels[currentLevel];
  12917. level.items[level.index] = value;
  12918. return true;
  12919. }
  12920. };
  12921. return InclusionTree;
  12922. }();
  12923. var BitModel = function BitModelClosure() {
  12924. var UNIFORM_CONTEXT = 17;
  12925. var RUNLENGTH_CONTEXT = 18;
  12926. 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]);
  12927. 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]);
  12928. 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]);
  12929. function BitModel(width, height, subband, zeroBitPlanes, mb) {
  12930. this.width = width;
  12931. this.height = height;
  12932. let contextLabelTable;
  12933. if (subband === "HH") {
  12934. contextLabelTable = HHContextLabel;
  12935. } else if (subband === "HL") {
  12936. contextLabelTable = HLContextLabel;
  12937. } else {
  12938. contextLabelTable = LLAndLHContextsLabel;
  12939. }
  12940. this.contextLabelTable = contextLabelTable;
  12941. var coefficientCount = width * height;
  12942. this.neighborsSignificance = new Uint8Array(coefficientCount);
  12943. this.coefficentsSign = new Uint8Array(coefficientCount);
  12944. let coefficentsMagnitude;
  12945. if (mb > 14) {
  12946. coefficentsMagnitude = new Uint32Array(coefficientCount);
  12947. } else if (mb > 6) {
  12948. coefficentsMagnitude = new Uint16Array(coefficientCount);
  12949. } else {
  12950. coefficentsMagnitude = new Uint8Array(coefficientCount);
  12951. }
  12952. this.coefficentsMagnitude = coefficentsMagnitude;
  12953. this.processingFlags = new Uint8Array(coefficientCount);
  12954. var bitsDecoded = new Uint8Array(coefficientCount);
  12955. if (zeroBitPlanes !== 0) {
  12956. for (var i = 0; i < coefficientCount; i++) {
  12957. bitsDecoded[i] = zeroBitPlanes;
  12958. }
  12959. }
  12960. this.bitsDecoded = bitsDecoded;
  12961. this.reset();
  12962. }
  12963. BitModel.prototype = {
  12964. setDecoder: function BitModel_setDecoder(decoder) {
  12965. this.decoder = decoder;
  12966. },
  12967. reset: function BitModel_reset() {
  12968. this.contexts = new Int8Array(19);
  12969. this.contexts[0] = 4 << 1 | 0;
  12970. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  12971. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  12972. },
  12973. setNeighborsSignificance: function BitModel_setNeighborsSignificance(row, column, index) {
  12974. var neighborsSignificance = this.neighborsSignificance;
  12975. var width = this.width,
  12976. height = this.height;
  12977. var left = column > 0;
  12978. var right = column + 1 < width;
  12979. var i;
  12980. if (row > 0) {
  12981. i = index - width;
  12982. if (left) {
  12983. neighborsSignificance[i - 1] += 0x10;
  12984. }
  12985. if (right) {
  12986. neighborsSignificance[i + 1] += 0x10;
  12987. }
  12988. neighborsSignificance[i] += 0x04;
  12989. }
  12990. if (row + 1 < height) {
  12991. i = index + width;
  12992. if (left) {
  12993. neighborsSignificance[i - 1] += 0x10;
  12994. }
  12995. if (right) {
  12996. neighborsSignificance[i + 1] += 0x10;
  12997. }
  12998. neighborsSignificance[i] += 0x04;
  12999. }
  13000. if (left) {
  13001. neighborsSignificance[index - 1] += 0x01;
  13002. }
  13003. if (right) {
  13004. neighborsSignificance[index + 1] += 0x01;
  13005. }
  13006. neighborsSignificance[index] |= 0x80;
  13007. },
  13008. runSignificancePropagationPass: function BitModel_runSignificancePropagationPass() {
  13009. var decoder = this.decoder;
  13010. var width = this.width,
  13011. height = this.height;
  13012. var coefficentsMagnitude = this.coefficentsMagnitude;
  13013. var coefficentsSign = this.coefficentsSign;
  13014. var neighborsSignificance = this.neighborsSignificance;
  13015. var processingFlags = this.processingFlags;
  13016. var contexts = this.contexts;
  13017. var labels = this.contextLabelTable;
  13018. var bitsDecoded = this.bitsDecoded;
  13019. var processedInverseMask = ~1;
  13020. var processedMask = 1;
  13021. var firstMagnitudeBitMask = 2;
  13022. for (var i0 = 0; i0 < height; i0 += 4) {
  13023. for (var j = 0; j < width; j++) {
  13024. var index = i0 * width + j;
  13025. for (var i1 = 0; i1 < 4; i1++, index += width) {
  13026. var i = i0 + i1;
  13027. if (i >= height) {
  13028. break;
  13029. }
  13030. processingFlags[index] &= processedInverseMask;
  13031. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  13032. continue;
  13033. }
  13034. var contextLabel = labels[neighborsSignificance[index]];
  13035. var decision = decoder.readBit(contexts, contextLabel);
  13036. if (decision) {
  13037. var sign = this.decodeSignBit(i, j, index);
  13038. coefficentsSign[index] = sign;
  13039. coefficentsMagnitude[index] = 1;
  13040. this.setNeighborsSignificance(i, j, index);
  13041. processingFlags[index] |= firstMagnitudeBitMask;
  13042. }
  13043. bitsDecoded[index]++;
  13044. processingFlags[index] |= processedMask;
  13045. }
  13046. }
  13047. }
  13048. },
  13049. decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
  13050. var width = this.width,
  13051. height = this.height;
  13052. var coefficentsMagnitude = this.coefficentsMagnitude;
  13053. var coefficentsSign = this.coefficentsSign;
  13054. var contribution, sign0, sign1, significance1;
  13055. var contextLabel, decoded;
  13056. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  13057. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  13058. sign1 = coefficentsSign[index + 1];
  13059. if (significance1) {
  13060. sign0 = coefficentsSign[index - 1];
  13061. contribution = 1 - sign1 - sign0;
  13062. } else {
  13063. contribution = 1 - sign1 - sign1;
  13064. }
  13065. } else if (significance1) {
  13066. sign0 = coefficentsSign[index - 1];
  13067. contribution = 1 - sign0 - sign0;
  13068. } else {
  13069. contribution = 0;
  13070. }
  13071. var horizontalContribution = 3 * contribution;
  13072. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  13073. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  13074. sign1 = coefficentsSign[index + width];
  13075. if (significance1) {
  13076. sign0 = coefficentsSign[index - width];
  13077. contribution = 1 - sign1 - sign0 + horizontalContribution;
  13078. } else {
  13079. contribution = 1 - sign1 - sign1 + horizontalContribution;
  13080. }
  13081. } else if (significance1) {
  13082. sign0 = coefficentsSign[index - width];
  13083. contribution = 1 - sign0 - sign0 + horizontalContribution;
  13084. } else {
  13085. contribution = horizontalContribution;
  13086. }
  13087. if (contribution >= 0) {
  13088. contextLabel = 9 + contribution;
  13089. decoded = this.decoder.readBit(this.contexts, contextLabel);
  13090. } else {
  13091. contextLabel = 9 - contribution;
  13092. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  13093. }
  13094. return decoded;
  13095. },
  13096. runMagnitudeRefinementPass: function BitModel_runMagnitudeRefinementPass() {
  13097. var decoder = this.decoder;
  13098. var width = this.width,
  13099. height = this.height;
  13100. var coefficentsMagnitude = this.coefficentsMagnitude;
  13101. var neighborsSignificance = this.neighborsSignificance;
  13102. var contexts = this.contexts;
  13103. var bitsDecoded = this.bitsDecoded;
  13104. var processingFlags = this.processingFlags;
  13105. var processedMask = 1;
  13106. var firstMagnitudeBitMask = 2;
  13107. var length = width * height;
  13108. var width4 = width * 4;
  13109. for (var index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  13110. indexNext = Math.min(length, index0 + width4);
  13111. for (var j = 0; j < width; j++) {
  13112. for (var index = index0 + j; index < indexNext; index += width) {
  13113. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  13114. continue;
  13115. }
  13116. var contextLabel = 16;
  13117. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  13118. processingFlags[index] ^= firstMagnitudeBitMask;
  13119. var significance = neighborsSignificance[index] & 127;
  13120. contextLabel = significance === 0 ? 15 : 14;
  13121. }
  13122. var bit = decoder.readBit(contexts, contextLabel);
  13123. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  13124. bitsDecoded[index]++;
  13125. processingFlags[index] |= processedMask;
  13126. }
  13127. }
  13128. }
  13129. },
  13130. runCleanupPass: function BitModel_runCleanupPass() {
  13131. var decoder = this.decoder;
  13132. var width = this.width,
  13133. height = this.height;
  13134. var neighborsSignificance = this.neighborsSignificance;
  13135. var coefficentsMagnitude = this.coefficentsMagnitude;
  13136. var coefficentsSign = this.coefficentsSign;
  13137. var contexts = this.contexts;
  13138. var labels = this.contextLabelTable;
  13139. var bitsDecoded = this.bitsDecoded;
  13140. var processingFlags = this.processingFlags;
  13141. var processedMask = 1;
  13142. var firstMagnitudeBitMask = 2;
  13143. var oneRowDown = width;
  13144. var twoRowsDown = width * 2;
  13145. var threeRowsDown = width * 3;
  13146. var iNext;
  13147. for (var i0 = 0; i0 < height; i0 = iNext) {
  13148. iNext = Math.min(i0 + 4, height);
  13149. var indexBase = i0 * width;
  13150. var checkAllEmpty = i0 + 3 < height;
  13151. for (var j = 0; j < width; j++) {
  13152. var index0 = indexBase + j;
  13153. 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;
  13154. var i1 = 0,
  13155. index = index0;
  13156. var i = i0,
  13157. sign;
  13158. if (allEmpty) {
  13159. var hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  13160. if (!hasSignificantCoefficent) {
  13161. bitsDecoded[index0]++;
  13162. bitsDecoded[index0 + oneRowDown]++;
  13163. bitsDecoded[index0 + twoRowsDown]++;
  13164. bitsDecoded[index0 + threeRowsDown]++;
  13165. continue;
  13166. }
  13167. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  13168. if (i1 !== 0) {
  13169. i = i0 + i1;
  13170. index += i1 * width;
  13171. }
  13172. sign = this.decodeSignBit(i, j, index);
  13173. coefficentsSign[index] = sign;
  13174. coefficentsMagnitude[index] = 1;
  13175. this.setNeighborsSignificance(i, j, index);
  13176. processingFlags[index] |= firstMagnitudeBitMask;
  13177. index = index0;
  13178. for (var i2 = i0; i2 <= i; i2++, index += width) {
  13179. bitsDecoded[index]++;
  13180. }
  13181. i1++;
  13182. }
  13183. for (i = i0 + i1; i < iNext; i++, index += width) {
  13184. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  13185. continue;
  13186. }
  13187. var contextLabel = labels[neighborsSignificance[index]];
  13188. var decision = decoder.readBit(contexts, contextLabel);
  13189. if (decision === 1) {
  13190. sign = this.decodeSignBit(i, j, index);
  13191. coefficentsSign[index] = sign;
  13192. coefficentsMagnitude[index] = 1;
  13193. this.setNeighborsSignificance(i, j, index);
  13194. processingFlags[index] |= firstMagnitudeBitMask;
  13195. }
  13196. bitsDecoded[index]++;
  13197. }
  13198. }
  13199. }
  13200. },
  13201. checkSegmentationSymbol: function BitModel_checkSegmentationSymbol() {
  13202. var decoder = this.decoder;
  13203. var contexts = this.contexts;
  13204. 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);
  13205. if (symbol !== 0xa) {
  13206. throw new JpxError("Invalid segmentation symbol");
  13207. }
  13208. }
  13209. };
  13210. return BitModel;
  13211. }();
  13212. var Transform = function TransformClosure() {
  13213. function Transform() {}
  13214. Transform.prototype.calculate = function transformCalculate(subbands, u0, v0) {
  13215. var ll = subbands[0];
  13216. for (var i = 1, ii = subbands.length; i < ii; i++) {
  13217. ll = this.iterate(ll, subbands[i], u0, v0);
  13218. }
  13219. return ll;
  13220. };
  13221. Transform.prototype.extend = function extend(buffer, offset, size) {
  13222. var i1 = offset - 1,
  13223. j1 = offset + 1;
  13224. var i2 = offset + size - 2,
  13225. j2 = offset + size;
  13226. buffer[i1--] = buffer[j1++];
  13227. buffer[j2++] = buffer[i2--];
  13228. buffer[i1--] = buffer[j1++];
  13229. buffer[j2++] = buffer[i2--];
  13230. buffer[i1--] = buffer[j1++];
  13231. buffer[j2++] = buffer[i2--];
  13232. buffer[i1] = buffer[j1];
  13233. buffer[j2] = buffer[i2];
  13234. };
  13235. Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh, u0, v0) {
  13236. var llWidth = ll.width,
  13237. llHeight = ll.height,
  13238. llItems = ll.items;
  13239. var width = hl_lh_hh.width;
  13240. var height = hl_lh_hh.height;
  13241. var items = hl_lh_hh.items;
  13242. var i, j, k, l, u, v;
  13243. for (k = 0, i = 0; i < llHeight; i++) {
  13244. l = i * 2 * width;
  13245. for (j = 0; j < llWidth; j++, k++, l += 2) {
  13246. items[l] = llItems[k];
  13247. }
  13248. }
  13249. llItems = ll.items = null;
  13250. var bufferPadding = 4;
  13251. var rowBuffer = new Float32Array(width + 2 * bufferPadding);
  13252. if (width === 1) {
  13253. if ((u0 & 1) !== 0) {
  13254. for (v = 0, k = 0; v < height; v++, k += width) {
  13255. items[k] *= 0.5;
  13256. }
  13257. }
  13258. } else {
  13259. for (v = 0, k = 0; v < height; v++, k += width) {
  13260. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  13261. this.extend(rowBuffer, bufferPadding, width);
  13262. this.filter(rowBuffer, bufferPadding, width);
  13263. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  13264. }
  13265. }
  13266. var numBuffers = 16;
  13267. var colBuffers = [];
  13268. for (i = 0; i < numBuffers; i++) {
  13269. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  13270. }
  13271. var b,
  13272. currentBuffer = 0;
  13273. ll = bufferPadding + height;
  13274. if (height === 1) {
  13275. if ((v0 & 1) !== 0) {
  13276. for (u = 0; u < width; u++) {
  13277. items[u] *= 0.5;
  13278. }
  13279. }
  13280. } else {
  13281. for (u = 0; u < width; u++) {
  13282. if (currentBuffer === 0) {
  13283. numBuffers = Math.min(width - u, numBuffers);
  13284. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  13285. for (b = 0; b < numBuffers; b++) {
  13286. colBuffers[b][l] = items[k + b];
  13287. }
  13288. }
  13289. currentBuffer = numBuffers;
  13290. }
  13291. currentBuffer--;
  13292. var buffer = colBuffers[currentBuffer];
  13293. this.extend(buffer, bufferPadding, height);
  13294. this.filter(buffer, bufferPadding, height);
  13295. if (currentBuffer === 0) {
  13296. k = u - numBuffers + 1;
  13297. for (l = bufferPadding; l < ll; k += width, l++) {
  13298. for (b = 0; b < numBuffers; b++) {
  13299. items[k + b] = colBuffers[b][l];
  13300. }
  13301. }
  13302. }
  13303. }
  13304. }
  13305. return {
  13306. width,
  13307. height,
  13308. items
  13309. };
  13310. };
  13311. return Transform;
  13312. }();
  13313. var IrreversibleTransform = function IrreversibleTransformClosure() {
  13314. function IrreversibleTransform() {
  13315. Transform.call(this);
  13316. }
  13317. IrreversibleTransform.prototype = Object.create(Transform.prototype);
  13318. IrreversibleTransform.prototype.filter = function irreversibleTransformFilter(x, offset, length) {
  13319. var len = length >> 1;
  13320. offset = offset | 0;
  13321. var j, n, current, next;
  13322. var alpha = -1.586134342059924;
  13323. var beta = -0.052980118572961;
  13324. var gamma = 0.882911075530934;
  13325. var delta = 0.443506852043971;
  13326. var K = 1.230174104914001;
  13327. var K_ = 1 / K;
  13328. j = offset - 3;
  13329. for (n = len + 4; n--; j += 2) {
  13330. x[j] *= K_;
  13331. }
  13332. j = offset - 2;
  13333. current = delta * x[j - 1];
  13334. for (n = len + 3; n--; j += 2) {
  13335. next = delta * x[j + 1];
  13336. x[j] = K * x[j] - current - next;
  13337. if (n--) {
  13338. j += 2;
  13339. current = delta * x[j + 1];
  13340. x[j] = K * x[j] - current - next;
  13341. } else {
  13342. break;
  13343. }
  13344. }
  13345. j = offset - 1;
  13346. current = gamma * x[j - 1];
  13347. for (n = len + 2; n--; j += 2) {
  13348. next = gamma * x[j + 1];
  13349. x[j] -= current + next;
  13350. if (n--) {
  13351. j += 2;
  13352. current = gamma * x[j + 1];
  13353. x[j] -= current + next;
  13354. } else {
  13355. break;
  13356. }
  13357. }
  13358. j = offset;
  13359. current = beta * x[j - 1];
  13360. for (n = len + 1; n--; j += 2) {
  13361. next = beta * x[j + 1];
  13362. x[j] -= current + next;
  13363. if (n--) {
  13364. j += 2;
  13365. current = beta * x[j + 1];
  13366. x[j] -= current + next;
  13367. } else {
  13368. break;
  13369. }
  13370. }
  13371. if (len !== 0) {
  13372. j = offset + 1;
  13373. current = alpha * x[j - 1];
  13374. for (n = len; n--; j += 2) {
  13375. next = alpha * x[j + 1];
  13376. x[j] -= current + next;
  13377. if (n--) {
  13378. j += 2;
  13379. current = alpha * x[j + 1];
  13380. x[j] -= current + next;
  13381. } else {
  13382. break;
  13383. }
  13384. }
  13385. }
  13386. };
  13387. return IrreversibleTransform;
  13388. }();
  13389. var ReversibleTransform = function ReversibleTransformClosure() {
  13390. function ReversibleTransform() {
  13391. Transform.call(this);
  13392. }
  13393. ReversibleTransform.prototype = Object.create(Transform.prototype);
  13394. ReversibleTransform.prototype.filter = function reversibleTransformFilter(x, offset, length) {
  13395. var len = length >> 1;
  13396. offset = offset | 0;
  13397. var j, n;
  13398. for (j = offset, n = len + 1; n--; j += 2) {
  13399. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  13400. }
  13401. for (j = offset + 1, n = len; n--; j += 2) {
  13402. x[j] += x[j - 1] + x[j + 1] >> 1;
  13403. }
  13404. };
  13405. return ReversibleTransform;
  13406. }();
  13407. return JpxImage;
  13408. }();
  13409. exports.JpxImage = JpxImage;
  13410. /***/ }),
  13411. /* 22 */
  13412. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  13413. Object.defineProperty(exports, "__esModule", ({
  13414. value: true
  13415. }));
  13416. exports.calculateSHA384 = calculateSHA384;
  13417. exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.calculateSHA512 = exports.calculateSHA256 = exports.calculateMD5 = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  13418. var _util = __w_pdfjs_require__(2);
  13419. var _primitives = __w_pdfjs_require__(5);
  13420. var _stream = __w_pdfjs_require__(12);
  13421. class ARCFourCipher {
  13422. constructor(key) {
  13423. this.a = 0;
  13424. this.b = 0;
  13425. var s = new Uint8Array(256);
  13426. var i,
  13427. j = 0,
  13428. tmp,
  13429. keyLength = key.length;
  13430. for (i = 0; i < 256; ++i) {
  13431. s[i] = i;
  13432. }
  13433. for (i = 0; i < 256; ++i) {
  13434. tmp = s[i];
  13435. j = j + tmp + key[i % keyLength] & 0xff;
  13436. s[i] = s[j];
  13437. s[j] = tmp;
  13438. }
  13439. this.s = s;
  13440. }
  13441. encryptBlock(data) {
  13442. var i,
  13443. n = data.length,
  13444. tmp,
  13445. tmp2;
  13446. var a = this.a,
  13447. b = this.b,
  13448. s = this.s;
  13449. var output = new Uint8Array(n);
  13450. for (i = 0; i < n; ++i) {
  13451. a = a + 1 & 0xff;
  13452. tmp = s[a];
  13453. b = b + tmp & 0xff;
  13454. tmp2 = s[b];
  13455. s[a] = tmp2;
  13456. s[b] = tmp;
  13457. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  13458. }
  13459. this.a = a;
  13460. this.b = b;
  13461. return output;
  13462. }
  13463. decryptBlock(data) {
  13464. return this.encryptBlock(data);
  13465. }
  13466. encrypt(data) {
  13467. return this.encryptBlock(data);
  13468. }
  13469. }
  13470. exports.ARCFourCipher = ARCFourCipher;
  13471. var calculateMD5 = function calculateMD5Closure() {
  13472. 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]);
  13473. 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]);
  13474. function hash(data, offset, length) {
  13475. var h0 = 1732584193,
  13476. h1 = -271733879,
  13477. h2 = -1732584194,
  13478. h3 = 271733878;
  13479. var paddedLength = length + 72 & ~63;
  13480. var padded = new Uint8Array(paddedLength);
  13481. var i, j, n;
  13482. for (i = 0; i < length; ++i) {
  13483. padded[i] = data[offset++];
  13484. }
  13485. padded[i++] = 0x80;
  13486. n = paddedLength - 8;
  13487. while (i < n) {
  13488. padded[i++] = 0;
  13489. }
  13490. padded[i++] = length << 3 & 0xff;
  13491. padded[i++] = length >> 5 & 0xff;
  13492. padded[i++] = length >> 13 & 0xff;
  13493. padded[i++] = length >> 21 & 0xff;
  13494. padded[i++] = length >>> 29 & 0xff;
  13495. padded[i++] = 0;
  13496. padded[i++] = 0;
  13497. padded[i++] = 0;
  13498. var w = new Int32Array(16);
  13499. for (i = 0; i < paddedLength;) {
  13500. for (j = 0; j < 16; ++j, i += 4) {
  13501. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  13502. }
  13503. var a = h0,
  13504. b = h1,
  13505. c = h2,
  13506. d = h3,
  13507. f,
  13508. g;
  13509. for (j = 0; j < 64; ++j) {
  13510. if (j < 16) {
  13511. f = b & c | ~b & d;
  13512. g = j;
  13513. } else if (j < 32) {
  13514. f = d & b | ~d & c;
  13515. g = 5 * j + 1 & 15;
  13516. } else if (j < 48) {
  13517. f = b ^ c ^ d;
  13518. g = 3 * j + 5 & 15;
  13519. } else {
  13520. f = c ^ (b | ~d);
  13521. g = 7 * j & 15;
  13522. }
  13523. var tmp = d,
  13524. rotateArg = a + f + k[j] + w[g] | 0,
  13525. rotate = r[j];
  13526. d = c;
  13527. c = b;
  13528. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  13529. a = tmp;
  13530. }
  13531. h0 = h0 + a | 0;
  13532. h1 = h1 + b | 0;
  13533. h2 = h2 + c | 0;
  13534. h3 = h3 + d | 0;
  13535. }
  13536. 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]);
  13537. }
  13538. return hash;
  13539. }();
  13540. exports.calculateMD5 = calculateMD5;
  13541. class Word64 {
  13542. constructor(highInteger, lowInteger) {
  13543. this.high = highInteger | 0;
  13544. this.low = lowInteger | 0;
  13545. }
  13546. and(word) {
  13547. this.high &= word.high;
  13548. this.low &= word.low;
  13549. }
  13550. xor(word) {
  13551. this.high ^= word.high;
  13552. this.low ^= word.low;
  13553. }
  13554. or(word) {
  13555. this.high |= word.high;
  13556. this.low |= word.low;
  13557. }
  13558. shiftRight(places) {
  13559. if (places >= 32) {
  13560. this.low = this.high >>> places - 32 | 0;
  13561. this.high = 0;
  13562. } else {
  13563. this.low = this.low >>> places | this.high << 32 - places;
  13564. this.high = this.high >>> places | 0;
  13565. }
  13566. }
  13567. shiftLeft(places) {
  13568. if (places >= 32) {
  13569. this.high = this.low << places - 32;
  13570. this.low = 0;
  13571. } else {
  13572. this.high = this.high << places | this.low >>> 32 - places;
  13573. this.low = this.low << places;
  13574. }
  13575. }
  13576. rotateRight(places) {
  13577. var low, high;
  13578. if (places & 32) {
  13579. high = this.low;
  13580. low = this.high;
  13581. } else {
  13582. low = this.low;
  13583. high = this.high;
  13584. }
  13585. places &= 31;
  13586. this.low = low >>> places | high << 32 - places;
  13587. this.high = high >>> places | low << 32 - places;
  13588. }
  13589. not() {
  13590. this.high = ~this.high;
  13591. this.low = ~this.low;
  13592. }
  13593. add(word) {
  13594. var lowAdd = (this.low >>> 0) + (word.low >>> 0);
  13595. var highAdd = (this.high >>> 0) + (word.high >>> 0);
  13596. if (lowAdd > 0xffffffff) {
  13597. highAdd += 1;
  13598. }
  13599. this.low = lowAdd | 0;
  13600. this.high = highAdd | 0;
  13601. }
  13602. copyTo(bytes, offset) {
  13603. bytes[offset] = this.high >>> 24 & 0xff;
  13604. bytes[offset + 1] = this.high >> 16 & 0xff;
  13605. bytes[offset + 2] = this.high >> 8 & 0xff;
  13606. bytes[offset + 3] = this.high & 0xff;
  13607. bytes[offset + 4] = this.low >>> 24 & 0xff;
  13608. bytes[offset + 5] = this.low >> 16 & 0xff;
  13609. bytes[offset + 6] = this.low >> 8 & 0xff;
  13610. bytes[offset + 7] = this.low & 0xff;
  13611. }
  13612. assign(word) {
  13613. this.high = word.high;
  13614. this.low = word.low;
  13615. }
  13616. }
  13617. var calculateSHA256 = function calculateSHA256Closure() {
  13618. function rotr(x, n) {
  13619. return x >>> n | x << 32 - n;
  13620. }
  13621. function ch(x, y, z) {
  13622. return x & y ^ ~x & z;
  13623. }
  13624. function maj(x, y, z) {
  13625. return x & y ^ x & z ^ y & z;
  13626. }
  13627. function sigma(x) {
  13628. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  13629. }
  13630. function sigmaPrime(x) {
  13631. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  13632. }
  13633. function littleSigma(x) {
  13634. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  13635. }
  13636. function littleSigmaPrime(x) {
  13637. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  13638. }
  13639. 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];
  13640. function hash(data, offset, length) {
  13641. var h0 = 0x6a09e667,
  13642. h1 = 0xbb67ae85,
  13643. h2 = 0x3c6ef372,
  13644. h3 = 0xa54ff53a,
  13645. h4 = 0x510e527f,
  13646. h5 = 0x9b05688c,
  13647. h6 = 0x1f83d9ab,
  13648. h7 = 0x5be0cd19;
  13649. var paddedLength = Math.ceil((length + 9) / 64) * 64;
  13650. var padded = new Uint8Array(paddedLength);
  13651. var i, j, n;
  13652. for (i = 0; i < length; ++i) {
  13653. padded[i] = data[offset++];
  13654. }
  13655. padded[i++] = 0x80;
  13656. n = paddedLength - 8;
  13657. while (i < n) {
  13658. padded[i++] = 0;
  13659. }
  13660. padded[i++] = 0;
  13661. padded[i++] = 0;
  13662. padded[i++] = 0;
  13663. padded[i++] = length >>> 29 & 0xff;
  13664. padded[i++] = length >> 21 & 0xff;
  13665. padded[i++] = length >> 13 & 0xff;
  13666. padded[i++] = length >> 5 & 0xff;
  13667. padded[i++] = length << 3 & 0xff;
  13668. var w = new Uint32Array(64);
  13669. for (i = 0; i < paddedLength;) {
  13670. for (j = 0; j < 16; ++j) {
  13671. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  13672. i += 4;
  13673. }
  13674. for (j = 16; j < 64; ++j) {
  13675. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  13676. }
  13677. var a = h0,
  13678. b = h1,
  13679. c = h2,
  13680. d = h3,
  13681. e = h4,
  13682. f = h5,
  13683. g = h6,
  13684. h = h7,
  13685. t1,
  13686. t2;
  13687. for (j = 0; j < 64; ++j) {
  13688. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  13689. t2 = sigma(a) + maj(a, b, c);
  13690. h = g;
  13691. g = f;
  13692. f = e;
  13693. e = d + t1 | 0;
  13694. d = c;
  13695. c = b;
  13696. b = a;
  13697. a = t1 + t2 | 0;
  13698. }
  13699. h0 = h0 + a | 0;
  13700. h1 = h1 + b | 0;
  13701. h2 = h2 + c | 0;
  13702. h3 = h3 + d | 0;
  13703. h4 = h4 + e | 0;
  13704. h5 = h5 + f | 0;
  13705. h6 = h6 + g | 0;
  13706. h7 = h7 + h | 0;
  13707. }
  13708. 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]);
  13709. }
  13710. return hash;
  13711. }();
  13712. exports.calculateSHA256 = calculateSHA256;
  13713. var calculateSHA512 = function calculateSHA512Closure() {
  13714. function ch(result, x, y, z, tmp) {
  13715. result.assign(x);
  13716. result.and(y);
  13717. tmp.assign(x);
  13718. tmp.not();
  13719. tmp.and(z);
  13720. result.xor(tmp);
  13721. }
  13722. function maj(result, x, y, z, tmp) {
  13723. result.assign(x);
  13724. result.and(y);
  13725. tmp.assign(x);
  13726. tmp.and(z);
  13727. result.xor(tmp);
  13728. tmp.assign(y);
  13729. tmp.and(z);
  13730. result.xor(tmp);
  13731. }
  13732. function sigma(result, x, tmp) {
  13733. result.assign(x);
  13734. result.rotateRight(28);
  13735. tmp.assign(x);
  13736. tmp.rotateRight(34);
  13737. result.xor(tmp);
  13738. tmp.assign(x);
  13739. tmp.rotateRight(39);
  13740. result.xor(tmp);
  13741. }
  13742. function sigmaPrime(result, x, tmp) {
  13743. result.assign(x);
  13744. result.rotateRight(14);
  13745. tmp.assign(x);
  13746. tmp.rotateRight(18);
  13747. result.xor(tmp);
  13748. tmp.assign(x);
  13749. tmp.rotateRight(41);
  13750. result.xor(tmp);
  13751. }
  13752. function littleSigma(result, x, tmp) {
  13753. result.assign(x);
  13754. result.rotateRight(1);
  13755. tmp.assign(x);
  13756. tmp.rotateRight(8);
  13757. result.xor(tmp);
  13758. tmp.assign(x);
  13759. tmp.shiftRight(7);
  13760. result.xor(tmp);
  13761. }
  13762. function littleSigmaPrime(result, x, tmp) {
  13763. result.assign(x);
  13764. result.rotateRight(19);
  13765. tmp.assign(x);
  13766. tmp.rotateRight(61);
  13767. result.xor(tmp);
  13768. tmp.assign(x);
  13769. tmp.shiftRight(6);
  13770. result.xor(tmp);
  13771. }
  13772. 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)];
  13773. function hash(data, offset, length, mode384 = false) {
  13774. var h0, h1, h2, h3, h4, h5, h6, h7;
  13775. if (!mode384) {
  13776. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  13777. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  13778. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  13779. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  13780. h4 = new Word64(0x510e527f, 0xade682d1);
  13781. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  13782. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  13783. h7 = new Word64(0x5be0cd19, 0x137e2179);
  13784. } else {
  13785. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  13786. h1 = new Word64(0x629a292a, 0x367cd507);
  13787. h2 = new Word64(0x9159015a, 0x3070dd17);
  13788. h3 = new Word64(0x152fecd8, 0xf70e5939);
  13789. h4 = new Word64(0x67332667, 0xffc00b31);
  13790. h5 = new Word64(0x8eb44a87, 0x68581511);
  13791. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  13792. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  13793. }
  13794. var paddedLength = Math.ceil((length + 17) / 128) * 128;
  13795. var padded = new Uint8Array(paddedLength);
  13796. var i, j, n;
  13797. for (i = 0; i < length; ++i) {
  13798. padded[i] = data[offset++];
  13799. }
  13800. padded[i++] = 0x80;
  13801. n = paddedLength - 16;
  13802. while (i < n) {
  13803. padded[i++] = 0;
  13804. }
  13805. padded[i++] = 0;
  13806. padded[i++] = 0;
  13807. padded[i++] = 0;
  13808. padded[i++] = 0;
  13809. padded[i++] = 0;
  13810. padded[i++] = 0;
  13811. padded[i++] = 0;
  13812. padded[i++] = 0;
  13813. padded[i++] = 0;
  13814. padded[i++] = 0;
  13815. padded[i++] = 0;
  13816. padded[i++] = length >>> 29 & 0xff;
  13817. padded[i++] = length >> 21 & 0xff;
  13818. padded[i++] = length >> 13 & 0xff;
  13819. padded[i++] = length >> 5 & 0xff;
  13820. padded[i++] = length << 3 & 0xff;
  13821. var w = new Array(80);
  13822. for (i = 0; i < 80; i++) {
  13823. w[i] = new Word64(0, 0);
  13824. }
  13825. var a = new Word64(0, 0),
  13826. b = new Word64(0, 0),
  13827. c = new Word64(0, 0);
  13828. var d = new Word64(0, 0),
  13829. e = new Word64(0, 0),
  13830. f = new Word64(0, 0);
  13831. var g = new Word64(0, 0),
  13832. h = new Word64(0, 0);
  13833. var t1 = new Word64(0, 0),
  13834. t2 = new Word64(0, 0);
  13835. var tmp1 = new Word64(0, 0),
  13836. tmp2 = new Word64(0, 0),
  13837. tmp3;
  13838. for (i = 0; i < paddedLength;) {
  13839. for (j = 0; j < 16; ++j) {
  13840. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  13841. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  13842. i += 8;
  13843. }
  13844. for (j = 16; j < 80; ++j) {
  13845. tmp3 = w[j];
  13846. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  13847. tmp3.add(w[j - 7]);
  13848. littleSigma(tmp1, w[j - 15], tmp2);
  13849. tmp3.add(tmp1);
  13850. tmp3.add(w[j - 16]);
  13851. }
  13852. a.assign(h0);
  13853. b.assign(h1);
  13854. c.assign(h2);
  13855. d.assign(h3);
  13856. e.assign(h4);
  13857. f.assign(h5);
  13858. g.assign(h6);
  13859. h.assign(h7);
  13860. for (j = 0; j < 80; ++j) {
  13861. t1.assign(h);
  13862. sigmaPrime(tmp1, e, tmp2);
  13863. t1.add(tmp1);
  13864. ch(tmp1, e, f, g, tmp2);
  13865. t1.add(tmp1);
  13866. t1.add(k[j]);
  13867. t1.add(w[j]);
  13868. sigma(t2, a, tmp2);
  13869. maj(tmp1, a, b, c, tmp2);
  13870. t2.add(tmp1);
  13871. tmp3 = h;
  13872. h = g;
  13873. g = f;
  13874. f = e;
  13875. d.add(t1);
  13876. e = d;
  13877. d = c;
  13878. c = b;
  13879. b = a;
  13880. tmp3.assign(t1);
  13881. tmp3.add(t2);
  13882. a = tmp3;
  13883. }
  13884. h0.add(a);
  13885. h1.add(b);
  13886. h2.add(c);
  13887. h3.add(d);
  13888. h4.add(e);
  13889. h5.add(f);
  13890. h6.add(g);
  13891. h7.add(h);
  13892. }
  13893. var result;
  13894. if (!mode384) {
  13895. result = new Uint8Array(64);
  13896. h0.copyTo(result, 0);
  13897. h1.copyTo(result, 8);
  13898. h2.copyTo(result, 16);
  13899. h3.copyTo(result, 24);
  13900. h4.copyTo(result, 32);
  13901. h5.copyTo(result, 40);
  13902. h6.copyTo(result, 48);
  13903. h7.copyTo(result, 56);
  13904. } else {
  13905. result = new Uint8Array(48);
  13906. h0.copyTo(result, 0);
  13907. h1.copyTo(result, 8);
  13908. h2.copyTo(result, 16);
  13909. h3.copyTo(result, 24);
  13910. h4.copyTo(result, 32);
  13911. h5.copyTo(result, 40);
  13912. }
  13913. return result;
  13914. }
  13915. return hash;
  13916. }();
  13917. exports.calculateSHA512 = calculateSHA512;
  13918. function calculateSHA384(data, offset, length) {
  13919. return calculateSHA512(data, offset, length, true);
  13920. }
  13921. class NullCipher {
  13922. decryptBlock(data) {
  13923. return data;
  13924. }
  13925. encrypt(data) {
  13926. return data;
  13927. }
  13928. }
  13929. class AESBaseCipher {
  13930. constructor() {
  13931. if (this.constructor === AESBaseCipher) {
  13932. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  13933. }
  13934. 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]);
  13935. 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]);
  13936. 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]);
  13937. this._mixCol = new Uint8Array(256);
  13938. for (let i = 0; i < 256; i++) {
  13939. if (i < 128) {
  13940. this._mixCol[i] = i << 1;
  13941. } else {
  13942. this._mixCol[i] = i << 1 ^ 0x1b;
  13943. }
  13944. }
  13945. this.buffer = new Uint8Array(16);
  13946. this.bufferPosition = 0;
  13947. }
  13948. _expandKey(cipherKey) {
  13949. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  13950. }
  13951. _decrypt(input, key) {
  13952. let t, u, v;
  13953. const state = new Uint8Array(16);
  13954. state.set(input);
  13955. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  13956. state[j] ^= key[k];
  13957. }
  13958. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  13959. t = state[13];
  13960. state[13] = state[9];
  13961. state[9] = state[5];
  13962. state[5] = state[1];
  13963. state[1] = t;
  13964. t = state[14];
  13965. u = state[10];
  13966. state[14] = state[6];
  13967. state[10] = state[2];
  13968. state[6] = t;
  13969. state[2] = u;
  13970. t = state[15];
  13971. u = state[11];
  13972. v = state[7];
  13973. state[15] = state[3];
  13974. state[11] = t;
  13975. state[7] = u;
  13976. state[3] = v;
  13977. for (let j = 0; j < 16; ++j) {
  13978. state[j] = this._inv_s[state[j]];
  13979. }
  13980. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  13981. state[j] ^= key[k];
  13982. }
  13983. for (let j = 0; j < 16; j += 4) {
  13984. const s0 = this._mix[state[j]];
  13985. const s1 = this._mix[state[j + 1]];
  13986. const s2 = this._mix[state[j + 2]];
  13987. const s3 = this._mix[state[j + 3]];
  13988. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  13989. state[j] = t >>> 24 & 0xff;
  13990. state[j + 1] = t >> 16 & 0xff;
  13991. state[j + 2] = t >> 8 & 0xff;
  13992. state[j + 3] = t & 0xff;
  13993. }
  13994. }
  13995. t = state[13];
  13996. state[13] = state[9];
  13997. state[9] = state[5];
  13998. state[5] = state[1];
  13999. state[1] = t;
  14000. t = state[14];
  14001. u = state[10];
  14002. state[14] = state[6];
  14003. state[10] = state[2];
  14004. state[6] = t;
  14005. state[2] = u;
  14006. t = state[15];
  14007. u = state[11];
  14008. v = state[7];
  14009. state[15] = state[3];
  14010. state[11] = t;
  14011. state[7] = u;
  14012. state[3] = v;
  14013. for (let j = 0; j < 16; ++j) {
  14014. state[j] = this._inv_s[state[j]];
  14015. state[j] ^= key[j];
  14016. }
  14017. return state;
  14018. }
  14019. _encrypt(input, key) {
  14020. const s = this._s;
  14021. let t, u, v;
  14022. const state = new Uint8Array(16);
  14023. state.set(input);
  14024. for (let j = 0; j < 16; ++j) {
  14025. state[j] ^= key[j];
  14026. }
  14027. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  14028. for (let j = 0; j < 16; ++j) {
  14029. state[j] = s[state[j]];
  14030. }
  14031. v = state[1];
  14032. state[1] = state[5];
  14033. state[5] = state[9];
  14034. state[9] = state[13];
  14035. state[13] = v;
  14036. v = state[2];
  14037. u = state[6];
  14038. state[2] = state[10];
  14039. state[6] = state[14];
  14040. state[10] = v;
  14041. state[14] = u;
  14042. v = state[3];
  14043. u = state[7];
  14044. t = state[11];
  14045. state[3] = state[15];
  14046. state[7] = v;
  14047. state[11] = u;
  14048. state[15] = t;
  14049. for (let j = 0; j < 16; j += 4) {
  14050. const s0 = state[j + 0];
  14051. const s1 = state[j + 1];
  14052. const s2 = state[j + 2];
  14053. const s3 = state[j + 3];
  14054. t = s0 ^ s1 ^ s2 ^ s3;
  14055. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  14056. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  14057. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  14058. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  14059. }
  14060. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  14061. state[j] ^= key[k];
  14062. }
  14063. }
  14064. for (let j = 0; j < 16; ++j) {
  14065. state[j] = s[state[j]];
  14066. }
  14067. v = state[1];
  14068. state[1] = state[5];
  14069. state[5] = state[9];
  14070. state[9] = state[13];
  14071. state[13] = v;
  14072. v = state[2];
  14073. u = state[6];
  14074. state[2] = state[10];
  14075. state[6] = state[14];
  14076. state[10] = v;
  14077. state[14] = u;
  14078. v = state[3];
  14079. u = state[7];
  14080. t = state[11];
  14081. state[3] = state[15];
  14082. state[7] = v;
  14083. state[11] = u;
  14084. state[15] = t;
  14085. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  14086. state[j] ^= key[k];
  14087. }
  14088. return state;
  14089. }
  14090. _decryptBlock2(data, finalize) {
  14091. const sourceLength = data.length;
  14092. let buffer = this.buffer,
  14093. bufferLength = this.bufferPosition;
  14094. const result = [];
  14095. let iv = this.iv;
  14096. for (let i = 0; i < sourceLength; ++i) {
  14097. buffer[bufferLength] = data[i];
  14098. ++bufferLength;
  14099. if (bufferLength < 16) {
  14100. continue;
  14101. }
  14102. const plain = this._decrypt(buffer, this._key);
  14103. for (let j = 0; j < 16; ++j) {
  14104. plain[j] ^= iv[j];
  14105. }
  14106. iv = buffer;
  14107. result.push(plain);
  14108. buffer = new Uint8Array(16);
  14109. bufferLength = 0;
  14110. }
  14111. this.buffer = buffer;
  14112. this.bufferLength = bufferLength;
  14113. this.iv = iv;
  14114. if (result.length === 0) {
  14115. return new Uint8Array(0);
  14116. }
  14117. let outputLength = 16 * result.length;
  14118. if (finalize) {
  14119. const lastBlock = result[result.length - 1];
  14120. let psLen = lastBlock[15];
  14121. if (psLen <= 16) {
  14122. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  14123. if (lastBlock[i] !== psLen) {
  14124. psLen = 0;
  14125. break;
  14126. }
  14127. }
  14128. outputLength -= psLen;
  14129. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  14130. }
  14131. }
  14132. const output = new Uint8Array(outputLength);
  14133. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  14134. output.set(result[i], j);
  14135. }
  14136. return output;
  14137. }
  14138. decryptBlock(data, finalize, iv = null) {
  14139. const sourceLength = data.length;
  14140. const buffer = this.buffer;
  14141. let bufferLength = this.bufferPosition;
  14142. if (iv) {
  14143. this.iv = iv;
  14144. } else {
  14145. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  14146. buffer[bufferLength] = data[i];
  14147. }
  14148. if (bufferLength < 16) {
  14149. this.bufferLength = bufferLength;
  14150. return new Uint8Array(0);
  14151. }
  14152. this.iv = buffer;
  14153. data = data.subarray(16);
  14154. }
  14155. this.buffer = new Uint8Array(16);
  14156. this.bufferLength = 0;
  14157. this.decryptBlock = this._decryptBlock2;
  14158. return this.decryptBlock(data, finalize);
  14159. }
  14160. encrypt(data, iv) {
  14161. const sourceLength = data.length;
  14162. let buffer = this.buffer,
  14163. bufferLength = this.bufferPosition;
  14164. const result = [];
  14165. if (!iv) {
  14166. iv = new Uint8Array(16);
  14167. }
  14168. for (let i = 0; i < sourceLength; ++i) {
  14169. buffer[bufferLength] = data[i];
  14170. ++bufferLength;
  14171. if (bufferLength < 16) {
  14172. continue;
  14173. }
  14174. for (let j = 0; j < 16; ++j) {
  14175. buffer[j] ^= iv[j];
  14176. }
  14177. const cipher = this._encrypt(buffer, this._key);
  14178. iv = cipher;
  14179. result.push(cipher);
  14180. buffer = new Uint8Array(16);
  14181. bufferLength = 0;
  14182. }
  14183. this.buffer = buffer;
  14184. this.bufferLength = bufferLength;
  14185. this.iv = iv;
  14186. if (result.length === 0) {
  14187. return new Uint8Array(0);
  14188. }
  14189. const outputLength = 16 * result.length;
  14190. const output = new Uint8Array(outputLength);
  14191. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  14192. output.set(result[i], j);
  14193. }
  14194. return output;
  14195. }
  14196. }
  14197. class AES128Cipher extends AESBaseCipher {
  14198. constructor(key) {
  14199. super();
  14200. this._cyclesOfRepetition = 10;
  14201. this._keySize = 160;
  14202. 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]);
  14203. this._key = this._expandKey(key);
  14204. }
  14205. _expandKey(cipherKey) {
  14206. const b = 176;
  14207. const s = this._s;
  14208. const rcon = this._rcon;
  14209. const result = new Uint8Array(b);
  14210. result.set(cipherKey);
  14211. for (let j = 16, i = 1; j < b; ++i) {
  14212. let t1 = result[j - 3];
  14213. let t2 = result[j - 2];
  14214. let t3 = result[j - 1];
  14215. let t4 = result[j - 4];
  14216. t1 = s[t1];
  14217. t2 = s[t2];
  14218. t3 = s[t3];
  14219. t4 = s[t4];
  14220. t1 = t1 ^ rcon[i];
  14221. for (let n = 0; n < 4; ++n) {
  14222. result[j] = t1 ^= result[j - 16];
  14223. j++;
  14224. result[j] = t2 ^= result[j - 16];
  14225. j++;
  14226. result[j] = t3 ^= result[j - 16];
  14227. j++;
  14228. result[j] = t4 ^= result[j - 16];
  14229. j++;
  14230. }
  14231. }
  14232. return result;
  14233. }
  14234. }
  14235. exports.AES128Cipher = AES128Cipher;
  14236. class AES256Cipher extends AESBaseCipher {
  14237. constructor(key) {
  14238. super();
  14239. this._cyclesOfRepetition = 14;
  14240. this._keySize = 224;
  14241. this._key = this._expandKey(key);
  14242. }
  14243. _expandKey(cipherKey) {
  14244. const b = 240;
  14245. const s = this._s;
  14246. const result = new Uint8Array(b);
  14247. result.set(cipherKey);
  14248. let r = 1;
  14249. let t1, t2, t3, t4;
  14250. for (let j = 32, i = 1; j < b; ++i) {
  14251. if (j % 32 === 16) {
  14252. t1 = s[t1];
  14253. t2 = s[t2];
  14254. t3 = s[t3];
  14255. t4 = s[t4];
  14256. } else if (j % 32 === 0) {
  14257. t1 = result[j - 3];
  14258. t2 = result[j - 2];
  14259. t3 = result[j - 1];
  14260. t4 = result[j - 4];
  14261. t1 = s[t1];
  14262. t2 = s[t2];
  14263. t3 = s[t3];
  14264. t4 = s[t4];
  14265. t1 = t1 ^ r;
  14266. if ((r <<= 1) >= 256) {
  14267. r = (r ^ 0x1b) & 0xff;
  14268. }
  14269. }
  14270. for (let n = 0; n < 4; ++n) {
  14271. result[j] = t1 ^= result[j - 32];
  14272. j++;
  14273. result[j] = t2 ^= result[j - 32];
  14274. j++;
  14275. result[j] = t3 ^= result[j - 32];
  14276. j++;
  14277. result[j] = t4 ^= result[j - 32];
  14278. j++;
  14279. }
  14280. }
  14281. return result;
  14282. }
  14283. }
  14284. exports.AES256Cipher = AES256Cipher;
  14285. class PDF17 {
  14286. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  14287. var hashData = new Uint8Array(password.length + 56);
  14288. hashData.set(password, 0);
  14289. hashData.set(ownerValidationSalt, password.length);
  14290. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  14291. var result = calculateSHA256(hashData, 0, hashData.length);
  14292. return (0, _util.isArrayEqual)(result, ownerPassword);
  14293. }
  14294. checkUserPassword(password, userValidationSalt, userPassword) {
  14295. var hashData = new Uint8Array(password.length + 8);
  14296. hashData.set(password, 0);
  14297. hashData.set(userValidationSalt, password.length);
  14298. var result = calculateSHA256(hashData, 0, hashData.length);
  14299. return (0, _util.isArrayEqual)(result, userPassword);
  14300. }
  14301. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  14302. var hashData = new Uint8Array(password.length + 56);
  14303. hashData.set(password, 0);
  14304. hashData.set(ownerKeySalt, password.length);
  14305. hashData.set(userBytes, password.length + ownerKeySalt.length);
  14306. var key = calculateSHA256(hashData, 0, hashData.length);
  14307. var cipher = new AES256Cipher(key);
  14308. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  14309. }
  14310. getUserKey(password, userKeySalt, userEncryption) {
  14311. var hashData = new Uint8Array(password.length + 8);
  14312. hashData.set(password, 0);
  14313. hashData.set(userKeySalt, password.length);
  14314. var key = calculateSHA256(hashData, 0, hashData.length);
  14315. var cipher = new AES256Cipher(key);
  14316. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  14317. }
  14318. }
  14319. exports.PDF17 = PDF17;
  14320. var PDF20 = function PDF20Closure() {
  14321. function calculatePDF20Hash(password, input, userBytes) {
  14322. var k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  14323. var e = [0];
  14324. var i = 0;
  14325. while (i < 64 || e[e.length - 1] > i - 32) {
  14326. const combinedLength = password.length + k.length + userBytes.length,
  14327. combinedArray = new Uint8Array(combinedLength);
  14328. let writeOffset = 0;
  14329. combinedArray.set(password, writeOffset);
  14330. writeOffset += password.length;
  14331. combinedArray.set(k, writeOffset);
  14332. writeOffset += k.length;
  14333. combinedArray.set(userBytes, writeOffset);
  14334. var k1 = new Uint8Array(combinedLength * 64);
  14335. for (var j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  14336. k1.set(combinedArray, pos);
  14337. }
  14338. var cipher = new AES128Cipher(k.subarray(0, 16));
  14339. e = cipher.encrypt(k1, k.subarray(16, 32));
  14340. var remainder = 0;
  14341. for (var z = 0; z < 16; z++) {
  14342. remainder *= 256 % 3;
  14343. remainder %= 3;
  14344. remainder += (e[z] >>> 0) % 3;
  14345. remainder %= 3;
  14346. }
  14347. if (remainder === 0) {
  14348. k = calculateSHA256(e, 0, e.length);
  14349. } else if (remainder === 1) {
  14350. k = calculateSHA384(e, 0, e.length);
  14351. } else if (remainder === 2) {
  14352. k = calculateSHA512(e, 0, e.length);
  14353. }
  14354. i++;
  14355. }
  14356. return k.subarray(0, 32);
  14357. }
  14358. class PDF20 {
  14359. hash(password, concatBytes, userBytes) {
  14360. return calculatePDF20Hash(password, concatBytes, userBytes);
  14361. }
  14362. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  14363. var hashData = new Uint8Array(password.length + 56);
  14364. hashData.set(password, 0);
  14365. hashData.set(ownerValidationSalt, password.length);
  14366. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  14367. var result = calculatePDF20Hash(password, hashData, userBytes);
  14368. return (0, _util.isArrayEqual)(result, ownerPassword);
  14369. }
  14370. checkUserPassword(password, userValidationSalt, userPassword) {
  14371. var hashData = new Uint8Array(password.length + 8);
  14372. hashData.set(password, 0);
  14373. hashData.set(userValidationSalt, password.length);
  14374. var result = calculatePDF20Hash(password, hashData, []);
  14375. return (0, _util.isArrayEqual)(result, userPassword);
  14376. }
  14377. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  14378. var hashData = new Uint8Array(password.length + 56);
  14379. hashData.set(password, 0);
  14380. hashData.set(ownerKeySalt, password.length);
  14381. hashData.set(userBytes, password.length + ownerKeySalt.length);
  14382. var key = calculatePDF20Hash(password, hashData, userBytes);
  14383. var cipher = new AES256Cipher(key);
  14384. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  14385. }
  14386. getUserKey(password, userKeySalt, userEncryption) {
  14387. var hashData = new Uint8Array(password.length + 8);
  14388. hashData.set(password, 0);
  14389. hashData.set(userKeySalt, password.length);
  14390. var key = calculatePDF20Hash(password, hashData, []);
  14391. var cipher = new AES256Cipher(key);
  14392. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  14393. }
  14394. }
  14395. return PDF20;
  14396. }();
  14397. exports.PDF20 = PDF20;
  14398. class CipherTransform {
  14399. constructor(stringCipherConstructor, streamCipherConstructor) {
  14400. this.StringCipherConstructor = stringCipherConstructor;
  14401. this.StreamCipherConstructor = streamCipherConstructor;
  14402. }
  14403. createStream(stream, length) {
  14404. var cipher = new this.StreamCipherConstructor();
  14405. return new _stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  14406. return cipher.decryptBlock(data, finalize);
  14407. });
  14408. }
  14409. decryptString(s) {
  14410. var cipher = new this.StringCipherConstructor();
  14411. var data = (0, _util.stringToBytes)(s);
  14412. data = cipher.decryptBlock(data, true);
  14413. return (0, _util.bytesToString)(data);
  14414. }
  14415. encryptString(s) {
  14416. const cipher = new this.StringCipherConstructor();
  14417. if (cipher instanceof AESBaseCipher) {
  14418. const strLen = s.length;
  14419. const pad = 16 - strLen % 16;
  14420. if (pad !== 16) {
  14421. s = s.padEnd(16 * Math.ceil(strLen / 16), String.fromCharCode(pad));
  14422. }
  14423. const iv = new Uint8Array(16);
  14424. if (typeof crypto !== "undefined") {
  14425. crypto.getRandomValues(iv);
  14426. } else {
  14427. for (let i = 0; i < 16; i++) {
  14428. iv[i] = Math.floor(256 * Math.random());
  14429. }
  14430. }
  14431. let data = (0, _util.stringToBytes)(s);
  14432. data = cipher.encrypt(data, iv);
  14433. const buf = new Uint8Array(16 + data.length);
  14434. buf.set(iv);
  14435. buf.set(data, 16);
  14436. return (0, _util.bytesToString)(buf);
  14437. }
  14438. let data = (0, _util.stringToBytes)(s);
  14439. data = cipher.encrypt(data);
  14440. return (0, _util.bytesToString)(data);
  14441. }
  14442. }
  14443. var CipherTransformFactory = function CipherTransformFactoryClosure() {
  14444. 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]);
  14445. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  14446. if (password) {
  14447. var passwordLength = Math.min(127, password.length);
  14448. password = password.subarray(0, passwordLength);
  14449. } else {
  14450. password = [];
  14451. }
  14452. var pdfAlgorithm;
  14453. if (revision === 6) {
  14454. pdfAlgorithm = new PDF20();
  14455. } else {
  14456. pdfAlgorithm = new PDF17();
  14457. }
  14458. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  14459. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  14460. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  14461. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  14462. }
  14463. return null;
  14464. }
  14465. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  14466. var hashDataSize = 40 + ownerPassword.length + fileId.length;
  14467. var hashData = new Uint8Array(hashDataSize),
  14468. i = 0,
  14469. j,
  14470. n;
  14471. if (password) {
  14472. n = Math.min(32, password.length);
  14473. for (; i < n; ++i) {
  14474. hashData[i] = password[i];
  14475. }
  14476. }
  14477. j = 0;
  14478. while (i < 32) {
  14479. hashData[i++] = defaultPasswordBytes[j++];
  14480. }
  14481. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  14482. hashData[i++] = ownerPassword[j];
  14483. }
  14484. hashData[i++] = flags & 0xff;
  14485. hashData[i++] = flags >> 8 & 0xff;
  14486. hashData[i++] = flags >> 16 & 0xff;
  14487. hashData[i++] = flags >>> 24 & 0xff;
  14488. for (j = 0, n = fileId.length; j < n; ++j) {
  14489. hashData[i++] = fileId[j];
  14490. }
  14491. if (revision >= 4 && !encryptMetadata) {
  14492. hashData[i++] = 0xff;
  14493. hashData[i++] = 0xff;
  14494. hashData[i++] = 0xff;
  14495. hashData[i++] = 0xff;
  14496. }
  14497. var hash = calculateMD5(hashData, 0, i);
  14498. var keyLengthInBytes = keyLength >> 3;
  14499. if (revision >= 3) {
  14500. for (j = 0; j < 50; ++j) {
  14501. hash = calculateMD5(hash, 0, keyLengthInBytes);
  14502. }
  14503. }
  14504. var encryptionKey = hash.subarray(0, keyLengthInBytes);
  14505. var cipher, checkData;
  14506. if (revision >= 3) {
  14507. for (i = 0; i < 32; ++i) {
  14508. hashData[i] = defaultPasswordBytes[i];
  14509. }
  14510. for (j = 0, n = fileId.length; j < n; ++j) {
  14511. hashData[i++] = fileId[j];
  14512. }
  14513. cipher = new ARCFourCipher(encryptionKey);
  14514. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  14515. n = encryptionKey.length;
  14516. var derivedKey = new Uint8Array(n),
  14517. k;
  14518. for (j = 1; j <= 19; ++j) {
  14519. for (k = 0; k < n; ++k) {
  14520. derivedKey[k] = encryptionKey[k] ^ j;
  14521. }
  14522. cipher = new ARCFourCipher(derivedKey);
  14523. checkData = cipher.encryptBlock(checkData);
  14524. }
  14525. for (j = 0, n = checkData.length; j < n; ++j) {
  14526. if (userPassword[j] !== checkData[j]) {
  14527. return null;
  14528. }
  14529. }
  14530. } else {
  14531. cipher = new ARCFourCipher(encryptionKey);
  14532. checkData = cipher.encryptBlock(defaultPasswordBytes);
  14533. for (j = 0, n = checkData.length; j < n; ++j) {
  14534. if (userPassword[j] !== checkData[j]) {
  14535. return null;
  14536. }
  14537. }
  14538. }
  14539. return encryptionKey;
  14540. }
  14541. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  14542. var hashData = new Uint8Array(32),
  14543. i = 0,
  14544. j,
  14545. n;
  14546. n = Math.min(32, password.length);
  14547. for (; i < n; ++i) {
  14548. hashData[i] = password[i];
  14549. }
  14550. j = 0;
  14551. while (i < 32) {
  14552. hashData[i++] = defaultPasswordBytes[j++];
  14553. }
  14554. var hash = calculateMD5(hashData, 0, i);
  14555. var keyLengthInBytes = keyLength >> 3;
  14556. if (revision >= 3) {
  14557. for (j = 0; j < 50; ++j) {
  14558. hash = calculateMD5(hash, 0, hash.length);
  14559. }
  14560. }
  14561. var cipher, userPassword;
  14562. if (revision >= 3) {
  14563. userPassword = ownerPassword;
  14564. var derivedKey = new Uint8Array(keyLengthInBytes),
  14565. k;
  14566. for (j = 19; j >= 0; j--) {
  14567. for (k = 0; k < keyLengthInBytes; ++k) {
  14568. derivedKey[k] = hash[k] ^ j;
  14569. }
  14570. cipher = new ARCFourCipher(derivedKey);
  14571. userPassword = cipher.encryptBlock(userPassword);
  14572. }
  14573. } else {
  14574. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  14575. userPassword = cipher.encryptBlock(ownerPassword);
  14576. }
  14577. return userPassword;
  14578. }
  14579. var identityName = _primitives.Name.get("Identity");
  14580. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  14581. var key = new Uint8Array(encryptionKey.length + 9),
  14582. i,
  14583. n;
  14584. for (i = 0, n = encryptionKey.length; i < n; ++i) {
  14585. key[i] = encryptionKey[i];
  14586. }
  14587. key[i++] = num & 0xff;
  14588. key[i++] = num >> 8 & 0xff;
  14589. key[i++] = num >> 16 & 0xff;
  14590. key[i++] = gen & 0xff;
  14591. key[i++] = gen >> 8 & 0xff;
  14592. if (isAes) {
  14593. key[i++] = 0x73;
  14594. key[i++] = 0x41;
  14595. key[i++] = 0x6c;
  14596. key[i++] = 0x54;
  14597. }
  14598. var hash = calculateMD5(key, 0, i);
  14599. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  14600. }
  14601. function buildCipherConstructor(cf, name, num, gen, key) {
  14602. if (!(0, _primitives.isName)(name)) {
  14603. throw new _util.FormatError("Invalid crypt filter name.");
  14604. }
  14605. var cryptFilter = cf.get(name.name);
  14606. var cfm;
  14607. if (cryptFilter !== null && cryptFilter !== undefined) {
  14608. cfm = cryptFilter.get("CFM");
  14609. }
  14610. if (!cfm || cfm.name === "None") {
  14611. return function cipherTransformFactoryBuildCipherConstructorNone() {
  14612. return new NullCipher();
  14613. };
  14614. }
  14615. if (cfm.name === "V2") {
  14616. return function cipherTransformFactoryBuildCipherConstructorV2() {
  14617. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  14618. };
  14619. }
  14620. if (cfm.name === "AESV2") {
  14621. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  14622. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  14623. };
  14624. }
  14625. if (cfm.name === "AESV3") {
  14626. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  14627. return new AES256Cipher(key);
  14628. };
  14629. }
  14630. throw new _util.FormatError("Unknown crypto method");
  14631. }
  14632. class CipherTransformFactory {
  14633. constructor(dict, fileId, password) {
  14634. var filter = dict.get("Filter");
  14635. if (!(0, _primitives.isName)(filter, "Standard")) {
  14636. throw new _util.FormatError("unknown encryption method");
  14637. }
  14638. this.dict = dict;
  14639. var algorithm = dict.get("V");
  14640. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  14641. throw new _util.FormatError("unsupported encryption algorithm");
  14642. }
  14643. this.algorithm = algorithm;
  14644. var keyLength = dict.get("Length");
  14645. if (!keyLength) {
  14646. if (algorithm <= 3) {
  14647. keyLength = 40;
  14648. } else {
  14649. var cfDict = dict.get("CF");
  14650. var streamCryptoName = dict.get("StmF");
  14651. if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
  14652. cfDict.suppressEncryption = true;
  14653. var handlerDict = cfDict.get(streamCryptoName.name);
  14654. keyLength = handlerDict && handlerDict.get("Length") || 128;
  14655. if (keyLength < 40) {
  14656. keyLength <<= 3;
  14657. }
  14658. }
  14659. }
  14660. }
  14661. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  14662. throw new _util.FormatError("invalid key length");
  14663. }
  14664. var ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  14665. var userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  14666. var flags = dict.get("P");
  14667. var revision = dict.get("R");
  14668. var encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  14669. this.encryptMetadata = encryptMetadata;
  14670. var fileIdBytes = (0, _util.stringToBytes)(fileId);
  14671. var passwordBytes;
  14672. if (password) {
  14673. if (revision === 6) {
  14674. try {
  14675. password = (0, _util.utf8StringToString)(password);
  14676. } catch (ex) {
  14677. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  14678. }
  14679. }
  14680. passwordBytes = (0, _util.stringToBytes)(password);
  14681. }
  14682. var encryptionKey;
  14683. if (algorithm !== 5) {
  14684. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  14685. } else {
  14686. var ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  14687. var ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  14688. var uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  14689. var userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  14690. var userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  14691. var ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  14692. var userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  14693. var perms = (0, _util.stringToBytes)(dict.get("Perms"));
  14694. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  14695. }
  14696. if (!encryptionKey && !password) {
  14697. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  14698. } else if (!encryptionKey && password) {
  14699. var decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  14700. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  14701. }
  14702. if (!encryptionKey) {
  14703. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  14704. }
  14705. this.encryptionKey = encryptionKey;
  14706. if (algorithm >= 4) {
  14707. var cf = dict.get("CF");
  14708. if ((0, _primitives.isDict)(cf)) {
  14709. cf.suppressEncryption = true;
  14710. }
  14711. this.cf = cf;
  14712. this.stmf = dict.get("StmF") || identityName;
  14713. this.strf = dict.get("StrF") || identityName;
  14714. this.eff = dict.get("EFF") || this.stmf;
  14715. }
  14716. }
  14717. createCipherTransform(num, gen) {
  14718. if (this.algorithm === 4 || this.algorithm === 5) {
  14719. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  14720. }
  14721. var key = buildObjectKey(num, gen, this.encryptionKey, false);
  14722. var cipherConstructor = function buildCipherCipherConstructor() {
  14723. return new ARCFourCipher(key);
  14724. };
  14725. return new CipherTransform(cipherConstructor, cipherConstructor);
  14726. }
  14727. }
  14728. return CipherTransformFactory;
  14729. }();
  14730. exports.CipherTransformFactory = CipherTransformFactory;
  14731. /***/ }),
  14732. /* 23 */
  14733. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  14734. Object.defineProperty(exports, "__esModule", ({
  14735. value: true
  14736. }));
  14737. exports.ColorSpace = void 0;
  14738. var _util = __w_pdfjs_require__(2);
  14739. var _primitives = __w_pdfjs_require__(5);
  14740. var _core_utils = __w_pdfjs_require__(8);
  14741. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  14742. const COMPONENTS = 3;
  14743. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  14744. const xRatio = w1 / w2;
  14745. const yRatio = h1 / h2;
  14746. let newIndex = 0,
  14747. oldIndex;
  14748. const xScaled = new Uint16Array(w2);
  14749. const w1Scanline = w1 * COMPONENTS;
  14750. for (let i = 0; i < w2; i++) {
  14751. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  14752. }
  14753. for (let i = 0; i < h2; i++) {
  14754. const py = Math.floor(i * yRatio) * w1Scanline;
  14755. for (let j = 0; j < w2; j++) {
  14756. oldIndex = py + xScaled[j];
  14757. dest[newIndex++] = src[oldIndex++];
  14758. dest[newIndex++] = src[oldIndex++];
  14759. dest[newIndex++] = src[oldIndex++];
  14760. newIndex += alpha01;
  14761. }
  14762. }
  14763. }
  14764. class ColorSpace {
  14765. constructor(name, numComps) {
  14766. if (this.constructor === ColorSpace) {
  14767. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  14768. }
  14769. this.name = name;
  14770. this.numComps = numComps;
  14771. }
  14772. getRgb(src, srcOffset) {
  14773. const rgb = new Uint8ClampedArray(3);
  14774. this.getRgbItem(src, srcOffset, rgb, 0);
  14775. return rgb;
  14776. }
  14777. getRgbItem(src, srcOffset, dest, destOffset) {
  14778. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  14779. }
  14780. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  14781. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  14782. }
  14783. getOutputLength(inputLength, alpha01) {
  14784. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  14785. }
  14786. isPassthrough(bits) {
  14787. return false;
  14788. }
  14789. isDefaultDecode(decodeMap, bpc) {
  14790. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  14791. }
  14792. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  14793. const count = originalWidth * originalHeight;
  14794. let rgbBuf = null;
  14795. const numComponentColors = 1 << bpc;
  14796. const needsResizing = originalHeight !== height || originalWidth !== width;
  14797. if (this.isPassthrough(bpc)) {
  14798. rgbBuf = comps;
  14799. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  14800. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  14801. for (let i = 0; i < numComponentColors; i++) {
  14802. allColors[i] = i;
  14803. }
  14804. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  14805. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  14806. if (!needsResizing) {
  14807. let destPos = 0;
  14808. for (let i = 0; i < count; ++i) {
  14809. const key = comps[i] * 3;
  14810. dest[destPos++] = colorMap[key];
  14811. dest[destPos++] = colorMap[key + 1];
  14812. dest[destPos++] = colorMap[key + 2];
  14813. destPos += alpha01;
  14814. }
  14815. } else {
  14816. rgbBuf = new Uint8Array(count * 3);
  14817. let rgbPos = 0;
  14818. for (let i = 0; i < count; ++i) {
  14819. const key = comps[i] * 3;
  14820. rgbBuf[rgbPos++] = colorMap[key];
  14821. rgbBuf[rgbPos++] = colorMap[key + 1];
  14822. rgbBuf[rgbPos++] = colorMap[key + 2];
  14823. }
  14824. }
  14825. } else {
  14826. if (!needsResizing) {
  14827. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  14828. } else {
  14829. rgbBuf = new Uint8ClampedArray(count * 3);
  14830. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  14831. }
  14832. }
  14833. if (rgbBuf) {
  14834. if (needsResizing) {
  14835. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  14836. } else {
  14837. let destPos = 0,
  14838. rgbPos = 0;
  14839. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  14840. dest[destPos++] = rgbBuf[rgbPos++];
  14841. dest[destPos++] = rgbBuf[rgbPos++];
  14842. dest[destPos++] = rgbBuf[rgbPos++];
  14843. destPos += alpha01;
  14844. }
  14845. }
  14846. }
  14847. }
  14848. get usesZeroToOneRange() {
  14849. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  14850. }
  14851. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  14852. if (!localColorSpaceCache) {
  14853. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  14854. }
  14855. if (!parsedColorSpace) {
  14856. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  14857. }
  14858. let csName, csRef;
  14859. if (cacheKey instanceof _primitives.Ref) {
  14860. csRef = cacheKey;
  14861. cacheKey = xref.fetch(cacheKey);
  14862. }
  14863. if (cacheKey instanceof _primitives.Name) {
  14864. csName = cacheKey.name;
  14865. }
  14866. if (csName || csRef) {
  14867. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  14868. }
  14869. }
  14870. static getCached(cacheKey, xref, localColorSpaceCache) {
  14871. if (!localColorSpaceCache) {
  14872. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  14873. }
  14874. if (cacheKey instanceof _primitives.Ref) {
  14875. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  14876. if (localColorSpace) {
  14877. return localColorSpace;
  14878. }
  14879. try {
  14880. cacheKey = xref.fetch(cacheKey);
  14881. } catch (ex) {
  14882. if (ex instanceof _core_utils.MissingDataException) {
  14883. throw ex;
  14884. }
  14885. }
  14886. }
  14887. if (cacheKey instanceof _primitives.Name) {
  14888. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  14889. if (localColorSpace) {
  14890. return localColorSpace;
  14891. }
  14892. }
  14893. return null;
  14894. }
  14895. static async parseAsync({
  14896. cs,
  14897. xref,
  14898. resources = null,
  14899. pdfFunctionFactory,
  14900. localColorSpaceCache
  14901. }) {
  14902. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  14903. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  14904. return parsedColorSpace;
  14905. }
  14906. static parse({
  14907. cs,
  14908. xref,
  14909. resources = null,
  14910. pdfFunctionFactory,
  14911. localColorSpaceCache
  14912. }) {
  14913. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  14914. if (cachedColorSpace) {
  14915. return cachedColorSpace;
  14916. }
  14917. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  14918. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  14919. return parsedColorSpace;
  14920. }
  14921. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  14922. cs = xref.fetchIfRef(cs);
  14923. if ((0, _primitives.isName)(cs)) {
  14924. switch (cs.name) {
  14925. case "DeviceGray":
  14926. case "G":
  14927. return this.singletons.gray;
  14928. case "DeviceRGB":
  14929. case "RGB":
  14930. return this.singletons.rgb;
  14931. case "DeviceCMYK":
  14932. case "CMYK":
  14933. return this.singletons.cmyk;
  14934. case "Pattern":
  14935. return new PatternCS(null);
  14936. default:
  14937. if ((0, _primitives.isDict)(resources)) {
  14938. const colorSpaces = resources.get("ColorSpace");
  14939. if ((0, _primitives.isDict)(colorSpaces)) {
  14940. const resourcesCS = colorSpaces.get(cs.name);
  14941. if (resourcesCS) {
  14942. if ((0, _primitives.isName)(resourcesCS)) {
  14943. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  14944. }
  14945. cs = resourcesCS;
  14946. break;
  14947. }
  14948. }
  14949. }
  14950. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  14951. }
  14952. }
  14953. if (Array.isArray(cs)) {
  14954. const mode = xref.fetchIfRef(cs[0]).name;
  14955. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  14956. switch (mode) {
  14957. case "DeviceGray":
  14958. case "G":
  14959. return this.singletons.gray;
  14960. case "DeviceRGB":
  14961. case "RGB":
  14962. return this.singletons.rgb;
  14963. case "DeviceCMYK":
  14964. case "CMYK":
  14965. return this.singletons.cmyk;
  14966. case "CalGray":
  14967. params = xref.fetchIfRef(cs[1]);
  14968. whitePoint = params.getArray("WhitePoint");
  14969. blackPoint = params.getArray("BlackPoint");
  14970. gamma = params.get("Gamma");
  14971. return new CalGrayCS(whitePoint, blackPoint, gamma);
  14972. case "CalRGB":
  14973. params = xref.fetchIfRef(cs[1]);
  14974. whitePoint = params.getArray("WhitePoint");
  14975. blackPoint = params.getArray("BlackPoint");
  14976. gamma = params.getArray("Gamma");
  14977. const matrix = params.getArray("Matrix");
  14978. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  14979. case "ICCBased":
  14980. const stream = xref.fetchIfRef(cs[1]);
  14981. const dict = stream.dict;
  14982. numComps = dict.get("N");
  14983. const alt = dict.get("Alternate");
  14984. if (alt) {
  14985. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  14986. if (altCS.numComps === numComps) {
  14987. return altCS;
  14988. }
  14989. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  14990. }
  14991. if (numComps === 1) {
  14992. return this.singletons.gray;
  14993. } else if (numComps === 3) {
  14994. return this.singletons.rgb;
  14995. } else if (numComps === 4) {
  14996. return this.singletons.cmyk;
  14997. }
  14998. break;
  14999. case "Pattern":
  15000. baseCS = cs[1] || null;
  15001. if (baseCS) {
  15002. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  15003. }
  15004. return new PatternCS(baseCS);
  15005. case "Indexed":
  15006. case "I":
  15007. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  15008. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  15009. const lookup = xref.fetchIfRef(cs[3]);
  15010. return new IndexedCS(baseCS, hiVal, lookup);
  15011. case "Separation":
  15012. case "DeviceN":
  15013. const name = xref.fetchIfRef(cs[1]);
  15014. numComps = Array.isArray(name) ? name.length : 1;
  15015. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  15016. const tintFn = pdfFunctionFactory.create(cs[3]);
  15017. return new AlternateCS(numComps, baseCS, tintFn);
  15018. case "Lab":
  15019. params = xref.fetchIfRef(cs[1]);
  15020. whitePoint = params.getArray("WhitePoint");
  15021. blackPoint = params.getArray("BlackPoint");
  15022. const range = params.getArray("Range");
  15023. return new LabCS(whitePoint, blackPoint, range);
  15024. default:
  15025. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  15026. }
  15027. }
  15028. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  15029. }
  15030. static isDefaultDecode(decode, numComps) {
  15031. if (!Array.isArray(decode)) {
  15032. return true;
  15033. }
  15034. if (numComps * 2 !== decode.length) {
  15035. (0, _util.warn)("The decode map is not the correct length");
  15036. return true;
  15037. }
  15038. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  15039. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  15040. return false;
  15041. }
  15042. }
  15043. return true;
  15044. }
  15045. static get singletons() {
  15046. return (0, _util.shadow)(this, "singletons", {
  15047. get gray() {
  15048. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  15049. },
  15050. get rgb() {
  15051. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  15052. },
  15053. get cmyk() {
  15054. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  15055. }
  15056. });
  15057. }
  15058. }
  15059. exports.ColorSpace = ColorSpace;
  15060. class AlternateCS extends ColorSpace {
  15061. constructor(numComps, base, tintFn) {
  15062. super("Alternate", numComps);
  15063. this.base = base;
  15064. this.tintFn = tintFn;
  15065. this.tmpBuf = new Float32Array(base.numComps);
  15066. }
  15067. getRgbItem(src, srcOffset, dest, destOffset) {
  15068. const tmpBuf = this.tmpBuf;
  15069. this.tintFn(src, srcOffset, tmpBuf, 0);
  15070. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  15071. }
  15072. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15073. const tintFn = this.tintFn;
  15074. const base = this.base;
  15075. const scale = 1 / ((1 << bits) - 1);
  15076. const baseNumComps = base.numComps;
  15077. const usesZeroToOneRange = base.usesZeroToOneRange;
  15078. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  15079. let pos = isPassthrough ? destOffset : 0;
  15080. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  15081. const numComps = this.numComps;
  15082. const scaled = new Float32Array(numComps);
  15083. const tinted = new Float32Array(baseNumComps);
  15084. let i, j;
  15085. for (i = 0; i < count; i++) {
  15086. for (j = 0; j < numComps; j++) {
  15087. scaled[j] = src[srcOffset++] * scale;
  15088. }
  15089. tintFn(scaled, 0, tinted, 0);
  15090. if (usesZeroToOneRange) {
  15091. for (j = 0; j < baseNumComps; j++) {
  15092. baseBuf[pos++] = tinted[j] * 255;
  15093. }
  15094. } else {
  15095. base.getRgbItem(tinted, 0, baseBuf, pos);
  15096. pos += baseNumComps;
  15097. }
  15098. }
  15099. if (!isPassthrough) {
  15100. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  15101. }
  15102. }
  15103. getOutputLength(inputLength, alpha01) {
  15104. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  15105. }
  15106. }
  15107. class PatternCS extends ColorSpace {
  15108. constructor(baseCS) {
  15109. super("Pattern", null);
  15110. this.base = baseCS;
  15111. }
  15112. isDefaultDecode(decodeMap, bpc) {
  15113. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  15114. }
  15115. }
  15116. class IndexedCS extends ColorSpace {
  15117. constructor(base, highVal, lookup) {
  15118. super("Indexed", 1);
  15119. this.base = base;
  15120. this.highVal = highVal;
  15121. const length = base.numComps * highVal;
  15122. this.lookup = new Uint8Array(length);
  15123. if ((0, _primitives.isStream)(lookup)) {
  15124. const bytes = lookup.getBytes(length);
  15125. this.lookup.set(bytes);
  15126. } else if (typeof lookup === "string") {
  15127. for (let i = 0; i < length; ++i) {
  15128. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  15129. }
  15130. } else {
  15131. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  15132. }
  15133. }
  15134. getRgbItem(src, srcOffset, dest, destOffset) {
  15135. const numComps = this.base.numComps;
  15136. const start = src[srcOffset] * numComps;
  15137. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  15138. }
  15139. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15140. const base = this.base;
  15141. const numComps = base.numComps;
  15142. const outputDelta = base.getOutputLength(numComps, alpha01);
  15143. const lookup = this.lookup;
  15144. for (let i = 0; i < count; ++i) {
  15145. const lookupPos = src[srcOffset++] * numComps;
  15146. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  15147. destOffset += outputDelta;
  15148. }
  15149. }
  15150. getOutputLength(inputLength, alpha01) {
  15151. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  15152. }
  15153. isDefaultDecode(decodeMap, bpc) {
  15154. if (!Array.isArray(decodeMap)) {
  15155. return true;
  15156. }
  15157. if (decodeMap.length !== 2) {
  15158. (0, _util.warn)("Decode map length is not correct");
  15159. return true;
  15160. }
  15161. if (!Number.isInteger(bpc) || bpc < 1) {
  15162. (0, _util.warn)("Bits per component is not correct");
  15163. return true;
  15164. }
  15165. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  15166. }
  15167. }
  15168. class DeviceGrayCS extends ColorSpace {
  15169. constructor() {
  15170. super("DeviceGray", 1);
  15171. }
  15172. getRgbItem(src, srcOffset, dest, destOffset) {
  15173. const c = src[srcOffset] * 255;
  15174. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  15175. }
  15176. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15177. const scale = 255 / ((1 << bits) - 1);
  15178. let j = srcOffset,
  15179. q = destOffset;
  15180. for (let i = 0; i < count; ++i) {
  15181. const c = scale * src[j++];
  15182. dest[q++] = c;
  15183. dest[q++] = c;
  15184. dest[q++] = c;
  15185. q += alpha01;
  15186. }
  15187. }
  15188. getOutputLength(inputLength, alpha01) {
  15189. return inputLength * (3 + alpha01);
  15190. }
  15191. }
  15192. class DeviceRgbCS extends ColorSpace {
  15193. constructor() {
  15194. super("DeviceRGB", 3);
  15195. }
  15196. getRgbItem(src, srcOffset, dest, destOffset) {
  15197. dest[destOffset] = src[srcOffset] * 255;
  15198. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  15199. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  15200. }
  15201. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15202. if (bits === 8 && alpha01 === 0) {
  15203. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  15204. return;
  15205. }
  15206. const scale = 255 / ((1 << bits) - 1);
  15207. let j = srcOffset,
  15208. q = destOffset;
  15209. for (let i = 0; i < count; ++i) {
  15210. dest[q++] = scale * src[j++];
  15211. dest[q++] = scale * src[j++];
  15212. dest[q++] = scale * src[j++];
  15213. q += alpha01;
  15214. }
  15215. }
  15216. getOutputLength(inputLength, alpha01) {
  15217. return inputLength * (3 + alpha01) / 3 | 0;
  15218. }
  15219. isPassthrough(bits) {
  15220. return bits === 8;
  15221. }
  15222. }
  15223. const DeviceCmykCS = function DeviceCmykCSClosure() {
  15224. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  15225. const c = src[srcOffset] * srcScale;
  15226. const m = src[srcOffset + 1] * srcScale;
  15227. const y = src[srcOffset + 2] * srcScale;
  15228. const k = src[srcOffset + 3] * srcScale;
  15229. 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);
  15230. 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);
  15231. 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);
  15232. }
  15233. class DeviceCmykCS extends ColorSpace {
  15234. constructor() {
  15235. super("DeviceCMYK", 4);
  15236. }
  15237. getRgbItem(src, srcOffset, dest, destOffset) {
  15238. convertToRgb(src, srcOffset, 1, dest, destOffset);
  15239. }
  15240. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15241. const scale = 1 / ((1 << bits) - 1);
  15242. for (let i = 0; i < count; i++) {
  15243. convertToRgb(src, srcOffset, scale, dest, destOffset);
  15244. srcOffset += 4;
  15245. destOffset += 3 + alpha01;
  15246. }
  15247. }
  15248. getOutputLength(inputLength, alpha01) {
  15249. return inputLength / 4 * (3 + alpha01) | 0;
  15250. }
  15251. }
  15252. return DeviceCmykCS;
  15253. }();
  15254. const CalGrayCS = function CalGrayCSClosure() {
  15255. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  15256. const A = src[srcOffset] * scale;
  15257. const AG = A ** cs.G;
  15258. const L = cs.YW * AG;
  15259. const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
  15260. dest[destOffset] = val;
  15261. dest[destOffset + 1] = val;
  15262. dest[destOffset + 2] = val;
  15263. }
  15264. class CalGrayCS extends ColorSpace {
  15265. constructor(whitePoint, blackPoint, gamma) {
  15266. super("CalGray", 1);
  15267. if (!whitePoint) {
  15268. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  15269. }
  15270. blackPoint = blackPoint || [0, 0, 0];
  15271. gamma = gamma || 1;
  15272. this.XW = whitePoint[0];
  15273. this.YW = whitePoint[1];
  15274. this.ZW = whitePoint[2];
  15275. this.XB = blackPoint[0];
  15276. this.YB = blackPoint[1];
  15277. this.ZB = blackPoint[2];
  15278. this.G = gamma;
  15279. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  15280. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  15281. }
  15282. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  15283. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  15284. this.XB = this.YB = this.ZB = 0;
  15285. }
  15286. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  15287. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  15288. }
  15289. if (this.G < 1) {
  15290. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  15291. this.G = 1;
  15292. }
  15293. }
  15294. getRgbItem(src, srcOffset, dest, destOffset) {
  15295. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  15296. }
  15297. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15298. const scale = 1 / ((1 << bits) - 1);
  15299. for (let i = 0; i < count; ++i) {
  15300. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  15301. srcOffset += 1;
  15302. destOffset += 3 + alpha01;
  15303. }
  15304. }
  15305. getOutputLength(inputLength, alpha01) {
  15306. return inputLength * (3 + alpha01);
  15307. }
  15308. }
  15309. return CalGrayCS;
  15310. }();
  15311. const CalRGBCS = function CalRGBCSClosure() {
  15312. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  15313. 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]);
  15314. 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]);
  15315. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  15316. const tempNormalizeMatrix = new Float32Array(3);
  15317. const tempConvertMatrix1 = new Float32Array(3);
  15318. const tempConvertMatrix2 = new Float32Array(3);
  15319. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  15320. function matrixProduct(a, b, result) {
  15321. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  15322. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  15323. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  15324. }
  15325. function convertToFlat(sourceWhitePoint, LMS, result) {
  15326. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  15327. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  15328. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  15329. }
  15330. function convertToD65(sourceWhitePoint, LMS, result) {
  15331. const D65X = 0.95047;
  15332. const D65Y = 1;
  15333. const D65Z = 1.08883;
  15334. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  15335. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  15336. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  15337. }
  15338. function sRGBTransferFunction(color) {
  15339. if (color <= 0.0031308) {
  15340. return adjustToRange(0, 1, 12.92 * color);
  15341. }
  15342. if (color >= 0.99554525) {
  15343. return 1;
  15344. }
  15345. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  15346. }
  15347. function adjustToRange(min, max, value) {
  15348. return Math.max(min, Math.min(max, value));
  15349. }
  15350. function decodeL(L) {
  15351. if (L < 0) {
  15352. return -decodeL(-L);
  15353. }
  15354. if (L > 8.0) {
  15355. return ((L + 16) / 116) ** 3;
  15356. }
  15357. return L * DECODE_L_CONSTANT;
  15358. }
  15359. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  15360. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  15361. result[0] = XYZ_Flat[0];
  15362. result[1] = XYZ_Flat[1];
  15363. result[2] = XYZ_Flat[2];
  15364. return;
  15365. }
  15366. const zeroDecodeL = decodeL(0);
  15367. const X_DST = zeroDecodeL;
  15368. const X_SRC = decodeL(sourceBlackPoint[0]);
  15369. const Y_DST = zeroDecodeL;
  15370. const Y_SRC = decodeL(sourceBlackPoint[1]);
  15371. const Z_DST = zeroDecodeL;
  15372. const Z_SRC = decodeL(sourceBlackPoint[2]);
  15373. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  15374. const X_Offset = 1 - X_Scale;
  15375. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  15376. const Y_Offset = 1 - Y_Scale;
  15377. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  15378. const Z_Offset = 1 - Z_Scale;
  15379. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  15380. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  15381. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  15382. }
  15383. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  15384. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  15385. result[0] = XYZ_In[0];
  15386. result[1] = XYZ_In[1];
  15387. result[2] = XYZ_In[2];
  15388. return;
  15389. }
  15390. const LMS = result;
  15391. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  15392. const LMS_Flat = tempNormalizeMatrix;
  15393. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  15394. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  15395. }
  15396. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  15397. const LMS = result;
  15398. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  15399. const LMS_D65 = tempNormalizeMatrix;
  15400. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  15401. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  15402. }
  15403. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  15404. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  15405. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  15406. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  15407. const AGR = A === 1 ? 1 : A ** cs.GR;
  15408. const BGG = B === 1 ? 1 : B ** cs.GG;
  15409. const CGB = C === 1 ? 1 : C ** cs.GB;
  15410. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  15411. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  15412. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  15413. const XYZ = tempConvertMatrix1;
  15414. XYZ[0] = X;
  15415. XYZ[1] = Y;
  15416. XYZ[2] = Z;
  15417. const XYZ_Flat = tempConvertMatrix2;
  15418. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  15419. const XYZ_Black = tempConvertMatrix1;
  15420. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  15421. const XYZ_D65 = tempConvertMatrix2;
  15422. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  15423. const SRGB = tempConvertMatrix1;
  15424. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  15425. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  15426. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  15427. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  15428. }
  15429. class CalRGBCS extends ColorSpace {
  15430. constructor(whitePoint, blackPoint, gamma, matrix) {
  15431. super("CalRGB", 3);
  15432. if (!whitePoint) {
  15433. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  15434. }
  15435. blackPoint = blackPoint || new Float32Array(3);
  15436. gamma = gamma || new Float32Array([1, 1, 1]);
  15437. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  15438. const XW = whitePoint[0];
  15439. const YW = whitePoint[1];
  15440. const ZW = whitePoint[2];
  15441. this.whitePoint = whitePoint;
  15442. const XB = blackPoint[0];
  15443. const YB = blackPoint[1];
  15444. const ZB = blackPoint[2];
  15445. this.blackPoint = blackPoint;
  15446. this.GR = gamma[0];
  15447. this.GG = gamma[1];
  15448. this.GB = gamma[2];
  15449. this.MXA = matrix[0];
  15450. this.MYA = matrix[1];
  15451. this.MZA = matrix[2];
  15452. this.MXB = matrix[3];
  15453. this.MYB = matrix[4];
  15454. this.MZB = matrix[5];
  15455. this.MXC = matrix[6];
  15456. this.MYC = matrix[7];
  15457. this.MZC = matrix[8];
  15458. if (XW < 0 || ZW < 0 || YW !== 1) {
  15459. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  15460. }
  15461. if (XB < 0 || YB < 0 || ZB < 0) {
  15462. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  15463. this.blackPoint = new Float32Array(3);
  15464. }
  15465. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  15466. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  15467. this.GR = this.GG = this.GB = 1;
  15468. }
  15469. }
  15470. getRgbItem(src, srcOffset, dest, destOffset) {
  15471. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  15472. }
  15473. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15474. const scale = 1 / ((1 << bits) - 1);
  15475. for (let i = 0; i < count; ++i) {
  15476. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  15477. srcOffset += 3;
  15478. destOffset += 3 + alpha01;
  15479. }
  15480. }
  15481. getOutputLength(inputLength, alpha01) {
  15482. return inputLength * (3 + alpha01) / 3 | 0;
  15483. }
  15484. }
  15485. return CalRGBCS;
  15486. }();
  15487. const LabCS = function LabCSClosure() {
  15488. function fn_g(x) {
  15489. let result;
  15490. if (x >= 6 / 29) {
  15491. result = x ** 3;
  15492. } else {
  15493. result = 108 / 841 * (x - 4 / 29);
  15494. }
  15495. return result;
  15496. }
  15497. function decode(value, high1, low2, high2) {
  15498. return low2 + value * (high2 - low2) / high1;
  15499. }
  15500. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  15501. let Ls = src[srcOffset];
  15502. let as = src[srcOffset + 1];
  15503. let bs = src[srcOffset + 2];
  15504. if (maxVal !== false) {
  15505. Ls = decode(Ls, maxVal, 0, 100);
  15506. as = decode(as, maxVal, cs.amin, cs.amax);
  15507. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  15508. }
  15509. if (as > cs.amax) {
  15510. as = cs.amax;
  15511. } else if (as < cs.amin) {
  15512. as = cs.amin;
  15513. }
  15514. if (bs > cs.bmax) {
  15515. bs = cs.bmax;
  15516. } else if (bs < cs.bmin) {
  15517. bs = cs.bmin;
  15518. }
  15519. const M = (Ls + 16) / 116;
  15520. const L = M + as / 500;
  15521. const N = M - bs / 200;
  15522. const X = cs.XW * fn_g(L);
  15523. const Y = cs.YW * fn_g(M);
  15524. const Z = cs.ZW * fn_g(N);
  15525. let r, g, b;
  15526. if (cs.ZW < 1) {
  15527. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  15528. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  15529. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  15530. } else {
  15531. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  15532. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  15533. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  15534. }
  15535. dest[destOffset] = Math.sqrt(r) * 255;
  15536. dest[destOffset + 1] = Math.sqrt(g) * 255;
  15537. dest[destOffset + 2] = Math.sqrt(b) * 255;
  15538. }
  15539. class LabCS extends ColorSpace {
  15540. constructor(whitePoint, blackPoint, range) {
  15541. super("Lab", 3);
  15542. if (!whitePoint) {
  15543. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  15544. }
  15545. blackPoint = blackPoint || [0, 0, 0];
  15546. range = range || [-100, 100, -100, 100];
  15547. this.XW = whitePoint[0];
  15548. this.YW = whitePoint[1];
  15549. this.ZW = whitePoint[2];
  15550. this.amin = range[0];
  15551. this.amax = range[1];
  15552. this.bmin = range[2];
  15553. this.bmax = range[3];
  15554. this.XB = blackPoint[0];
  15555. this.YB = blackPoint[1];
  15556. this.ZB = blackPoint[2];
  15557. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  15558. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  15559. }
  15560. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  15561. (0, _util.info)("Invalid BlackPoint, falling back to default");
  15562. this.XB = this.YB = this.ZB = 0;
  15563. }
  15564. if (this.amin > this.amax || this.bmin > this.bmax) {
  15565. (0, _util.info)("Invalid Range, falling back to defaults");
  15566. this.amin = -100;
  15567. this.amax = 100;
  15568. this.bmin = -100;
  15569. this.bmax = 100;
  15570. }
  15571. }
  15572. getRgbItem(src, srcOffset, dest, destOffset) {
  15573. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  15574. }
  15575. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  15576. const maxVal = (1 << bits) - 1;
  15577. for (let i = 0; i < count; i++) {
  15578. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  15579. srcOffset += 3;
  15580. destOffset += 3 + alpha01;
  15581. }
  15582. }
  15583. getOutputLength(inputLength, alpha01) {
  15584. return inputLength * (3 + alpha01) / 3 | 0;
  15585. }
  15586. isDefaultDecode(decodeMap, bpc) {
  15587. return true;
  15588. }
  15589. get usesZeroToOneRange() {
  15590. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  15591. }
  15592. }
  15593. return LabCS;
  15594. }();
  15595. /***/ }),
  15596. /* 24 */
  15597. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15598. Object.defineProperty(exports, "__esModule", ({
  15599. value: true
  15600. }));
  15601. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  15602. var _util = __w_pdfjs_require__(2);
  15603. var _primitives = __w_pdfjs_require__(5);
  15604. class BaseLocalCache {
  15605. constructor(options) {
  15606. if (this.constructor === BaseLocalCache) {
  15607. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  15608. }
  15609. if (!options || !options.onlyRefs) {
  15610. this._nameRefMap = new Map();
  15611. this._imageMap = new Map();
  15612. }
  15613. this._imageCache = new _primitives.RefSetCache();
  15614. }
  15615. getByName(name) {
  15616. const ref = this._nameRefMap.get(name);
  15617. if (ref) {
  15618. return this.getByRef(ref);
  15619. }
  15620. return this._imageMap.get(name) || null;
  15621. }
  15622. getByRef(ref) {
  15623. return this._imageCache.get(ref) || null;
  15624. }
  15625. set(name, ref, data) {
  15626. (0, _util.unreachable)("Abstract method `set` called.");
  15627. }
  15628. }
  15629. class LocalImageCache extends BaseLocalCache {
  15630. set(name, ref = null, data) {
  15631. if (!name) {
  15632. throw new Error('LocalImageCache.set - expected "name" argument.');
  15633. }
  15634. if (ref) {
  15635. if (this._imageCache.has(ref)) {
  15636. return;
  15637. }
  15638. this._nameRefMap.set(name, ref);
  15639. this._imageCache.put(ref, data);
  15640. return;
  15641. }
  15642. if (this._imageMap.has(name)) {
  15643. return;
  15644. }
  15645. this._imageMap.set(name, data);
  15646. }
  15647. }
  15648. exports.LocalImageCache = LocalImageCache;
  15649. class LocalColorSpaceCache extends BaseLocalCache {
  15650. set(name = null, ref = null, data) {
  15651. if (!name && !ref) {
  15652. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  15653. }
  15654. if (ref) {
  15655. if (this._imageCache.has(ref)) {
  15656. return;
  15657. }
  15658. if (name) {
  15659. this._nameRefMap.set(name, ref);
  15660. }
  15661. this._imageCache.put(ref, data);
  15662. return;
  15663. }
  15664. if (this._imageMap.has(name)) {
  15665. return;
  15666. }
  15667. this._imageMap.set(name, data);
  15668. }
  15669. }
  15670. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  15671. class LocalFunctionCache extends BaseLocalCache {
  15672. constructor(options) {
  15673. super({
  15674. onlyRefs: true
  15675. });
  15676. }
  15677. getByName(name) {
  15678. (0, _util.unreachable)("Should not call `getByName` method.");
  15679. }
  15680. set(name = null, ref, data) {
  15681. if (!ref) {
  15682. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  15683. }
  15684. if (this._imageCache.has(ref)) {
  15685. return;
  15686. }
  15687. this._imageCache.put(ref, data);
  15688. }
  15689. }
  15690. exports.LocalFunctionCache = LocalFunctionCache;
  15691. class LocalGStateCache extends BaseLocalCache {
  15692. set(name, ref = null, data) {
  15693. if (!name) {
  15694. throw new Error('LocalGStateCache.set - expected "name" argument.');
  15695. }
  15696. if (ref) {
  15697. if (this._imageCache.has(ref)) {
  15698. return;
  15699. }
  15700. this._nameRefMap.set(name, ref);
  15701. this._imageCache.put(ref, data);
  15702. return;
  15703. }
  15704. if (this._imageMap.has(name)) {
  15705. return;
  15706. }
  15707. this._imageMap.set(name, data);
  15708. }
  15709. }
  15710. exports.LocalGStateCache = LocalGStateCache;
  15711. class LocalTilingPatternCache extends BaseLocalCache {
  15712. set(name, ref = null, data) {
  15713. if (!name) {
  15714. throw new Error('LocalTilingPatternCache.set - expected "name" argument.');
  15715. }
  15716. if (ref) {
  15717. if (this._imageCache.has(ref)) {
  15718. return;
  15719. }
  15720. this._nameRefMap.set(name, ref);
  15721. this._imageCache.put(ref, data);
  15722. return;
  15723. }
  15724. if (this._imageMap.has(name)) {
  15725. return;
  15726. }
  15727. this._imageMap.set(name, data);
  15728. }
  15729. }
  15730. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  15731. class GlobalImageCache {
  15732. static get NUM_PAGES_THRESHOLD() {
  15733. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  15734. }
  15735. static get MIN_IMAGES_TO_CACHE() {
  15736. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  15737. }
  15738. static get MAX_BYTE_SIZE() {
  15739. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  15740. }
  15741. constructor() {
  15742. this._refCache = new _primitives.RefSetCache();
  15743. this._imageCache = new _primitives.RefSetCache();
  15744. }
  15745. get _byteSize() {
  15746. let byteSize = 0;
  15747. this._imageCache.forEach(imageData => {
  15748. byteSize += imageData.byteSize;
  15749. });
  15750. return byteSize;
  15751. }
  15752. get _cacheLimitReached() {
  15753. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  15754. return false;
  15755. }
  15756. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  15757. return false;
  15758. }
  15759. return true;
  15760. }
  15761. shouldCache(ref, pageIndex) {
  15762. const pageIndexSet = this._refCache.get(ref);
  15763. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  15764. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  15765. return false;
  15766. }
  15767. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  15768. return false;
  15769. }
  15770. return true;
  15771. }
  15772. addPageIndex(ref, pageIndex) {
  15773. let pageIndexSet = this._refCache.get(ref);
  15774. if (!pageIndexSet) {
  15775. pageIndexSet = new Set();
  15776. this._refCache.put(ref, pageIndexSet);
  15777. }
  15778. pageIndexSet.add(pageIndex);
  15779. }
  15780. addByteSize(ref, byteSize) {
  15781. const imageData = this._imageCache.get(ref);
  15782. if (!imageData) {
  15783. return;
  15784. }
  15785. if (imageData.byteSize) {
  15786. return;
  15787. }
  15788. imageData.byteSize = byteSize;
  15789. }
  15790. getData(ref, pageIndex) {
  15791. const pageIndexSet = this._refCache.get(ref);
  15792. if (!pageIndexSet) {
  15793. return null;
  15794. }
  15795. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  15796. return null;
  15797. }
  15798. const imageData = this._imageCache.get(ref);
  15799. if (!imageData) {
  15800. return null;
  15801. }
  15802. pageIndexSet.add(pageIndex);
  15803. return imageData;
  15804. }
  15805. setData(ref, data) {
  15806. if (!this._refCache.has(ref)) {
  15807. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  15808. }
  15809. if (this._imageCache.has(ref)) {
  15810. return;
  15811. }
  15812. if (this._cacheLimitReached) {
  15813. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  15814. return;
  15815. }
  15816. this._imageCache.put(ref, data);
  15817. }
  15818. clear(onlyData = false) {
  15819. if (!onlyData) {
  15820. this._refCache.clear();
  15821. }
  15822. this._imageCache.clear();
  15823. }
  15824. }
  15825. exports.GlobalImageCache = GlobalImageCache;
  15826. /***/ }),
  15827. /* 25 */
  15828. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15829. Object.defineProperty(exports, "__esModule", ({
  15830. value: true
  15831. }));
  15832. exports.MetadataParser = void 0;
  15833. var _xml_parser = __w_pdfjs_require__(26);
  15834. class MetadataParser {
  15835. constructor(data) {
  15836. data = this._repair(data);
  15837. const parser = new _xml_parser.SimpleXMLParser({
  15838. lowerCaseName: true
  15839. });
  15840. const xmlDocument = parser.parseFromString(data);
  15841. this._metadataMap = new Map();
  15842. this._data = data;
  15843. if (xmlDocument) {
  15844. this._parse(xmlDocument);
  15845. }
  15846. }
  15847. _repair(data) {
  15848. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  15849. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  15850. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  15851. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  15852. switch (name) {
  15853. case "amp":
  15854. return "&";
  15855. case "apos":
  15856. return "'";
  15857. case "gt":
  15858. return ">";
  15859. case "lt":
  15860. return "<";
  15861. case "quot":
  15862. return '"';
  15863. }
  15864. throw new Error(`_repair: ${name} isn't defined.`);
  15865. });
  15866. const charBuf = [];
  15867. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  15868. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  15869. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  15870. charBuf.push(String.fromCharCode(code));
  15871. } else {
  15872. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  15873. }
  15874. }
  15875. return ">" + charBuf.join("");
  15876. });
  15877. }
  15878. _getSequence(entry) {
  15879. const name = entry.nodeName;
  15880. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  15881. return null;
  15882. }
  15883. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  15884. }
  15885. _parseArray(entry) {
  15886. if (!entry.hasChildNodes()) {
  15887. return;
  15888. }
  15889. const [seqNode] = entry.childNodes;
  15890. const sequence = this._getSequence(seqNode) || [];
  15891. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  15892. }
  15893. _parse(xmlDocument) {
  15894. let rdf = xmlDocument.documentElement;
  15895. if (rdf.nodeName !== "rdf:rdf") {
  15896. rdf = rdf.firstChild;
  15897. while (rdf && rdf.nodeName !== "rdf:rdf") {
  15898. rdf = rdf.nextSibling;
  15899. }
  15900. }
  15901. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  15902. return;
  15903. }
  15904. for (const desc of rdf.childNodes) {
  15905. if (desc.nodeName !== "rdf:description") {
  15906. continue;
  15907. }
  15908. for (const entry of desc.childNodes) {
  15909. const name = entry.nodeName;
  15910. switch (name) {
  15911. case "#text":
  15912. continue;
  15913. case "dc:creator":
  15914. case "dc:subject":
  15915. this._parseArray(entry);
  15916. continue;
  15917. }
  15918. this._metadataMap.set(name, entry.textContent.trim());
  15919. }
  15920. }
  15921. }
  15922. get serializable() {
  15923. return {
  15924. parsedData: this._metadataMap,
  15925. rawData: this._data
  15926. };
  15927. }
  15928. }
  15929. exports.MetadataParser = MetadataParser;
  15930. /***/ }),
  15931. /* 26 */
  15932. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  15933. Object.defineProperty(exports, "__esModule", ({
  15934. value: true
  15935. }));
  15936. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  15937. var _core_utils = __w_pdfjs_require__(8);
  15938. const XMLParserErrorCode = {
  15939. NoError: 0,
  15940. EndOfDocument: -1,
  15941. UnterminatedCdat: -2,
  15942. UnterminatedXmlDeclaration: -3,
  15943. UnterminatedDoctypeDeclaration: -4,
  15944. UnterminatedComment: -5,
  15945. MalformedElement: -6,
  15946. OutOfMemory: -7,
  15947. UnterminatedAttributeValue: -8,
  15948. UnterminatedElement: -9,
  15949. ElementNeverBegun: -10
  15950. };
  15951. exports.XMLParserErrorCode = XMLParserErrorCode;
  15952. function isWhitespace(s, index) {
  15953. const ch = s[index];
  15954. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  15955. }
  15956. function isWhitespaceString(s) {
  15957. for (let i = 0, ii = s.length; i < ii; i++) {
  15958. if (!isWhitespace(s, i)) {
  15959. return false;
  15960. }
  15961. }
  15962. return true;
  15963. }
  15964. class XMLParserBase {
  15965. _resolveEntities(s) {
  15966. return s.replace(/&([^;]+);/g, (all, entity) => {
  15967. if (entity.substring(0, 2) === "#x") {
  15968. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  15969. } else if (entity.substring(0, 1) === "#") {
  15970. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  15971. }
  15972. switch (entity) {
  15973. case "lt":
  15974. return "<";
  15975. case "gt":
  15976. return ">";
  15977. case "amp":
  15978. return "&";
  15979. case "quot":
  15980. return '"';
  15981. case "apos":
  15982. return "'";
  15983. }
  15984. return this.onResolveEntity(entity);
  15985. });
  15986. }
  15987. _parseContent(s, start) {
  15988. const attributes = [];
  15989. let pos = start;
  15990. function skipWs() {
  15991. while (pos < s.length && isWhitespace(s, pos)) {
  15992. ++pos;
  15993. }
  15994. }
  15995. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  15996. ++pos;
  15997. }
  15998. const name = s.substring(start, pos);
  15999. skipWs();
  16000. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  16001. skipWs();
  16002. let attrName = "",
  16003. attrValue = "";
  16004. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  16005. attrName += s[pos];
  16006. ++pos;
  16007. }
  16008. skipWs();
  16009. if (s[pos] !== "=") {
  16010. return null;
  16011. }
  16012. ++pos;
  16013. skipWs();
  16014. const attrEndChar = s[pos];
  16015. if (attrEndChar !== '"' && attrEndChar !== "'") {
  16016. return null;
  16017. }
  16018. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  16019. if (attrEndIndex < 0) {
  16020. return null;
  16021. }
  16022. attrValue = s.substring(pos, attrEndIndex);
  16023. attributes.push({
  16024. name: attrName,
  16025. value: this._resolveEntities(attrValue)
  16026. });
  16027. pos = attrEndIndex + 1;
  16028. skipWs();
  16029. }
  16030. return {
  16031. name,
  16032. attributes,
  16033. parsed: pos - start
  16034. };
  16035. }
  16036. _parseProcessingInstruction(s, start) {
  16037. let pos = start;
  16038. function skipWs() {
  16039. while (pos < s.length && isWhitespace(s, pos)) {
  16040. ++pos;
  16041. }
  16042. }
  16043. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  16044. ++pos;
  16045. }
  16046. const name = s.substring(start, pos);
  16047. skipWs();
  16048. const attrStart = pos;
  16049. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  16050. ++pos;
  16051. }
  16052. const value = s.substring(attrStart, pos);
  16053. return {
  16054. name,
  16055. value,
  16056. parsed: pos - start
  16057. };
  16058. }
  16059. parseXml(s) {
  16060. let i = 0;
  16061. while (i < s.length) {
  16062. const ch = s[i];
  16063. let j = i;
  16064. if (ch === "<") {
  16065. ++j;
  16066. const ch2 = s[j];
  16067. let q;
  16068. switch (ch2) {
  16069. case "/":
  16070. ++j;
  16071. q = s.indexOf(">", j);
  16072. if (q < 0) {
  16073. this.onError(XMLParserErrorCode.UnterminatedElement);
  16074. return;
  16075. }
  16076. this.onEndElement(s.substring(j, q));
  16077. j = q + 1;
  16078. break;
  16079. case "?":
  16080. ++j;
  16081. const pi = this._parseProcessingInstruction(s, j);
  16082. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  16083. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  16084. return;
  16085. }
  16086. this.onPi(pi.name, pi.value);
  16087. j += pi.parsed + 2;
  16088. break;
  16089. case "!":
  16090. if (s.substring(j + 1, j + 3) === "--") {
  16091. q = s.indexOf("-->", j + 3);
  16092. if (q < 0) {
  16093. this.onError(XMLParserErrorCode.UnterminatedComment);
  16094. return;
  16095. }
  16096. this.onComment(s.substring(j + 3, q));
  16097. j = q + 3;
  16098. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  16099. q = s.indexOf("]]>", j + 8);
  16100. if (q < 0) {
  16101. this.onError(XMLParserErrorCode.UnterminatedCdat);
  16102. return;
  16103. }
  16104. this.onCdata(s.substring(j + 8, q));
  16105. j = q + 3;
  16106. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  16107. const q2 = s.indexOf("[", j + 8);
  16108. let complexDoctype = false;
  16109. q = s.indexOf(">", j + 8);
  16110. if (q < 0) {
  16111. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  16112. return;
  16113. }
  16114. if (q2 > 0 && q > q2) {
  16115. q = s.indexOf("]>", j + 8);
  16116. if (q < 0) {
  16117. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  16118. return;
  16119. }
  16120. complexDoctype = true;
  16121. }
  16122. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  16123. this.onDoctype(doctypeContent);
  16124. j = q + (complexDoctype ? 2 : 1);
  16125. } else {
  16126. this.onError(XMLParserErrorCode.MalformedElement);
  16127. return;
  16128. }
  16129. break;
  16130. default:
  16131. const content = this._parseContent(s, j);
  16132. if (content === null) {
  16133. this.onError(XMLParserErrorCode.MalformedElement);
  16134. return;
  16135. }
  16136. let isClosed = false;
  16137. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  16138. isClosed = true;
  16139. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  16140. this.onError(XMLParserErrorCode.UnterminatedElement);
  16141. return;
  16142. }
  16143. this.onBeginElement(content.name, content.attributes, isClosed);
  16144. j += content.parsed + (isClosed ? 2 : 1);
  16145. break;
  16146. }
  16147. } else {
  16148. while (j < s.length && s[j] !== "<") {
  16149. j++;
  16150. }
  16151. const text = s.substring(i, j);
  16152. this.onText(this._resolveEntities(text));
  16153. }
  16154. i = j;
  16155. }
  16156. }
  16157. onResolveEntity(name) {
  16158. return `&${name};`;
  16159. }
  16160. onPi(name, value) {}
  16161. onComment(text) {}
  16162. onCdata(text) {}
  16163. onDoctype(doctypeContent) {}
  16164. onText(text) {}
  16165. onBeginElement(name, attributes, isEmpty) {}
  16166. onEndElement(name) {}
  16167. onError(code) {}
  16168. }
  16169. exports.XMLParserBase = XMLParserBase;
  16170. class SimpleDOMNode {
  16171. constructor(nodeName, nodeValue) {
  16172. this.nodeName = nodeName;
  16173. this.nodeValue = nodeValue;
  16174. Object.defineProperty(this, "parentNode", {
  16175. value: null,
  16176. writable: true
  16177. });
  16178. }
  16179. get firstChild() {
  16180. return this.childNodes && this.childNodes[0];
  16181. }
  16182. get nextSibling() {
  16183. const childNodes = this.parentNode.childNodes;
  16184. if (!childNodes) {
  16185. return undefined;
  16186. }
  16187. const index = childNodes.indexOf(this);
  16188. if (index === -1) {
  16189. return undefined;
  16190. }
  16191. return childNodes[index + 1];
  16192. }
  16193. get textContent() {
  16194. if (!this.childNodes) {
  16195. return this.nodeValue || "";
  16196. }
  16197. return this.childNodes.map(function (child) {
  16198. return child.textContent;
  16199. }).join("");
  16200. }
  16201. hasChildNodes() {
  16202. return this.childNodes && this.childNodes.length > 0;
  16203. }
  16204. searchNode(paths, pos) {
  16205. if (pos >= paths.length) {
  16206. return this;
  16207. }
  16208. const component = paths[pos];
  16209. const stack = [];
  16210. let node = this;
  16211. while (true) {
  16212. if (component.name === node.nodeName) {
  16213. if (component.pos === 0) {
  16214. const res = node.searchNode(paths, pos + 1);
  16215. if (res !== null) {
  16216. return res;
  16217. }
  16218. } else if (stack.length === 0) {
  16219. return null;
  16220. } else {
  16221. const [parent] = stack.pop();
  16222. let siblingPos = 0;
  16223. for (const child of parent.childNodes) {
  16224. if (component.name === child.nodeName) {
  16225. if (siblingPos === component.pos) {
  16226. return child.searchNode(paths, pos + 1);
  16227. }
  16228. siblingPos++;
  16229. }
  16230. }
  16231. return node.searchNode(paths, pos + 1);
  16232. }
  16233. }
  16234. if (node.childNodes && node.childNodes.length !== 0) {
  16235. stack.push([node, 0]);
  16236. node = node.childNodes[0];
  16237. } else if (stack.length === 0) {
  16238. return null;
  16239. } else {
  16240. while (stack.length !== 0) {
  16241. const [parent, currentPos] = stack.pop();
  16242. const newPos = currentPos + 1;
  16243. if (newPos < parent.childNodes.length) {
  16244. stack.push([parent, newPos]);
  16245. node = parent.childNodes[newPos];
  16246. break;
  16247. }
  16248. }
  16249. if (stack.length === 0) {
  16250. return null;
  16251. }
  16252. }
  16253. }
  16254. }
  16255. dump(buffer) {
  16256. if (this.nodeName === "#text") {
  16257. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  16258. return;
  16259. }
  16260. buffer.push(`<${this.nodeName}`);
  16261. if (this.attributes) {
  16262. for (const attribute of this.attributes) {
  16263. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  16264. }
  16265. }
  16266. if (this.hasChildNodes()) {
  16267. buffer.push(">");
  16268. for (const child of this.childNodes) {
  16269. child.dump(buffer);
  16270. }
  16271. buffer.push(`</${this.nodeName}>`);
  16272. } else if (this.nodeValue) {
  16273. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  16274. } else {
  16275. buffer.push("/>");
  16276. }
  16277. }
  16278. }
  16279. exports.SimpleDOMNode = SimpleDOMNode;
  16280. class SimpleXMLParser extends XMLParserBase {
  16281. constructor({
  16282. hasAttributes = false,
  16283. lowerCaseName = false
  16284. }) {
  16285. super();
  16286. this._currentFragment = null;
  16287. this._stack = null;
  16288. this._errorCode = XMLParserErrorCode.NoError;
  16289. this._hasAttributes = hasAttributes;
  16290. this._lowerCaseName = lowerCaseName;
  16291. }
  16292. parseFromString(data) {
  16293. this._currentFragment = [];
  16294. this._stack = [];
  16295. this._errorCode = XMLParserErrorCode.NoError;
  16296. this.parseXml(data);
  16297. if (this._errorCode !== XMLParserErrorCode.NoError) {
  16298. return undefined;
  16299. }
  16300. const [documentElement] = this._currentFragment;
  16301. if (!documentElement) {
  16302. return undefined;
  16303. }
  16304. return {
  16305. documentElement
  16306. };
  16307. }
  16308. onText(text) {
  16309. if (isWhitespaceString(text)) {
  16310. return;
  16311. }
  16312. const node = new SimpleDOMNode("#text", text);
  16313. this._currentFragment.push(node);
  16314. }
  16315. onCdata(text) {
  16316. const node = new SimpleDOMNode("#text", text);
  16317. this._currentFragment.push(node);
  16318. }
  16319. onBeginElement(name, attributes, isEmpty) {
  16320. if (this._lowerCaseName) {
  16321. name = name.toLowerCase();
  16322. }
  16323. const node = new SimpleDOMNode(name);
  16324. node.childNodes = [];
  16325. if (this._hasAttributes) {
  16326. node.attributes = attributes;
  16327. }
  16328. this._currentFragment.push(node);
  16329. if (isEmpty) {
  16330. return;
  16331. }
  16332. this._stack.push(this._currentFragment);
  16333. this._currentFragment = node.childNodes;
  16334. }
  16335. onEndElement(name) {
  16336. this._currentFragment = this._stack.pop() || [];
  16337. const lastElement = this._currentFragment[this._currentFragment.length - 1];
  16338. if (!lastElement) {
  16339. return;
  16340. }
  16341. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  16342. lastElement.childNodes[i].parentNode = lastElement;
  16343. }
  16344. }
  16345. onError(code) {
  16346. this._errorCode = code;
  16347. }
  16348. }
  16349. exports.SimpleXMLParser = SimpleXMLParser;
  16350. /***/ }),
  16351. /* 27 */
  16352. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16353. Object.defineProperty(exports, "__esModule", ({
  16354. value: true
  16355. }));
  16356. exports.getQuadPoints = getQuadPoints;
  16357. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  16358. var _util = __w_pdfjs_require__(2);
  16359. var _obj = __w_pdfjs_require__(10);
  16360. var _core_utils = __w_pdfjs_require__(8);
  16361. var _default_appearance = __w_pdfjs_require__(28);
  16362. var _primitives = __w_pdfjs_require__(5);
  16363. var _colorspace = __w_pdfjs_require__(23);
  16364. var _operator_list = __w_pdfjs_require__(46);
  16365. var _stream = __w_pdfjs_require__(12);
  16366. var _writer = __w_pdfjs_require__(48);
  16367. class AnnotationFactory {
  16368. static create(xref, ref, pdfManager, idFactory, collectFields) {
  16369. return pdfManager.ensureCatalog("acroForm").then(acroForm => {
  16370. return pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, collectFields]);
  16371. });
  16372. }
  16373. static _create(xref, ref, pdfManager, idFactory, acroForm, collectFields) {
  16374. const dict = xref.fetchIfRef(ref);
  16375. if (!(0, _primitives.isDict)(dict)) {
  16376. return undefined;
  16377. }
  16378. const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
  16379. let subtype = dict.get("Subtype");
  16380. subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
  16381. const parameters = {
  16382. xref,
  16383. ref,
  16384. dict,
  16385. subtype,
  16386. id,
  16387. pdfManager,
  16388. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  16389. collectFields
  16390. };
  16391. switch (subtype) {
  16392. case "Link":
  16393. return new LinkAnnotation(parameters);
  16394. case "Text":
  16395. return new TextAnnotation(parameters);
  16396. case "Widget":
  16397. let fieldType = (0, _core_utils.getInheritableProperty)({
  16398. dict,
  16399. key: "FT"
  16400. });
  16401. fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  16402. switch (fieldType) {
  16403. case "Tx":
  16404. return new TextWidgetAnnotation(parameters);
  16405. case "Btn":
  16406. return new ButtonWidgetAnnotation(parameters);
  16407. case "Ch":
  16408. return new ChoiceWidgetAnnotation(parameters);
  16409. }
  16410. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  16411. return new WidgetAnnotation(parameters);
  16412. case "Popup":
  16413. return new PopupAnnotation(parameters);
  16414. case "FreeText":
  16415. return new FreeTextAnnotation(parameters);
  16416. case "Line":
  16417. return new LineAnnotation(parameters);
  16418. case "Square":
  16419. return new SquareAnnotation(parameters);
  16420. case "Circle":
  16421. return new CircleAnnotation(parameters);
  16422. case "PolyLine":
  16423. return new PolylineAnnotation(parameters);
  16424. case "Polygon":
  16425. return new PolygonAnnotation(parameters);
  16426. case "Caret":
  16427. return new CaretAnnotation(parameters);
  16428. case "Ink":
  16429. return new InkAnnotation(parameters);
  16430. case "Highlight":
  16431. return new HighlightAnnotation(parameters);
  16432. case "Underline":
  16433. return new UnderlineAnnotation(parameters);
  16434. case "Squiggly":
  16435. return new SquigglyAnnotation(parameters);
  16436. case "StrikeOut":
  16437. return new StrikeOutAnnotation(parameters);
  16438. case "Stamp":
  16439. return new StampAnnotation(parameters);
  16440. case "FileAttachment":
  16441. return new FileAttachmentAnnotation(parameters);
  16442. default:
  16443. if (!collectFields) {
  16444. if (!subtype) {
  16445. (0, _util.warn)("Annotation is missing the required /Subtype.");
  16446. } else {
  16447. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  16448. }
  16449. }
  16450. return new Annotation(parameters);
  16451. }
  16452. }
  16453. }
  16454. exports.AnnotationFactory = AnnotationFactory;
  16455. function getRgbColor(color) {
  16456. const rgbColor = new Uint8ClampedArray(3);
  16457. if (!Array.isArray(color)) {
  16458. return rgbColor;
  16459. }
  16460. switch (color.length) {
  16461. case 0:
  16462. return null;
  16463. case 1:
  16464. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  16465. return rgbColor;
  16466. case 3:
  16467. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  16468. return rgbColor;
  16469. case 4:
  16470. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  16471. return rgbColor;
  16472. default:
  16473. return rgbColor;
  16474. }
  16475. }
  16476. function getQuadPoints(dict, rect) {
  16477. if (!dict.has("QuadPoints")) {
  16478. return null;
  16479. }
  16480. const quadPoints = dict.getArray("QuadPoints");
  16481. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  16482. return null;
  16483. }
  16484. const quadPointsLists = [];
  16485. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  16486. quadPointsLists.push([]);
  16487. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  16488. const x = quadPoints[j];
  16489. const y = quadPoints[j + 1];
  16490. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  16491. return null;
  16492. }
  16493. quadPointsLists[i].push({
  16494. x,
  16495. y
  16496. });
  16497. }
  16498. }
  16499. return quadPointsLists.map(quadPointsList => {
  16500. 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]);
  16501. return [{
  16502. x: minX,
  16503. y: maxY
  16504. }, {
  16505. x: maxX,
  16506. y: maxY
  16507. }, {
  16508. x: minX,
  16509. y: minY
  16510. }, {
  16511. x: maxX,
  16512. y: minY
  16513. }];
  16514. });
  16515. }
  16516. function getTransformMatrix(rect, bbox, matrix) {
  16517. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  16518. if (minX === maxX || minY === maxY) {
  16519. return [1, 0, 0, 1, rect[0], rect[1]];
  16520. }
  16521. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  16522. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  16523. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  16524. }
  16525. class Annotation {
  16526. constructor(params) {
  16527. const dict = params.dict;
  16528. this.setContents(dict.get("Contents"));
  16529. this.setModificationDate(dict.get("M"));
  16530. this.setFlags(dict.get("F"));
  16531. this.setRectangle(dict.getArray("Rect"));
  16532. this.setColor(dict.getArray("C"));
  16533. this.setBorderStyle(dict);
  16534. this.setAppearance(dict);
  16535. this._streams = [];
  16536. if (this.appearance) {
  16537. this._streams.push(this.appearance);
  16538. }
  16539. this.data = {
  16540. annotationFlags: this.flags,
  16541. borderStyle: this.borderStyle,
  16542. color: this.color,
  16543. contents: this.contents,
  16544. hasAppearance: !!this.appearance,
  16545. id: params.id,
  16546. modificationDate: this.modificationDate,
  16547. rect: this.rectangle,
  16548. subtype: params.subtype
  16549. };
  16550. if (params.collectFields) {
  16551. const kids = dict.get("Kids");
  16552. if (Array.isArray(kids)) {
  16553. const kidIds = [];
  16554. for (const kid of kids) {
  16555. if ((0, _primitives.isRef)(kid)) {
  16556. kidIds.push(kid.toString());
  16557. }
  16558. }
  16559. if (kidIds.length !== 0) {
  16560. this.data.kidIds = kidIds;
  16561. }
  16562. }
  16563. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  16564. this.data.fieldName = this._constructFieldName(dict);
  16565. }
  16566. this._fallbackFontDict = null;
  16567. }
  16568. _hasFlag(flags, flag) {
  16569. return !!(flags & flag);
  16570. }
  16571. _isViewable(flags) {
  16572. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  16573. }
  16574. _isPrintable(flags) {
  16575. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  16576. }
  16577. isHidden(annotationStorage) {
  16578. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  16579. if (storageEntry && storageEntry.hidden !== undefined) {
  16580. return storageEntry.hidden;
  16581. }
  16582. return this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  16583. }
  16584. get viewable() {
  16585. if (this.data.quadPoints === null) {
  16586. return false;
  16587. }
  16588. if (this.flags === 0) {
  16589. return true;
  16590. }
  16591. return this._isViewable(this.flags);
  16592. }
  16593. get printable() {
  16594. if (this.data.quadPoints === null) {
  16595. return false;
  16596. }
  16597. if (this.flags === 0) {
  16598. return false;
  16599. }
  16600. return this._isPrintable(this.flags);
  16601. }
  16602. setContents(contents) {
  16603. this.contents = (0, _util.stringToPDFString)(contents || "");
  16604. }
  16605. setModificationDate(modificationDate) {
  16606. this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
  16607. }
  16608. setFlags(flags) {
  16609. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  16610. }
  16611. hasFlag(flag) {
  16612. return this._hasFlag(this.flags, flag);
  16613. }
  16614. setRectangle(rectangle) {
  16615. if (Array.isArray(rectangle) && rectangle.length === 4) {
  16616. this.rectangle = _util.Util.normalizeRect(rectangle);
  16617. } else {
  16618. this.rectangle = [0, 0, 0, 0];
  16619. }
  16620. }
  16621. setColor(color) {
  16622. this.color = getRgbColor(color);
  16623. }
  16624. setBorderStyle(borderStyle) {
  16625. this.borderStyle = new AnnotationBorderStyle();
  16626. if (!(0, _primitives.isDict)(borderStyle)) {
  16627. return;
  16628. }
  16629. if (borderStyle.has("BS")) {
  16630. const dict = borderStyle.get("BS");
  16631. const dictType = dict.get("Type");
  16632. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  16633. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  16634. this.borderStyle.setStyle(dict.get("S"));
  16635. this.borderStyle.setDashArray(dict.getArray("D"));
  16636. }
  16637. } else if (borderStyle.has("Border")) {
  16638. const array = borderStyle.getArray("Border");
  16639. if (Array.isArray(array) && array.length >= 3) {
  16640. this.borderStyle.setHorizontalCornerRadius(array[0]);
  16641. this.borderStyle.setVerticalCornerRadius(array[1]);
  16642. this.borderStyle.setWidth(array[2], this.rectangle);
  16643. if (array.length === 4) {
  16644. this.borderStyle.setDashArray(array[3]);
  16645. }
  16646. }
  16647. } else {
  16648. this.borderStyle.setWidth(0);
  16649. }
  16650. }
  16651. setAppearance(dict) {
  16652. this.appearance = null;
  16653. const appearanceStates = dict.get("AP");
  16654. if (!(0, _primitives.isDict)(appearanceStates)) {
  16655. return;
  16656. }
  16657. const normalAppearanceState = appearanceStates.get("N");
  16658. if ((0, _primitives.isStream)(normalAppearanceState)) {
  16659. this.appearance = normalAppearanceState;
  16660. return;
  16661. }
  16662. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  16663. return;
  16664. }
  16665. const as = dict.get("AS");
  16666. if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
  16667. return;
  16668. }
  16669. this.appearance = normalAppearanceState.get(as.name);
  16670. }
  16671. loadResources(keys) {
  16672. return this.appearance.dict.getAsync("Resources").then(resources => {
  16673. if (!resources) {
  16674. return undefined;
  16675. }
  16676. const objectLoader = new _obj.ObjectLoader(resources, keys, resources.xref);
  16677. return objectLoader.load().then(function () {
  16678. return resources;
  16679. });
  16680. });
  16681. }
  16682. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  16683. if (!this.appearance) {
  16684. return Promise.resolve(new _operator_list.OperatorList());
  16685. }
  16686. const appearance = this.appearance;
  16687. const data = this.data;
  16688. const appearanceDict = appearance.dict;
  16689. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  16690. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  16691. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  16692. const transform = getTransformMatrix(data.rect, bbox, matrix);
  16693. return resourcesPromise.then(resources => {
  16694. const opList = new _operator_list.OperatorList();
  16695. opList.addOp(_util.OPS.beginAnnotation, [data.rect, transform, matrix]);
  16696. return evaluator.getOperatorList({
  16697. stream: appearance,
  16698. task,
  16699. resources,
  16700. operatorList: opList,
  16701. fallbackFontDict: this._fallbackFontDict
  16702. }).then(() => {
  16703. opList.addOp(_util.OPS.endAnnotation, []);
  16704. this.reset();
  16705. return opList;
  16706. });
  16707. });
  16708. }
  16709. async save(evaluator, task, annotationStorage) {
  16710. return null;
  16711. }
  16712. getFieldObject() {
  16713. if (this.data.kidIds) {
  16714. return {
  16715. id: this.data.id,
  16716. actions: this.data.actions,
  16717. name: this.data.fieldName,
  16718. type: "",
  16719. kidIds: this.data.kidIds
  16720. };
  16721. }
  16722. return null;
  16723. }
  16724. reset() {
  16725. for (const stream of this._streams) {
  16726. stream.reset();
  16727. }
  16728. }
  16729. _constructFieldName(dict) {
  16730. if (!dict.has("T") && !dict.has("Parent")) {
  16731. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  16732. return "";
  16733. }
  16734. if (!dict.has("Parent")) {
  16735. return (0, _util.stringToPDFString)(dict.get("T"));
  16736. }
  16737. const fieldName = [];
  16738. if (dict.has("T")) {
  16739. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  16740. }
  16741. let loopDict = dict;
  16742. const visited = new _primitives.RefSet();
  16743. if (dict.objId) {
  16744. visited.put(dict.objId);
  16745. }
  16746. while (loopDict.has("Parent")) {
  16747. loopDict = loopDict.get("Parent");
  16748. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  16749. break;
  16750. }
  16751. if (loopDict.objId) {
  16752. visited.put(loopDict.objId);
  16753. }
  16754. if (loopDict.has("T")) {
  16755. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  16756. }
  16757. }
  16758. return fieldName.join(".");
  16759. }
  16760. }
  16761. exports.Annotation = Annotation;
  16762. class AnnotationBorderStyle {
  16763. constructor() {
  16764. this.width = 1;
  16765. this.style = _util.AnnotationBorderStyleType.SOLID;
  16766. this.dashArray = [3];
  16767. this.horizontalCornerRadius = 0;
  16768. this.verticalCornerRadius = 0;
  16769. }
  16770. setWidth(width, rect = [0, 0, 0, 0]) {
  16771. if ((0, _primitives.isName)(width)) {
  16772. this.width = 0;
  16773. return;
  16774. }
  16775. if (Number.isInteger(width)) {
  16776. if (width > 0) {
  16777. const maxWidth = (rect[2] - rect[0]) / 2;
  16778. const maxHeight = (rect[3] - rect[1]) / 2;
  16779. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  16780. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  16781. width = 1;
  16782. }
  16783. }
  16784. this.width = width;
  16785. }
  16786. }
  16787. setStyle(style) {
  16788. if (!(0, _primitives.isName)(style)) {
  16789. return;
  16790. }
  16791. switch (style.name) {
  16792. case "S":
  16793. this.style = _util.AnnotationBorderStyleType.SOLID;
  16794. break;
  16795. case "D":
  16796. this.style = _util.AnnotationBorderStyleType.DASHED;
  16797. break;
  16798. case "B":
  16799. this.style = _util.AnnotationBorderStyleType.BEVELED;
  16800. break;
  16801. case "I":
  16802. this.style = _util.AnnotationBorderStyleType.INSET;
  16803. break;
  16804. case "U":
  16805. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  16806. break;
  16807. default:
  16808. break;
  16809. }
  16810. }
  16811. setDashArray(dashArray) {
  16812. if (Array.isArray(dashArray) && dashArray.length > 0) {
  16813. let isValid = true;
  16814. let allZeros = true;
  16815. for (const element of dashArray) {
  16816. const validNumber = +element >= 0;
  16817. if (!validNumber) {
  16818. isValid = false;
  16819. break;
  16820. } else if (element > 0) {
  16821. allZeros = false;
  16822. }
  16823. }
  16824. if (isValid && !allZeros) {
  16825. this.dashArray = dashArray;
  16826. } else {
  16827. this.width = 0;
  16828. }
  16829. } else if (dashArray) {
  16830. this.width = 0;
  16831. }
  16832. }
  16833. setHorizontalCornerRadius(radius) {
  16834. if (Number.isInteger(radius)) {
  16835. this.horizontalCornerRadius = radius;
  16836. }
  16837. }
  16838. setVerticalCornerRadius(radius) {
  16839. if (Number.isInteger(radius)) {
  16840. this.verticalCornerRadius = radius;
  16841. }
  16842. }
  16843. }
  16844. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  16845. class MarkupAnnotation extends Annotation {
  16846. constructor(parameters) {
  16847. super(parameters);
  16848. const dict = parameters.dict;
  16849. if (dict.has("IRT")) {
  16850. const rawIRT = dict.getRaw("IRT");
  16851. this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
  16852. const rt = dict.get("RT");
  16853. this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
  16854. }
  16855. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  16856. const parent = dict.get("IRT");
  16857. this.data.title = (0, _util.stringToPDFString)(parent.get("T") || "");
  16858. this.setContents(parent.get("Contents"));
  16859. this.data.contents = this.contents;
  16860. if (!parent.has("CreationDate")) {
  16861. this.data.creationDate = null;
  16862. } else {
  16863. this.setCreationDate(parent.get("CreationDate"));
  16864. this.data.creationDate = this.creationDate;
  16865. }
  16866. if (!parent.has("M")) {
  16867. this.data.modificationDate = null;
  16868. } else {
  16869. this.setModificationDate(parent.get("M"));
  16870. this.data.modificationDate = this.modificationDate;
  16871. }
  16872. this.data.hasPopup = parent.has("Popup");
  16873. if (!parent.has("C")) {
  16874. this.data.color = null;
  16875. } else {
  16876. this.setColor(parent.getArray("C"));
  16877. this.data.color = this.color;
  16878. }
  16879. } else {
  16880. this.data.title = (0, _util.stringToPDFString)(dict.get("T") || "");
  16881. this.setCreationDate(dict.get("CreationDate"));
  16882. this.data.creationDate = this.creationDate;
  16883. this.data.hasPopup = dict.has("Popup");
  16884. if (!dict.has("C")) {
  16885. this.data.color = null;
  16886. }
  16887. }
  16888. }
  16889. setCreationDate(creationDate) {
  16890. this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
  16891. }
  16892. _setDefaultAppearance({
  16893. xref,
  16894. extra,
  16895. strokeColor,
  16896. fillColor,
  16897. blendMode,
  16898. pointsCallback
  16899. }) {
  16900. let minX = Number.MAX_VALUE;
  16901. let minY = Number.MAX_VALUE;
  16902. let maxX = Number.MIN_VALUE;
  16903. let maxY = Number.MIN_VALUE;
  16904. const buffer = ["q"];
  16905. if (extra) {
  16906. buffer.push(extra);
  16907. }
  16908. if (strokeColor) {
  16909. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  16910. }
  16911. if (fillColor) {
  16912. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  16913. }
  16914. let pointsArray = this.data.quadPoints;
  16915. if (!pointsArray) {
  16916. pointsArray = [[{
  16917. x: this.rectangle[0],
  16918. y: this.rectangle[3]
  16919. }, {
  16920. x: this.rectangle[2],
  16921. y: this.rectangle[3]
  16922. }, {
  16923. x: this.rectangle[0],
  16924. y: this.rectangle[1]
  16925. }, {
  16926. x: this.rectangle[2],
  16927. y: this.rectangle[1]
  16928. }]];
  16929. }
  16930. for (const points of pointsArray) {
  16931. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  16932. minX = Math.min(minX, mX);
  16933. maxX = Math.max(maxX, MX);
  16934. minY = Math.min(minY, mY);
  16935. maxY = Math.max(maxY, MY);
  16936. }
  16937. buffer.push("Q");
  16938. const formDict = new _primitives.Dict(xref);
  16939. const appearanceStreamDict = new _primitives.Dict(xref);
  16940. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  16941. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  16942. appearanceStream.dict = appearanceStreamDict;
  16943. formDict.set("Fm0", appearanceStream);
  16944. const gsDict = new _primitives.Dict(xref);
  16945. if (blendMode) {
  16946. gsDict.set("BM", _primitives.Name.get(blendMode));
  16947. }
  16948. const stateDict = new _primitives.Dict(xref);
  16949. stateDict.set("GS0", gsDict);
  16950. const resources = new _primitives.Dict(xref);
  16951. resources.set("ExtGState", stateDict);
  16952. resources.set("XObject", formDict);
  16953. const appearanceDict = new _primitives.Dict(xref);
  16954. appearanceDict.set("Resources", resources);
  16955. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  16956. appearanceDict.set("BBox", bbox);
  16957. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  16958. this.appearance.dict = appearanceDict;
  16959. this._streams.push(this.appearance, appearanceStream);
  16960. }
  16961. }
  16962. exports.MarkupAnnotation = MarkupAnnotation;
  16963. class WidgetAnnotation extends Annotation {
  16964. constructor(params) {
  16965. super(params);
  16966. const dict = params.dict;
  16967. const data = this.data;
  16968. this.ref = params.ref;
  16969. data.annotationType = _util.AnnotationType.WIDGET;
  16970. if (data.fieldName === undefined) {
  16971. data.fieldName = this._constructFieldName(dict);
  16972. }
  16973. if (data.actions === undefined) {
  16974. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  16975. }
  16976. const fieldValue = (0, _core_utils.getInheritableProperty)({
  16977. dict,
  16978. key: "V",
  16979. getArray: true
  16980. });
  16981. data.fieldValue = this._decodeFormValue(fieldValue);
  16982. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  16983. dict,
  16984. key: "DV",
  16985. getArray: true
  16986. });
  16987. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  16988. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  16989. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  16990. dict,
  16991. key: "DA"
  16992. }) || params.acroForm.get("DA");
  16993. this._defaultAppearance = (0, _util.isString)(defaultAppearance) ? defaultAppearance : "";
  16994. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  16995. const fieldType = (0, _core_utils.getInheritableProperty)({
  16996. dict,
  16997. key: "FT"
  16998. });
  16999. data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  17000. const localResources = (0, _core_utils.getInheritableProperty)({
  17001. dict,
  17002. key: "DR"
  17003. });
  17004. const acroFormResources = params.acroForm.get("DR");
  17005. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  17006. this._fieldResources = {
  17007. localResources,
  17008. acroFormResources,
  17009. appearanceResources,
  17010. mergedResources: _primitives.Dict.merge({
  17011. xref: params.xref,
  17012. dictArray: [localResources, appearanceResources, acroFormResources],
  17013. mergeSubDicts: true
  17014. })
  17015. };
  17016. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  17017. dict,
  17018. key: "Ff"
  17019. });
  17020. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  17021. data.fieldFlags = 0;
  17022. }
  17023. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  17024. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  17025. if (data.fieldType === "Sig") {
  17026. data.fieldValue = null;
  17027. this.setFlags(_util.AnnotationFlag.HIDDEN);
  17028. data.hidden = true;
  17029. }
  17030. }
  17031. _decodeFormValue(formValue) {
  17032. if (Array.isArray(formValue)) {
  17033. return formValue.filter(item => (0, _util.isString)(item)).map(item => (0, _util.stringToPDFString)(item));
  17034. } else if ((0, _primitives.isName)(formValue)) {
  17035. return (0, _util.stringToPDFString)(formValue.name);
  17036. } else if ((0, _util.isString)(formValue)) {
  17037. return (0, _util.stringToPDFString)(formValue);
  17038. }
  17039. return null;
  17040. }
  17041. hasFieldFlag(flag) {
  17042. return !!(this.data.fieldFlags & flag);
  17043. }
  17044. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  17045. if (renderForms) {
  17046. return Promise.resolve(new _operator_list.OperatorList());
  17047. }
  17048. if (!this._hasText) {
  17049. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  17050. }
  17051. return this._getAppearance(evaluator, task, annotationStorage).then(content => {
  17052. if (this.appearance && content === null) {
  17053. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  17054. }
  17055. const operatorList = new _operator_list.OperatorList();
  17056. if (!this._defaultAppearance || content === null) {
  17057. return operatorList;
  17058. }
  17059. const matrix = [1, 0, 0, 1, 0, 0];
  17060. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17061. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  17062. operatorList.addOp(_util.OPS.beginAnnotation, [this.data.rect, transform, matrix]);
  17063. const stream = new _stream.StringStream(content);
  17064. return evaluator.getOperatorList({
  17065. stream,
  17066. task,
  17067. resources: this._fieldResources.mergedResources,
  17068. operatorList
  17069. }).then(function () {
  17070. operatorList.addOp(_util.OPS.endAnnotation, []);
  17071. return operatorList;
  17072. });
  17073. });
  17074. }
  17075. async save(evaluator, task, annotationStorage) {
  17076. if (!annotationStorage) {
  17077. return null;
  17078. }
  17079. const storageEntry = annotationStorage.get(this.data.id);
  17080. const value = storageEntry && storageEntry.value;
  17081. if (value === this.data.fieldValue || value === undefined) {
  17082. return null;
  17083. }
  17084. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  17085. if (appearance === null) {
  17086. return null;
  17087. }
  17088. const {
  17089. xref
  17090. } = evaluator;
  17091. const dict = xref.fetchIfRef(this.ref);
  17092. if (!(0, _primitives.isDict)(dict)) {
  17093. return null;
  17094. }
  17095. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17096. const xfa = {
  17097. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  17098. value
  17099. };
  17100. const newRef = xref.getNewRef();
  17101. const AP = new _primitives.Dict(xref);
  17102. AP.set("N", newRef);
  17103. const encrypt = xref.encrypt;
  17104. let originalTransform = null;
  17105. let newTransform = null;
  17106. if (encrypt) {
  17107. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  17108. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  17109. appearance = newTransform.encryptString(appearance);
  17110. }
  17111. dict.set("V", (0, _util.isAscii)(value) ? value : (0, _util.stringToUTF16BEString)(value));
  17112. dict.set("AP", AP);
  17113. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  17114. const appearanceDict = new _primitives.Dict(xref);
  17115. appearanceDict.set("Length", appearance.length);
  17116. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  17117. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  17118. appearanceDict.set("BBox", bbox);
  17119. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  17120. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  17121. bufferOriginal.push("\nendobj\n");
  17122. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  17123. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  17124. bufferNew.push(" stream\n");
  17125. bufferNew.push(appearance);
  17126. bufferNew.push("\nendstream\nendobj\n");
  17127. return [{
  17128. ref: this.ref,
  17129. data: bufferOriginal.join(""),
  17130. xfa
  17131. }, {
  17132. ref: newRef,
  17133. data: bufferNew.join(""),
  17134. xfa: null
  17135. }];
  17136. }
  17137. async _getAppearance(evaluator, task, annotationStorage) {
  17138. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  17139. if (!annotationStorage || isPassword) {
  17140. return null;
  17141. }
  17142. const storageEntry = annotationStorage.get(this.data.id);
  17143. let value = storageEntry && storageEntry.value;
  17144. if (value === undefined) {
  17145. return null;
  17146. }
  17147. value = value.trim();
  17148. if (value === "") {
  17149. return "";
  17150. }
  17151. let lineCount = -1;
  17152. if (this.data.multiLine) {
  17153. lineCount = value.split(/\r\n|\r|\n/).length;
  17154. }
  17155. const defaultPadding = 2;
  17156. const hPadding = defaultPadding;
  17157. const totalHeight = this.data.rect[3] - this.data.rect[1];
  17158. const totalWidth = this.data.rect[2] - this.data.rect[0];
  17159. if (!this._defaultAppearance) {
  17160. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  17161. }
  17162. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight, lineCount);
  17163. const font = await this._getFontData(evaluator, task);
  17164. let descent = font.descent;
  17165. if (isNaN(descent)) {
  17166. descent = 0;
  17167. }
  17168. const vPadding = defaultPadding + Math.abs(descent) * fontSize;
  17169. const alignment = this.data.textAlignment;
  17170. if (this.data.multiLine) {
  17171. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding);
  17172. }
  17173. const encodedString = font.encodeString(value).join("");
  17174. if (this.data.comb) {
  17175. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding);
  17176. }
  17177. if (alignment === 0 || alignment > 2) {
  17178. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  17179. }
  17180. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  17181. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  17182. }
  17183. async _getFontData(evaluator, task) {
  17184. const operatorList = new _operator_list.OperatorList();
  17185. const initialState = {
  17186. font: null,
  17187. clone() {
  17188. return this;
  17189. }
  17190. };
  17191. const {
  17192. fontName,
  17193. fontSize
  17194. } = this.data.defaultAppearanceData;
  17195. await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  17196. return initialState.font;
  17197. }
  17198. _computeFontSize(height, lineCount) {
  17199. let {
  17200. fontSize
  17201. } = this.data.defaultAppearanceData;
  17202. if (!fontSize) {
  17203. const roundWithOneDigit = x => Math.round(x * 10) / 10;
  17204. const FONT_FACTOR = 0.8;
  17205. if (lineCount === -1) {
  17206. fontSize = roundWithOneDigit(FONT_FACTOR * height);
  17207. } else {
  17208. fontSize = 10;
  17209. let lineHeight = fontSize / FONT_FACTOR;
  17210. let numberOfLines = Math.round(height / lineHeight);
  17211. numberOfLines = Math.max(numberOfLines, lineCount);
  17212. lineHeight = height / numberOfLines;
  17213. fontSize = roundWithOneDigit(FONT_FACTOR * lineHeight);
  17214. }
  17215. const {
  17216. fontName,
  17217. fontColor
  17218. } = this.data.defaultAppearanceData;
  17219. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  17220. fontSize,
  17221. fontName,
  17222. fontColor
  17223. });
  17224. }
  17225. return [this._defaultAppearance, fontSize];
  17226. }
  17227. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  17228. const glyphs = font.charsToGlyphs(text);
  17229. const scale = fontSize / 1000;
  17230. let width = 0;
  17231. for (const glyph of glyphs) {
  17232. width += glyph.width * scale;
  17233. }
  17234. let shift;
  17235. if (alignment === 1) {
  17236. shift = (totalWidth - width) / 2;
  17237. } else if (alignment === 2) {
  17238. shift = totalWidth - width - hPadding;
  17239. } else {
  17240. shift = hPadding;
  17241. }
  17242. shift = shift.toFixed(2);
  17243. vPadding = vPadding.toFixed(2);
  17244. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  17245. }
  17246. _getSaveFieldResources(xref) {
  17247. const {
  17248. localResources,
  17249. appearanceResources,
  17250. acroFormResources
  17251. } = this._fieldResources;
  17252. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  17253. if (!fontName) {
  17254. return localResources || _primitives.Dict.empty;
  17255. }
  17256. for (const resources of [localResources, appearanceResources]) {
  17257. if (resources instanceof _primitives.Dict) {
  17258. const localFont = resources.get("Font");
  17259. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  17260. return resources;
  17261. }
  17262. }
  17263. }
  17264. if (acroFormResources instanceof _primitives.Dict) {
  17265. const acroFormFont = acroFormResources.get("Font");
  17266. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  17267. const subFontDict = new _primitives.Dict(xref);
  17268. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  17269. const subResourcesDict = new _primitives.Dict(xref);
  17270. subResourcesDict.set("Font", subFontDict);
  17271. return _primitives.Dict.merge({
  17272. xref,
  17273. dictArray: [subResourcesDict, localResources],
  17274. mergeSubDicts: true
  17275. });
  17276. }
  17277. }
  17278. return localResources || _primitives.Dict.empty;
  17279. }
  17280. getFieldObject() {
  17281. if (this.data.fieldType === "Sig") {
  17282. return {
  17283. id: this.data.id,
  17284. value: null,
  17285. type: "signature"
  17286. };
  17287. }
  17288. return null;
  17289. }
  17290. }
  17291. class TextWidgetAnnotation extends WidgetAnnotation {
  17292. constructor(params) {
  17293. super(params);
  17294. this._hasText = true;
  17295. const dict = params.dict;
  17296. if (!(0, _util.isString)(this.data.fieldValue)) {
  17297. this.data.fieldValue = "";
  17298. }
  17299. let alignment = (0, _core_utils.getInheritableProperty)({
  17300. dict,
  17301. key: "Q"
  17302. });
  17303. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  17304. alignment = null;
  17305. }
  17306. this.data.textAlignment = alignment;
  17307. let maximumLength = (0, _core_utils.getInheritableProperty)({
  17308. dict,
  17309. key: "MaxLen"
  17310. });
  17311. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  17312. maximumLength = null;
  17313. }
  17314. this.data.maxLen = maximumLength;
  17315. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  17316. 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;
  17317. }
  17318. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
  17319. const combWidth = (width / this.data.maxLen).toFixed(2);
  17320. const buf = [];
  17321. const positions = font.getCharPositions(text);
  17322. for (const [start, end] of positions) {
  17323. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  17324. }
  17325. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  17326. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  17327. }
  17328. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) {
  17329. const lines = text.split(/\r\n|\r|\n/);
  17330. const buf = [];
  17331. const totalWidth = width - 2 * hPadding;
  17332. for (const line of lines) {
  17333. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  17334. for (const chunk of chunks) {
  17335. const padding = buf.length === 0 ? hPadding : 0;
  17336. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  17337. }
  17338. }
  17339. const renderedText = buf.join("\n");
  17340. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  17341. }
  17342. _splitLine(line, font, fontSize, width) {
  17343. line = font.encodeString(line).join("");
  17344. const glyphs = font.charsToGlyphs(line);
  17345. if (glyphs.length <= 1) {
  17346. return [line];
  17347. }
  17348. const positions = font.getCharPositions(line);
  17349. const scale = fontSize / 1000;
  17350. const chunks = [];
  17351. let lastSpacePosInStringStart = -1,
  17352. lastSpacePosInStringEnd = -1,
  17353. lastSpacePos = -1,
  17354. startChunk = 0,
  17355. currentWidth = 0;
  17356. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  17357. const [start, end] = positions[i];
  17358. const glyph = glyphs[i];
  17359. const glyphWidth = glyph.width * scale;
  17360. if (glyph.unicode === " ") {
  17361. if (currentWidth + glyphWidth > width) {
  17362. chunks.push(line.substring(startChunk, start));
  17363. startChunk = start;
  17364. currentWidth = glyphWidth;
  17365. lastSpacePosInStringStart = -1;
  17366. lastSpacePos = -1;
  17367. } else {
  17368. currentWidth += glyphWidth;
  17369. lastSpacePosInStringStart = start;
  17370. lastSpacePosInStringEnd = end;
  17371. lastSpacePos = i;
  17372. }
  17373. } else {
  17374. if (currentWidth + glyphWidth > width) {
  17375. if (lastSpacePosInStringStart !== -1) {
  17376. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  17377. startChunk = lastSpacePosInStringEnd;
  17378. i = lastSpacePos + 1;
  17379. lastSpacePosInStringStart = -1;
  17380. currentWidth = 0;
  17381. } else {
  17382. chunks.push(line.substring(startChunk, start));
  17383. startChunk = start;
  17384. currentWidth = glyphWidth;
  17385. }
  17386. } else {
  17387. currentWidth += glyphWidth;
  17388. }
  17389. }
  17390. }
  17391. if (startChunk < line.length) {
  17392. chunks.push(line.substring(startChunk, line.length));
  17393. }
  17394. return chunks;
  17395. }
  17396. getFieldObject() {
  17397. return {
  17398. id: this.data.id,
  17399. value: this.data.fieldValue,
  17400. defaultValue: this.data.defaultFieldValue,
  17401. multiline: this.data.multiLine,
  17402. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  17403. charLimit: this.data.maxLen,
  17404. comb: this.data.comb,
  17405. editable: !this.data.readOnly,
  17406. hidden: this.data.hidden,
  17407. name: this.data.fieldName,
  17408. rect: this.data.rect,
  17409. actions: this.data.actions,
  17410. type: "text"
  17411. };
  17412. }
  17413. }
  17414. class ButtonWidgetAnnotation extends WidgetAnnotation {
  17415. constructor(params) {
  17416. super(params);
  17417. this.checkedAppearance = null;
  17418. this.uncheckedAppearance = null;
  17419. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  17420. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  17421. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  17422. this.data.isTooltipOnly = false;
  17423. if (this.data.checkBox) {
  17424. this._processCheckBox(params);
  17425. } else if (this.data.radioButton) {
  17426. this._processRadioButton(params);
  17427. } else if (this.data.pushButton) {
  17428. this._processPushButton(params);
  17429. } else {
  17430. (0, _util.warn)("Invalid field flags for button widget annotation");
  17431. }
  17432. }
  17433. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  17434. if (this.data.pushButton) {
  17435. return super.getOperatorList(evaluator, task, false, annotationStorage);
  17436. }
  17437. if (annotationStorage) {
  17438. const storageEntry = annotationStorage.get(this.data.id);
  17439. const value = storageEntry && storageEntry.value;
  17440. if (value === undefined) {
  17441. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  17442. }
  17443. let appearance;
  17444. if (value) {
  17445. appearance = this.checkedAppearance;
  17446. } else {
  17447. appearance = this.uncheckedAppearance;
  17448. }
  17449. if (appearance) {
  17450. const savedAppearance = this.appearance;
  17451. this.appearance = appearance;
  17452. const operatorList = super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  17453. this.appearance = savedAppearance;
  17454. return operatorList;
  17455. }
  17456. return Promise.resolve(new _operator_list.OperatorList());
  17457. }
  17458. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  17459. }
  17460. async save(evaluator, task, annotationStorage) {
  17461. if (this.data.checkBox) {
  17462. return this._saveCheckbox(evaluator, task, annotationStorage);
  17463. }
  17464. if (this.data.radioButton) {
  17465. return this._saveRadioButton(evaluator, task, annotationStorage);
  17466. }
  17467. return null;
  17468. }
  17469. async _saveCheckbox(evaluator, task, annotationStorage) {
  17470. if (!annotationStorage) {
  17471. return null;
  17472. }
  17473. const storageEntry = annotationStorage.get(this.data.id);
  17474. const value = storageEntry && storageEntry.value;
  17475. if (value === undefined) {
  17476. return null;
  17477. }
  17478. const defaultValue = this.data.fieldValue && this.data.fieldValue !== "Off";
  17479. if (defaultValue === value) {
  17480. return null;
  17481. }
  17482. const dict = evaluator.xref.fetchIfRef(this.ref);
  17483. if (!(0, _primitives.isDict)(dict)) {
  17484. return null;
  17485. }
  17486. const xfa = {
  17487. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  17488. value: value ? this.data.exportValue : ""
  17489. };
  17490. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  17491. dict.set("V", name);
  17492. dict.set("AS", name);
  17493. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  17494. const encrypt = evaluator.xref.encrypt;
  17495. let originalTransform = null;
  17496. if (encrypt) {
  17497. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  17498. }
  17499. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  17500. (0, _writer.writeDict)(dict, buffer, originalTransform);
  17501. buffer.push("\nendobj\n");
  17502. return [{
  17503. ref: this.ref,
  17504. data: buffer.join(""),
  17505. xfa
  17506. }];
  17507. }
  17508. async _saveRadioButton(evaluator, task, annotationStorage) {
  17509. if (!annotationStorage) {
  17510. return null;
  17511. }
  17512. const storageEntry = annotationStorage.get(this.data.id);
  17513. const value = storageEntry && storageEntry.value;
  17514. if (value === undefined) {
  17515. return null;
  17516. }
  17517. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  17518. if (defaultValue === value) {
  17519. return null;
  17520. }
  17521. const dict = evaluator.xref.fetchIfRef(this.ref);
  17522. if (!(0, _primitives.isDict)(dict)) {
  17523. return null;
  17524. }
  17525. const xfa = {
  17526. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  17527. value: value ? this.data.buttonValue : ""
  17528. };
  17529. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  17530. let parentBuffer = null;
  17531. const encrypt = evaluator.xref.encrypt;
  17532. if (value) {
  17533. if ((0, _primitives.isRef)(this.parent)) {
  17534. const parent = evaluator.xref.fetch(this.parent);
  17535. let parentTransform = null;
  17536. if (encrypt) {
  17537. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  17538. }
  17539. parent.set("V", name);
  17540. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  17541. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  17542. parentBuffer.push("\nendobj\n");
  17543. } else if ((0, _primitives.isDict)(this.parent)) {
  17544. this.parent.set("V", name);
  17545. }
  17546. }
  17547. dict.set("AS", name);
  17548. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  17549. let originalTransform = null;
  17550. if (encrypt) {
  17551. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  17552. }
  17553. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  17554. (0, _writer.writeDict)(dict, buffer, originalTransform);
  17555. buffer.push("\nendobj\n");
  17556. const newRefs = [{
  17557. ref: this.ref,
  17558. data: buffer.join(""),
  17559. xfa
  17560. }];
  17561. if (parentBuffer !== null) {
  17562. newRefs.push({
  17563. ref: this.parent,
  17564. data: parentBuffer.join(""),
  17565. xfa: null
  17566. });
  17567. }
  17568. return newRefs;
  17569. }
  17570. _processCheckBox(params) {
  17571. const customAppearance = params.dict.get("AP");
  17572. if (!(0, _primitives.isDict)(customAppearance)) {
  17573. return;
  17574. }
  17575. const normalAppearance = customAppearance.get("N");
  17576. if (!(0, _primitives.isDict)(normalAppearance)) {
  17577. return;
  17578. }
  17579. const exportValues = normalAppearance.getKeys();
  17580. if (!exportValues.includes("Off")) {
  17581. exportValues.push("Off");
  17582. }
  17583. if (exportValues.length !== 2) {
  17584. return;
  17585. }
  17586. this.data.exportValue = exportValues[0] === "Off" ? exportValues[1] : exportValues[0];
  17587. this.checkedAppearance = normalAppearance.get(this.data.exportValue);
  17588. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  17589. this._streams.push(this.checkedAppearance);
  17590. if (this.uncheckedAppearance) {
  17591. this._streams.push(this.uncheckedAppearance);
  17592. }
  17593. this._fallbackFontDict = this.fallbackFontDict;
  17594. }
  17595. _processRadioButton(params) {
  17596. this.data.fieldValue = this.data.buttonValue = null;
  17597. const fieldParent = params.dict.get("Parent");
  17598. if ((0, _primitives.isDict)(fieldParent)) {
  17599. this.parent = params.dict.getRaw("Parent");
  17600. const fieldParentValue = fieldParent.get("V");
  17601. if ((0, _primitives.isName)(fieldParentValue)) {
  17602. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  17603. }
  17604. }
  17605. const appearanceStates = params.dict.get("AP");
  17606. if (!(0, _primitives.isDict)(appearanceStates)) {
  17607. return;
  17608. }
  17609. const normalAppearance = appearanceStates.get("N");
  17610. if (!(0, _primitives.isDict)(normalAppearance)) {
  17611. return;
  17612. }
  17613. for (const key of normalAppearance.getKeys()) {
  17614. if (key !== "Off") {
  17615. this.data.buttonValue = this._decodeFormValue(key);
  17616. break;
  17617. }
  17618. }
  17619. this.checkedAppearance = normalAppearance.get(this.data.buttonValue);
  17620. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  17621. this._streams.push(this.checkedAppearance);
  17622. if (this.uncheckedAppearance) {
  17623. this._streams.push(this.uncheckedAppearance);
  17624. }
  17625. this._fallbackFontDict = this.fallbackFontDict;
  17626. }
  17627. _processPushButton(params) {
  17628. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  17629. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  17630. return;
  17631. }
  17632. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  17633. _obj.Catalog.parseDestDictionary({
  17634. destDict: params.dict,
  17635. resultObj: this.data,
  17636. docBaseUrl: params.pdfManager.docBaseUrl
  17637. });
  17638. }
  17639. getFieldObject() {
  17640. let type = "button";
  17641. let exportValues;
  17642. if (this.data.checkBox) {
  17643. type = "checkbox";
  17644. exportValues = this.data.exportValue;
  17645. } else if (this.data.radioButton) {
  17646. type = "radiobutton";
  17647. exportValues = this.data.buttonValue;
  17648. }
  17649. return {
  17650. id: this.data.id,
  17651. value: this.data.fieldValue || "Off",
  17652. defaultValue: this.data.defaultFieldValue,
  17653. exportValues,
  17654. editable: !this.data.readOnly,
  17655. name: this.data.fieldName,
  17656. rect: this.data.rect,
  17657. hidden: this.data.hidden,
  17658. actions: this.data.actions,
  17659. type
  17660. };
  17661. }
  17662. get fallbackFontDict() {
  17663. const dict = new _primitives.Dict();
  17664. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  17665. dict.set("Type", _primitives.Name.get("FallbackType"));
  17666. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  17667. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  17668. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  17669. }
  17670. }
  17671. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  17672. constructor(params) {
  17673. super(params);
  17674. this.data.options = [];
  17675. const options = (0, _core_utils.getInheritableProperty)({
  17676. dict: params.dict,
  17677. key: "Opt"
  17678. });
  17679. if (Array.isArray(options)) {
  17680. const xref = params.xref;
  17681. for (let i = 0, ii = options.length; i < ii; i++) {
  17682. const option = xref.fetchIfRef(options[i]);
  17683. const isOptionArray = Array.isArray(option);
  17684. this.data.options[i] = {
  17685. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  17686. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  17687. };
  17688. }
  17689. }
  17690. if ((0, _util.isString)(this.data.fieldValue)) {
  17691. this.data.fieldValue = [this.data.fieldValue];
  17692. } else if (!this.data.fieldValue) {
  17693. this.data.fieldValue = [];
  17694. }
  17695. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  17696. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  17697. this._hasText = true;
  17698. }
  17699. getFieldObject() {
  17700. const type = this.data.combo ? "combobox" : "listbox";
  17701. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  17702. return {
  17703. id: this.data.id,
  17704. value,
  17705. defaultValue: this.data.defaultFieldValue,
  17706. editable: !this.data.readOnly,
  17707. name: this.data.fieldName,
  17708. rect: this.data.rect,
  17709. numItems: this.data.fieldValue.length,
  17710. multipleSelection: this.data.multiSelect,
  17711. hidden: this.data.hidden,
  17712. actions: this.data.actions,
  17713. items: this.data.options,
  17714. type
  17715. };
  17716. }
  17717. }
  17718. class TextAnnotation extends MarkupAnnotation {
  17719. constructor(parameters) {
  17720. const DEFAULT_ICON_SIZE = 22;
  17721. super(parameters);
  17722. const dict = parameters.dict;
  17723. this.data.annotationType = _util.AnnotationType.TEXT;
  17724. if (this.data.hasAppearance) {
  17725. this.data.name = "NoIcon";
  17726. } else {
  17727. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  17728. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  17729. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  17730. }
  17731. if (dict.has("State")) {
  17732. this.data.state = dict.get("State") || null;
  17733. this.data.stateModel = dict.get("StateModel") || null;
  17734. } else {
  17735. this.data.state = null;
  17736. this.data.stateModel = null;
  17737. }
  17738. }
  17739. }
  17740. class LinkAnnotation extends Annotation {
  17741. constructor(params) {
  17742. super(params);
  17743. this.data.annotationType = _util.AnnotationType.LINK;
  17744. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  17745. if (quadPoints) {
  17746. this.data.quadPoints = quadPoints;
  17747. }
  17748. _obj.Catalog.parseDestDictionary({
  17749. destDict: params.dict,
  17750. resultObj: this.data,
  17751. docBaseUrl: params.pdfManager.docBaseUrl
  17752. });
  17753. }
  17754. }
  17755. class PopupAnnotation extends Annotation {
  17756. constructor(parameters) {
  17757. super(parameters);
  17758. this.data.annotationType = _util.AnnotationType.POPUP;
  17759. let parentItem = parameters.dict.get("Parent");
  17760. if (!parentItem) {
  17761. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  17762. return;
  17763. }
  17764. const parentSubtype = parentItem.get("Subtype");
  17765. this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
  17766. const rawParent = parameters.dict.getRaw("Parent");
  17767. this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
  17768. const parentRect = parentItem.getArray("Rect");
  17769. if (Array.isArray(parentRect) && parentRect.length === 4) {
  17770. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  17771. } else {
  17772. this.data.parentRect = [0, 0, 0, 0];
  17773. }
  17774. const rt = parentItem.get("RT");
  17775. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  17776. parentItem = parentItem.get("IRT");
  17777. }
  17778. if (!parentItem.has("M")) {
  17779. this.data.modificationDate = null;
  17780. } else {
  17781. this.setModificationDate(parentItem.get("M"));
  17782. this.data.modificationDate = this.modificationDate;
  17783. }
  17784. if (!parentItem.has("C")) {
  17785. this.data.color = null;
  17786. } else {
  17787. this.setColor(parentItem.getArray("C"));
  17788. this.data.color = this.color;
  17789. }
  17790. if (!this.viewable) {
  17791. const parentFlags = parentItem.get("F");
  17792. if (this._isViewable(parentFlags)) {
  17793. this.setFlags(parentFlags);
  17794. }
  17795. }
  17796. this.data.title = (0, _util.stringToPDFString)(parentItem.get("T") || "");
  17797. this.data.contents = (0, _util.stringToPDFString)(parentItem.get("Contents") || "");
  17798. }
  17799. }
  17800. class FreeTextAnnotation extends MarkupAnnotation {
  17801. constructor(parameters) {
  17802. super(parameters);
  17803. this.data.annotationType = _util.AnnotationType.FREETEXT;
  17804. }
  17805. }
  17806. class LineAnnotation extends MarkupAnnotation {
  17807. constructor(parameters) {
  17808. super(parameters);
  17809. this.data.annotationType = _util.AnnotationType.LINE;
  17810. const lineCoordinates = parameters.dict.getArray("L");
  17811. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  17812. if (!this.appearance) {
  17813. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  17814. const borderWidth = this.borderStyle.width;
  17815. if ((0, _util.isArrayEqual)(this.rectangle, [0, 0, 0, 0])) {
  17816. this.rectangle = [this.data.lineCoordinates[0] - 2 * borderWidth, this.data.lineCoordinates[1] - 2 * borderWidth, this.data.lineCoordinates[2] + 2 * borderWidth, this.data.lineCoordinates[3] + 2 * borderWidth];
  17817. }
  17818. this._setDefaultAppearance({
  17819. xref: parameters.xref,
  17820. extra: `${borderWidth} w`,
  17821. strokeColor,
  17822. pointsCallback: (buffer, points) => {
  17823. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`);
  17824. buffer.push(`${lineCoordinates[2]} ${lineCoordinates[3]} l`);
  17825. buffer.push("S");
  17826. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  17827. }
  17828. });
  17829. }
  17830. }
  17831. }
  17832. class SquareAnnotation extends MarkupAnnotation {
  17833. constructor(parameters) {
  17834. super(parameters);
  17835. this.data.annotationType = _util.AnnotationType.SQUARE;
  17836. if (!this.appearance) {
  17837. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  17838. let fillColor = null;
  17839. let interiorColor = parameters.dict.getArray("IC");
  17840. if (interiorColor) {
  17841. interiorColor = getRgbColor(interiorColor);
  17842. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  17843. }
  17844. this._setDefaultAppearance({
  17845. xref: parameters.xref,
  17846. extra: `${this.borderStyle.width} w`,
  17847. strokeColor,
  17848. fillColor,
  17849. pointsCallback: (buffer, points) => {
  17850. const x = points[2].x + this.borderStyle.width / 2;
  17851. const y = points[2].y + this.borderStyle.width / 2;
  17852. const width = points[3].x - points[2].x - this.borderStyle.width;
  17853. const height = points[1].y - points[3].y - this.borderStyle.width;
  17854. buffer.push(`${x} ${y} ${width} ${height} re`);
  17855. if (fillColor) {
  17856. buffer.push("B");
  17857. } else {
  17858. buffer.push("S");
  17859. }
  17860. return [points[0].x, points[1].x, points[3].y, points[1].y];
  17861. }
  17862. });
  17863. }
  17864. }
  17865. }
  17866. class CircleAnnotation extends MarkupAnnotation {
  17867. constructor(parameters) {
  17868. super(parameters);
  17869. this.data.annotationType = _util.AnnotationType.CIRCLE;
  17870. if (!this.appearance) {
  17871. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  17872. let fillColor = null;
  17873. let interiorColor = parameters.dict.getArray("IC");
  17874. if (interiorColor) {
  17875. interiorColor = getRgbColor(interiorColor);
  17876. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  17877. }
  17878. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  17879. this._setDefaultAppearance({
  17880. xref: parameters.xref,
  17881. extra: `${this.borderStyle.width} w`,
  17882. strokeColor,
  17883. fillColor,
  17884. pointsCallback: (buffer, points) => {
  17885. const x0 = points[0].x + this.borderStyle.width / 2;
  17886. const y0 = points[0].y - this.borderStyle.width / 2;
  17887. const x1 = points[3].x - this.borderStyle.width / 2;
  17888. const y1 = points[3].y + this.borderStyle.width / 2;
  17889. const xMid = x0 + (x1 - x0) / 2;
  17890. const yMid = y0 + (y1 - y0) / 2;
  17891. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  17892. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  17893. buffer.push(`${xMid} ${y1} m`);
  17894. buffer.push(`${xMid + xOffset} ${y1} ${x1} ${yMid + yOffset} ${x1} ${yMid} c`);
  17895. buffer.push(`${x1} ${yMid - yOffset} ${xMid + xOffset} ${y0} ${xMid} ${y0} c`);
  17896. buffer.push(`${xMid - xOffset} ${y0} ${x0} ${yMid - yOffset} ${x0} ${yMid} c`);
  17897. buffer.push(`${x0} ${yMid + yOffset} ${xMid - xOffset} ${y1} ${xMid} ${y1} c`);
  17898. buffer.push("h");
  17899. if (fillColor) {
  17900. buffer.push("B");
  17901. } else {
  17902. buffer.push("S");
  17903. }
  17904. return [points[0].x, points[1].x, points[3].y, points[1].y];
  17905. }
  17906. });
  17907. }
  17908. }
  17909. }
  17910. class PolylineAnnotation extends MarkupAnnotation {
  17911. constructor(parameters) {
  17912. super(parameters);
  17913. this.data.annotationType = _util.AnnotationType.POLYLINE;
  17914. this.data.vertices = [];
  17915. const rawVertices = parameters.dict.getArray("Vertices");
  17916. if (!Array.isArray(rawVertices)) {
  17917. return;
  17918. }
  17919. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  17920. this.data.vertices.push({
  17921. x: rawVertices[i],
  17922. y: rawVertices[i + 1]
  17923. });
  17924. }
  17925. }
  17926. }
  17927. class PolygonAnnotation extends PolylineAnnotation {
  17928. constructor(parameters) {
  17929. super(parameters);
  17930. this.data.annotationType = _util.AnnotationType.POLYGON;
  17931. }
  17932. }
  17933. class CaretAnnotation extends MarkupAnnotation {
  17934. constructor(parameters) {
  17935. super(parameters);
  17936. this.data.annotationType = _util.AnnotationType.CARET;
  17937. }
  17938. }
  17939. class InkAnnotation extends MarkupAnnotation {
  17940. constructor(parameters) {
  17941. super(parameters);
  17942. this.data.annotationType = _util.AnnotationType.INK;
  17943. this.data.inkLists = [];
  17944. const rawInkLists = parameters.dict.getArray("InkList");
  17945. if (!Array.isArray(rawInkLists)) {
  17946. return;
  17947. }
  17948. const xref = parameters.xref;
  17949. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  17950. this.data.inkLists.push([]);
  17951. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  17952. this.data.inkLists[i].push({
  17953. x: xref.fetchIfRef(rawInkLists[i][j]),
  17954. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  17955. });
  17956. }
  17957. }
  17958. }
  17959. }
  17960. class HighlightAnnotation extends MarkupAnnotation {
  17961. constructor(parameters) {
  17962. super(parameters);
  17963. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  17964. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  17965. if (quadPoints) {
  17966. if (!this.appearance) {
  17967. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  17968. this._setDefaultAppearance({
  17969. xref: parameters.xref,
  17970. fillColor,
  17971. blendMode: "Multiply",
  17972. pointsCallback: (buffer, points) => {
  17973. buffer.push(`${points[0].x} ${points[0].y} m`);
  17974. buffer.push(`${points[1].x} ${points[1].y} l`);
  17975. buffer.push(`${points[3].x} ${points[3].y} l`);
  17976. buffer.push(`${points[2].x} ${points[2].y} l`);
  17977. buffer.push("f");
  17978. return [points[0].x, points[1].x, points[3].y, points[1].y];
  17979. }
  17980. });
  17981. }
  17982. } else {
  17983. this.data.hasPopup = false;
  17984. }
  17985. }
  17986. }
  17987. class UnderlineAnnotation extends MarkupAnnotation {
  17988. constructor(parameters) {
  17989. super(parameters);
  17990. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  17991. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  17992. if (quadPoints) {
  17993. if (!this.appearance) {
  17994. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  17995. this._setDefaultAppearance({
  17996. xref: parameters.xref,
  17997. extra: "[] 0 d 1 w",
  17998. strokeColor,
  17999. pointsCallback: (buffer, points) => {
  18000. buffer.push(`${points[2].x} ${points[2].y} m`);
  18001. buffer.push(`${points[3].x} ${points[3].y} l`);
  18002. buffer.push("S");
  18003. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18004. }
  18005. });
  18006. }
  18007. } else {
  18008. this.data.hasPopup = false;
  18009. }
  18010. }
  18011. }
  18012. class SquigglyAnnotation extends MarkupAnnotation {
  18013. constructor(parameters) {
  18014. super(parameters);
  18015. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  18016. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18017. if (quadPoints) {
  18018. if (!this.appearance) {
  18019. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18020. this._setDefaultAppearance({
  18021. xref: parameters.xref,
  18022. extra: "[] 0 d 1 w",
  18023. strokeColor,
  18024. pointsCallback: (buffer, points) => {
  18025. const dy = (points[0].y - points[2].y) / 6;
  18026. let shift = dy;
  18027. let x = points[2].x;
  18028. const y = points[2].y;
  18029. const xEnd = points[3].x;
  18030. buffer.push(`${x} ${y + shift} m`);
  18031. do {
  18032. x += 2;
  18033. shift = shift === 0 ? dy : 0;
  18034. buffer.push(`${x} ${y + shift} l`);
  18035. } while (x < xEnd);
  18036. buffer.push("S");
  18037. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  18038. }
  18039. });
  18040. }
  18041. } else {
  18042. this.data.hasPopup = false;
  18043. }
  18044. }
  18045. }
  18046. class StrikeOutAnnotation extends MarkupAnnotation {
  18047. constructor(parameters) {
  18048. super(parameters);
  18049. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  18050. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18051. if (quadPoints) {
  18052. if (!this.appearance) {
  18053. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18054. this._setDefaultAppearance({
  18055. xref: parameters.xref,
  18056. extra: "[] 0 d 1 w",
  18057. strokeColor,
  18058. pointsCallback: (buffer, points) => {
  18059. buffer.push(`${(points[0].x + points[2].x) / 2}` + ` ${(points[0].y + points[2].y) / 2} m`);
  18060. buffer.push(`${(points[1].x + points[3].x) / 2}` + ` ${(points[1].y + points[3].y) / 2} l`);
  18061. buffer.push("S");
  18062. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18063. }
  18064. });
  18065. }
  18066. } else {
  18067. this.data.hasPopup = false;
  18068. }
  18069. }
  18070. }
  18071. class StampAnnotation extends MarkupAnnotation {
  18072. constructor(parameters) {
  18073. super(parameters);
  18074. this.data.annotationType = _util.AnnotationType.STAMP;
  18075. }
  18076. }
  18077. class FileAttachmentAnnotation extends MarkupAnnotation {
  18078. constructor(parameters) {
  18079. super(parameters);
  18080. const file = new _obj.FileSpec(parameters.dict.get("FS"), parameters.xref);
  18081. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  18082. this.data.file = file.serializable;
  18083. }
  18084. }
  18085. /***/ }),
  18086. /* 28 */
  18087. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18088. Object.defineProperty(exports, "__esModule", ({
  18089. value: true
  18090. }));
  18091. exports.createDefaultAppearance = createDefaultAppearance;
  18092. exports.parseDefaultAppearance = parseDefaultAppearance;
  18093. var _util = __w_pdfjs_require__(2);
  18094. var _colorspace = __w_pdfjs_require__(23);
  18095. var _core_utils = __w_pdfjs_require__(8);
  18096. var _evaluator = __w_pdfjs_require__(29);
  18097. var _primitives = __w_pdfjs_require__(5);
  18098. var _stream = __w_pdfjs_require__(12);
  18099. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  18100. constructor(str) {
  18101. super(new _stream.StringStream(str));
  18102. }
  18103. parse() {
  18104. const operation = {
  18105. fn: 0,
  18106. args: []
  18107. };
  18108. const result = {
  18109. fontSize: 0,
  18110. fontName: "",
  18111. fontColor: new Uint8ClampedArray(3)
  18112. };
  18113. try {
  18114. while (true) {
  18115. operation.args.length = 0;
  18116. if (!this.read(operation)) {
  18117. break;
  18118. }
  18119. if (this.savedStatesDepth !== 0) {
  18120. continue;
  18121. }
  18122. const {
  18123. fn,
  18124. args
  18125. } = operation;
  18126. switch (fn | 0) {
  18127. case _util.OPS.setFont:
  18128. const [fontName, fontSize] = args;
  18129. if (fontName instanceof _primitives.Name) {
  18130. result.fontName = fontName.name;
  18131. }
  18132. if (typeof fontSize === "number" && fontSize > 0) {
  18133. result.fontSize = fontSize;
  18134. }
  18135. break;
  18136. case _util.OPS.setFillRGBColor:
  18137. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  18138. break;
  18139. case _util.OPS.setFillGray:
  18140. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  18141. break;
  18142. case _util.OPS.setFillColorSpace:
  18143. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  18144. break;
  18145. }
  18146. }
  18147. } catch (reason) {
  18148. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  18149. }
  18150. return result;
  18151. }
  18152. }
  18153. function parseDefaultAppearance(str) {
  18154. return new DefaultAppearanceEvaluator(str).parse();
  18155. }
  18156. function createDefaultAppearance({
  18157. fontSize,
  18158. fontName,
  18159. fontColor
  18160. }) {
  18161. let colorCmd;
  18162. if (fontColor.every(c => c === 0)) {
  18163. colorCmd = "0 g";
  18164. } else {
  18165. colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg";
  18166. }
  18167. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${colorCmd}`;
  18168. }
  18169. /***/ }),
  18170. /* 29 */
  18171. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18172. Object.defineProperty(exports, "__esModule", ({
  18173. value: true
  18174. }));
  18175. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  18176. var _util = __w_pdfjs_require__(2);
  18177. var _cmap = __w_pdfjs_require__(30);
  18178. var _primitives = __w_pdfjs_require__(5);
  18179. var _stream = __w_pdfjs_require__(12);
  18180. var _fonts = __w_pdfjs_require__(31);
  18181. var _encodings = __w_pdfjs_require__(34);
  18182. var _unicode = __w_pdfjs_require__(37);
  18183. var _standard_fonts = __w_pdfjs_require__(36);
  18184. var _pattern = __w_pdfjs_require__(40);
  18185. var _function = __w_pdfjs_require__(41);
  18186. var _parser = __w_pdfjs_require__(11);
  18187. var _image_utils = __w_pdfjs_require__(24);
  18188. var _bidi = __w_pdfjs_require__(43);
  18189. var _colorspace = __w_pdfjs_require__(23);
  18190. var _glyphlist = __w_pdfjs_require__(35);
  18191. var _core_utils = __w_pdfjs_require__(8);
  18192. var _metrics = __w_pdfjs_require__(44);
  18193. var _murmurhash = __w_pdfjs_require__(45);
  18194. var _operator_list = __w_pdfjs_require__(46);
  18195. var _image = __w_pdfjs_require__(47);
  18196. const DefaultPartialEvaluatorOptions = Object.freeze({
  18197. maxImageSize: -1,
  18198. disableFontFace: false,
  18199. ignoreErrors: false,
  18200. isEvalSupported: true,
  18201. fontExtraProperties: false
  18202. });
  18203. const PatternType = {
  18204. TILING: 1,
  18205. SHADING: 2
  18206. };
  18207. const deferred = Promise.resolve();
  18208. function normalizeBlendMode(value, parsingArray = false) {
  18209. if (Array.isArray(value)) {
  18210. for (let i = 0, ii = value.length; i < ii; i++) {
  18211. const maybeBM = normalizeBlendMode(value[i], true);
  18212. if (maybeBM) {
  18213. return maybeBM;
  18214. }
  18215. }
  18216. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  18217. return "source-over";
  18218. }
  18219. if (!(0, _primitives.isName)(value)) {
  18220. if (parsingArray) {
  18221. return null;
  18222. }
  18223. return "source-over";
  18224. }
  18225. switch (value.name) {
  18226. case "Normal":
  18227. case "Compatible":
  18228. return "source-over";
  18229. case "Multiply":
  18230. return "multiply";
  18231. case "Screen":
  18232. return "screen";
  18233. case "Overlay":
  18234. return "overlay";
  18235. case "Darken":
  18236. return "darken";
  18237. case "Lighten":
  18238. return "lighten";
  18239. case "ColorDodge":
  18240. return "color-dodge";
  18241. case "ColorBurn":
  18242. return "color-burn";
  18243. case "HardLight":
  18244. return "hard-light";
  18245. case "SoftLight":
  18246. return "soft-light";
  18247. case "Difference":
  18248. return "difference";
  18249. case "Exclusion":
  18250. return "exclusion";
  18251. case "Hue":
  18252. return "hue";
  18253. case "Saturation":
  18254. return "saturation";
  18255. case "Color":
  18256. return "color";
  18257. case "Luminosity":
  18258. return "luminosity";
  18259. }
  18260. if (parsingArray) {
  18261. return null;
  18262. }
  18263. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  18264. return "source-over";
  18265. }
  18266. class TimeSlotManager {
  18267. static get TIME_SLOT_DURATION_MS() {
  18268. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  18269. }
  18270. static get CHECK_TIME_EVERY() {
  18271. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  18272. }
  18273. constructor() {
  18274. this.reset();
  18275. }
  18276. check() {
  18277. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  18278. return false;
  18279. }
  18280. this.checked = 0;
  18281. return this.endTime <= Date.now();
  18282. }
  18283. reset() {
  18284. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  18285. this.checked = 0;
  18286. }
  18287. }
  18288. class PartialEvaluator {
  18289. constructor({
  18290. xref,
  18291. handler,
  18292. pageIndex,
  18293. idFactory,
  18294. fontCache,
  18295. builtInCMapCache,
  18296. globalImageCache,
  18297. options = null
  18298. }) {
  18299. this.xref = xref;
  18300. this.handler = handler;
  18301. this.pageIndex = pageIndex;
  18302. this.idFactory = idFactory;
  18303. this.fontCache = fontCache;
  18304. this.builtInCMapCache = builtInCMapCache;
  18305. this.globalImageCache = globalImageCache;
  18306. this.options = options || DefaultPartialEvaluatorOptions;
  18307. this.parsingType3Font = false;
  18308. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  18309. }
  18310. get _pdfFunctionFactory() {
  18311. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  18312. xref: this.xref,
  18313. isEvalSupported: this.options.isEvalSupported
  18314. });
  18315. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  18316. }
  18317. clone(newOptions = DefaultPartialEvaluatorOptions) {
  18318. var newEvaluator = Object.create(this);
  18319. newEvaluator.options = newOptions;
  18320. return newEvaluator;
  18321. }
  18322. hasBlendModes(resources, nonBlendModesSet) {
  18323. if (!(resources instanceof _primitives.Dict)) {
  18324. return false;
  18325. }
  18326. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  18327. return false;
  18328. }
  18329. const processed = new _primitives.RefSet(nonBlendModesSet);
  18330. if (resources.objId) {
  18331. processed.put(resources.objId);
  18332. }
  18333. var nodes = [resources],
  18334. xref = this.xref;
  18335. while (nodes.length) {
  18336. var node = nodes.shift();
  18337. var graphicStates = node.get("ExtGState");
  18338. if (graphicStates instanceof _primitives.Dict) {
  18339. for (let graphicState of graphicStates.getRawValues()) {
  18340. if (graphicState instanceof _primitives.Ref) {
  18341. if (processed.has(graphicState)) {
  18342. continue;
  18343. }
  18344. try {
  18345. graphicState = xref.fetch(graphicState);
  18346. } catch (ex) {
  18347. processed.put(graphicState);
  18348. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  18349. continue;
  18350. }
  18351. }
  18352. if (!(graphicState instanceof _primitives.Dict)) {
  18353. continue;
  18354. }
  18355. if (graphicState.objId) {
  18356. processed.put(graphicState.objId);
  18357. }
  18358. const bm = graphicState.get("BM");
  18359. if (bm instanceof _primitives.Name) {
  18360. if (bm.name !== "Normal") {
  18361. return true;
  18362. }
  18363. continue;
  18364. }
  18365. if (bm !== undefined && Array.isArray(bm)) {
  18366. for (const element of bm) {
  18367. if (element instanceof _primitives.Name && element.name !== "Normal") {
  18368. return true;
  18369. }
  18370. }
  18371. }
  18372. }
  18373. }
  18374. var xObjects = node.get("XObject");
  18375. if (!(xObjects instanceof _primitives.Dict)) {
  18376. continue;
  18377. }
  18378. for (let xObject of xObjects.getRawValues()) {
  18379. if (xObject instanceof _primitives.Ref) {
  18380. if (processed.has(xObject)) {
  18381. continue;
  18382. }
  18383. try {
  18384. xObject = xref.fetch(xObject);
  18385. } catch (ex) {
  18386. processed.put(xObject);
  18387. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  18388. continue;
  18389. }
  18390. }
  18391. if (!(0, _primitives.isStream)(xObject)) {
  18392. continue;
  18393. }
  18394. if (xObject.dict.objId) {
  18395. processed.put(xObject.dict.objId);
  18396. }
  18397. var xResources = xObject.dict.get("Resources");
  18398. if (!(xResources instanceof _primitives.Dict)) {
  18399. continue;
  18400. }
  18401. if (xResources.objId && processed.has(xResources.objId)) {
  18402. continue;
  18403. }
  18404. nodes.push(xResources);
  18405. if (xResources.objId) {
  18406. processed.put(xResources.objId);
  18407. }
  18408. }
  18409. }
  18410. processed.forEach(ref => {
  18411. nonBlendModesSet.put(ref);
  18412. });
  18413. return false;
  18414. }
  18415. async fetchBuiltInCMap(name) {
  18416. const cachedData = this.builtInCMapCache.get(name);
  18417. if (cachedData) {
  18418. return cachedData;
  18419. }
  18420. const readableStream = this.handler.sendWithStream("FetchBuiltInCMap", {
  18421. name
  18422. });
  18423. const reader = readableStream.getReader();
  18424. const data = await new Promise(function (resolve, reject) {
  18425. function pump() {
  18426. reader.read().then(function ({
  18427. value,
  18428. done
  18429. }) {
  18430. if (done) {
  18431. return;
  18432. }
  18433. resolve(value);
  18434. pump();
  18435. }, reject);
  18436. }
  18437. pump();
  18438. });
  18439. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  18440. this.builtInCMapCache.set(name, data);
  18441. }
  18442. return data;
  18443. }
  18444. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  18445. var dict = xobj.dict;
  18446. var matrix = dict.getArray("Matrix");
  18447. var bbox = dict.getArray("BBox");
  18448. if (Array.isArray(bbox) && bbox.length === 4) {
  18449. bbox = _util.Util.normalizeRect(bbox);
  18450. } else {
  18451. bbox = null;
  18452. }
  18453. let optionalContent = null;
  18454. if (dict.has("OC")) {
  18455. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  18456. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  18457. }
  18458. var group = dict.get("Group");
  18459. if (group) {
  18460. var groupOptions = {
  18461. matrix,
  18462. bbox,
  18463. smask,
  18464. isolated: false,
  18465. knockout: false
  18466. };
  18467. var groupSubtype = group.get("S");
  18468. var colorSpace = null;
  18469. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  18470. groupOptions.isolated = group.get("I") || false;
  18471. groupOptions.knockout = group.get("K") || false;
  18472. if (group.has("CS")) {
  18473. const cs = group.getRaw("CS");
  18474. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  18475. if (cachedColorSpace) {
  18476. colorSpace = cachedColorSpace;
  18477. } else {
  18478. colorSpace = await this.parseColorSpace({
  18479. cs,
  18480. resources,
  18481. localColorSpaceCache
  18482. });
  18483. }
  18484. }
  18485. }
  18486. if (smask && smask.backdrop) {
  18487. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  18488. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  18489. }
  18490. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  18491. }
  18492. operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
  18493. return this.getOperatorList({
  18494. stream: xobj,
  18495. task,
  18496. resources: dict.get("Resources") || resources,
  18497. operatorList,
  18498. initialState
  18499. }).then(function () {
  18500. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  18501. if (group) {
  18502. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  18503. }
  18504. if (optionalContent) {
  18505. operatorList.addOp(_util.OPS.endMarkedContent, []);
  18506. }
  18507. });
  18508. }
  18509. _sendImgData(objId, imgData, cacheGlobally = false) {
  18510. const transfers = imgData ? [imgData.data.buffer] : null;
  18511. if (this.parsingType3Font || cacheGlobally) {
  18512. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  18513. }
  18514. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  18515. }
  18516. async buildPaintImageXObject({
  18517. resources,
  18518. image,
  18519. isInline = false,
  18520. operatorList,
  18521. cacheKey,
  18522. localImageCache,
  18523. localColorSpaceCache
  18524. }) {
  18525. var dict = image.dict;
  18526. const imageRef = dict.objId;
  18527. var w = dict.get("Width", "W");
  18528. var h = dict.get("Height", "H");
  18529. if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
  18530. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  18531. return undefined;
  18532. }
  18533. var maxImageSize = this.options.maxImageSize;
  18534. if (maxImageSize !== -1 && w * h > maxImageSize) {
  18535. (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
  18536. return undefined;
  18537. }
  18538. var imageMask = dict.get("ImageMask", "IM") || false;
  18539. var imgData, args;
  18540. if (imageMask) {
  18541. var width = dict.get("Width", "W");
  18542. var height = dict.get("Height", "H");
  18543. var bitStrideLength = width + 7 >> 3;
  18544. var imgArray = image.getBytes(bitStrideLength * height, true);
  18545. var decode = dict.getArray("Decode", "D");
  18546. imgData = _image.PDFImage.createMask({
  18547. imgArray,
  18548. width,
  18549. height,
  18550. imageIsFromDecodeStream: image instanceof _stream.DecodeStream,
  18551. inverseDecode: !!decode && decode[0] > 0
  18552. });
  18553. imgData.cached = !!cacheKey;
  18554. args = [imgData];
  18555. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  18556. if (cacheKey) {
  18557. localImageCache.set(cacheKey, imageRef, {
  18558. fn: _util.OPS.paintImageMaskXObject,
  18559. args
  18560. });
  18561. }
  18562. return undefined;
  18563. }
  18564. var softMask = dict.get("SMask", "SM") || false;
  18565. var mask = dict.get("Mask") || false;
  18566. var SMALL_IMAGE_DIMENSIONS = 200;
  18567. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  18568. const imageObj = new _image.PDFImage({
  18569. xref: this.xref,
  18570. res: resources,
  18571. image,
  18572. isInline,
  18573. pdfFunctionFactory: this._pdfFunctionFactory,
  18574. localColorSpaceCache
  18575. });
  18576. imgData = imageObj.createImageData(true);
  18577. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  18578. return undefined;
  18579. }
  18580. let objId = `img_${this.idFactory.createObjId()}`,
  18581. cacheGlobally = false;
  18582. if (this.parsingType3Font) {
  18583. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  18584. } else if (imageRef) {
  18585. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  18586. if (cacheGlobally) {
  18587. objId = `${this.idFactory.getDocId()}_${objId}`;
  18588. }
  18589. }
  18590. operatorList.addDependency(objId);
  18591. args = [objId, w, h];
  18592. _image.PDFImage.buildImage({
  18593. xref: this.xref,
  18594. res: resources,
  18595. image,
  18596. isInline,
  18597. pdfFunctionFactory: this._pdfFunctionFactory,
  18598. localColorSpaceCache
  18599. }).then(imageObj => {
  18600. imgData = imageObj.createImageData(false);
  18601. if (cacheKey && imageRef && cacheGlobally) {
  18602. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  18603. }
  18604. return this._sendImgData(objId, imgData, cacheGlobally);
  18605. }).catch(reason => {
  18606. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  18607. return this._sendImgData(objId, null, cacheGlobally);
  18608. });
  18609. operatorList.addOp(_util.OPS.paintImageXObject, args);
  18610. if (cacheKey) {
  18611. localImageCache.set(cacheKey, imageRef, {
  18612. fn: _util.OPS.paintImageXObject,
  18613. args
  18614. });
  18615. if (imageRef) {
  18616. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  18617. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  18618. if (cacheGlobally) {
  18619. this.globalImageCache.setData(imageRef, {
  18620. objId,
  18621. fn: _util.OPS.paintImageXObject,
  18622. args,
  18623. byteSize: 0
  18624. });
  18625. }
  18626. }
  18627. }
  18628. return undefined;
  18629. }
  18630. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  18631. var smaskContent = smask.get("G");
  18632. var smaskOptions = {
  18633. subtype: smask.get("S").name,
  18634. backdrop: smask.get("BC")
  18635. };
  18636. var transferObj = smask.get("TR");
  18637. if ((0, _function.isPDFFunction)(transferObj)) {
  18638. const transferFn = this._pdfFunctionFactory.create(transferObj);
  18639. var transferMap = new Uint8Array(256);
  18640. var tmp = new Float32Array(1);
  18641. for (var i = 0; i < 256; i++) {
  18642. tmp[0] = i / 255;
  18643. transferFn(tmp, 0, tmp, 0);
  18644. transferMap[i] = tmp[0] * 255 | 0;
  18645. }
  18646. smaskOptions.transferMap = transferMap;
  18647. }
  18648. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  18649. }
  18650. handleTransferFunction(tr) {
  18651. let transferArray;
  18652. if (Array.isArray(tr)) {
  18653. transferArray = tr;
  18654. } else if ((0, _function.isPDFFunction)(tr)) {
  18655. transferArray = [tr];
  18656. } else {
  18657. return null;
  18658. }
  18659. const transferMaps = [];
  18660. let numFns = 0,
  18661. numEffectfulFns = 0;
  18662. for (const entry of transferArray) {
  18663. const transferObj = this.xref.fetchIfRef(entry);
  18664. numFns++;
  18665. if ((0, _primitives.isName)(transferObj, "Identity")) {
  18666. transferMaps.push(null);
  18667. continue;
  18668. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  18669. return null;
  18670. }
  18671. const transferFn = this._pdfFunctionFactory.create(transferObj);
  18672. const transferMap = new Uint8Array(256),
  18673. tmp = new Float32Array(1);
  18674. for (let j = 0; j < 256; j++) {
  18675. tmp[0] = j / 255;
  18676. transferFn(tmp, 0, tmp, 0);
  18677. transferMap[j] = tmp[0] * 255 | 0;
  18678. }
  18679. transferMaps.push(transferMap);
  18680. numEffectfulFns++;
  18681. }
  18682. if (!(numFns === 1 || numFns === 4)) {
  18683. return null;
  18684. }
  18685. if (numEffectfulFns === 0) {
  18686. return null;
  18687. }
  18688. return transferMaps;
  18689. }
  18690. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, cacheKey, localTilingPatternCache) {
  18691. const tilingOpList = new _operator_list.OperatorList();
  18692. const patternResources = _primitives.Dict.merge({
  18693. xref: this.xref,
  18694. dictArray: [patternDict.get("Resources"), resources]
  18695. });
  18696. return this.getOperatorList({
  18697. stream: pattern,
  18698. task,
  18699. resources: patternResources,
  18700. operatorList: tilingOpList
  18701. }).then(function () {
  18702. const operatorListIR = tilingOpList.getIR();
  18703. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  18704. operatorList.addDependencies(tilingOpList.dependencies);
  18705. operatorList.addOp(fn, tilingPatternIR);
  18706. if (cacheKey) {
  18707. localTilingPatternCache.set(cacheKey, patternDict.objId, {
  18708. operatorListIR,
  18709. dict: patternDict
  18710. });
  18711. }
  18712. }).catch(reason => {
  18713. if (reason instanceof _util.AbortException) {
  18714. return;
  18715. }
  18716. if (this.options.ignoreErrors) {
  18717. this.handler.send("UnsupportedFeature", {
  18718. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  18719. });
  18720. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  18721. return;
  18722. }
  18723. throw reason;
  18724. });
  18725. }
  18726. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null) {
  18727. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  18728. return this.loadFont(fontName, fontRef, resources, fallbackFontDict).then(translated => {
  18729. if (!translated.font.isType3Font) {
  18730. return translated;
  18731. }
  18732. return translated.loadType3Data(this, resources, task).then(function () {
  18733. operatorList.addDependencies(translated.type3Dependencies);
  18734. return translated;
  18735. }).catch(reason => {
  18736. this.handler.send("UnsupportedFeature", {
  18737. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  18738. });
  18739. return new TranslatedFont({
  18740. loadedName: "g_font_error",
  18741. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  18742. dict: translated.font,
  18743. extraProperties: this.options.fontExtraProperties
  18744. });
  18745. });
  18746. }).then(translated => {
  18747. state.font = translated.font;
  18748. translated.send(this.handler);
  18749. return translated.loadedName;
  18750. });
  18751. }
  18752. handleText(chars, state) {
  18753. const font = state.font;
  18754. const glyphs = font.charsToGlyphs(chars);
  18755. if (font.data) {
  18756. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  18757. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  18758. PartialEvaluator.buildFontPaths(font, glyphs, this.handler);
  18759. }
  18760. }
  18761. return glyphs;
  18762. }
  18763. ensureStateFont(state) {
  18764. if (state.font) {
  18765. return;
  18766. }
  18767. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  18768. if (this.options.ignoreErrors) {
  18769. this.handler.send("UnsupportedFeature", {
  18770. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  18771. });
  18772. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  18773. return;
  18774. }
  18775. throw reason;
  18776. }
  18777. async setGState({
  18778. resources,
  18779. gState,
  18780. operatorList,
  18781. cacheKey,
  18782. task,
  18783. stateManager,
  18784. localGStateCache,
  18785. localColorSpaceCache
  18786. }) {
  18787. const gStateRef = gState.objId;
  18788. let isSimpleGState = true;
  18789. var gStateObj = [];
  18790. var gStateKeys = gState.getKeys();
  18791. var promise = Promise.resolve();
  18792. for (var i = 0, ii = gStateKeys.length; i < ii; i++) {
  18793. const key = gStateKeys[i];
  18794. const value = gState.get(key);
  18795. switch (key) {
  18796. case "Type":
  18797. break;
  18798. case "LW":
  18799. case "LC":
  18800. case "LJ":
  18801. case "ML":
  18802. case "D":
  18803. case "RI":
  18804. case "FL":
  18805. case "CA":
  18806. case "ca":
  18807. gStateObj.push([key, value]);
  18808. break;
  18809. case "Font":
  18810. isSimpleGState = false;
  18811. promise = promise.then(() => {
  18812. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  18813. operatorList.addDependency(loadedName);
  18814. gStateObj.push([key, [loadedName, value[1]]]);
  18815. });
  18816. });
  18817. break;
  18818. case "BM":
  18819. gStateObj.push([key, normalizeBlendMode(value)]);
  18820. break;
  18821. case "SMask":
  18822. if ((0, _primitives.isName)(value, "None")) {
  18823. gStateObj.push([key, false]);
  18824. break;
  18825. }
  18826. if ((0, _primitives.isDict)(value)) {
  18827. isSimpleGState = false;
  18828. promise = promise.then(() => {
  18829. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  18830. });
  18831. gStateObj.push([key, true]);
  18832. } else {
  18833. (0, _util.warn)("Unsupported SMask type");
  18834. }
  18835. break;
  18836. case "TR":
  18837. const transferMaps = this.handleTransferFunction(value);
  18838. gStateObj.push([key, transferMaps]);
  18839. break;
  18840. case "OP":
  18841. case "op":
  18842. case "OPM":
  18843. case "BG":
  18844. case "BG2":
  18845. case "UCR":
  18846. case "UCR2":
  18847. case "TR2":
  18848. case "HT":
  18849. case "SM":
  18850. case "SA":
  18851. case "AIS":
  18852. case "TK":
  18853. (0, _util.info)("graphic state operator " + key);
  18854. break;
  18855. default:
  18856. (0, _util.info)("Unknown graphic state operator " + key);
  18857. break;
  18858. }
  18859. }
  18860. return promise.then(function () {
  18861. if (gStateObj.length > 0) {
  18862. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  18863. }
  18864. if (isSimpleGState) {
  18865. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  18866. }
  18867. });
  18868. }
  18869. loadFont(fontName, font, resources, fallbackFontDict = null) {
  18870. const errorFont = async () => {
  18871. return new TranslatedFont({
  18872. loadedName: "g_font_error",
  18873. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  18874. dict: font,
  18875. extraProperties: this.options.fontExtraProperties
  18876. });
  18877. };
  18878. var fontRef,
  18879. xref = this.xref;
  18880. if (font) {
  18881. if (!(0, _primitives.isRef)(font)) {
  18882. throw new _util.FormatError('The "font" object should be a reference.');
  18883. }
  18884. fontRef = font;
  18885. } else {
  18886. var fontRes = resources.get("Font");
  18887. if (fontRes) {
  18888. fontRef = fontRes.getRaw(fontName);
  18889. }
  18890. }
  18891. if (!fontRef) {
  18892. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  18893. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  18894. (0, _util.warn)(`${partialMsg}.`);
  18895. return errorFont();
  18896. }
  18897. this.handler.send("UnsupportedFeature", {
  18898. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  18899. });
  18900. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  18901. if (fallbackFontDict) {
  18902. fontRef = fallbackFontDict;
  18903. } else {
  18904. fontRef = PartialEvaluator.fallbackFontDict;
  18905. }
  18906. }
  18907. if (this.fontCache.has(fontRef)) {
  18908. return this.fontCache.get(fontRef);
  18909. }
  18910. font = xref.fetchIfRef(fontRef);
  18911. if (!(0, _primitives.isDict)(font)) {
  18912. return errorFont();
  18913. }
  18914. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  18915. return this.fontCache.get(font.cacheKey);
  18916. }
  18917. var fontCapability = (0, _util.createPromiseCapability)();
  18918. let preEvaluatedFont;
  18919. try {
  18920. preEvaluatedFont = this.preEvaluateFont(font);
  18921. } catch (reason) {
  18922. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  18923. return errorFont();
  18924. }
  18925. const {
  18926. descriptor,
  18927. hash
  18928. } = preEvaluatedFont;
  18929. var fontRefIsRef = (0, _primitives.isRef)(fontRef),
  18930. fontID;
  18931. if (fontRefIsRef) {
  18932. fontID = `f${fontRef.toString()}`;
  18933. }
  18934. if (hash && (0, _primitives.isDict)(descriptor)) {
  18935. if (!descriptor.fontAliases) {
  18936. descriptor.fontAliases = Object.create(null);
  18937. }
  18938. var fontAliases = descriptor.fontAliases;
  18939. if (fontAliases[hash]) {
  18940. var aliasFontRef = fontAliases[hash].aliasRef;
  18941. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  18942. this.fontCache.putAlias(fontRef, aliasFontRef);
  18943. return this.fontCache.get(fontRef);
  18944. }
  18945. } else {
  18946. fontAliases[hash] = {
  18947. fontID: this.idFactory.createFontId()
  18948. };
  18949. }
  18950. if (fontRefIsRef) {
  18951. fontAliases[hash].aliasRef = fontRef;
  18952. }
  18953. fontID = fontAliases[hash].fontID;
  18954. }
  18955. if (fontRefIsRef) {
  18956. this.fontCache.put(fontRef, fontCapability.promise);
  18957. } else {
  18958. if (!fontID) {
  18959. fontID = this.idFactory.createFontId();
  18960. }
  18961. font.cacheKey = `cacheKey_${fontID}`;
  18962. this.fontCache.put(font.cacheKey, fontCapability.promise);
  18963. }
  18964. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  18965. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  18966. this.translateFont(preEvaluatedFont).then(translatedFont => {
  18967. if (translatedFont.fontType !== undefined) {
  18968. var xrefFontStats = xref.stats.fontTypes;
  18969. xrefFontStats[translatedFont.fontType] = true;
  18970. }
  18971. fontCapability.resolve(new TranslatedFont({
  18972. loadedName: font.loadedName,
  18973. font: translatedFont,
  18974. dict: font,
  18975. extraProperties: this.options.fontExtraProperties
  18976. }));
  18977. }).catch(reason => {
  18978. this.handler.send("UnsupportedFeature", {
  18979. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  18980. });
  18981. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  18982. try {
  18983. var fontFile3 = descriptor && descriptor.get("FontFile3");
  18984. var subtype = fontFile3 && fontFile3.get("Subtype");
  18985. var fontType = (0, _fonts.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  18986. var xrefFontStats = xref.stats.fontTypes;
  18987. xrefFontStats[fontType] = true;
  18988. } catch (ex) {}
  18989. fontCapability.resolve(new TranslatedFont({
  18990. loadedName: font.loadedName,
  18991. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  18992. dict: font,
  18993. extraProperties: this.options.fontExtraProperties
  18994. }));
  18995. });
  18996. return fontCapability.promise;
  18997. }
  18998. buildPath(operatorList, fn, args, parsingText = false) {
  18999. var lastIndex = operatorList.length - 1;
  19000. if (!args) {
  19001. args = [];
  19002. }
  19003. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  19004. if (parsingText) {
  19005. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  19006. operatorList.addOp(_util.OPS.save, null);
  19007. }
  19008. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  19009. if (parsingText) {
  19010. operatorList.addOp(_util.OPS.restore, null);
  19011. }
  19012. } else {
  19013. var opArgs = operatorList.argsArray[lastIndex];
  19014. opArgs[0].push(fn);
  19015. Array.prototype.push.apply(opArgs[1], args);
  19016. }
  19017. }
  19018. parseColorSpace({
  19019. cs,
  19020. resources,
  19021. localColorSpaceCache
  19022. }) {
  19023. return _colorspace.ColorSpace.parseAsync({
  19024. cs,
  19025. xref: this.xref,
  19026. resources,
  19027. pdfFunctionFactory: this._pdfFunctionFactory,
  19028. localColorSpaceCache
  19029. }).catch(reason => {
  19030. if (reason instanceof _util.AbortException) {
  19031. return null;
  19032. }
  19033. if (this.options.ignoreErrors) {
  19034. this.handler.send("UnsupportedFeature", {
  19035. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  19036. });
  19037. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  19038. return null;
  19039. }
  19040. throw reason;
  19041. });
  19042. }
  19043. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache) {
  19044. const patternName = args.pop();
  19045. if (patternName instanceof _primitives.Name) {
  19046. const name = patternName.name;
  19047. const localTilingPattern = localTilingPatternCache.getByName(name);
  19048. if (localTilingPattern) {
  19049. try {
  19050. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  19051. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  19052. operatorList.addOp(fn, tilingPatternIR);
  19053. return undefined;
  19054. } catch (ex) {}
  19055. }
  19056. let pattern = patterns.get(name);
  19057. if (pattern) {
  19058. var dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
  19059. var typeNum = dict.get("PatternType");
  19060. if (typeNum === PatternType.TILING) {
  19061. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  19062. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, name, localTilingPatternCache);
  19063. } else if (typeNum === PatternType.SHADING) {
  19064. var shading = dict.get("Shading");
  19065. var matrix = dict.getArray("Matrix");
  19066. pattern = _pattern.Pattern.parseShading(shading, matrix, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  19067. operatorList.addOp(fn, pattern.getIR());
  19068. return undefined;
  19069. }
  19070. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  19071. }
  19072. }
  19073. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  19074. }
  19075. async parseMarkedContentProps(contentProperties, resources) {
  19076. let optionalContent;
  19077. if ((0, _primitives.isName)(contentProperties)) {
  19078. const properties = resources.get("Properties");
  19079. optionalContent = properties.get(contentProperties.name);
  19080. } else if ((0, _primitives.isDict)(contentProperties)) {
  19081. optionalContent = contentProperties;
  19082. } else {
  19083. throw new _util.FormatError("Optional content properties malformed.");
  19084. }
  19085. const optionalContentType = optionalContent.get("Type").name;
  19086. if (optionalContentType === "OCG") {
  19087. return {
  19088. type: optionalContentType,
  19089. id: optionalContent.objId
  19090. };
  19091. } else if (optionalContentType === "OCMD") {
  19092. const optionalContentGroups = optionalContent.get("OCGs");
  19093. if (Array.isArray(optionalContentGroups) || (0, _primitives.isDict)(optionalContentGroups)) {
  19094. const groupIds = [];
  19095. if (Array.isArray(optionalContentGroups)) {
  19096. optionalContent.get("OCGs").forEach(ocg => {
  19097. groupIds.push(ocg.toString());
  19098. });
  19099. } else {
  19100. groupIds.push(optionalContentGroups.objId);
  19101. }
  19102. let expression = null;
  19103. if (optionalContent.get("VE")) {
  19104. expression = true;
  19105. }
  19106. return {
  19107. type: optionalContentType,
  19108. ids: groupIds,
  19109. policy: (0, _primitives.isName)(optionalContent.get("P")) ? optionalContent.get("P").name : null,
  19110. expression
  19111. };
  19112. } else if ((0, _primitives.isRef)(optionalContentGroups)) {
  19113. return {
  19114. type: optionalContentType,
  19115. id: optionalContentGroups.toString()
  19116. };
  19117. }
  19118. }
  19119. return null;
  19120. }
  19121. getOperatorList({
  19122. stream,
  19123. task,
  19124. resources,
  19125. operatorList,
  19126. initialState = null,
  19127. fallbackFontDict = null
  19128. }) {
  19129. resources = resources || _primitives.Dict.empty;
  19130. initialState = initialState || new EvalState();
  19131. if (!operatorList) {
  19132. throw new Error('getOperatorList: missing "operatorList" parameter');
  19133. }
  19134. var self = this;
  19135. var xref = this.xref;
  19136. let parsingText = false;
  19137. const localImageCache = new _image_utils.LocalImageCache();
  19138. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  19139. const localGStateCache = new _image_utils.LocalGStateCache();
  19140. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  19141. var xobjs = resources.get("XObject") || _primitives.Dict.empty;
  19142. var patterns = resources.get("Pattern") || _primitives.Dict.empty;
  19143. var stateManager = new StateManager(initialState);
  19144. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  19145. var timeSlotManager = new TimeSlotManager();
  19146. function closePendingRestoreOPS(argument) {
  19147. for (var i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  19148. operatorList.addOp(_util.OPS.restore, []);
  19149. }
  19150. }
  19151. return new Promise(function promiseBody(resolve, reject) {
  19152. const next = function (promise) {
  19153. Promise.all([promise, operatorList.ready]).then(function () {
  19154. try {
  19155. promiseBody(resolve, reject);
  19156. } catch (ex) {
  19157. reject(ex);
  19158. }
  19159. }, reject);
  19160. };
  19161. task.ensureNotTerminated();
  19162. timeSlotManager.reset();
  19163. var stop,
  19164. operation = {},
  19165. i,
  19166. ii,
  19167. cs,
  19168. name;
  19169. while (!(stop = timeSlotManager.check())) {
  19170. operation.args = null;
  19171. if (!preprocessor.read(operation)) {
  19172. break;
  19173. }
  19174. var args = operation.args;
  19175. var fn = operation.fn;
  19176. switch (fn | 0) {
  19177. case _util.OPS.paintXObject:
  19178. name = args[0].name;
  19179. if (name) {
  19180. const localImage = localImageCache.getByName(name);
  19181. if (localImage) {
  19182. operatorList.addOp(localImage.fn, localImage.args);
  19183. args = null;
  19184. continue;
  19185. }
  19186. }
  19187. next(new Promise(function (resolveXObject, rejectXObject) {
  19188. if (!name) {
  19189. throw new _util.FormatError("XObject must be referred to by name.");
  19190. }
  19191. let xobj = xobjs.getRaw(name);
  19192. if (xobj instanceof _primitives.Ref) {
  19193. const localImage = localImageCache.getByRef(xobj);
  19194. if (localImage) {
  19195. operatorList.addOp(localImage.fn, localImage.args);
  19196. resolveXObject();
  19197. return;
  19198. }
  19199. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  19200. if (globalImage) {
  19201. operatorList.addDependency(globalImage.objId);
  19202. operatorList.addOp(globalImage.fn, globalImage.args);
  19203. resolveXObject();
  19204. return;
  19205. }
  19206. xobj = xref.fetch(xobj);
  19207. }
  19208. if (!(0, _primitives.isStream)(xobj)) {
  19209. throw new _util.FormatError("XObject should be a stream");
  19210. }
  19211. const type = xobj.dict.get("Subtype");
  19212. if (!(0, _primitives.isName)(type)) {
  19213. throw new _util.FormatError("XObject should have a Name subtype");
  19214. }
  19215. if (type.name === "Form") {
  19216. stateManager.save();
  19217. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  19218. stateManager.restore();
  19219. resolveXObject();
  19220. }, rejectXObject);
  19221. return;
  19222. } else if (type.name === "Image") {
  19223. self.buildPaintImageXObject({
  19224. resources,
  19225. image: xobj,
  19226. operatorList,
  19227. cacheKey: name,
  19228. localImageCache,
  19229. localColorSpaceCache
  19230. }).then(resolveXObject, rejectXObject);
  19231. return;
  19232. } else if (type.name === "PS") {
  19233. (0, _util.info)("Ignored XObject subtype PS");
  19234. } else {
  19235. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  19236. }
  19237. resolveXObject();
  19238. }).catch(function (reason) {
  19239. if (reason instanceof _util.AbortException) {
  19240. return;
  19241. }
  19242. if (self.options.ignoreErrors) {
  19243. self.handler.send("UnsupportedFeature", {
  19244. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  19245. });
  19246. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  19247. return;
  19248. }
  19249. throw reason;
  19250. }));
  19251. return;
  19252. case _util.OPS.setFont:
  19253. var fontSize = args[1];
  19254. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  19255. operatorList.addDependency(loadedName);
  19256. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  19257. }));
  19258. return;
  19259. case _util.OPS.beginText:
  19260. parsingText = true;
  19261. break;
  19262. case _util.OPS.endText:
  19263. parsingText = false;
  19264. break;
  19265. case _util.OPS.endInlineImage:
  19266. var cacheKey = args[0].cacheKey;
  19267. if (cacheKey) {
  19268. const localImage = localImageCache.getByName(cacheKey);
  19269. if (localImage) {
  19270. operatorList.addOp(localImage.fn, localImage.args);
  19271. args = null;
  19272. continue;
  19273. }
  19274. }
  19275. next(self.buildPaintImageXObject({
  19276. resources,
  19277. image: args[0],
  19278. isInline: true,
  19279. operatorList,
  19280. cacheKey,
  19281. localImageCache,
  19282. localColorSpaceCache
  19283. }));
  19284. return;
  19285. case _util.OPS.showText:
  19286. if (!stateManager.state.font) {
  19287. self.ensureStateFont(stateManager.state);
  19288. continue;
  19289. }
  19290. args[0] = self.handleText(args[0], stateManager.state);
  19291. break;
  19292. case _util.OPS.showSpacedText:
  19293. if (!stateManager.state.font) {
  19294. self.ensureStateFont(stateManager.state);
  19295. continue;
  19296. }
  19297. var arr = args[0];
  19298. var combinedGlyphs = [];
  19299. var arrLength = arr.length;
  19300. var state = stateManager.state;
  19301. for (i = 0; i < arrLength; ++i) {
  19302. var arrItem = arr[i];
  19303. if ((0, _util.isString)(arrItem)) {
  19304. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  19305. } else if ((0, _util.isNum)(arrItem)) {
  19306. combinedGlyphs.push(arrItem);
  19307. }
  19308. }
  19309. args[0] = combinedGlyphs;
  19310. fn = _util.OPS.showText;
  19311. break;
  19312. case _util.OPS.nextLineShowText:
  19313. if (!stateManager.state.font) {
  19314. self.ensureStateFont(stateManager.state);
  19315. continue;
  19316. }
  19317. operatorList.addOp(_util.OPS.nextLine);
  19318. args[0] = self.handleText(args[0], stateManager.state);
  19319. fn = _util.OPS.showText;
  19320. break;
  19321. case _util.OPS.nextLineSetSpacingShowText:
  19322. if (!stateManager.state.font) {
  19323. self.ensureStateFont(stateManager.state);
  19324. continue;
  19325. }
  19326. operatorList.addOp(_util.OPS.nextLine);
  19327. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  19328. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  19329. args[0] = self.handleText(args[0], stateManager.state);
  19330. fn = _util.OPS.showText;
  19331. break;
  19332. case _util.OPS.setTextRenderingMode:
  19333. stateManager.state.textRenderingMode = args[0];
  19334. break;
  19335. case _util.OPS.setFillColorSpace:
  19336. {
  19337. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  19338. if (cachedColorSpace) {
  19339. stateManager.state.fillColorSpace = cachedColorSpace;
  19340. continue;
  19341. }
  19342. next(self.parseColorSpace({
  19343. cs: args[0],
  19344. resources,
  19345. localColorSpaceCache
  19346. }).then(function (colorSpace) {
  19347. if (colorSpace) {
  19348. stateManager.state.fillColorSpace = colorSpace;
  19349. }
  19350. }));
  19351. return;
  19352. }
  19353. case _util.OPS.setStrokeColorSpace:
  19354. {
  19355. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  19356. if (cachedColorSpace) {
  19357. stateManager.state.strokeColorSpace = cachedColorSpace;
  19358. continue;
  19359. }
  19360. next(self.parseColorSpace({
  19361. cs: args[0],
  19362. resources,
  19363. localColorSpaceCache
  19364. }).then(function (colorSpace) {
  19365. if (colorSpace) {
  19366. stateManager.state.strokeColorSpace = colorSpace;
  19367. }
  19368. }));
  19369. return;
  19370. }
  19371. case _util.OPS.setFillColor:
  19372. cs = stateManager.state.fillColorSpace;
  19373. args = cs.getRgb(args, 0);
  19374. fn = _util.OPS.setFillRGBColor;
  19375. break;
  19376. case _util.OPS.setStrokeColor:
  19377. cs = stateManager.state.strokeColorSpace;
  19378. args = cs.getRgb(args, 0);
  19379. fn = _util.OPS.setStrokeRGBColor;
  19380. break;
  19381. case _util.OPS.setFillGray:
  19382. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  19383. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  19384. fn = _util.OPS.setFillRGBColor;
  19385. break;
  19386. case _util.OPS.setStrokeGray:
  19387. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  19388. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  19389. fn = _util.OPS.setStrokeRGBColor;
  19390. break;
  19391. case _util.OPS.setFillCMYKColor:
  19392. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  19393. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  19394. fn = _util.OPS.setFillRGBColor;
  19395. break;
  19396. case _util.OPS.setStrokeCMYKColor:
  19397. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  19398. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  19399. fn = _util.OPS.setStrokeRGBColor;
  19400. break;
  19401. case _util.OPS.setFillRGBColor:
  19402. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  19403. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  19404. break;
  19405. case _util.OPS.setStrokeRGBColor:
  19406. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  19407. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  19408. break;
  19409. case _util.OPS.setFillColorN:
  19410. cs = stateManager.state.fillColorSpace;
  19411. if (cs.name === "Pattern") {
  19412. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache));
  19413. return;
  19414. }
  19415. args = cs.getRgb(args, 0);
  19416. fn = _util.OPS.setFillRGBColor;
  19417. break;
  19418. case _util.OPS.setStrokeColorN:
  19419. cs = stateManager.state.strokeColorSpace;
  19420. if (cs.name === "Pattern") {
  19421. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache));
  19422. return;
  19423. }
  19424. args = cs.getRgb(args, 0);
  19425. fn = _util.OPS.setStrokeRGBColor;
  19426. break;
  19427. case _util.OPS.shadingFill:
  19428. var shadingRes = resources.get("Shading");
  19429. if (!shadingRes) {
  19430. throw new _util.FormatError("No shading resource found");
  19431. }
  19432. var shading = shadingRes.get(args[0].name);
  19433. if (!shading) {
  19434. throw new _util.FormatError("No shading object found");
  19435. }
  19436. var shadingFill = _pattern.Pattern.parseShading(shading, null, xref, resources, self.handler, self._pdfFunctionFactory, localColorSpaceCache);
  19437. var patternIR = shadingFill.getIR();
  19438. args = [patternIR];
  19439. fn = _util.OPS.shadingFill;
  19440. break;
  19441. case _util.OPS.setGState:
  19442. name = args[0].name;
  19443. if (name) {
  19444. const localGStateObj = localGStateCache.getByName(name);
  19445. if (localGStateObj) {
  19446. if (localGStateObj.length > 0) {
  19447. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  19448. }
  19449. args = null;
  19450. continue;
  19451. }
  19452. }
  19453. next(new Promise(function (resolveGState, rejectGState) {
  19454. if (!name) {
  19455. throw new _util.FormatError("GState must be referred to by name.");
  19456. }
  19457. const extGState = resources.get("ExtGState");
  19458. if (!(extGState instanceof _primitives.Dict)) {
  19459. throw new _util.FormatError("ExtGState should be a dictionary.");
  19460. }
  19461. const gState = extGState.get(name);
  19462. if (!(gState instanceof _primitives.Dict)) {
  19463. throw new _util.FormatError("GState should be a dictionary.");
  19464. }
  19465. self.setGState({
  19466. resources,
  19467. gState,
  19468. operatorList,
  19469. cacheKey: name,
  19470. task,
  19471. stateManager,
  19472. localGStateCache,
  19473. localColorSpaceCache
  19474. }).then(resolveGState, rejectGState);
  19475. }).catch(function (reason) {
  19476. if (reason instanceof _util.AbortException) {
  19477. return;
  19478. }
  19479. if (self.options.ignoreErrors) {
  19480. self.handler.send("UnsupportedFeature", {
  19481. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  19482. });
  19483. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  19484. return;
  19485. }
  19486. throw reason;
  19487. }));
  19488. return;
  19489. case _util.OPS.moveTo:
  19490. case _util.OPS.lineTo:
  19491. case _util.OPS.curveTo:
  19492. case _util.OPS.curveTo2:
  19493. case _util.OPS.curveTo3:
  19494. case _util.OPS.closePath:
  19495. case _util.OPS.rectangle:
  19496. self.buildPath(operatorList, fn, args, parsingText);
  19497. continue;
  19498. case _util.OPS.markPoint:
  19499. case _util.OPS.markPointProps:
  19500. case _util.OPS.beginCompat:
  19501. case _util.OPS.endCompat:
  19502. continue;
  19503. case _util.OPS.beginMarkedContentProps:
  19504. if (!(0, _primitives.isName)(args[0])) {
  19505. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  19506. continue;
  19507. }
  19508. if (args[0].name === "OC") {
  19509. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  19510. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  19511. }).catch(reason => {
  19512. if (reason instanceof _util.AbortException) {
  19513. return;
  19514. }
  19515. if (self.options.ignoreErrors) {
  19516. self.handler.send("UnsupportedFeature", {
  19517. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  19518. });
  19519. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  19520. return;
  19521. }
  19522. throw reason;
  19523. }));
  19524. return;
  19525. }
  19526. args = [args[0].name];
  19527. break;
  19528. case _util.OPS.beginMarkedContent:
  19529. case _util.OPS.endMarkedContent:
  19530. default:
  19531. if (args !== null) {
  19532. for (i = 0, ii = args.length; i < ii; i++) {
  19533. if (args[i] instanceof _primitives.Dict) {
  19534. break;
  19535. }
  19536. }
  19537. if (i < ii) {
  19538. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  19539. continue;
  19540. }
  19541. }
  19542. }
  19543. operatorList.addOp(fn, args);
  19544. }
  19545. if (stop) {
  19546. next(deferred);
  19547. return;
  19548. }
  19549. closePendingRestoreOPS();
  19550. resolve();
  19551. }).catch(reason => {
  19552. if (reason instanceof _util.AbortException) {
  19553. return;
  19554. }
  19555. if (this.options.ignoreErrors) {
  19556. this.handler.send("UnsupportedFeature", {
  19557. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  19558. });
  19559. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  19560. closePendingRestoreOPS();
  19561. return;
  19562. }
  19563. throw reason;
  19564. });
  19565. }
  19566. getTextContent({
  19567. stream,
  19568. task,
  19569. resources,
  19570. stateManager = null,
  19571. normalizeWhitespace = false,
  19572. combineTextItems = false,
  19573. sink,
  19574. seenStyles = new Set()
  19575. }) {
  19576. resources = resources || _primitives.Dict.empty;
  19577. stateManager = stateManager || new StateManager(new TextState());
  19578. var WhitespaceRegexp = /\s/g;
  19579. var textContent = {
  19580. items: [],
  19581. styles: Object.create(null)
  19582. };
  19583. var textContentItem = {
  19584. initialized: false,
  19585. str: [],
  19586. width: 0,
  19587. height: 0,
  19588. vertical: false,
  19589. lastAdvanceWidth: 0,
  19590. lastAdvanceHeight: 0,
  19591. textAdvanceScale: 0,
  19592. spaceWidth: 0,
  19593. fakeSpaceMin: Infinity,
  19594. fakeMultiSpaceMin: Infinity,
  19595. fakeMultiSpaceMax: -0,
  19596. textRunBreakAllowed: false,
  19597. transform: null,
  19598. fontName: null
  19599. };
  19600. var SPACE_FACTOR = 0.3;
  19601. var MULTI_SPACE_FACTOR = 1.5;
  19602. var MULTI_SPACE_FACTOR_MAX = 4;
  19603. var self = this;
  19604. var xref = this.xref;
  19605. var xobjs = null;
  19606. const emptyXObjectCache = new _image_utils.LocalImageCache();
  19607. const emptyGStateCache = new _image_utils.LocalGStateCache();
  19608. var preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  19609. var textState;
  19610. function ensureTextContentItem() {
  19611. if (textContentItem.initialized) {
  19612. return textContentItem;
  19613. }
  19614. const font = textState.font,
  19615. loadedName = font.loadedName;
  19616. if (!seenStyles.has(loadedName)) {
  19617. seenStyles.add(loadedName);
  19618. textContent.styles[loadedName] = {
  19619. fontFamily: font.fallbackName,
  19620. ascent: font.ascent,
  19621. descent: font.descent,
  19622. vertical: font.vertical
  19623. };
  19624. }
  19625. textContentItem.fontName = loadedName;
  19626. var tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  19627. if (font.isType3Font && textState.fontSize <= 1 && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  19628. const glyphHeight = font.bbox[3] - font.bbox[1];
  19629. if (glyphHeight > 0) {
  19630. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  19631. }
  19632. }
  19633. var trm = _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  19634. textContentItem.transform = trm;
  19635. if (!font.vertical) {
  19636. textContentItem.width = 0;
  19637. textContentItem.height = Math.hypot(trm[2], trm[3]);
  19638. textContentItem.vertical = false;
  19639. } else {
  19640. textContentItem.width = Math.hypot(trm[0], trm[1]);
  19641. textContentItem.height = 0;
  19642. textContentItem.vertical = true;
  19643. }
  19644. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  19645. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  19646. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  19647. textContentItem.lastAdvanceWidth = 0;
  19648. textContentItem.lastAdvanceHeight = 0;
  19649. var spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  19650. if (spaceWidth) {
  19651. textContentItem.spaceWidth = spaceWidth;
  19652. textContentItem.fakeSpaceMin = spaceWidth * SPACE_FACTOR;
  19653. textContentItem.fakeMultiSpaceMin = spaceWidth * MULTI_SPACE_FACTOR;
  19654. textContentItem.fakeMultiSpaceMax = spaceWidth * MULTI_SPACE_FACTOR_MAX;
  19655. textContentItem.textRunBreakAllowed = !font.isMonospace;
  19656. } else {
  19657. textContentItem.spaceWidth = 0;
  19658. textContentItem.fakeSpaceMin = Infinity;
  19659. textContentItem.fakeMultiSpaceMin = Infinity;
  19660. textContentItem.fakeMultiSpaceMax = 0;
  19661. textContentItem.textRunBreakAllowed = false;
  19662. }
  19663. textContentItem.initialized = true;
  19664. return textContentItem;
  19665. }
  19666. function replaceWhitespace(str) {
  19667. var i = 0,
  19668. ii = str.length,
  19669. code;
  19670. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) {
  19671. i++;
  19672. }
  19673. return i < ii ? str.replace(WhitespaceRegexp, " ") : str;
  19674. }
  19675. function runBidiTransform(textChunk) {
  19676. var str = textChunk.str.join("");
  19677. var bidiResult = (0, _bidi.bidi)(str, -1, textChunk.vertical);
  19678. return {
  19679. str: normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str,
  19680. dir: bidiResult.dir,
  19681. width: textChunk.width,
  19682. height: textChunk.height,
  19683. transform: textChunk.transform,
  19684. fontName: textChunk.fontName
  19685. };
  19686. }
  19687. function handleSetFont(fontName, fontRef) {
  19688. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  19689. textState.font = translated.font;
  19690. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  19691. });
  19692. }
  19693. function buildTextContentItem(chars) {
  19694. var font = textState.font;
  19695. var textChunk = ensureTextContentItem();
  19696. var width = 0;
  19697. var height = 0;
  19698. var glyphs = font.charsToGlyphs(chars);
  19699. for (var i = 0; i < glyphs.length; i++) {
  19700. var glyph = glyphs[i];
  19701. var glyphWidth = null;
  19702. if (font.vertical && glyph.vmetric) {
  19703. glyphWidth = glyph.vmetric[0];
  19704. } else {
  19705. glyphWidth = glyph.width;
  19706. }
  19707. var glyphUnicode = glyph.unicode;
  19708. var NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  19709. if (NormalizedUnicodes[glyphUnicode] !== undefined) {
  19710. glyphUnicode = NormalizedUnicodes[glyphUnicode];
  19711. }
  19712. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  19713. var charSpacing = textState.charSpacing;
  19714. if (glyph.isSpace) {
  19715. var wordSpacing = textState.wordSpacing;
  19716. charSpacing += wordSpacing;
  19717. if (wordSpacing > 0) {
  19718. addFakeSpaces(wordSpacing, textChunk.str);
  19719. }
  19720. }
  19721. var tx = 0;
  19722. var ty = 0;
  19723. if (!font.vertical) {
  19724. var w0 = glyphWidth * textState.fontMatrix[0];
  19725. tx = (w0 * textState.fontSize + charSpacing) * textState.textHScale;
  19726. width += tx;
  19727. } else {
  19728. var w1 = glyphWidth * textState.fontMatrix[0];
  19729. ty = w1 * textState.fontSize + charSpacing;
  19730. height += ty;
  19731. }
  19732. textState.translateTextMatrix(tx, ty);
  19733. textChunk.str.push(glyphUnicode);
  19734. }
  19735. if (!font.vertical) {
  19736. textChunk.lastAdvanceWidth = width;
  19737. textChunk.width += width;
  19738. } else {
  19739. textChunk.lastAdvanceHeight = height;
  19740. textChunk.height += Math.abs(height);
  19741. }
  19742. return textChunk;
  19743. }
  19744. function addFakeSpaces(width, strBuf) {
  19745. if (width < textContentItem.fakeSpaceMin) {
  19746. return;
  19747. }
  19748. if (width < textContentItem.fakeMultiSpaceMin) {
  19749. strBuf.push(" ");
  19750. return;
  19751. }
  19752. var fakeSpaces = Math.round(width / textContentItem.spaceWidth);
  19753. while (fakeSpaces-- > 0) {
  19754. strBuf.push(" ");
  19755. }
  19756. }
  19757. function flushTextContentItem() {
  19758. if (!textContentItem.initialized) {
  19759. return;
  19760. }
  19761. if (!textContentItem.vertical) {
  19762. textContentItem.width *= textContentItem.textAdvanceScale;
  19763. } else {
  19764. textContentItem.height *= textContentItem.textAdvanceScale;
  19765. }
  19766. textContent.items.push(runBidiTransform(textContentItem));
  19767. textContentItem.initialized = false;
  19768. textContentItem.str.length = 0;
  19769. }
  19770. function enqueueChunk() {
  19771. const length = textContent.items.length;
  19772. if (length > 0) {
  19773. sink.enqueue(textContent, length);
  19774. textContent.items = [];
  19775. textContent.styles = Object.create(null);
  19776. }
  19777. }
  19778. var timeSlotManager = new TimeSlotManager();
  19779. return new Promise(function promiseBody(resolve, reject) {
  19780. const next = function (promise) {
  19781. enqueueChunk();
  19782. Promise.all([promise, sink.ready]).then(function () {
  19783. try {
  19784. promiseBody(resolve, reject);
  19785. } catch (ex) {
  19786. reject(ex);
  19787. }
  19788. }, reject);
  19789. };
  19790. task.ensureNotTerminated();
  19791. timeSlotManager.reset();
  19792. var stop,
  19793. operation = {},
  19794. args = [];
  19795. while (!(stop = timeSlotManager.check())) {
  19796. args.length = 0;
  19797. operation.args = args;
  19798. if (!preprocessor.read(operation)) {
  19799. break;
  19800. }
  19801. textState = stateManager.state;
  19802. var fn = operation.fn;
  19803. args = operation.args;
  19804. var advance, diff;
  19805. switch (fn | 0) {
  19806. case _util.OPS.setFont:
  19807. var fontNameArg = args[0].name,
  19808. fontSizeArg = args[1];
  19809. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  19810. break;
  19811. }
  19812. flushTextContentItem();
  19813. textState.fontName = fontNameArg;
  19814. textState.fontSize = fontSizeArg;
  19815. next(handleSetFont(fontNameArg, null));
  19816. return;
  19817. case _util.OPS.setTextRise:
  19818. flushTextContentItem();
  19819. textState.textRise = args[0];
  19820. break;
  19821. case _util.OPS.setHScale:
  19822. flushTextContentItem();
  19823. textState.textHScale = args[0] / 100;
  19824. break;
  19825. case _util.OPS.setLeading:
  19826. flushTextContentItem();
  19827. textState.leading = args[0];
  19828. break;
  19829. case _util.OPS.moveText:
  19830. var isSameTextLine = !textState.font ? false : (textState.font.vertical ? args[0] : args[1]) === 0;
  19831. advance = args[0] - args[1];
  19832. if (combineTextItems && isSameTextLine && textContentItem.initialized && advance > 0 && advance <= textContentItem.fakeMultiSpaceMax) {
  19833. textState.translateTextLineMatrix(args[0], args[1]);
  19834. textContentItem.width += args[0] - textContentItem.lastAdvanceWidth;
  19835. textContentItem.height += args[1] - textContentItem.lastAdvanceHeight;
  19836. diff = args[0] - textContentItem.lastAdvanceWidth - (args[1] - textContentItem.lastAdvanceHeight);
  19837. addFakeSpaces(diff, textContentItem.str);
  19838. break;
  19839. }
  19840. flushTextContentItem();
  19841. textState.translateTextLineMatrix(args[0], args[1]);
  19842. textState.textMatrix = textState.textLineMatrix.slice();
  19843. break;
  19844. case _util.OPS.setLeadingMoveText:
  19845. flushTextContentItem();
  19846. textState.leading = -args[1];
  19847. textState.translateTextLineMatrix(args[0], args[1]);
  19848. textState.textMatrix = textState.textLineMatrix.slice();
  19849. break;
  19850. case _util.OPS.nextLine:
  19851. flushTextContentItem();
  19852. textState.carriageReturn();
  19853. break;
  19854. case _util.OPS.setTextMatrix:
  19855. advance = textState.calcTextLineMatrixAdvance(args[0], args[1], args[2], args[3], args[4], args[5]);
  19856. if (combineTextItems && advance !== null && textContentItem.initialized && advance.value > 0 && advance.value <= textContentItem.fakeMultiSpaceMax) {
  19857. textState.translateTextLineMatrix(advance.width, advance.height);
  19858. textContentItem.width += advance.width - textContentItem.lastAdvanceWidth;
  19859. textContentItem.height += advance.height - textContentItem.lastAdvanceHeight;
  19860. diff = advance.width - textContentItem.lastAdvanceWidth - (advance.height - textContentItem.lastAdvanceHeight);
  19861. addFakeSpaces(diff, textContentItem.str);
  19862. break;
  19863. }
  19864. flushTextContentItem();
  19865. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  19866. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  19867. break;
  19868. case _util.OPS.setCharSpacing:
  19869. textState.charSpacing = args[0];
  19870. break;
  19871. case _util.OPS.setWordSpacing:
  19872. textState.wordSpacing = args[0];
  19873. break;
  19874. case _util.OPS.beginText:
  19875. flushTextContentItem();
  19876. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  19877. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  19878. break;
  19879. case _util.OPS.showSpacedText:
  19880. if (!stateManager.state.font) {
  19881. self.ensureStateFont(stateManager.state);
  19882. continue;
  19883. }
  19884. var items = args[0];
  19885. var offset;
  19886. for (var j = 0, jj = items.length; j < jj; j++) {
  19887. if (typeof items[j] === "string") {
  19888. buildTextContentItem(items[j]);
  19889. } else if ((0, _util.isNum)(items[j])) {
  19890. ensureTextContentItem();
  19891. advance = items[j] * textState.fontSize / 1000;
  19892. var breakTextRun = false;
  19893. if (textState.font.vertical) {
  19894. offset = advance;
  19895. textState.translateTextMatrix(0, offset);
  19896. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  19897. if (!breakTextRun) {
  19898. textContentItem.height += offset;
  19899. }
  19900. } else {
  19901. advance = -advance;
  19902. offset = advance * textState.textHScale;
  19903. textState.translateTextMatrix(offset, 0);
  19904. breakTextRun = textContentItem.textRunBreakAllowed && advance > textContentItem.fakeMultiSpaceMax;
  19905. if (!breakTextRun) {
  19906. textContentItem.width += offset;
  19907. }
  19908. }
  19909. if (breakTextRun) {
  19910. flushTextContentItem();
  19911. } else if (advance > 0) {
  19912. addFakeSpaces(advance, textContentItem.str);
  19913. }
  19914. }
  19915. }
  19916. break;
  19917. case _util.OPS.showText:
  19918. if (!stateManager.state.font) {
  19919. self.ensureStateFont(stateManager.state);
  19920. continue;
  19921. }
  19922. buildTextContentItem(args[0]);
  19923. break;
  19924. case _util.OPS.nextLineShowText:
  19925. if (!stateManager.state.font) {
  19926. self.ensureStateFont(stateManager.state);
  19927. continue;
  19928. }
  19929. flushTextContentItem();
  19930. textState.carriageReturn();
  19931. buildTextContentItem(args[0]);
  19932. break;
  19933. case _util.OPS.nextLineSetSpacingShowText:
  19934. if (!stateManager.state.font) {
  19935. self.ensureStateFont(stateManager.state);
  19936. continue;
  19937. }
  19938. flushTextContentItem();
  19939. textState.wordSpacing = args[0];
  19940. textState.charSpacing = args[1];
  19941. textState.carriageReturn();
  19942. buildTextContentItem(args[2]);
  19943. break;
  19944. case _util.OPS.paintXObject:
  19945. flushTextContentItem();
  19946. if (!xobjs) {
  19947. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  19948. }
  19949. var name = args[0].name;
  19950. if (name && emptyXObjectCache.getByName(name)) {
  19951. break;
  19952. }
  19953. next(new Promise(function (resolveXObject, rejectXObject) {
  19954. if (!name) {
  19955. throw new _util.FormatError("XObject must be referred to by name.");
  19956. }
  19957. let xobj = xobjs.getRaw(name);
  19958. if (xobj instanceof _primitives.Ref) {
  19959. if (emptyXObjectCache.getByRef(xobj)) {
  19960. resolveXObject();
  19961. return;
  19962. }
  19963. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  19964. if (globalImage) {
  19965. resolveXObject();
  19966. return;
  19967. }
  19968. xobj = xref.fetch(xobj);
  19969. }
  19970. if (!(0, _primitives.isStream)(xobj)) {
  19971. throw new _util.FormatError("XObject should be a stream");
  19972. }
  19973. const type = xobj.dict.get("Subtype");
  19974. if (!(0, _primitives.isName)(type)) {
  19975. throw new _util.FormatError("XObject should have a Name subtype");
  19976. }
  19977. if (type.name !== "Form") {
  19978. emptyXObjectCache.set(name, xobj.dict.objId, true);
  19979. resolveXObject();
  19980. return;
  19981. }
  19982. const currentState = stateManager.state.clone();
  19983. const xObjStateManager = new StateManager(currentState);
  19984. const matrix = xobj.dict.getArray("Matrix");
  19985. if (Array.isArray(matrix) && matrix.length === 6) {
  19986. xObjStateManager.transform(matrix);
  19987. }
  19988. enqueueChunk();
  19989. const sinkWrapper = {
  19990. enqueueInvoked: false,
  19991. enqueue(chunk, size) {
  19992. this.enqueueInvoked = true;
  19993. sink.enqueue(chunk, size);
  19994. },
  19995. get desiredSize() {
  19996. return sink.desiredSize;
  19997. },
  19998. get ready() {
  19999. return sink.ready;
  20000. }
  20001. };
  20002. self.getTextContent({
  20003. stream: xobj,
  20004. task,
  20005. resources: xobj.dict.get("Resources") || resources,
  20006. stateManager: xObjStateManager,
  20007. normalizeWhitespace,
  20008. combineTextItems,
  20009. sink: sinkWrapper,
  20010. seenStyles
  20011. }).then(function () {
  20012. if (!sinkWrapper.enqueueInvoked) {
  20013. emptyXObjectCache.set(name, xobj.dict.objId, true);
  20014. }
  20015. resolveXObject();
  20016. }, rejectXObject);
  20017. }).catch(function (reason) {
  20018. if (reason instanceof _util.AbortException) {
  20019. return;
  20020. }
  20021. if (self.options.ignoreErrors) {
  20022. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  20023. return;
  20024. }
  20025. throw reason;
  20026. }));
  20027. return;
  20028. case _util.OPS.setGState:
  20029. name = args[0].name;
  20030. if (name && emptyGStateCache.getByName(name)) {
  20031. break;
  20032. }
  20033. next(new Promise(function (resolveGState, rejectGState) {
  20034. if (!name) {
  20035. throw new _util.FormatError("GState must be referred to by name.");
  20036. }
  20037. const extGState = resources.get("ExtGState");
  20038. if (!(extGState instanceof _primitives.Dict)) {
  20039. throw new _util.FormatError("ExtGState should be a dictionary.");
  20040. }
  20041. const gState = extGState.get(name);
  20042. if (!(gState instanceof _primitives.Dict)) {
  20043. throw new _util.FormatError("GState should be a dictionary.");
  20044. }
  20045. const gStateFont = gState.get("Font");
  20046. if (!gStateFont) {
  20047. emptyGStateCache.set(name, gState.objId, true);
  20048. resolveGState();
  20049. return;
  20050. }
  20051. flushTextContentItem();
  20052. textState.fontName = null;
  20053. textState.fontSize = gStateFont[1];
  20054. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  20055. }).catch(function (reason) {
  20056. if (reason instanceof _util.AbortException) {
  20057. return;
  20058. }
  20059. if (self.options.ignoreErrors) {
  20060. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  20061. return;
  20062. }
  20063. throw reason;
  20064. }));
  20065. return;
  20066. }
  20067. if (textContent.items.length >= sink.desiredSize) {
  20068. stop = true;
  20069. break;
  20070. }
  20071. }
  20072. if (stop) {
  20073. next(deferred);
  20074. return;
  20075. }
  20076. flushTextContentItem();
  20077. enqueueChunk();
  20078. resolve();
  20079. }).catch(reason => {
  20080. if (reason instanceof _util.AbortException) {
  20081. return;
  20082. }
  20083. if (this.options.ignoreErrors) {
  20084. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  20085. flushTextContentItem();
  20086. enqueueChunk();
  20087. return;
  20088. }
  20089. throw reason;
  20090. });
  20091. }
  20092. extractDataStructures(dict, baseDict, properties) {
  20093. const xref = this.xref;
  20094. let cidToGidBytes;
  20095. var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  20096. var toUnicodePromise = toUnicode ? this.readToUnicode(toUnicode) : Promise.resolve(undefined);
  20097. if (properties.composite) {
  20098. var cidSystemInfo = dict.get("CIDSystemInfo");
  20099. if ((0, _primitives.isDict)(cidSystemInfo)) {
  20100. properties.cidSystemInfo = {
  20101. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  20102. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  20103. supplement: cidSystemInfo.get("Supplement")
  20104. };
  20105. }
  20106. var cidToGidMap = dict.get("CIDToGIDMap");
  20107. if ((0, _primitives.isStream)(cidToGidMap)) {
  20108. cidToGidBytes = cidToGidMap.getBytes();
  20109. }
  20110. }
  20111. var differences = [];
  20112. var baseEncodingName = null;
  20113. var encoding;
  20114. if (dict.has("Encoding")) {
  20115. encoding = dict.get("Encoding");
  20116. if ((0, _primitives.isDict)(encoding)) {
  20117. baseEncodingName = encoding.get("BaseEncoding");
  20118. baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
  20119. if (encoding.has("Differences")) {
  20120. var diffEncoding = encoding.get("Differences");
  20121. var index = 0;
  20122. for (var j = 0, jj = diffEncoding.length; j < jj; j++) {
  20123. var data = xref.fetchIfRef(diffEncoding[j]);
  20124. if ((0, _util.isNum)(data)) {
  20125. index = data;
  20126. } else if ((0, _primitives.isName)(data)) {
  20127. differences[index++] = data.name;
  20128. } else {
  20129. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  20130. }
  20131. }
  20132. }
  20133. } else if ((0, _primitives.isName)(encoding)) {
  20134. baseEncodingName = encoding.name;
  20135. } else {
  20136. throw new _util.FormatError("Encoding is not a Name nor a Dict");
  20137. }
  20138. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  20139. baseEncodingName = null;
  20140. }
  20141. }
  20142. if (baseEncodingName) {
  20143. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName).slice();
  20144. } else {
  20145. var isSymbolicFont = !!(properties.flags & _fonts.FontFlags.Symbolic);
  20146. var isNonsymbolicFont = !!(properties.flags & _fonts.FontFlags.Nonsymbolic);
  20147. encoding = _encodings.StandardEncoding;
  20148. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  20149. encoding = _encodings.WinAnsiEncoding;
  20150. }
  20151. if (isSymbolicFont) {
  20152. encoding = _encodings.MacRomanEncoding;
  20153. if (!properties.file) {
  20154. if (/Symbol/i.test(properties.name)) {
  20155. encoding = _encodings.SymbolSetEncoding;
  20156. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  20157. encoding = _encodings.ZapfDingbatsEncoding;
  20158. }
  20159. }
  20160. }
  20161. properties.defaultEncoding = encoding;
  20162. }
  20163. properties.differences = differences;
  20164. properties.baseEncodingName = baseEncodingName;
  20165. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  20166. properties.dict = dict;
  20167. return toUnicodePromise.then(readToUnicode => {
  20168. properties.toUnicode = readToUnicode;
  20169. return this.buildToUnicode(properties);
  20170. }).then(builtToUnicode => {
  20171. properties.toUnicode = builtToUnicode;
  20172. if (cidToGidBytes) {
  20173. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  20174. }
  20175. return properties;
  20176. });
  20177. }
  20178. _buildSimpleFontToUnicode(properties, forceGlyphs = false) {
  20179. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  20180. const toUnicode = [];
  20181. const encoding = properties.defaultEncoding.slice();
  20182. const baseEncodingName = properties.baseEncodingName;
  20183. const differences = properties.differences;
  20184. for (const charcode in differences) {
  20185. const glyphName = differences[charcode];
  20186. if (glyphName === ".notdef") {
  20187. continue;
  20188. }
  20189. encoding[charcode] = glyphName;
  20190. }
  20191. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  20192. for (const charcode in encoding) {
  20193. let glyphName = encoding[charcode];
  20194. if (glyphName === "") {
  20195. continue;
  20196. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  20197. let code = 0;
  20198. switch (glyphName[0]) {
  20199. case "G":
  20200. if (glyphName.length === 3) {
  20201. code = parseInt(glyphName.substring(1), 16);
  20202. }
  20203. break;
  20204. case "g":
  20205. if (glyphName.length === 5) {
  20206. code = parseInt(glyphName.substring(1), 16);
  20207. }
  20208. break;
  20209. case "C":
  20210. case "c":
  20211. if (glyphName.length >= 3 && glyphName.length <= 4) {
  20212. const codeStr = glyphName.substring(1);
  20213. if (forceGlyphs) {
  20214. code = parseInt(codeStr, 16);
  20215. break;
  20216. }
  20217. code = +codeStr;
  20218. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  20219. return this._buildSimpleFontToUnicode(properties, true);
  20220. }
  20221. }
  20222. break;
  20223. default:
  20224. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  20225. if (unicode !== -1) {
  20226. code = unicode;
  20227. }
  20228. }
  20229. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  20230. if (baseEncodingName && code === +charcode) {
  20231. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  20232. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  20233. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  20234. continue;
  20235. }
  20236. }
  20237. toUnicode[charcode] = String.fromCodePoint(code);
  20238. }
  20239. continue;
  20240. }
  20241. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  20242. }
  20243. return new _fonts.ToUnicodeMap(toUnicode);
  20244. }
  20245. buildToUnicode(properties) {
  20246. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  20247. if (properties.hasIncludedToUnicodeMap) {
  20248. if (!properties.composite && properties.hasEncoding) {
  20249. properties.fallbackToUnicode = this._buildSimpleFontToUnicode(properties);
  20250. }
  20251. return Promise.resolve(properties.toUnicode);
  20252. }
  20253. if (!properties.composite) {
  20254. return Promise.resolve(this._buildSimpleFontToUnicode(properties));
  20255. }
  20256. 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"))) {
  20257. const registry = properties.cidSystemInfo.registry;
  20258. const ordering = properties.cidSystemInfo.ordering;
  20259. const ucs2CMapName = _primitives.Name.get(registry + "-" + ordering + "-UCS2");
  20260. return _cmap.CMapFactory.create({
  20261. encoding: ucs2CMapName,
  20262. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  20263. useCMap: null
  20264. }).then(function (ucs2CMap) {
  20265. const cMap = properties.cMap;
  20266. const toUnicode = [];
  20267. cMap.forEach(function (charcode, cid) {
  20268. if (cid > 0xffff) {
  20269. throw new _util.FormatError("Max size of CID is 65,535");
  20270. }
  20271. const ucs2 = ucs2CMap.lookup(cid);
  20272. if (ucs2) {
  20273. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  20274. }
  20275. });
  20276. return new _fonts.ToUnicodeMap(toUnicode);
  20277. });
  20278. }
  20279. return Promise.resolve(new _fonts.IdentityToUnicodeMap(properties.firstChar, properties.lastChar));
  20280. }
  20281. readToUnicode(toUnicode) {
  20282. var cmapObj = toUnicode;
  20283. if ((0, _primitives.isName)(cmapObj)) {
  20284. return _cmap.CMapFactory.create({
  20285. encoding: cmapObj,
  20286. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  20287. useCMap: null
  20288. }).then(function (cmap) {
  20289. if (cmap instanceof _cmap.IdentityCMap) {
  20290. return new _fonts.IdentityToUnicodeMap(0, 0xffff);
  20291. }
  20292. return new _fonts.ToUnicodeMap(cmap.getMap());
  20293. });
  20294. } else if ((0, _primitives.isStream)(cmapObj)) {
  20295. return _cmap.CMapFactory.create({
  20296. encoding: cmapObj,
  20297. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  20298. useCMap: null
  20299. }).then(function (cmap) {
  20300. if (cmap instanceof _cmap.IdentityCMap) {
  20301. return new _fonts.IdentityToUnicodeMap(0, 0xffff);
  20302. }
  20303. var map = new Array(cmap.length);
  20304. cmap.forEach(function (charCode, token) {
  20305. var str = [];
  20306. for (var k = 0; k < token.length; k += 2) {
  20307. var w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  20308. if ((w1 & 0xf800) !== 0xd800) {
  20309. str.push(w1);
  20310. continue;
  20311. }
  20312. k += 2;
  20313. var w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  20314. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  20315. }
  20316. map[charCode] = String.fromCodePoint.apply(String, str);
  20317. });
  20318. return new _fonts.ToUnicodeMap(map);
  20319. }, reason => {
  20320. if (reason instanceof _util.AbortException) {
  20321. return null;
  20322. }
  20323. if (this.options.ignoreErrors) {
  20324. this.handler.send("UnsupportedFeature", {
  20325. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  20326. });
  20327. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  20328. return null;
  20329. }
  20330. throw reason;
  20331. });
  20332. }
  20333. return Promise.resolve(null);
  20334. }
  20335. readCidToGidMap(glyphsData, toUnicode) {
  20336. var result = [];
  20337. for (var j = 0, jj = glyphsData.length; j < jj; j++) {
  20338. var glyphID = glyphsData[j++] << 8 | glyphsData[j];
  20339. const code = j >> 1;
  20340. if (glyphID === 0 && !toUnicode.has(code)) {
  20341. continue;
  20342. }
  20343. result[code] = glyphID;
  20344. }
  20345. return result;
  20346. }
  20347. extractWidths(dict, descriptor, properties) {
  20348. var xref = this.xref;
  20349. var glyphsWidths = [];
  20350. var defaultWidth = 0;
  20351. var glyphsVMetrics = [];
  20352. var defaultVMetrics;
  20353. var i, ii, j, jj, start, code, widths;
  20354. if (properties.composite) {
  20355. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  20356. widths = dict.get("W");
  20357. if (widths) {
  20358. for (i = 0, ii = widths.length; i < ii; i++) {
  20359. start = xref.fetchIfRef(widths[i++]);
  20360. code = xref.fetchIfRef(widths[i]);
  20361. if (Array.isArray(code)) {
  20362. for (j = 0, jj = code.length; j < jj; j++) {
  20363. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  20364. }
  20365. } else {
  20366. var width = xref.fetchIfRef(widths[++i]);
  20367. for (j = start; j <= code; j++) {
  20368. glyphsWidths[j] = width;
  20369. }
  20370. }
  20371. }
  20372. }
  20373. if (properties.vertical) {
  20374. var vmetrics = dict.getArray("DW2") || [880, -1000];
  20375. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  20376. vmetrics = dict.get("W2");
  20377. if (vmetrics) {
  20378. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  20379. start = xref.fetchIfRef(vmetrics[i++]);
  20380. code = xref.fetchIfRef(vmetrics[i]);
  20381. if (Array.isArray(code)) {
  20382. for (j = 0, jj = code.length; j < jj; j++) {
  20383. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  20384. }
  20385. } else {
  20386. var vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  20387. for (j = start; j <= code; j++) {
  20388. glyphsVMetrics[j] = vmetric;
  20389. }
  20390. }
  20391. }
  20392. }
  20393. }
  20394. } else {
  20395. var firstChar = properties.firstChar;
  20396. widths = dict.get("Widths");
  20397. if (widths) {
  20398. j = firstChar;
  20399. for (i = 0, ii = widths.length; i < ii; i++) {
  20400. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  20401. }
  20402. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  20403. } else {
  20404. var baseFontName = dict.get("BaseFont");
  20405. if ((0, _primitives.isName)(baseFontName)) {
  20406. var metrics = this.getBaseFontMetrics(baseFontName.name);
  20407. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  20408. defaultWidth = metrics.defaultWidth;
  20409. }
  20410. }
  20411. }
  20412. var isMonospace = true;
  20413. var firstWidth = defaultWidth;
  20414. for (var glyph in glyphsWidths) {
  20415. var glyphWidth = glyphsWidths[glyph];
  20416. if (!glyphWidth) {
  20417. continue;
  20418. }
  20419. if (!firstWidth) {
  20420. firstWidth = glyphWidth;
  20421. continue;
  20422. }
  20423. if (firstWidth !== glyphWidth) {
  20424. isMonospace = false;
  20425. break;
  20426. }
  20427. }
  20428. if (isMonospace) {
  20429. properties.flags |= _fonts.FontFlags.FixedPitch;
  20430. }
  20431. properties.defaultWidth = defaultWidth;
  20432. properties.widths = glyphsWidths;
  20433. properties.defaultVMetrics = defaultVMetrics;
  20434. properties.vmetrics = glyphsVMetrics;
  20435. }
  20436. isSerifFont(baseFontName) {
  20437. var fontNameWoStyle = baseFontName.split("-")[0];
  20438. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  20439. }
  20440. getBaseFontMetrics(name) {
  20441. var defaultWidth = 0;
  20442. var widths = Object.create(null);
  20443. var monospace = false;
  20444. var stdFontMap = (0, _standard_fonts.getStdFontMap)();
  20445. var lookupName = stdFontMap[name] || name;
  20446. var Metrics = (0, _metrics.getMetrics)();
  20447. if (!(lookupName in Metrics)) {
  20448. if (this.isSerifFont(name)) {
  20449. lookupName = "Times-Roman";
  20450. } else {
  20451. lookupName = "Helvetica";
  20452. }
  20453. }
  20454. var glyphWidths = Metrics[lookupName];
  20455. if ((0, _util.isNum)(glyphWidths)) {
  20456. defaultWidth = glyphWidths;
  20457. monospace = true;
  20458. } else {
  20459. widths = glyphWidths();
  20460. }
  20461. return {
  20462. defaultWidth,
  20463. monospace,
  20464. widths
  20465. };
  20466. }
  20467. buildCharCodeToWidth(widthsByGlyphName, properties) {
  20468. var widths = Object.create(null);
  20469. var differences = properties.differences;
  20470. var encoding = properties.defaultEncoding;
  20471. for (var charCode = 0; charCode < 256; charCode++) {
  20472. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  20473. widths[charCode] = widthsByGlyphName[differences[charCode]];
  20474. continue;
  20475. }
  20476. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  20477. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  20478. continue;
  20479. }
  20480. }
  20481. return widths;
  20482. }
  20483. preEvaluateFont(dict) {
  20484. var baseDict = dict;
  20485. var type = dict.get("Subtype");
  20486. if (!(0, _primitives.isName)(type)) {
  20487. throw new _util.FormatError("invalid font Subtype");
  20488. }
  20489. var composite = false;
  20490. var uint8array;
  20491. if (type.name === "Type0") {
  20492. var df = dict.get("DescendantFonts");
  20493. if (!df) {
  20494. throw new _util.FormatError("Descendant fonts are not specified");
  20495. }
  20496. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  20497. if (!(dict instanceof _primitives.Dict)) {
  20498. throw new _util.FormatError("Descendant font is not a dictionary.");
  20499. }
  20500. type = dict.get("Subtype");
  20501. if (!(0, _primitives.isName)(type)) {
  20502. throw new _util.FormatError("invalid font Subtype");
  20503. }
  20504. composite = true;
  20505. }
  20506. var descriptor = dict.get("FontDescriptor");
  20507. if (descriptor) {
  20508. var hash = new _murmurhash.MurmurHash3_64();
  20509. var encoding = baseDict.getRaw("Encoding");
  20510. if ((0, _primitives.isName)(encoding)) {
  20511. hash.update(encoding.name);
  20512. } else if ((0, _primitives.isRef)(encoding)) {
  20513. hash.update(encoding.toString());
  20514. } else if ((0, _primitives.isDict)(encoding)) {
  20515. for (const entry of encoding.getRawValues()) {
  20516. if ((0, _primitives.isName)(entry)) {
  20517. hash.update(entry.name);
  20518. } else if ((0, _primitives.isRef)(entry)) {
  20519. hash.update(entry.toString());
  20520. } else if (Array.isArray(entry)) {
  20521. var diffLength = entry.length,
  20522. diffBuf = new Array(diffLength);
  20523. for (var j = 0; j < diffLength; j++) {
  20524. var diffEntry = entry[j];
  20525. if ((0, _primitives.isName)(diffEntry)) {
  20526. diffBuf[j] = diffEntry.name;
  20527. } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
  20528. diffBuf[j] = diffEntry.toString();
  20529. }
  20530. }
  20531. hash.update(diffBuf.join());
  20532. }
  20533. }
  20534. }
  20535. const firstChar = dict.get("FirstChar") || 0;
  20536. const lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  20537. hash.update(`${firstChar}-${lastChar}`);
  20538. var toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  20539. if ((0, _primitives.isStream)(toUnicode)) {
  20540. var stream = toUnicode.str || toUnicode;
  20541. uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  20542. hash.update(uint8array);
  20543. } else if ((0, _primitives.isName)(toUnicode)) {
  20544. hash.update(toUnicode.name);
  20545. }
  20546. var widths = dict.get("Widths") || baseDict.get("Widths");
  20547. if (widths) {
  20548. uint8array = new Uint8Array(new Uint32Array(widths).buffer);
  20549. hash.update(uint8array);
  20550. }
  20551. }
  20552. return {
  20553. descriptor,
  20554. dict,
  20555. baseDict,
  20556. composite,
  20557. type: type.name,
  20558. hash: hash ? hash.hexdigest() : ""
  20559. };
  20560. }
  20561. async translateFont(preEvaluatedFont) {
  20562. var baseDict = preEvaluatedFont.baseDict;
  20563. var dict = preEvaluatedFont.dict;
  20564. var composite = preEvaluatedFont.composite;
  20565. var descriptor = preEvaluatedFont.descriptor;
  20566. var type = preEvaluatedFont.type;
  20567. var maxCharIndex = composite ? 0xffff : 0xff;
  20568. var properties;
  20569. const firstChar = dict.get("FirstChar") || 0;
  20570. const lastChar = dict.get("LastChar") || maxCharIndex;
  20571. if (!descriptor) {
  20572. if (type === "Type3") {
  20573. descriptor = new _primitives.Dict(null);
  20574. descriptor.set("FontName", _primitives.Name.get(type));
  20575. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  20576. } else {
  20577. var baseFontName = dict.get("BaseFont");
  20578. if (!(0, _primitives.isName)(baseFontName)) {
  20579. throw new _util.FormatError("Base font is not specified");
  20580. }
  20581. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  20582. var metrics = this.getBaseFontMetrics(baseFontName);
  20583. var fontNameWoStyle = baseFontName.split("-")[0];
  20584. 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);
  20585. properties = {
  20586. type,
  20587. name: baseFontName,
  20588. widths: metrics.widths,
  20589. defaultWidth: metrics.defaultWidth,
  20590. flags,
  20591. firstChar,
  20592. lastChar
  20593. };
  20594. const widths = dict.get("Widths");
  20595. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  20596. if (widths) {
  20597. const glyphWidths = [];
  20598. let j = firstChar;
  20599. for (let i = 0, ii = widths.length; i < ii; i++) {
  20600. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  20601. }
  20602. newProperties.widths = glyphWidths;
  20603. } else {
  20604. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  20605. }
  20606. return new _fonts.Font(baseFontName, null, newProperties);
  20607. });
  20608. }
  20609. }
  20610. var fontName = descriptor.get("FontName");
  20611. var baseFont = dict.get("BaseFont");
  20612. if ((0, _util.isString)(fontName)) {
  20613. fontName = _primitives.Name.get(fontName);
  20614. }
  20615. if ((0, _util.isString)(baseFont)) {
  20616. baseFont = _primitives.Name.get(baseFont);
  20617. }
  20618. if (type !== "Type3") {
  20619. var fontNameStr = fontName && fontName.name;
  20620. var baseFontStr = baseFont && baseFont.name;
  20621. if (fontNameStr !== baseFontStr) {
  20622. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  20623. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  20624. fontName = baseFont;
  20625. }
  20626. }
  20627. }
  20628. fontName = fontName || baseFont;
  20629. if (!(0, _primitives.isName)(fontName)) {
  20630. throw new _util.FormatError("invalid font name");
  20631. }
  20632. let fontFile;
  20633. try {
  20634. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  20635. } catch (ex) {
  20636. if (!this.options.ignoreErrors) {
  20637. throw ex;
  20638. }
  20639. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  20640. fontFile = new _stream.NullStream();
  20641. }
  20642. if (fontFile) {
  20643. if (fontFile.dict) {
  20644. var subtype = fontFile.dict.get("Subtype");
  20645. if (subtype) {
  20646. subtype = subtype.name;
  20647. }
  20648. var length1 = fontFile.dict.get("Length1");
  20649. var length2 = fontFile.dict.get("Length2");
  20650. var length3 = fontFile.dict.get("Length3");
  20651. }
  20652. }
  20653. properties = {
  20654. type,
  20655. name: fontName.name,
  20656. subtype,
  20657. file: fontFile,
  20658. length1,
  20659. length2,
  20660. length3,
  20661. loadedName: baseDict.loadedName,
  20662. composite,
  20663. fixedPitch: false,
  20664. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  20665. firstChar: firstChar || 0,
  20666. lastChar: lastChar || maxCharIndex,
  20667. bbox: descriptor.getArray("FontBBox"),
  20668. ascent: descriptor.get("Ascent"),
  20669. descent: descriptor.get("Descent"),
  20670. xHeight: descriptor.get("XHeight"),
  20671. capHeight: descriptor.get("CapHeight"),
  20672. flags: descriptor.get("Flags"),
  20673. italicAngle: descriptor.get("ItalicAngle"),
  20674. isType3Font: false
  20675. };
  20676. if (composite) {
  20677. const cidEncoding = baseDict.get("Encoding");
  20678. if ((0, _primitives.isName)(cidEncoding)) {
  20679. properties.cidEncoding = cidEncoding.name;
  20680. }
  20681. const cMap = await _cmap.CMapFactory.create({
  20682. encoding: cidEncoding,
  20683. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  20684. useCMap: null
  20685. });
  20686. properties.cMap = cMap;
  20687. properties.vertical = properties.cMap.vertical;
  20688. }
  20689. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  20690. this.extractWidths(dict, descriptor, newProperties);
  20691. if (type === "Type3") {
  20692. newProperties.isType3Font = true;
  20693. }
  20694. return new _fonts.Font(fontName.name, fontFile, newProperties);
  20695. });
  20696. }
  20697. static buildFontPaths(font, glyphs, handler) {
  20698. function buildPath(fontChar) {
  20699. if (font.renderer.hasBuiltPath(fontChar)) {
  20700. return;
  20701. }
  20702. handler.send("commonobj", [`${font.loadedName}_path_${fontChar}`, "FontPath", font.renderer.getPathJs(fontChar)]);
  20703. }
  20704. for (const glyph of glyphs) {
  20705. buildPath(glyph.fontChar);
  20706. const accent = glyph.accent;
  20707. if (accent && accent.fontChar) {
  20708. buildPath(accent.fontChar);
  20709. }
  20710. }
  20711. }
  20712. static get fallbackFontDict() {
  20713. const dict = new _primitives.Dict();
  20714. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  20715. dict.set("Type", _primitives.Name.get("FallbackType"));
  20716. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  20717. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  20718. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  20719. }
  20720. }
  20721. exports.PartialEvaluator = PartialEvaluator;
  20722. class TranslatedFont {
  20723. constructor({
  20724. loadedName,
  20725. font,
  20726. dict,
  20727. extraProperties = false
  20728. }) {
  20729. this.loadedName = loadedName;
  20730. this.font = font;
  20731. this.dict = dict;
  20732. this._extraProperties = extraProperties;
  20733. this.type3Loaded = null;
  20734. this.type3Dependencies = font.isType3Font ? new Set() : null;
  20735. this.sent = false;
  20736. }
  20737. send(handler) {
  20738. if (this.sent) {
  20739. return;
  20740. }
  20741. this.sent = true;
  20742. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._extraProperties)]);
  20743. }
  20744. fallback(handler) {
  20745. if (!this.font.data) {
  20746. return;
  20747. }
  20748. this.font.disableFontFace = true;
  20749. const glyphs = this.font.glyphCacheValues;
  20750. PartialEvaluator.buildFontPaths(this.font, glyphs, handler);
  20751. }
  20752. loadType3Data(evaluator, resources, task) {
  20753. if (this.type3Loaded) {
  20754. return this.type3Loaded;
  20755. }
  20756. if (!this.font.isType3Font) {
  20757. throw new Error("Must be a Type3 font.");
  20758. }
  20759. var type3Options = Object.create(evaluator.options);
  20760. type3Options.ignoreErrors = false;
  20761. var type3Evaluator = evaluator.clone(type3Options);
  20762. type3Evaluator.parsingType3Font = true;
  20763. const translatedFont = this.font,
  20764. type3Dependencies = this.type3Dependencies;
  20765. var loadCharProcsPromise = Promise.resolve();
  20766. var charProcs = this.dict.get("CharProcs");
  20767. var fontResources = this.dict.get("Resources") || resources;
  20768. var charProcOperatorList = Object.create(null);
  20769. for (const key of charProcs.getKeys()) {
  20770. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  20771. var glyphStream = charProcs.get(key);
  20772. var operatorList = new _operator_list.OperatorList();
  20773. return type3Evaluator.getOperatorList({
  20774. stream: glyphStream,
  20775. task,
  20776. resources: fontResources,
  20777. operatorList
  20778. }).then(() => {
  20779. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  20780. this._removeType3ColorOperators(operatorList);
  20781. }
  20782. charProcOperatorList[key] = operatorList.getIR();
  20783. for (const dependency of operatorList.dependencies) {
  20784. type3Dependencies.add(dependency);
  20785. }
  20786. }).catch(function (reason) {
  20787. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  20788. const dummyOperatorList = new _operator_list.OperatorList();
  20789. charProcOperatorList[key] = dummyOperatorList.getIR();
  20790. });
  20791. });
  20792. }
  20793. this.type3Loaded = loadCharProcsPromise.then(function () {
  20794. translatedFont.charProcOperatorList = charProcOperatorList;
  20795. });
  20796. return this.type3Loaded;
  20797. }
  20798. _removeType3ColorOperators(operatorList) {
  20799. let i = 1,
  20800. ii = operatorList.length;
  20801. while (i < ii) {
  20802. switch (operatorList.fnArray[i]) {
  20803. case _util.OPS.setStrokeColorSpace:
  20804. case _util.OPS.setFillColorSpace:
  20805. case _util.OPS.setStrokeColor:
  20806. case _util.OPS.setStrokeColorN:
  20807. case _util.OPS.setFillColor:
  20808. case _util.OPS.setFillColorN:
  20809. case _util.OPS.setStrokeGray:
  20810. case _util.OPS.setFillGray:
  20811. case _util.OPS.setStrokeRGBColor:
  20812. case _util.OPS.setFillRGBColor:
  20813. case _util.OPS.setStrokeCMYKColor:
  20814. case _util.OPS.setFillCMYKColor:
  20815. case _util.OPS.shadingFill:
  20816. case _util.OPS.setRenderingIntent:
  20817. operatorList.fnArray.splice(i, 1);
  20818. operatorList.argsArray.splice(i, 1);
  20819. ii--;
  20820. continue;
  20821. case _util.OPS.setGState:
  20822. const [gStateObj] = operatorList.argsArray[i];
  20823. let j = 0,
  20824. jj = gStateObj.length;
  20825. while (j < jj) {
  20826. const [gStateKey] = gStateObj[j];
  20827. switch (gStateKey) {
  20828. case "TR":
  20829. case "TR2":
  20830. case "HT":
  20831. case "BG":
  20832. case "BG2":
  20833. case "UCR":
  20834. case "UCR2":
  20835. gStateObj.splice(j, 1);
  20836. jj--;
  20837. continue;
  20838. }
  20839. j++;
  20840. }
  20841. break;
  20842. }
  20843. i++;
  20844. }
  20845. }
  20846. }
  20847. class StateManager {
  20848. constructor(initialState = new EvalState()) {
  20849. this.state = initialState;
  20850. this.stateStack = [];
  20851. }
  20852. save() {
  20853. var old = this.state;
  20854. this.stateStack.push(this.state);
  20855. this.state = old.clone();
  20856. }
  20857. restore() {
  20858. var prev = this.stateStack.pop();
  20859. if (prev) {
  20860. this.state = prev;
  20861. }
  20862. }
  20863. transform(args) {
  20864. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  20865. }
  20866. }
  20867. class TextState {
  20868. constructor() {
  20869. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  20870. this.fontName = null;
  20871. this.fontSize = 0;
  20872. this.font = null;
  20873. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  20874. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  20875. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  20876. this.charSpacing = 0;
  20877. this.wordSpacing = 0;
  20878. this.leading = 0;
  20879. this.textHScale = 1;
  20880. this.textRise = 0;
  20881. }
  20882. setTextMatrix(a, b, c, d, e, f) {
  20883. var m = this.textMatrix;
  20884. m[0] = a;
  20885. m[1] = b;
  20886. m[2] = c;
  20887. m[3] = d;
  20888. m[4] = e;
  20889. m[5] = f;
  20890. }
  20891. setTextLineMatrix(a, b, c, d, e, f) {
  20892. var m = this.textLineMatrix;
  20893. m[0] = a;
  20894. m[1] = b;
  20895. m[2] = c;
  20896. m[3] = d;
  20897. m[4] = e;
  20898. m[5] = f;
  20899. }
  20900. translateTextMatrix(x, y) {
  20901. var m = this.textMatrix;
  20902. m[4] = m[0] * x + m[2] * y + m[4];
  20903. m[5] = m[1] * x + m[3] * y + m[5];
  20904. }
  20905. translateTextLineMatrix(x, y) {
  20906. var m = this.textLineMatrix;
  20907. m[4] = m[0] * x + m[2] * y + m[4];
  20908. m[5] = m[1] * x + m[3] * y + m[5];
  20909. }
  20910. calcTextLineMatrixAdvance(a, b, c, d, e, f) {
  20911. var font = this.font;
  20912. if (!font) {
  20913. return null;
  20914. }
  20915. var m = this.textLineMatrix;
  20916. if (!(a === m[0] && b === m[1] && c === m[2] && d === m[3])) {
  20917. return null;
  20918. }
  20919. var txDiff = e - m[4],
  20920. tyDiff = f - m[5];
  20921. if (font.vertical && txDiff !== 0 || !font.vertical && tyDiff !== 0) {
  20922. return null;
  20923. }
  20924. var tx,
  20925. ty,
  20926. denominator = a * d - b * c;
  20927. if (font.vertical) {
  20928. tx = -tyDiff * c / denominator;
  20929. ty = tyDiff * a / denominator;
  20930. } else {
  20931. tx = txDiff * d / denominator;
  20932. ty = -txDiff * b / denominator;
  20933. }
  20934. return {
  20935. width: tx,
  20936. height: ty,
  20937. value: font.vertical ? ty : tx
  20938. };
  20939. }
  20940. calcRenderMatrix(ctm) {
  20941. var tsm = [this.fontSize * this.textHScale, 0, 0, this.fontSize, 0, this.textRise];
  20942. return _util.Util.transform(ctm, _util.Util.transform(this.textMatrix, tsm));
  20943. }
  20944. carriageReturn() {
  20945. this.translateTextLineMatrix(0, -this.leading);
  20946. this.textMatrix = this.textLineMatrix.slice();
  20947. }
  20948. clone() {
  20949. var clone = Object.create(this);
  20950. clone.textMatrix = this.textMatrix.slice();
  20951. clone.textLineMatrix = this.textLineMatrix.slice();
  20952. clone.fontMatrix = this.fontMatrix.slice();
  20953. return clone;
  20954. }
  20955. }
  20956. class EvalState {
  20957. constructor() {
  20958. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  20959. this.font = null;
  20960. this.textRenderingMode = _util.TextRenderingMode.FILL;
  20961. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  20962. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  20963. }
  20964. clone() {
  20965. return Object.create(this);
  20966. }
  20967. }
  20968. class EvaluatorPreprocessor {
  20969. static get opMap() {
  20970. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  20971. t.w = {
  20972. id: _util.OPS.setLineWidth,
  20973. numArgs: 1,
  20974. variableArgs: false
  20975. };
  20976. t.J = {
  20977. id: _util.OPS.setLineCap,
  20978. numArgs: 1,
  20979. variableArgs: false
  20980. };
  20981. t.j = {
  20982. id: _util.OPS.setLineJoin,
  20983. numArgs: 1,
  20984. variableArgs: false
  20985. };
  20986. t.M = {
  20987. id: _util.OPS.setMiterLimit,
  20988. numArgs: 1,
  20989. variableArgs: false
  20990. };
  20991. t.d = {
  20992. id: _util.OPS.setDash,
  20993. numArgs: 2,
  20994. variableArgs: false
  20995. };
  20996. t.ri = {
  20997. id: _util.OPS.setRenderingIntent,
  20998. numArgs: 1,
  20999. variableArgs: false
  21000. };
  21001. t.i = {
  21002. id: _util.OPS.setFlatness,
  21003. numArgs: 1,
  21004. variableArgs: false
  21005. };
  21006. t.gs = {
  21007. id: _util.OPS.setGState,
  21008. numArgs: 1,
  21009. variableArgs: false
  21010. };
  21011. t.q = {
  21012. id: _util.OPS.save,
  21013. numArgs: 0,
  21014. variableArgs: false
  21015. };
  21016. t.Q = {
  21017. id: _util.OPS.restore,
  21018. numArgs: 0,
  21019. variableArgs: false
  21020. };
  21021. t.cm = {
  21022. id: _util.OPS.transform,
  21023. numArgs: 6,
  21024. variableArgs: false
  21025. };
  21026. t.m = {
  21027. id: _util.OPS.moveTo,
  21028. numArgs: 2,
  21029. variableArgs: false
  21030. };
  21031. t.l = {
  21032. id: _util.OPS.lineTo,
  21033. numArgs: 2,
  21034. variableArgs: false
  21035. };
  21036. t.c = {
  21037. id: _util.OPS.curveTo,
  21038. numArgs: 6,
  21039. variableArgs: false
  21040. };
  21041. t.v = {
  21042. id: _util.OPS.curveTo2,
  21043. numArgs: 4,
  21044. variableArgs: false
  21045. };
  21046. t.y = {
  21047. id: _util.OPS.curveTo3,
  21048. numArgs: 4,
  21049. variableArgs: false
  21050. };
  21051. t.h = {
  21052. id: _util.OPS.closePath,
  21053. numArgs: 0,
  21054. variableArgs: false
  21055. };
  21056. t.re = {
  21057. id: _util.OPS.rectangle,
  21058. numArgs: 4,
  21059. variableArgs: false
  21060. };
  21061. t.S = {
  21062. id: _util.OPS.stroke,
  21063. numArgs: 0,
  21064. variableArgs: false
  21065. };
  21066. t.s = {
  21067. id: _util.OPS.closeStroke,
  21068. numArgs: 0,
  21069. variableArgs: false
  21070. };
  21071. t.f = {
  21072. id: _util.OPS.fill,
  21073. numArgs: 0,
  21074. variableArgs: false
  21075. };
  21076. t.F = {
  21077. id: _util.OPS.fill,
  21078. numArgs: 0,
  21079. variableArgs: false
  21080. };
  21081. t["f*"] = {
  21082. id: _util.OPS.eoFill,
  21083. numArgs: 0,
  21084. variableArgs: false
  21085. };
  21086. t.B = {
  21087. id: _util.OPS.fillStroke,
  21088. numArgs: 0,
  21089. variableArgs: false
  21090. };
  21091. t["B*"] = {
  21092. id: _util.OPS.eoFillStroke,
  21093. numArgs: 0,
  21094. variableArgs: false
  21095. };
  21096. t.b = {
  21097. id: _util.OPS.closeFillStroke,
  21098. numArgs: 0,
  21099. variableArgs: false
  21100. };
  21101. t["b*"] = {
  21102. id: _util.OPS.closeEOFillStroke,
  21103. numArgs: 0,
  21104. variableArgs: false
  21105. };
  21106. t.n = {
  21107. id: _util.OPS.endPath,
  21108. numArgs: 0,
  21109. variableArgs: false
  21110. };
  21111. t.W = {
  21112. id: _util.OPS.clip,
  21113. numArgs: 0,
  21114. variableArgs: false
  21115. };
  21116. t["W*"] = {
  21117. id: _util.OPS.eoClip,
  21118. numArgs: 0,
  21119. variableArgs: false
  21120. };
  21121. t.BT = {
  21122. id: _util.OPS.beginText,
  21123. numArgs: 0,
  21124. variableArgs: false
  21125. };
  21126. t.ET = {
  21127. id: _util.OPS.endText,
  21128. numArgs: 0,
  21129. variableArgs: false
  21130. };
  21131. t.Tc = {
  21132. id: _util.OPS.setCharSpacing,
  21133. numArgs: 1,
  21134. variableArgs: false
  21135. };
  21136. t.Tw = {
  21137. id: _util.OPS.setWordSpacing,
  21138. numArgs: 1,
  21139. variableArgs: false
  21140. };
  21141. t.Tz = {
  21142. id: _util.OPS.setHScale,
  21143. numArgs: 1,
  21144. variableArgs: false
  21145. };
  21146. t.TL = {
  21147. id: _util.OPS.setLeading,
  21148. numArgs: 1,
  21149. variableArgs: false
  21150. };
  21151. t.Tf = {
  21152. id: _util.OPS.setFont,
  21153. numArgs: 2,
  21154. variableArgs: false
  21155. };
  21156. t.Tr = {
  21157. id: _util.OPS.setTextRenderingMode,
  21158. numArgs: 1,
  21159. variableArgs: false
  21160. };
  21161. t.Ts = {
  21162. id: _util.OPS.setTextRise,
  21163. numArgs: 1,
  21164. variableArgs: false
  21165. };
  21166. t.Td = {
  21167. id: _util.OPS.moveText,
  21168. numArgs: 2,
  21169. variableArgs: false
  21170. };
  21171. t.TD = {
  21172. id: _util.OPS.setLeadingMoveText,
  21173. numArgs: 2,
  21174. variableArgs: false
  21175. };
  21176. t.Tm = {
  21177. id: _util.OPS.setTextMatrix,
  21178. numArgs: 6,
  21179. variableArgs: false
  21180. };
  21181. t["T*"] = {
  21182. id: _util.OPS.nextLine,
  21183. numArgs: 0,
  21184. variableArgs: false
  21185. };
  21186. t.Tj = {
  21187. id: _util.OPS.showText,
  21188. numArgs: 1,
  21189. variableArgs: false
  21190. };
  21191. t.TJ = {
  21192. id: _util.OPS.showSpacedText,
  21193. numArgs: 1,
  21194. variableArgs: false
  21195. };
  21196. t["'"] = {
  21197. id: _util.OPS.nextLineShowText,
  21198. numArgs: 1,
  21199. variableArgs: false
  21200. };
  21201. t['"'] = {
  21202. id: _util.OPS.nextLineSetSpacingShowText,
  21203. numArgs: 3,
  21204. variableArgs: false
  21205. };
  21206. t.d0 = {
  21207. id: _util.OPS.setCharWidth,
  21208. numArgs: 2,
  21209. variableArgs: false
  21210. };
  21211. t.d1 = {
  21212. id: _util.OPS.setCharWidthAndBounds,
  21213. numArgs: 6,
  21214. variableArgs: false
  21215. };
  21216. t.CS = {
  21217. id: _util.OPS.setStrokeColorSpace,
  21218. numArgs: 1,
  21219. variableArgs: false
  21220. };
  21221. t.cs = {
  21222. id: _util.OPS.setFillColorSpace,
  21223. numArgs: 1,
  21224. variableArgs: false
  21225. };
  21226. t.SC = {
  21227. id: _util.OPS.setStrokeColor,
  21228. numArgs: 4,
  21229. variableArgs: true
  21230. };
  21231. t.SCN = {
  21232. id: _util.OPS.setStrokeColorN,
  21233. numArgs: 33,
  21234. variableArgs: true
  21235. };
  21236. t.sc = {
  21237. id: _util.OPS.setFillColor,
  21238. numArgs: 4,
  21239. variableArgs: true
  21240. };
  21241. t.scn = {
  21242. id: _util.OPS.setFillColorN,
  21243. numArgs: 33,
  21244. variableArgs: true
  21245. };
  21246. t.G = {
  21247. id: _util.OPS.setStrokeGray,
  21248. numArgs: 1,
  21249. variableArgs: false
  21250. };
  21251. t.g = {
  21252. id: _util.OPS.setFillGray,
  21253. numArgs: 1,
  21254. variableArgs: false
  21255. };
  21256. t.RG = {
  21257. id: _util.OPS.setStrokeRGBColor,
  21258. numArgs: 3,
  21259. variableArgs: false
  21260. };
  21261. t.rg = {
  21262. id: _util.OPS.setFillRGBColor,
  21263. numArgs: 3,
  21264. variableArgs: false
  21265. };
  21266. t.K = {
  21267. id: _util.OPS.setStrokeCMYKColor,
  21268. numArgs: 4,
  21269. variableArgs: false
  21270. };
  21271. t.k = {
  21272. id: _util.OPS.setFillCMYKColor,
  21273. numArgs: 4,
  21274. variableArgs: false
  21275. };
  21276. t.sh = {
  21277. id: _util.OPS.shadingFill,
  21278. numArgs: 1,
  21279. variableArgs: false
  21280. };
  21281. t.BI = {
  21282. id: _util.OPS.beginInlineImage,
  21283. numArgs: 0,
  21284. variableArgs: false
  21285. };
  21286. t.ID = {
  21287. id: _util.OPS.beginImageData,
  21288. numArgs: 0,
  21289. variableArgs: false
  21290. };
  21291. t.EI = {
  21292. id: _util.OPS.endInlineImage,
  21293. numArgs: 1,
  21294. variableArgs: false
  21295. };
  21296. t.Do = {
  21297. id: _util.OPS.paintXObject,
  21298. numArgs: 1,
  21299. variableArgs: false
  21300. };
  21301. t.MP = {
  21302. id: _util.OPS.markPoint,
  21303. numArgs: 1,
  21304. variableArgs: false
  21305. };
  21306. t.DP = {
  21307. id: _util.OPS.markPointProps,
  21308. numArgs: 2,
  21309. variableArgs: false
  21310. };
  21311. t.BMC = {
  21312. id: _util.OPS.beginMarkedContent,
  21313. numArgs: 1,
  21314. variableArgs: false
  21315. };
  21316. t.BDC = {
  21317. id: _util.OPS.beginMarkedContentProps,
  21318. numArgs: 2,
  21319. variableArgs: false
  21320. };
  21321. t.EMC = {
  21322. id: _util.OPS.endMarkedContent,
  21323. numArgs: 0,
  21324. variableArgs: false
  21325. };
  21326. t.BX = {
  21327. id: _util.OPS.beginCompat,
  21328. numArgs: 0,
  21329. variableArgs: false
  21330. };
  21331. t.EX = {
  21332. id: _util.OPS.endCompat,
  21333. numArgs: 0,
  21334. variableArgs: false
  21335. };
  21336. t.BM = null;
  21337. t.BD = null;
  21338. t.true = null;
  21339. t.fa = null;
  21340. t.fal = null;
  21341. t.fals = null;
  21342. t.false = null;
  21343. t.nu = null;
  21344. t.nul = null;
  21345. t.null = null;
  21346. });
  21347. return (0, _util.shadow)(this, "opMap", getOPMap());
  21348. }
  21349. static get MAX_INVALID_PATH_OPS() {
  21350. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 20);
  21351. }
  21352. constructor(stream, xref, stateManager = new StateManager()) {
  21353. this.parser = new _parser.Parser({
  21354. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  21355. xref
  21356. });
  21357. this.stateManager = stateManager;
  21358. this.nonProcessedArgs = [];
  21359. this._numInvalidPathOPS = 0;
  21360. }
  21361. get savedStatesDepth() {
  21362. return this.stateManager.stateStack.length;
  21363. }
  21364. read(operation) {
  21365. var args = operation.args;
  21366. while (true) {
  21367. var obj = this.parser.getObj();
  21368. if (obj instanceof _primitives.Cmd) {
  21369. var cmd = obj.cmd;
  21370. var opSpec = EvaluatorPreprocessor.opMap[cmd];
  21371. if (!opSpec) {
  21372. (0, _util.warn)(`Unknown command "${cmd}".`);
  21373. continue;
  21374. }
  21375. var fn = opSpec.id;
  21376. var numArgs = opSpec.numArgs;
  21377. var argsLength = args !== null ? args.length : 0;
  21378. if (!opSpec.variableArgs) {
  21379. if (argsLength !== numArgs) {
  21380. var nonProcessedArgs = this.nonProcessedArgs;
  21381. while (argsLength > numArgs) {
  21382. nonProcessedArgs.push(args.shift());
  21383. argsLength--;
  21384. }
  21385. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  21386. if (args === null) {
  21387. args = [];
  21388. }
  21389. args.unshift(nonProcessedArgs.pop());
  21390. argsLength++;
  21391. }
  21392. }
  21393. if (argsLength < numArgs) {
  21394. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  21395. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  21396. throw new _util.FormatError(`Invalid ${partialMsg}`);
  21397. }
  21398. (0, _util.warn)(`Skipping ${partialMsg}`);
  21399. if (args !== null) {
  21400. args.length = 0;
  21401. }
  21402. continue;
  21403. }
  21404. } else if (argsLength > numArgs) {
  21405. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  21406. }
  21407. this.preprocessCommand(fn, args);
  21408. operation.fn = fn;
  21409. operation.args = args;
  21410. return true;
  21411. }
  21412. if (obj === _primitives.EOF) {
  21413. return false;
  21414. }
  21415. if (obj !== null) {
  21416. if (args === null) {
  21417. args = [];
  21418. }
  21419. args.push(obj);
  21420. if (args.length > 33) {
  21421. throw new _util.FormatError("Too many arguments");
  21422. }
  21423. }
  21424. }
  21425. }
  21426. preprocessCommand(fn, args) {
  21427. switch (fn | 0) {
  21428. case _util.OPS.save:
  21429. this.stateManager.save();
  21430. break;
  21431. case _util.OPS.restore:
  21432. this.stateManager.restore();
  21433. break;
  21434. case _util.OPS.transform:
  21435. this.stateManager.transform(args);
  21436. break;
  21437. }
  21438. }
  21439. }
  21440. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  21441. /***/ }),
  21442. /* 30 */
  21443. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  21444. Object.defineProperty(exports, "__esModule", ({
  21445. value: true
  21446. }));
  21447. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  21448. var _util = __w_pdfjs_require__(2);
  21449. var _primitives = __w_pdfjs_require__(5);
  21450. var _parser = __w_pdfjs_require__(11);
  21451. var _core_utils = __w_pdfjs_require__(8);
  21452. var _stream = __w_pdfjs_require__(12);
  21453. 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"];
  21454. const MAX_MAP_RANGE = 2 ** 24 - 1;
  21455. class CMap {
  21456. constructor(builtInCMap = false) {
  21457. this.codespaceRanges = [[], [], [], []];
  21458. this.numCodespaceRanges = 0;
  21459. this._map = [];
  21460. this.name = "";
  21461. this.vertical = false;
  21462. this.useCMap = null;
  21463. this.builtInCMap = builtInCMap;
  21464. }
  21465. addCodespaceRange(n, low, high) {
  21466. this.codespaceRanges[n - 1].push(low, high);
  21467. this.numCodespaceRanges++;
  21468. }
  21469. mapCidRange(low, high, dstLow) {
  21470. if (high - low > MAX_MAP_RANGE) {
  21471. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  21472. }
  21473. while (low <= high) {
  21474. this._map[low++] = dstLow++;
  21475. }
  21476. }
  21477. mapBfRange(low, high, dstLow) {
  21478. if (high - low > MAX_MAP_RANGE) {
  21479. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  21480. }
  21481. var lastByte = dstLow.length - 1;
  21482. while (low <= high) {
  21483. this._map[low++] = dstLow;
  21484. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  21485. }
  21486. }
  21487. mapBfRangeToArray(low, high, array) {
  21488. if (high - low > MAX_MAP_RANGE) {
  21489. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  21490. }
  21491. const ii = array.length;
  21492. let i = 0;
  21493. while (low <= high && i < ii) {
  21494. this._map[low] = array[i++];
  21495. ++low;
  21496. }
  21497. }
  21498. mapOne(src, dst) {
  21499. this._map[src] = dst;
  21500. }
  21501. lookup(code) {
  21502. return this._map[code];
  21503. }
  21504. contains(code) {
  21505. return this._map[code] !== undefined;
  21506. }
  21507. forEach(callback) {
  21508. const map = this._map;
  21509. const length = map.length;
  21510. if (length <= 0x10000) {
  21511. for (let i = 0; i < length; i++) {
  21512. if (map[i] !== undefined) {
  21513. callback(i, map[i]);
  21514. }
  21515. }
  21516. } else {
  21517. for (const i in map) {
  21518. callback(i, map[i]);
  21519. }
  21520. }
  21521. }
  21522. charCodeOf(value) {
  21523. const map = this._map;
  21524. if (map.length <= 0x10000) {
  21525. return map.indexOf(value);
  21526. }
  21527. for (const charCode in map) {
  21528. if (map[charCode] === value) {
  21529. return charCode | 0;
  21530. }
  21531. }
  21532. return -1;
  21533. }
  21534. getMap() {
  21535. return this._map;
  21536. }
  21537. readCharCode(str, offset, out) {
  21538. let c = 0;
  21539. const codespaceRanges = this.codespaceRanges;
  21540. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  21541. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  21542. const codespaceRange = codespaceRanges[n];
  21543. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  21544. const low = codespaceRange[k++];
  21545. const high = codespaceRange[k++];
  21546. if (c >= low && c <= high) {
  21547. out.charcode = c;
  21548. out.length = n + 1;
  21549. return;
  21550. }
  21551. }
  21552. }
  21553. out.charcode = 0;
  21554. out.length = 1;
  21555. }
  21556. getCharCodeLength(charCode) {
  21557. const codespaceRanges = this.codespaceRanges;
  21558. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  21559. const codespaceRange = codespaceRanges[n];
  21560. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  21561. const low = codespaceRange[k++];
  21562. const high = codespaceRange[k++];
  21563. if (charCode >= low && charCode <= high) {
  21564. return n + 1;
  21565. }
  21566. }
  21567. }
  21568. return 1;
  21569. }
  21570. get length() {
  21571. return this._map.length;
  21572. }
  21573. get isIdentityCMap() {
  21574. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  21575. return false;
  21576. }
  21577. if (this._map.length !== 0x10000) {
  21578. return false;
  21579. }
  21580. for (let i = 0; i < 0x10000; i++) {
  21581. if (this._map[i] !== i) {
  21582. return false;
  21583. }
  21584. }
  21585. return true;
  21586. }
  21587. }
  21588. exports.CMap = CMap;
  21589. class IdentityCMap extends CMap {
  21590. constructor(vertical, n) {
  21591. super();
  21592. this.vertical = vertical;
  21593. this.addCodespaceRange(n, 0, 0xffff);
  21594. }
  21595. mapCidRange(low, high, dstLow) {
  21596. (0, _util.unreachable)("should not call mapCidRange");
  21597. }
  21598. mapBfRange(low, high, dstLow) {
  21599. (0, _util.unreachable)("should not call mapBfRange");
  21600. }
  21601. mapBfRangeToArray(low, high, array) {
  21602. (0, _util.unreachable)("should not call mapBfRangeToArray");
  21603. }
  21604. mapOne(src, dst) {
  21605. (0, _util.unreachable)("should not call mapCidOne");
  21606. }
  21607. lookup(code) {
  21608. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  21609. }
  21610. contains(code) {
  21611. return Number.isInteger(code) && code <= 0xffff;
  21612. }
  21613. forEach(callback) {
  21614. for (let i = 0; i <= 0xffff; i++) {
  21615. callback(i, i);
  21616. }
  21617. }
  21618. charCodeOf(value) {
  21619. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  21620. }
  21621. getMap() {
  21622. const map = new Array(0x10000);
  21623. for (let i = 0; i <= 0xffff; i++) {
  21624. map[i] = i;
  21625. }
  21626. return map;
  21627. }
  21628. get length() {
  21629. return 0x10000;
  21630. }
  21631. get isIdentityCMap() {
  21632. (0, _util.unreachable)("should not access .isIdentityCMap");
  21633. }
  21634. }
  21635. exports.IdentityCMap = IdentityCMap;
  21636. var BinaryCMapReader = function BinaryCMapReaderClosure() {
  21637. function hexToInt(a, size) {
  21638. var n = 0;
  21639. for (var i = 0; i <= size; i++) {
  21640. n = n << 8 | a[i];
  21641. }
  21642. return n >>> 0;
  21643. }
  21644. function hexToStr(a, size) {
  21645. if (size === 1) {
  21646. return String.fromCharCode(a[0], a[1]);
  21647. }
  21648. if (size === 3) {
  21649. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  21650. }
  21651. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  21652. }
  21653. function addHex(a, b, size) {
  21654. var c = 0;
  21655. for (var i = size; i >= 0; i--) {
  21656. c += a[i] + b[i];
  21657. a[i] = c & 255;
  21658. c >>= 8;
  21659. }
  21660. }
  21661. function incHex(a, size) {
  21662. var c = 1;
  21663. for (var i = size; i >= 0 && c > 0; i--) {
  21664. c += a[i];
  21665. a[i] = c & 255;
  21666. c >>= 8;
  21667. }
  21668. }
  21669. var MAX_NUM_SIZE = 16;
  21670. var MAX_ENCODED_NUM_SIZE = 19;
  21671. class BinaryCMapStream {
  21672. constructor(data) {
  21673. this.buffer = data;
  21674. this.pos = 0;
  21675. this.end = data.length;
  21676. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  21677. }
  21678. readByte() {
  21679. if (this.pos >= this.end) {
  21680. return -1;
  21681. }
  21682. return this.buffer[this.pos++];
  21683. }
  21684. readNumber() {
  21685. var n = 0;
  21686. var last;
  21687. do {
  21688. var b = this.readByte();
  21689. if (b < 0) {
  21690. throw new _util.FormatError("unexpected EOF in bcmap");
  21691. }
  21692. last = !(b & 0x80);
  21693. n = n << 7 | b & 0x7f;
  21694. } while (!last);
  21695. return n;
  21696. }
  21697. readSigned() {
  21698. var n = this.readNumber();
  21699. return n & 1 ? ~(n >>> 1) : n >>> 1;
  21700. }
  21701. readHex(num, size) {
  21702. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  21703. this.pos += size + 1;
  21704. }
  21705. readHexNumber(num, size) {
  21706. var last;
  21707. var stack = this.tmpBuf,
  21708. sp = 0;
  21709. do {
  21710. var b = this.readByte();
  21711. if (b < 0) {
  21712. throw new _util.FormatError("unexpected EOF in bcmap");
  21713. }
  21714. last = !(b & 0x80);
  21715. stack[sp++] = b & 0x7f;
  21716. } while (!last);
  21717. var i = size,
  21718. buffer = 0,
  21719. bufferSize = 0;
  21720. while (i >= 0) {
  21721. while (bufferSize < 8 && stack.length > 0) {
  21722. buffer = stack[--sp] << bufferSize | buffer;
  21723. bufferSize += 7;
  21724. }
  21725. num[i] = buffer & 255;
  21726. i--;
  21727. buffer >>= 8;
  21728. bufferSize -= 8;
  21729. }
  21730. }
  21731. readHexSigned(num, size) {
  21732. this.readHexNumber(num, size);
  21733. var sign = num[size] & 1 ? 255 : 0;
  21734. var c = 0;
  21735. for (var i = 0; i <= size; i++) {
  21736. c = (c & 1) << 8 | num[i];
  21737. num[i] = c >> 1 ^ sign;
  21738. }
  21739. }
  21740. readString() {
  21741. var len = this.readNumber();
  21742. var s = "";
  21743. for (var i = 0; i < len; i++) {
  21744. s += String.fromCharCode(this.readNumber());
  21745. }
  21746. return s;
  21747. }
  21748. }
  21749. class BinaryCMapReader {
  21750. async process(data, cMap, extend) {
  21751. var stream = new BinaryCMapStream(data);
  21752. var header = stream.readByte();
  21753. cMap.vertical = !!(header & 1);
  21754. var useCMap = null;
  21755. var start = new Uint8Array(MAX_NUM_SIZE);
  21756. var end = new Uint8Array(MAX_NUM_SIZE);
  21757. var char = new Uint8Array(MAX_NUM_SIZE);
  21758. var charCode = new Uint8Array(MAX_NUM_SIZE);
  21759. var tmp = new Uint8Array(MAX_NUM_SIZE);
  21760. var code;
  21761. var b;
  21762. while ((b = stream.readByte()) >= 0) {
  21763. var type = b >> 5;
  21764. if (type === 7) {
  21765. switch (b & 0x1f) {
  21766. case 0:
  21767. stream.readString();
  21768. break;
  21769. case 1:
  21770. useCMap = stream.readString();
  21771. break;
  21772. }
  21773. continue;
  21774. }
  21775. var sequence = !!(b & 0x10);
  21776. var dataSize = b & 15;
  21777. if (dataSize + 1 > MAX_NUM_SIZE) {
  21778. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  21779. }
  21780. var ucs2DataSize = 1;
  21781. var subitemsCount = stream.readNumber();
  21782. var i;
  21783. switch (type) {
  21784. case 0:
  21785. stream.readHex(start, dataSize);
  21786. stream.readHexNumber(end, dataSize);
  21787. addHex(end, start, dataSize);
  21788. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  21789. for (i = 1; i < subitemsCount; i++) {
  21790. incHex(end, dataSize);
  21791. stream.readHexNumber(start, dataSize);
  21792. addHex(start, end, dataSize);
  21793. stream.readHexNumber(end, dataSize);
  21794. addHex(end, start, dataSize);
  21795. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  21796. }
  21797. break;
  21798. case 1:
  21799. stream.readHex(start, dataSize);
  21800. stream.readHexNumber(end, dataSize);
  21801. addHex(end, start, dataSize);
  21802. stream.readNumber();
  21803. for (i = 1; i < subitemsCount; i++) {
  21804. incHex(end, dataSize);
  21805. stream.readHexNumber(start, dataSize);
  21806. addHex(start, end, dataSize);
  21807. stream.readHexNumber(end, dataSize);
  21808. addHex(end, start, dataSize);
  21809. stream.readNumber();
  21810. }
  21811. break;
  21812. case 2:
  21813. stream.readHex(char, dataSize);
  21814. code = stream.readNumber();
  21815. cMap.mapOne(hexToInt(char, dataSize), code);
  21816. for (i = 1; i < subitemsCount; i++) {
  21817. incHex(char, dataSize);
  21818. if (!sequence) {
  21819. stream.readHexNumber(tmp, dataSize);
  21820. addHex(char, tmp, dataSize);
  21821. }
  21822. code = stream.readSigned() + (code + 1);
  21823. cMap.mapOne(hexToInt(char, dataSize), code);
  21824. }
  21825. break;
  21826. case 3:
  21827. stream.readHex(start, dataSize);
  21828. stream.readHexNumber(end, dataSize);
  21829. addHex(end, start, dataSize);
  21830. code = stream.readNumber();
  21831. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  21832. for (i = 1; i < subitemsCount; i++) {
  21833. incHex(end, dataSize);
  21834. if (!sequence) {
  21835. stream.readHexNumber(start, dataSize);
  21836. addHex(start, end, dataSize);
  21837. } else {
  21838. start.set(end);
  21839. }
  21840. stream.readHexNumber(end, dataSize);
  21841. addHex(end, start, dataSize);
  21842. code = stream.readNumber();
  21843. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  21844. }
  21845. break;
  21846. case 4:
  21847. stream.readHex(char, ucs2DataSize);
  21848. stream.readHex(charCode, dataSize);
  21849. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  21850. for (i = 1; i < subitemsCount; i++) {
  21851. incHex(char, ucs2DataSize);
  21852. if (!sequence) {
  21853. stream.readHexNumber(tmp, ucs2DataSize);
  21854. addHex(char, tmp, ucs2DataSize);
  21855. }
  21856. incHex(charCode, dataSize);
  21857. stream.readHexSigned(tmp, dataSize);
  21858. addHex(charCode, tmp, dataSize);
  21859. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  21860. }
  21861. break;
  21862. case 5:
  21863. stream.readHex(start, ucs2DataSize);
  21864. stream.readHexNumber(end, ucs2DataSize);
  21865. addHex(end, start, ucs2DataSize);
  21866. stream.readHex(charCode, dataSize);
  21867. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  21868. for (i = 1; i < subitemsCount; i++) {
  21869. incHex(end, ucs2DataSize);
  21870. if (!sequence) {
  21871. stream.readHexNumber(start, ucs2DataSize);
  21872. addHex(start, end, ucs2DataSize);
  21873. } else {
  21874. start.set(end);
  21875. }
  21876. stream.readHexNumber(end, ucs2DataSize);
  21877. addHex(end, start, ucs2DataSize);
  21878. stream.readHex(charCode, dataSize);
  21879. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  21880. }
  21881. break;
  21882. default:
  21883. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  21884. }
  21885. }
  21886. if (useCMap) {
  21887. return extend(useCMap);
  21888. }
  21889. return cMap;
  21890. }
  21891. }
  21892. return BinaryCMapReader;
  21893. }();
  21894. var CMapFactory = function CMapFactoryClosure() {
  21895. function strToInt(str) {
  21896. var a = 0;
  21897. for (var i = 0; i < str.length; i++) {
  21898. a = a << 8 | str.charCodeAt(i);
  21899. }
  21900. return a >>> 0;
  21901. }
  21902. function expectString(obj) {
  21903. if (!(0, _util.isString)(obj)) {
  21904. throw new _util.FormatError("Malformed CMap: expected string.");
  21905. }
  21906. }
  21907. function expectInt(obj) {
  21908. if (!Number.isInteger(obj)) {
  21909. throw new _util.FormatError("Malformed CMap: expected int.");
  21910. }
  21911. }
  21912. function parseBfChar(cMap, lexer) {
  21913. while (true) {
  21914. var obj = lexer.getObj();
  21915. if ((0, _primitives.isEOF)(obj)) {
  21916. break;
  21917. }
  21918. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  21919. return;
  21920. }
  21921. expectString(obj);
  21922. var src = strToInt(obj);
  21923. obj = lexer.getObj();
  21924. expectString(obj);
  21925. var dst = obj;
  21926. cMap.mapOne(src, dst);
  21927. }
  21928. }
  21929. function parseBfRange(cMap, lexer) {
  21930. while (true) {
  21931. var obj = lexer.getObj();
  21932. if ((0, _primitives.isEOF)(obj)) {
  21933. break;
  21934. }
  21935. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  21936. return;
  21937. }
  21938. expectString(obj);
  21939. var low = strToInt(obj);
  21940. obj = lexer.getObj();
  21941. expectString(obj);
  21942. var high = strToInt(obj);
  21943. obj = lexer.getObj();
  21944. if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
  21945. var dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  21946. cMap.mapBfRange(low, high, dstLow);
  21947. } else if ((0, _primitives.isCmd)(obj, "[")) {
  21948. obj = lexer.getObj();
  21949. var array = [];
  21950. while (!(0, _primitives.isCmd)(obj, "]") && !(0, _primitives.isEOF)(obj)) {
  21951. array.push(obj);
  21952. obj = lexer.getObj();
  21953. }
  21954. cMap.mapBfRangeToArray(low, high, array);
  21955. } else {
  21956. break;
  21957. }
  21958. }
  21959. throw new _util.FormatError("Invalid bf range.");
  21960. }
  21961. function parseCidChar(cMap, lexer) {
  21962. while (true) {
  21963. var obj = lexer.getObj();
  21964. if ((0, _primitives.isEOF)(obj)) {
  21965. break;
  21966. }
  21967. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  21968. return;
  21969. }
  21970. expectString(obj);
  21971. var src = strToInt(obj);
  21972. obj = lexer.getObj();
  21973. expectInt(obj);
  21974. var dst = obj;
  21975. cMap.mapOne(src, dst);
  21976. }
  21977. }
  21978. function parseCidRange(cMap, lexer) {
  21979. while (true) {
  21980. var obj = lexer.getObj();
  21981. if ((0, _primitives.isEOF)(obj)) {
  21982. break;
  21983. }
  21984. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  21985. return;
  21986. }
  21987. expectString(obj);
  21988. var low = strToInt(obj);
  21989. obj = lexer.getObj();
  21990. expectString(obj);
  21991. var high = strToInt(obj);
  21992. obj = lexer.getObj();
  21993. expectInt(obj);
  21994. var dstLow = obj;
  21995. cMap.mapCidRange(low, high, dstLow);
  21996. }
  21997. }
  21998. function parseCodespaceRange(cMap, lexer) {
  21999. while (true) {
  22000. var obj = lexer.getObj();
  22001. if ((0, _primitives.isEOF)(obj)) {
  22002. break;
  22003. }
  22004. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  22005. return;
  22006. }
  22007. if (!(0, _util.isString)(obj)) {
  22008. break;
  22009. }
  22010. var low = strToInt(obj);
  22011. obj = lexer.getObj();
  22012. if (!(0, _util.isString)(obj)) {
  22013. break;
  22014. }
  22015. var high = strToInt(obj);
  22016. cMap.addCodespaceRange(obj.length, low, high);
  22017. }
  22018. throw new _util.FormatError("Invalid codespace range.");
  22019. }
  22020. function parseWMode(cMap, lexer) {
  22021. var obj = lexer.getObj();
  22022. if (Number.isInteger(obj)) {
  22023. cMap.vertical = !!obj;
  22024. }
  22025. }
  22026. function parseCMapName(cMap, lexer) {
  22027. var obj = lexer.getObj();
  22028. if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
  22029. cMap.name = obj.name;
  22030. }
  22031. }
  22032. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  22033. var previous;
  22034. var embeddedUseCMap;
  22035. objLoop: while (true) {
  22036. try {
  22037. var obj = lexer.getObj();
  22038. if ((0, _primitives.isEOF)(obj)) {
  22039. break;
  22040. } else if ((0, _primitives.isName)(obj)) {
  22041. if (obj.name === "WMode") {
  22042. parseWMode(cMap, lexer);
  22043. } else if (obj.name === "CMapName") {
  22044. parseCMapName(cMap, lexer);
  22045. }
  22046. previous = obj;
  22047. } else if ((0, _primitives.isCmd)(obj)) {
  22048. switch (obj.cmd) {
  22049. case "endcmap":
  22050. break objLoop;
  22051. case "usecmap":
  22052. if ((0, _primitives.isName)(previous)) {
  22053. embeddedUseCMap = previous.name;
  22054. }
  22055. break;
  22056. case "begincodespacerange":
  22057. parseCodespaceRange(cMap, lexer);
  22058. break;
  22059. case "beginbfchar":
  22060. parseBfChar(cMap, lexer);
  22061. break;
  22062. case "begincidchar":
  22063. parseCidChar(cMap, lexer);
  22064. break;
  22065. case "beginbfrange":
  22066. parseBfRange(cMap, lexer);
  22067. break;
  22068. case "begincidrange":
  22069. parseCidRange(cMap, lexer);
  22070. break;
  22071. }
  22072. }
  22073. } catch (ex) {
  22074. if (ex instanceof _core_utils.MissingDataException) {
  22075. throw ex;
  22076. }
  22077. (0, _util.warn)("Invalid cMap data: " + ex);
  22078. continue;
  22079. }
  22080. }
  22081. if (!useCMap && embeddedUseCMap) {
  22082. useCMap = embeddedUseCMap;
  22083. }
  22084. if (useCMap) {
  22085. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  22086. }
  22087. return cMap;
  22088. }
  22089. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  22090. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  22091. if (cMap.numCodespaceRanges === 0) {
  22092. var useCodespaceRanges = cMap.useCMap.codespaceRanges;
  22093. for (var i = 0; i < useCodespaceRanges.length; i++) {
  22094. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  22095. }
  22096. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  22097. }
  22098. cMap.useCMap.forEach(function (key, value) {
  22099. if (!cMap.contains(key)) {
  22100. cMap.mapOne(key, cMap.useCMap.lookup(key));
  22101. }
  22102. });
  22103. return cMap;
  22104. }
  22105. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  22106. if (name === "Identity-H") {
  22107. return new IdentityCMap(false, 2);
  22108. } else if (name === "Identity-V") {
  22109. return new IdentityCMap(true, 2);
  22110. }
  22111. if (!BUILT_IN_CMAPS.includes(name)) {
  22112. throw new Error("Unknown CMap name: " + name);
  22113. }
  22114. if (!fetchBuiltInCMap) {
  22115. throw new Error("Built-in CMap parameters are not provided.");
  22116. }
  22117. const {
  22118. cMapData,
  22119. compressionType
  22120. } = await fetchBuiltInCMap(name);
  22121. var cMap = new CMap(true);
  22122. if (compressionType === _util.CMapCompressionType.BINARY) {
  22123. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  22124. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  22125. });
  22126. }
  22127. if (compressionType === _util.CMapCompressionType.NONE) {
  22128. var lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  22129. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  22130. }
  22131. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  22132. }
  22133. return {
  22134. async create(params) {
  22135. var encoding = params.encoding;
  22136. var fetchBuiltInCMap = params.fetchBuiltInCMap;
  22137. var useCMap = params.useCMap;
  22138. if ((0, _primitives.isName)(encoding)) {
  22139. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  22140. } else if ((0, _primitives.isStream)(encoding)) {
  22141. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  22142. if (parsedCMap.isIdentityCMap) {
  22143. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  22144. }
  22145. return parsedCMap;
  22146. }
  22147. throw new Error("Encoding required.");
  22148. }
  22149. };
  22150. }();
  22151. exports.CMapFactory = CMapFactory;
  22152. /***/ }),
  22153. /* 31 */
  22154. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  22155. Object.defineProperty(exports, "__esModule", ({
  22156. value: true
  22157. }));
  22158. exports.getFontType = getFontType;
  22159. exports.ToUnicodeMap = exports.SEAC_ANALYSIS_ENABLED = exports.IdentityToUnicodeMap = exports.FontFlags = exports.Font = exports.ErrorFont = void 0;
  22160. var _util = __w_pdfjs_require__(2);
  22161. var _cff_parser = __w_pdfjs_require__(32);
  22162. var _glyphlist = __w_pdfjs_require__(35);
  22163. var _encodings = __w_pdfjs_require__(34);
  22164. var _standard_fonts = __w_pdfjs_require__(36);
  22165. var _unicode = __w_pdfjs_require__(37);
  22166. var _core_utils = __w_pdfjs_require__(8);
  22167. var _font_renderer = __w_pdfjs_require__(38);
  22168. var _cmap = __w_pdfjs_require__(30);
  22169. var _stream = __w_pdfjs_require__(12);
  22170. var _type1_parser = __w_pdfjs_require__(39);
  22171. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  22172. var PDF_GLYPH_SPACE_UNITS = 1000;
  22173. var SEAC_ANALYSIS_ENABLED = true;
  22174. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  22175. 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"];
  22176. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  22177. var FontFlags = {
  22178. FixedPitch: 1,
  22179. Serif: 2,
  22180. Symbolic: 4,
  22181. Script: 8,
  22182. Nonsymbolic: 32,
  22183. Italic: 64,
  22184. AllCap: 65536,
  22185. SmallCap: 131072,
  22186. ForceBold: 262144
  22187. };
  22188. exports.FontFlags = FontFlags;
  22189. 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"];
  22190. function adjustWidths(properties) {
  22191. if (!properties.fontMatrix) {
  22192. return;
  22193. }
  22194. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  22195. return;
  22196. }
  22197. var scale = 0.001 / properties.fontMatrix[0];
  22198. var glyphsWidths = properties.widths;
  22199. for (var glyph in glyphsWidths) {
  22200. glyphsWidths[glyph] *= scale;
  22201. }
  22202. properties.defaultWidth *= scale;
  22203. }
  22204. function adjustToUnicode(properties, builtInEncoding) {
  22205. if (properties.hasIncludedToUnicodeMap) {
  22206. return;
  22207. }
  22208. if (properties.hasEncoding) {
  22209. return;
  22210. }
  22211. if (builtInEncoding === properties.defaultEncoding) {
  22212. return;
  22213. }
  22214. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  22215. return;
  22216. }
  22217. var toUnicode = [],
  22218. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22219. for (var charCode in builtInEncoding) {
  22220. var glyphName = builtInEncoding[charCode];
  22221. var unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  22222. if (unicode !== -1) {
  22223. toUnicode[charCode] = String.fromCharCode(unicode);
  22224. }
  22225. }
  22226. properties.toUnicode.amend(toUnicode);
  22227. }
  22228. function getFontType(type, subtype) {
  22229. switch (type) {
  22230. case "Type1":
  22231. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  22232. case "CIDFontType0":
  22233. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  22234. case "OpenType":
  22235. return _util.FontType.OPENTYPE;
  22236. case "TrueType":
  22237. return _util.FontType.TRUETYPE;
  22238. case "CIDFontType2":
  22239. return _util.FontType.CIDFONTTYPE2;
  22240. case "MMType1":
  22241. return _util.FontType.MMTYPE1;
  22242. case "Type0":
  22243. return _util.FontType.TYPE0;
  22244. default:
  22245. return _util.FontType.UNKNOWN;
  22246. }
  22247. }
  22248. function recoverGlyphName(name, glyphsUnicodeMap) {
  22249. if (glyphsUnicodeMap[name] !== undefined) {
  22250. return name;
  22251. }
  22252. var unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  22253. if (unicode !== -1) {
  22254. for (var key in glyphsUnicodeMap) {
  22255. if (glyphsUnicodeMap[key] === unicode) {
  22256. return key;
  22257. }
  22258. }
  22259. }
  22260. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  22261. return name;
  22262. }
  22263. var Glyph = function GlyphClosure() {
  22264. function Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  22265. this.fontChar = fontChar;
  22266. this.unicode = unicode;
  22267. this.accent = accent;
  22268. this.width = width;
  22269. this.vmetric = vmetric;
  22270. this.operatorListId = operatorListId;
  22271. this.isSpace = isSpace;
  22272. this.isInFont = isInFont;
  22273. }
  22274. Glyph.prototype.matchesForCache = function (fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  22275. 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;
  22276. };
  22277. return Glyph;
  22278. }();
  22279. var ToUnicodeMap = function ToUnicodeMapClosure() {
  22280. function ToUnicodeMap(cmap = []) {
  22281. this._map = cmap;
  22282. }
  22283. ToUnicodeMap.prototype = {
  22284. get length() {
  22285. return this._map.length;
  22286. },
  22287. forEach(callback) {
  22288. for (var charCode in this._map) {
  22289. callback(charCode, this._map[charCode].charCodeAt(0));
  22290. }
  22291. },
  22292. has(i) {
  22293. return this._map[i] !== undefined;
  22294. },
  22295. get(i) {
  22296. return this._map[i];
  22297. },
  22298. charCodeOf(value) {
  22299. const map = this._map;
  22300. if (map.length <= 0x10000) {
  22301. return map.indexOf(value);
  22302. }
  22303. for (const charCode in map) {
  22304. if (map[charCode] === value) {
  22305. return charCode | 0;
  22306. }
  22307. }
  22308. return -1;
  22309. },
  22310. amend(map) {
  22311. for (var charCode in map) {
  22312. this._map[charCode] = map[charCode];
  22313. }
  22314. }
  22315. };
  22316. return ToUnicodeMap;
  22317. }();
  22318. exports.ToUnicodeMap = ToUnicodeMap;
  22319. var IdentityToUnicodeMap = function IdentityToUnicodeMapClosure() {
  22320. function IdentityToUnicodeMap(firstChar, lastChar) {
  22321. this.firstChar = firstChar;
  22322. this.lastChar = lastChar;
  22323. }
  22324. IdentityToUnicodeMap.prototype = {
  22325. get length() {
  22326. return this.lastChar + 1 - this.firstChar;
  22327. },
  22328. forEach(callback) {
  22329. for (var i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  22330. callback(i, i);
  22331. }
  22332. },
  22333. has(i) {
  22334. return this.firstChar <= i && i <= this.lastChar;
  22335. },
  22336. get(i) {
  22337. if (this.firstChar <= i && i <= this.lastChar) {
  22338. return String.fromCharCode(i);
  22339. }
  22340. return undefined;
  22341. },
  22342. charCodeOf(v) {
  22343. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  22344. },
  22345. amend(map) {
  22346. (0, _util.unreachable)("Should not call amend()");
  22347. }
  22348. };
  22349. return IdentityToUnicodeMap;
  22350. }();
  22351. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  22352. var OpenTypeFileBuilder = function OpenTypeFileBuilderClosure() {
  22353. function writeInt16(dest, offset, num) {
  22354. dest[offset] = num >> 8 & 0xff;
  22355. dest[offset + 1] = num & 0xff;
  22356. }
  22357. function writeInt32(dest, offset, num) {
  22358. dest[offset] = num >> 24 & 0xff;
  22359. dest[offset + 1] = num >> 16 & 0xff;
  22360. dest[offset + 2] = num >> 8 & 0xff;
  22361. dest[offset + 3] = num & 0xff;
  22362. }
  22363. function writeData(dest, offset, data) {
  22364. var i, ii;
  22365. if (data instanceof Uint8Array) {
  22366. dest.set(data, offset);
  22367. } else if (typeof data === "string") {
  22368. for (i = 0, ii = data.length; i < ii; i++) {
  22369. dest[offset++] = data.charCodeAt(i) & 0xff;
  22370. }
  22371. } else {
  22372. for (i = 0, ii = data.length; i < ii; i++) {
  22373. dest[offset++] = data[i] & 0xff;
  22374. }
  22375. }
  22376. }
  22377. function OpenTypeFileBuilder(sfnt) {
  22378. this.sfnt = sfnt;
  22379. this.tables = Object.create(null);
  22380. }
  22381. OpenTypeFileBuilder.getSearchParams = function OpenTypeFileBuilder_getSearchParams(entriesCount, entrySize) {
  22382. var maxPower2 = 1,
  22383. log2 = 0;
  22384. while ((maxPower2 ^ entriesCount) > maxPower2) {
  22385. maxPower2 <<= 1;
  22386. log2++;
  22387. }
  22388. var searchRange = maxPower2 * entrySize;
  22389. return {
  22390. range: searchRange,
  22391. entry: log2,
  22392. rangeShift: entrySize * entriesCount - searchRange
  22393. };
  22394. };
  22395. var OTF_HEADER_SIZE = 12;
  22396. var OTF_TABLE_ENTRY_SIZE = 16;
  22397. OpenTypeFileBuilder.prototype = {
  22398. toArray: function OpenTypeFileBuilder_toArray() {
  22399. var sfnt = this.sfnt;
  22400. var tables = this.tables;
  22401. var tablesNames = Object.keys(tables);
  22402. tablesNames.sort();
  22403. var numTables = tablesNames.length;
  22404. var i, j, jj, table, tableName;
  22405. var offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  22406. var tableOffsets = [offset];
  22407. for (i = 0; i < numTables; i++) {
  22408. table = tables[tablesNames[i]];
  22409. var paddedLength = (table.length + 3 & ~3) >>> 0;
  22410. offset += paddedLength;
  22411. tableOffsets.push(offset);
  22412. }
  22413. var file = new Uint8Array(offset);
  22414. for (i = 0; i < numTables; i++) {
  22415. table = tables[tablesNames[i]];
  22416. writeData(file, tableOffsets[i], table);
  22417. }
  22418. if (sfnt === "true") {
  22419. sfnt = (0, _util.string32)(0x00010000);
  22420. }
  22421. file[0] = sfnt.charCodeAt(0) & 0xff;
  22422. file[1] = sfnt.charCodeAt(1) & 0xff;
  22423. file[2] = sfnt.charCodeAt(2) & 0xff;
  22424. file[3] = sfnt.charCodeAt(3) & 0xff;
  22425. writeInt16(file, 4, numTables);
  22426. var searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  22427. writeInt16(file, 6, searchParams.range);
  22428. writeInt16(file, 8, searchParams.entry);
  22429. writeInt16(file, 10, searchParams.rangeShift);
  22430. offset = OTF_HEADER_SIZE;
  22431. for (i = 0; i < numTables; i++) {
  22432. tableName = tablesNames[i];
  22433. file[offset] = tableName.charCodeAt(0) & 0xff;
  22434. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  22435. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  22436. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  22437. var checksum = 0;
  22438. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  22439. var quad = (0, _core_utils.readUint32)(file, j);
  22440. checksum = checksum + quad >>> 0;
  22441. }
  22442. writeInt32(file, offset + 4, checksum);
  22443. writeInt32(file, offset + 8, tableOffsets[i]);
  22444. writeInt32(file, offset + 12, tables[tableName].length);
  22445. offset += OTF_TABLE_ENTRY_SIZE;
  22446. }
  22447. return file;
  22448. },
  22449. addTable: function OpenTypeFileBuilder_addTable(tag, data) {
  22450. if (tag in this.tables) {
  22451. throw new Error("Table " + tag + " already exists");
  22452. }
  22453. this.tables[tag] = data;
  22454. }
  22455. };
  22456. return OpenTypeFileBuilder;
  22457. }();
  22458. var Font = function FontClosure() {
  22459. function Font(name, file, properties) {
  22460. var charCode;
  22461. this.name = name;
  22462. this.loadedName = properties.loadedName;
  22463. this.isType3Font = properties.isType3Font;
  22464. this.missingFile = false;
  22465. this.glyphCache = Object.create(null);
  22466. this.isSerifFont = !!(properties.flags & FontFlags.Serif);
  22467. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  22468. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  22469. var type = properties.type;
  22470. var subtype = properties.subtype;
  22471. this.type = type;
  22472. this.subtype = subtype;
  22473. let fallbackName = "sans-serif";
  22474. if (this.isMonospace) {
  22475. fallbackName = "monospace";
  22476. } else if (this.isSerifFont) {
  22477. fallbackName = "serif";
  22478. }
  22479. this.fallbackName = fallbackName;
  22480. this.differences = properties.differences;
  22481. this.widths = properties.widths;
  22482. this.defaultWidth = properties.defaultWidth;
  22483. this.composite = properties.composite;
  22484. this.cMap = properties.cMap;
  22485. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  22486. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  22487. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  22488. this.fontMatrix = properties.fontMatrix;
  22489. this.bbox = properties.bbox;
  22490. this.defaultEncoding = properties.defaultEncoding;
  22491. this.toUnicode = properties.toUnicode;
  22492. this.fallbackToUnicode = properties.fallbackToUnicode || new ToUnicodeMap();
  22493. this.toFontChar = [];
  22494. if (properties.type === "Type3") {
  22495. for (charCode = 0; charCode < 256; charCode++) {
  22496. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  22497. }
  22498. this.fontType = _util.FontType.TYPE3;
  22499. return;
  22500. }
  22501. this.cidEncoding = properties.cidEncoding;
  22502. this.vertical = !!properties.vertical;
  22503. if (this.vertical) {
  22504. this.vmetrics = properties.vmetrics;
  22505. this.defaultVMetrics = properties.defaultVMetrics;
  22506. }
  22507. if (!file || file.isEmpty) {
  22508. if (file) {
  22509. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  22510. }
  22511. this.fallbackToSystemFont(properties);
  22512. return;
  22513. }
  22514. [type, subtype] = getFontFileType(file, properties);
  22515. if (type !== this.type || subtype !== this.subtype) {
  22516. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  22517. }
  22518. try {
  22519. var data;
  22520. switch (type) {
  22521. case "MMType1":
  22522. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  22523. case "Type1":
  22524. case "CIDFontType0":
  22525. this.mimetype = "font/opentype";
  22526. var cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  22527. adjustWidths(properties);
  22528. data = this.convert(name, cff, properties);
  22529. break;
  22530. case "OpenType":
  22531. case "TrueType":
  22532. case "CIDFontType2":
  22533. this.mimetype = "font/opentype";
  22534. data = this.checkAndRepair(name, file, properties);
  22535. if (this.isOpenType) {
  22536. adjustWidths(properties);
  22537. type = "OpenType";
  22538. }
  22539. break;
  22540. default:
  22541. throw new _util.FormatError(`Font ${type} is not supported`);
  22542. }
  22543. } catch (e) {
  22544. (0, _util.warn)(e);
  22545. this.fallbackToSystemFont(properties);
  22546. return;
  22547. }
  22548. this.data = data;
  22549. this.fontType = getFontType(type, subtype);
  22550. this.fontMatrix = properties.fontMatrix;
  22551. this.widths = properties.widths;
  22552. this.defaultWidth = properties.defaultWidth;
  22553. this.toUnicode = properties.toUnicode;
  22554. this.seacMap = properties.seacMap;
  22555. }
  22556. function int16(b0, b1) {
  22557. return (b0 << 8) + b1;
  22558. }
  22559. function writeSignedInt16(bytes, index, value) {
  22560. bytes[index + 1] = value;
  22561. bytes[index] = value >>> 8;
  22562. }
  22563. function signedInt16(b0, b1) {
  22564. var value = (b0 << 8) + b1;
  22565. return value & 1 << 15 ? value - 0x10000 : value;
  22566. }
  22567. function int32(b0, b1, b2, b3) {
  22568. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  22569. }
  22570. function string16(value) {
  22571. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  22572. }
  22573. function safeString16(value) {
  22574. if (value > 0x7fff) {
  22575. value = 0x7fff;
  22576. } else if (value < -0x8000) {
  22577. value = -0x8000;
  22578. }
  22579. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  22580. }
  22581. function isTrueTypeFile(file) {
  22582. var header = file.peekBytes(4);
  22583. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  22584. }
  22585. function isTrueTypeCollectionFile(file) {
  22586. const header = file.peekBytes(4);
  22587. return (0, _util.bytesToString)(header) === "ttcf";
  22588. }
  22589. function isOpenTypeFile(file) {
  22590. var header = file.peekBytes(4);
  22591. return (0, _util.bytesToString)(header) === "OTTO";
  22592. }
  22593. function isType1File(file) {
  22594. var header = file.peekBytes(2);
  22595. if (header[0] === 0x25 && header[1] === 0x21) {
  22596. return true;
  22597. }
  22598. if (header[0] === 0x80 && header[1] === 0x01) {
  22599. return true;
  22600. }
  22601. return false;
  22602. }
  22603. function isCFFFile(file) {
  22604. const header = file.peekBytes(4);
  22605. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  22606. return true;
  22607. }
  22608. return false;
  22609. }
  22610. function getFontFileType(file, {
  22611. type,
  22612. subtype,
  22613. composite
  22614. }) {
  22615. let fileType, fileSubtype;
  22616. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  22617. if (composite) {
  22618. fileType = "CIDFontType2";
  22619. } else {
  22620. fileType = "TrueType";
  22621. }
  22622. } else if (isOpenTypeFile(file)) {
  22623. if (composite) {
  22624. fileType = "CIDFontType2";
  22625. } else {
  22626. fileType = "OpenType";
  22627. }
  22628. } else if (isType1File(file)) {
  22629. if (composite) {
  22630. fileType = "CIDFontType0";
  22631. } else {
  22632. fileType = type === "MMType1" ? "MMType1" : "Type1";
  22633. }
  22634. } else if (isCFFFile(file)) {
  22635. if (composite) {
  22636. fileType = "CIDFontType0";
  22637. fileSubtype = "CIDFontType0C";
  22638. } else {
  22639. fileType = type === "MMType1" ? "MMType1" : "Type1";
  22640. fileSubtype = "Type1C";
  22641. }
  22642. } else {
  22643. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  22644. fileType = type;
  22645. fileSubtype = subtype;
  22646. }
  22647. return [fileType, fileSubtype];
  22648. }
  22649. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  22650. var toFontChar = [],
  22651. unicode;
  22652. for (var i = 0, ii = encoding.length; i < ii; i++) {
  22653. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  22654. if (unicode !== -1) {
  22655. toFontChar[i] = unicode;
  22656. }
  22657. }
  22658. for (var charCode in differences) {
  22659. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  22660. if (unicode !== -1) {
  22661. toFontChar[+charCode] = unicode;
  22662. }
  22663. }
  22664. return toFontChar;
  22665. }
  22666. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  22667. var newMap = Object.create(null);
  22668. var toFontChar = [];
  22669. var privateUseAreaIndex = 0;
  22670. var nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  22671. var privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  22672. for (var originalCharCode in charCodeToGlyphId) {
  22673. originalCharCode |= 0;
  22674. var glyphId = charCodeToGlyphId[originalCharCode];
  22675. if (!hasGlyph(glyphId)) {
  22676. continue;
  22677. }
  22678. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  22679. privateUseAreaIndex++;
  22680. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  22681. (0, _util.warn)("Ran out of space in font private use area.");
  22682. break;
  22683. }
  22684. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  22685. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  22686. }
  22687. var fontCharCode = nextAvailableFontCharCode++;
  22688. if (glyphId === 0) {
  22689. glyphId = newGlyphZeroId;
  22690. }
  22691. newMap[fontCharCode] = glyphId;
  22692. toFontChar[originalCharCode] = fontCharCode;
  22693. }
  22694. return {
  22695. toFontChar,
  22696. charCodeToGlyphId: newMap,
  22697. nextAvailableFontCharCode
  22698. };
  22699. }
  22700. function getRanges(glyphs, numGlyphs) {
  22701. var codes = [];
  22702. for (var charCode in glyphs) {
  22703. if (glyphs[charCode] >= numGlyphs) {
  22704. continue;
  22705. }
  22706. codes.push({
  22707. fontCharCode: charCode | 0,
  22708. glyphId: glyphs[charCode]
  22709. });
  22710. }
  22711. if (codes.length === 0) {
  22712. codes.push({
  22713. fontCharCode: 0,
  22714. glyphId: 0
  22715. });
  22716. }
  22717. codes.sort(function fontGetRangesSort(a, b) {
  22718. return a.fontCharCode - b.fontCharCode;
  22719. });
  22720. var ranges = [];
  22721. var length = codes.length;
  22722. for (var n = 0; n < length;) {
  22723. var start = codes[n].fontCharCode;
  22724. var codeIndices = [codes[n].glyphId];
  22725. ++n;
  22726. var end = start;
  22727. while (n < length && end + 1 === codes[n].fontCharCode) {
  22728. codeIndices.push(codes[n].glyphId);
  22729. ++end;
  22730. ++n;
  22731. if (end === 0xffff) {
  22732. break;
  22733. }
  22734. }
  22735. ranges.push([start, end, codeIndices]);
  22736. }
  22737. return ranges;
  22738. }
  22739. function createCmapTable(glyphs, numGlyphs) {
  22740. var ranges = getRanges(glyphs, numGlyphs);
  22741. var numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  22742. var cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  22743. var i, ii, j, jj;
  22744. for (i = ranges.length - 1; i >= 0; --i) {
  22745. if (ranges[i][0] <= 0xffff) {
  22746. break;
  22747. }
  22748. }
  22749. var bmpLength = i + 1;
  22750. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  22751. ranges[i][1] = 0xfffe;
  22752. }
  22753. var trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  22754. var segCount = bmpLength + trailingRangesCount;
  22755. var searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  22756. var startCount = "";
  22757. var endCount = "";
  22758. var idDeltas = "";
  22759. var idRangeOffsets = "";
  22760. var glyphsIds = "";
  22761. var bias = 0;
  22762. var range, start, end, codes;
  22763. for (i = 0, ii = bmpLength; i < ii; i++) {
  22764. range = ranges[i];
  22765. start = range[0];
  22766. end = range[1];
  22767. startCount += string16(start);
  22768. endCount += string16(end);
  22769. codes = range[2];
  22770. var contiguous = true;
  22771. for (j = 1, jj = codes.length; j < jj; ++j) {
  22772. if (codes[j] !== codes[j - 1] + 1) {
  22773. contiguous = false;
  22774. break;
  22775. }
  22776. }
  22777. if (!contiguous) {
  22778. var offset = (segCount - i) * 2 + bias * 2;
  22779. bias += end - start + 1;
  22780. idDeltas += string16(0);
  22781. idRangeOffsets += string16(offset);
  22782. for (j = 0, jj = codes.length; j < jj; ++j) {
  22783. glyphsIds += string16(codes[j]);
  22784. }
  22785. } else {
  22786. var startCode = codes[0];
  22787. idDeltas += string16(startCode - start & 0xffff);
  22788. idRangeOffsets += string16(0);
  22789. }
  22790. }
  22791. if (trailingRangesCount > 0) {
  22792. endCount += "\xFF\xFF";
  22793. startCount += "\xFF\xFF";
  22794. idDeltas += "\x00\x01";
  22795. idRangeOffsets += "\x00\x00";
  22796. }
  22797. var format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  22798. var format31012 = "";
  22799. var header31012 = "";
  22800. if (numTables > 1) {
  22801. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  22802. format31012 = "";
  22803. for (i = 0, ii = ranges.length; i < ii; i++) {
  22804. range = ranges[i];
  22805. start = range[0];
  22806. codes = range[2];
  22807. var code = codes[0];
  22808. for (j = 1, jj = codes.length; j < jj; ++j) {
  22809. if (codes[j] !== codes[j - 1] + 1) {
  22810. end = range[0] + j - 1;
  22811. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  22812. start = end + 1;
  22813. code = codes[j];
  22814. }
  22815. }
  22816. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  22817. }
  22818. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  22819. }
  22820. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  22821. }
  22822. function validateOS2Table(os2, file) {
  22823. file.pos = (file.start || 0) + os2.offset;
  22824. var version = file.getUint16();
  22825. file.skip(60);
  22826. var selection = file.getUint16();
  22827. if (version < 4 && selection & 0x0300) {
  22828. return false;
  22829. }
  22830. var firstChar = file.getUint16();
  22831. var lastChar = file.getUint16();
  22832. if (firstChar > lastChar) {
  22833. return false;
  22834. }
  22835. file.skip(6);
  22836. var usWinAscent = file.getUint16();
  22837. if (usWinAscent === 0) {
  22838. return false;
  22839. }
  22840. os2.data[8] = os2.data[9] = 0;
  22841. return true;
  22842. }
  22843. function createOS2Table(properties, charstrings, override) {
  22844. override = override || {
  22845. unitsPerEm: 0,
  22846. yMax: 0,
  22847. yMin: 0,
  22848. ascent: 0,
  22849. descent: 0
  22850. };
  22851. var ulUnicodeRange1 = 0;
  22852. var ulUnicodeRange2 = 0;
  22853. var ulUnicodeRange3 = 0;
  22854. var ulUnicodeRange4 = 0;
  22855. var firstCharIndex = null;
  22856. var lastCharIndex = 0;
  22857. if (charstrings) {
  22858. for (var code in charstrings) {
  22859. code |= 0;
  22860. if (firstCharIndex > code || !firstCharIndex) {
  22861. firstCharIndex = code;
  22862. }
  22863. if (lastCharIndex < code) {
  22864. lastCharIndex = code;
  22865. }
  22866. var position = (0, _unicode.getUnicodeRangeFor)(code);
  22867. if (position < 32) {
  22868. ulUnicodeRange1 |= 1 << position;
  22869. } else if (position < 64) {
  22870. ulUnicodeRange2 |= 1 << position - 32;
  22871. } else if (position < 96) {
  22872. ulUnicodeRange3 |= 1 << position - 64;
  22873. } else if (position < 123) {
  22874. ulUnicodeRange4 |= 1 << position - 96;
  22875. } else {
  22876. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  22877. }
  22878. }
  22879. if (lastCharIndex > 0xffff) {
  22880. lastCharIndex = 0xffff;
  22881. }
  22882. } else {
  22883. firstCharIndex = 0;
  22884. lastCharIndex = 255;
  22885. }
  22886. var bbox = properties.bbox || [0, 0, 0, 0];
  22887. var unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  22888. var scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  22889. var typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  22890. var typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  22891. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  22892. typoDescent = -typoDescent;
  22893. }
  22894. var winAscent = override.yMax || typoAscent;
  22895. var winDescent = -override.yMin || -typoDescent;
  22896. 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";
  22897. }
  22898. function createPostTable(properties) {
  22899. var angle = Math.floor(properties.italicAngle * 2 ** 16);
  22900. 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";
  22901. }
  22902. function createNameTable(name, proto) {
  22903. if (!proto) {
  22904. proto = [[], []];
  22905. }
  22906. 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"];
  22907. var stringsUnicode = [];
  22908. var i, ii, j, jj, str;
  22909. for (i = 0, ii = strings.length; i < ii; i++) {
  22910. str = proto[1][i] || strings[i];
  22911. var strBufUnicode = [];
  22912. for (j = 0, jj = str.length; j < jj; j++) {
  22913. strBufUnicode.push(string16(str.charCodeAt(j)));
  22914. }
  22915. stringsUnicode.push(strBufUnicode.join(""));
  22916. }
  22917. var names = [strings, stringsUnicode];
  22918. var platforms = ["\x00\x01", "\x00\x03"];
  22919. var encodings = ["\x00\x00", "\x00\x01"];
  22920. var languages = ["\x00\x00", "\x04\x09"];
  22921. var namesRecordCount = strings.length * platforms.length;
  22922. var nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  22923. var strOffset = 0;
  22924. for (i = 0, ii = platforms.length; i < ii; i++) {
  22925. var strs = names[i];
  22926. for (j = 0, jj = strs.length; j < jj; j++) {
  22927. str = strs[j];
  22928. var nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  22929. nameTable += nameRecord;
  22930. strOffset += str.length;
  22931. }
  22932. }
  22933. nameTable += strings.join("") + stringsUnicode.join("");
  22934. return nameTable;
  22935. }
  22936. Font.prototype = {
  22937. name: null,
  22938. font: null,
  22939. mimetype: null,
  22940. disableFontFace: false,
  22941. get renderer() {
  22942. var renderer = _font_renderer.FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  22943. return (0, _util.shadow)(this, "renderer", renderer);
  22944. },
  22945. exportData(extraProperties = false) {
  22946. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  22947. const data = Object.create(null);
  22948. let property, value;
  22949. for (property of exportDataProperties) {
  22950. value = this[property];
  22951. if (value !== undefined) {
  22952. data[property] = value;
  22953. }
  22954. }
  22955. return data;
  22956. },
  22957. fallbackToSystemFont(properties) {
  22958. this.missingFile = true;
  22959. var name = this.name;
  22960. var type = this.type;
  22961. var subtype = this.subtype;
  22962. let fontName = name.replace(/[,_]/g, "-").replace(/\s/g, "");
  22963. var stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  22964. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  22965. const isStandardFont = !!stdFontMap[fontName];
  22966. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  22967. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  22968. this.bold = fontName.search(/bold/gi) !== -1;
  22969. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  22970. this.black = name.search(/Black/g) !== -1;
  22971. const isNarrow = name.search(/Narrow/g) !== -1;
  22972. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  22973. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  22974. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)(),
  22975. cidToGidMap = properties.cidToGidMap;
  22976. const map = [];
  22977. for (const charCode in GlyphMapForStandardFonts) {
  22978. map[+charCode] = GlyphMapForStandardFonts[charCode];
  22979. }
  22980. if (/Arial-?Black/i.test(name)) {
  22981. var SupplementalGlyphMapForArialBlack = (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)();
  22982. for (const charCode in SupplementalGlyphMapForArialBlack) {
  22983. map[+charCode] = SupplementalGlyphMapForArialBlack[charCode];
  22984. }
  22985. } else if (/Calibri/i.test(name)) {
  22986. const SupplementalGlyphMapForCalibri = (0, _standard_fonts.getSupplementalGlyphMapForCalibri)();
  22987. for (const charCode in SupplementalGlyphMapForCalibri) {
  22988. map[+charCode] = SupplementalGlyphMapForCalibri[charCode];
  22989. }
  22990. }
  22991. if (cidToGidMap) {
  22992. for (const charCode in map) {
  22993. const cid = map[charCode];
  22994. if (cidToGidMap[cid] !== undefined) {
  22995. map[+charCode] = cidToGidMap[cid];
  22996. }
  22997. }
  22998. }
  22999. var isIdentityUnicode = this.toUnicode instanceof IdentityToUnicodeMap;
  23000. if (!isIdentityUnicode) {
  23001. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  23002. map[+charCode] = unicodeCharCode;
  23003. });
  23004. }
  23005. this.toFontChar = map;
  23006. this.toUnicode = new ToUnicodeMap(map);
  23007. } else if (/Symbol/i.test(fontName)) {
  23008. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  23009. } else if (/Dingbats/i.test(fontName)) {
  23010. if (/Wingdings/i.test(name)) {
  23011. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  23012. }
  23013. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  23014. } else if (isStandardFont) {
  23015. this.toFontChar = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  23016. } else {
  23017. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  23018. const map = [];
  23019. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  23020. if (!this.composite) {
  23021. var glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  23022. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  23023. if (unicode !== -1) {
  23024. unicodeCharCode = unicode;
  23025. }
  23026. }
  23027. map[+charCode] = unicodeCharCode;
  23028. });
  23029. if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
  23030. if (/Verdana/i.test(name)) {
  23031. const GlyphMapForStandardFonts = (0, _standard_fonts.getGlyphMapForStandardFonts)();
  23032. for (const charCode in GlyphMapForStandardFonts) {
  23033. map[+charCode] = GlyphMapForStandardFonts[charCode];
  23034. }
  23035. }
  23036. }
  23037. this.toFontChar = map;
  23038. }
  23039. this.loadedName = fontName.split("-")[0];
  23040. this.fontType = getFontType(type, subtype);
  23041. },
  23042. checkAndRepair: function Font_checkAndRepair(name, font, properties) {
  23043. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  23044. function readTables(file, numTables) {
  23045. const tables = Object.create(null);
  23046. tables["OS/2"] = null;
  23047. tables.cmap = null;
  23048. tables.head = null;
  23049. tables.hhea = null;
  23050. tables.hmtx = null;
  23051. tables.maxp = null;
  23052. tables.name = null;
  23053. tables.post = null;
  23054. for (let i = 0; i < numTables; i++) {
  23055. const table = readTableEntry(file);
  23056. if (!VALID_TABLES.includes(table.tag)) {
  23057. continue;
  23058. }
  23059. if (table.length === 0) {
  23060. continue;
  23061. }
  23062. tables[table.tag] = table;
  23063. }
  23064. return tables;
  23065. }
  23066. function readTableEntry(file) {
  23067. var tag = (0, _util.bytesToString)(file.getBytes(4));
  23068. var checksum = file.getInt32() >>> 0;
  23069. var offset = file.getInt32() >>> 0;
  23070. var length = file.getInt32() >>> 0;
  23071. var previousPosition = file.pos;
  23072. file.pos = file.start ? file.start : 0;
  23073. file.skip(offset);
  23074. var data = file.getBytes(length);
  23075. file.pos = previousPosition;
  23076. if (tag === "head") {
  23077. data[8] = data[9] = data[10] = data[11] = 0;
  23078. data[17] |= 0x20;
  23079. }
  23080. return {
  23081. tag,
  23082. checksum,
  23083. length,
  23084. offset,
  23085. data
  23086. };
  23087. }
  23088. function readOpenTypeHeader(ttf) {
  23089. return {
  23090. version: (0, _util.bytesToString)(ttf.getBytes(4)),
  23091. numTables: ttf.getUint16(),
  23092. searchRange: ttf.getUint16(),
  23093. entrySelector: ttf.getUint16(),
  23094. rangeShift: ttf.getUint16()
  23095. };
  23096. }
  23097. function readTrueTypeCollectionHeader(ttc) {
  23098. const ttcTag = (0, _util.bytesToString)(ttc.getBytes(4));
  23099. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  23100. const majorVersion = ttc.getUint16();
  23101. const minorVersion = ttc.getUint16();
  23102. const numFonts = ttc.getInt32() >>> 0;
  23103. const offsetTable = [];
  23104. for (let i = 0; i < numFonts; i++) {
  23105. offsetTable.push(ttc.getInt32() >>> 0);
  23106. }
  23107. const header = {
  23108. ttcTag,
  23109. majorVersion,
  23110. minorVersion,
  23111. numFonts,
  23112. offsetTable
  23113. };
  23114. switch (majorVersion) {
  23115. case 1:
  23116. return header;
  23117. case 2:
  23118. header.dsigTag = ttc.getInt32() >>> 0;
  23119. header.dsigLength = ttc.getInt32() >>> 0;
  23120. header.dsigOffset = ttc.getInt32() >>> 0;
  23121. return header;
  23122. }
  23123. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  23124. }
  23125. function readTrueTypeCollectionData(ttc, fontName) {
  23126. const {
  23127. numFonts,
  23128. offsetTable
  23129. } = readTrueTypeCollectionHeader(ttc);
  23130. for (let i = 0; i < numFonts; i++) {
  23131. ttc.pos = (ttc.start || 0) + offsetTable[i];
  23132. const potentialHeader = readOpenTypeHeader(ttc);
  23133. const potentialTables = readTables(ttc, potentialHeader.numTables);
  23134. if (!potentialTables.name) {
  23135. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  23136. }
  23137. const nameTable = readNameTable(potentialTables.name);
  23138. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  23139. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  23140. const nameEntry = nameTable[j][k];
  23141. if (nameEntry && nameEntry.replace(/\s/g, "") === fontName) {
  23142. return {
  23143. header: potentialHeader,
  23144. tables: potentialTables
  23145. };
  23146. }
  23147. }
  23148. }
  23149. }
  23150. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  23151. }
  23152. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  23153. if (!cmap) {
  23154. (0, _util.warn)("No cmap table available.");
  23155. return {
  23156. platformId: -1,
  23157. encodingId: -1,
  23158. mappings: [],
  23159. hasShortCmap: false
  23160. };
  23161. }
  23162. var segment;
  23163. var start = (file.start ? file.start : 0) + cmap.offset;
  23164. file.pos = start;
  23165. file.skip(2);
  23166. var numTables = file.getUint16();
  23167. var potentialTable;
  23168. var canBreak = false;
  23169. for (var i = 0; i < numTables; i++) {
  23170. var platformId = file.getUint16();
  23171. var encodingId = file.getUint16();
  23172. var offset = file.getInt32() >>> 0;
  23173. var useTable = false;
  23174. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  23175. continue;
  23176. }
  23177. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  23178. useTable = true;
  23179. } else if (platformId === 1 && encodingId === 0) {
  23180. useTable = true;
  23181. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  23182. useTable = true;
  23183. if (!isSymbolicFont) {
  23184. canBreak = true;
  23185. }
  23186. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  23187. useTable = true;
  23188. canBreak = true;
  23189. }
  23190. if (useTable) {
  23191. potentialTable = {
  23192. platformId,
  23193. encodingId,
  23194. offset
  23195. };
  23196. }
  23197. if (canBreak) {
  23198. break;
  23199. }
  23200. }
  23201. if (potentialTable) {
  23202. file.pos = start + potentialTable.offset;
  23203. }
  23204. if (!potentialTable || file.peekByte() === -1) {
  23205. (0, _util.warn)("Could not find a preferred cmap table.");
  23206. return {
  23207. platformId: -1,
  23208. encodingId: -1,
  23209. mappings: [],
  23210. hasShortCmap: false
  23211. };
  23212. }
  23213. var format = file.getUint16();
  23214. file.skip(2 + 2);
  23215. var hasShortCmap = false;
  23216. var mappings = [];
  23217. var j, glyphId;
  23218. if (format === 0) {
  23219. for (j = 0; j < 256; j++) {
  23220. var index = file.getByte();
  23221. if (!index) {
  23222. continue;
  23223. }
  23224. mappings.push({
  23225. charCode: j,
  23226. glyphId: index
  23227. });
  23228. }
  23229. hasShortCmap = true;
  23230. } else if (format === 4) {
  23231. var segCount = file.getUint16() >> 1;
  23232. file.skip(6);
  23233. var segIndex,
  23234. segments = [];
  23235. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23236. segments.push({
  23237. end: file.getUint16()
  23238. });
  23239. }
  23240. file.skip(2);
  23241. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23242. segments[segIndex].start = file.getUint16();
  23243. }
  23244. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23245. segments[segIndex].delta = file.getUint16();
  23246. }
  23247. var offsetsCount = 0;
  23248. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23249. segment = segments[segIndex];
  23250. var rangeOffset = file.getUint16();
  23251. if (!rangeOffset) {
  23252. segment.offsetIndex = -1;
  23253. continue;
  23254. }
  23255. var offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  23256. segment.offsetIndex = offsetIndex;
  23257. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  23258. }
  23259. var offsets = [];
  23260. for (j = 0; j < offsetsCount; j++) {
  23261. offsets.push(file.getUint16());
  23262. }
  23263. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23264. segment = segments[segIndex];
  23265. start = segment.start;
  23266. var end = segment.end;
  23267. var delta = segment.delta;
  23268. offsetIndex = segment.offsetIndex;
  23269. for (j = start; j <= end; j++) {
  23270. if (j === 0xffff) {
  23271. continue;
  23272. }
  23273. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  23274. glyphId = glyphId + delta & 0xffff;
  23275. mappings.push({
  23276. charCode: j,
  23277. glyphId
  23278. });
  23279. }
  23280. }
  23281. } else if (format === 6) {
  23282. var firstCode = file.getUint16();
  23283. var entryCount = file.getUint16();
  23284. for (j = 0; j < entryCount; j++) {
  23285. glyphId = file.getUint16();
  23286. var charCode = firstCode + j;
  23287. mappings.push({
  23288. charCode,
  23289. glyphId
  23290. });
  23291. }
  23292. } else {
  23293. (0, _util.warn)("cmap table has unsupported format: " + format);
  23294. return {
  23295. platformId: -1,
  23296. encodingId: -1,
  23297. mappings: [],
  23298. hasShortCmap: false
  23299. };
  23300. }
  23301. mappings.sort(function (a, b) {
  23302. return a.charCode - b.charCode;
  23303. });
  23304. for (i = 1; i < mappings.length; i++) {
  23305. if (mappings[i - 1].charCode === mappings[i].charCode) {
  23306. mappings.splice(i, 1);
  23307. i--;
  23308. }
  23309. }
  23310. return {
  23311. platformId: potentialTable.platformId,
  23312. encodingId: potentialTable.encodingId,
  23313. mappings,
  23314. hasShortCmap
  23315. };
  23316. }
  23317. function sanitizeMetrics(file, header, metrics, numGlyphs, dupFirstEntry) {
  23318. if (!header) {
  23319. if (metrics) {
  23320. metrics.data = null;
  23321. }
  23322. return;
  23323. }
  23324. file.pos = (file.start ? file.start : 0) + header.offset;
  23325. file.pos += 4;
  23326. file.pos += 2;
  23327. file.pos += 2;
  23328. file.pos += 2;
  23329. file.pos += 2;
  23330. file.pos += 2;
  23331. file.pos += 2;
  23332. file.pos += 2;
  23333. file.pos += 2;
  23334. file.pos += 2;
  23335. file.pos += 2;
  23336. file.pos += 8;
  23337. file.pos += 2;
  23338. var numOfMetrics = file.getUint16();
  23339. if (numOfMetrics > numGlyphs) {
  23340. (0, _util.info)("The numOfMetrics (" + numOfMetrics + ") should not be " + "greater than the numGlyphs (" + numGlyphs + ")");
  23341. numOfMetrics = numGlyphs;
  23342. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  23343. header.data[35] = numOfMetrics & 0x00ff;
  23344. }
  23345. var numOfSidebearings = numGlyphs - numOfMetrics;
  23346. var numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  23347. if (numMissing > 0) {
  23348. var entries = new Uint8Array(metrics.length + numMissing * 2);
  23349. entries.set(metrics.data);
  23350. if (dupFirstEntry) {
  23351. entries[metrics.length] = metrics.data[2];
  23352. entries[metrics.length + 1] = metrics.data[3];
  23353. }
  23354. metrics.data = entries;
  23355. }
  23356. }
  23357. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  23358. var glyphProfile = {
  23359. length: 0,
  23360. sizeOfInstructions: 0
  23361. };
  23362. if (sourceEnd - sourceStart <= 12) {
  23363. return glyphProfile;
  23364. }
  23365. var glyf = source.subarray(sourceStart, sourceEnd);
  23366. var contoursCount = signedInt16(glyf[0], glyf[1]);
  23367. if (contoursCount < 0) {
  23368. contoursCount = -1;
  23369. writeSignedInt16(glyf, 0, contoursCount);
  23370. dest.set(glyf, destStart);
  23371. glyphProfile.length = glyf.length;
  23372. return glyphProfile;
  23373. }
  23374. var i,
  23375. j = 10,
  23376. flagsCount = 0;
  23377. for (i = 0; i < contoursCount; i++) {
  23378. var endPoint = glyf[j] << 8 | glyf[j + 1];
  23379. flagsCount = endPoint + 1;
  23380. j += 2;
  23381. }
  23382. var instructionsStart = j;
  23383. var instructionsLength = glyf[j] << 8 | glyf[j + 1];
  23384. glyphProfile.sizeOfInstructions = instructionsLength;
  23385. j += 2 + instructionsLength;
  23386. var instructionsEnd = j;
  23387. var coordinatesLength = 0;
  23388. for (i = 0; i < flagsCount; i++) {
  23389. var flag = glyf[j++];
  23390. if (flag & 0xc0) {
  23391. glyf[j - 1] = flag & 0x3f;
  23392. }
  23393. let xLength = 2;
  23394. if (flag & 2) {
  23395. xLength = 1;
  23396. } else if (flag & 16) {
  23397. xLength = 0;
  23398. }
  23399. let yLength = 2;
  23400. if (flag & 4) {
  23401. yLength = 1;
  23402. } else if (flag & 32) {
  23403. yLength = 0;
  23404. }
  23405. const xyLength = xLength + yLength;
  23406. coordinatesLength += xyLength;
  23407. if (flag & 8) {
  23408. var repeat = glyf[j++];
  23409. i += repeat;
  23410. coordinatesLength += repeat * xyLength;
  23411. }
  23412. }
  23413. if (coordinatesLength === 0) {
  23414. return glyphProfile;
  23415. }
  23416. var glyphDataLength = j + coordinatesLength;
  23417. if (glyphDataLength > glyf.length) {
  23418. return glyphProfile;
  23419. }
  23420. if (!hintsValid && instructionsLength > 0) {
  23421. dest.set(glyf.subarray(0, instructionsStart), destStart);
  23422. dest.set([0, 0], destStart + instructionsStart);
  23423. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  23424. glyphDataLength -= instructionsLength;
  23425. if (glyf.length - glyphDataLength > 3) {
  23426. glyphDataLength = glyphDataLength + 3 & ~3;
  23427. }
  23428. glyphProfile.length = glyphDataLength;
  23429. return glyphProfile;
  23430. }
  23431. if (glyf.length - glyphDataLength > 3) {
  23432. glyphDataLength = glyphDataLength + 3 & ~3;
  23433. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  23434. glyphProfile.length = glyphDataLength;
  23435. return glyphProfile;
  23436. }
  23437. dest.set(glyf, destStart);
  23438. glyphProfile.length = glyf.length;
  23439. return glyphProfile;
  23440. }
  23441. function sanitizeHead(head, numGlyphs, locaLength) {
  23442. var data = head.data;
  23443. var version = int32(data[0], data[1], data[2], data[3]);
  23444. if (version >> 16 !== 1) {
  23445. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  23446. data[0] = 0;
  23447. data[1] = 1;
  23448. data[2] = 0;
  23449. data[3] = 0;
  23450. }
  23451. var indexToLocFormat = int16(data[50], data[51]);
  23452. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  23453. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  23454. var numGlyphsPlusOne = numGlyphs + 1;
  23455. if (locaLength === numGlyphsPlusOne << 1) {
  23456. data[50] = 0;
  23457. data[51] = 0;
  23458. } else if (locaLength === numGlyphsPlusOne << 2) {
  23459. data[50] = 0;
  23460. data[51] = 1;
  23461. } else {
  23462. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  23463. }
  23464. }
  23465. }
  23466. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  23467. var itemSize, itemDecode, itemEncode;
  23468. if (isGlyphLocationsLong) {
  23469. itemSize = 4;
  23470. itemDecode = function fontItemDecodeLong(data, offset) {
  23471. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  23472. };
  23473. itemEncode = function fontItemEncodeLong(data, offset, value) {
  23474. data[offset] = value >>> 24 & 0xff;
  23475. data[offset + 1] = value >> 16 & 0xff;
  23476. data[offset + 2] = value >> 8 & 0xff;
  23477. data[offset + 3] = value & 0xff;
  23478. };
  23479. } else {
  23480. itemSize = 2;
  23481. itemDecode = function fontItemDecode(data, offset) {
  23482. return data[offset] << 9 | data[offset + 1] << 1;
  23483. };
  23484. itemEncode = function fontItemEncode(data, offset, value) {
  23485. data[offset] = value >> 9 & 0xff;
  23486. data[offset + 1] = value >> 1 & 0xff;
  23487. };
  23488. }
  23489. var numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  23490. var locaDataSize = itemSize * (1 + numGlyphsOut);
  23491. var locaData = new Uint8Array(locaDataSize);
  23492. locaData.set(loca.data.subarray(0, locaDataSize));
  23493. loca.data = locaData;
  23494. var oldGlyfData = glyf.data;
  23495. var oldGlyfDataLength = oldGlyfData.length;
  23496. var newGlyfData = new Uint8Array(oldGlyfDataLength);
  23497. var i, j;
  23498. const locaEntries = [];
  23499. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  23500. let offset = itemDecode(locaData, j);
  23501. if (offset > oldGlyfDataLength) {
  23502. offset = oldGlyfDataLength;
  23503. }
  23504. locaEntries.push({
  23505. index: i,
  23506. offset,
  23507. endOffset: 0
  23508. });
  23509. }
  23510. locaEntries.sort((a, b) => {
  23511. return a.offset - b.offset;
  23512. });
  23513. for (i = 0; i < numGlyphs; i++) {
  23514. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  23515. }
  23516. locaEntries.sort((a, b) => {
  23517. return a.index - b.index;
  23518. });
  23519. var missingGlyphs = Object.create(null);
  23520. var writeOffset = 0;
  23521. itemEncode(locaData, 0, writeOffset);
  23522. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  23523. var glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  23524. var newLength = glyphProfile.length;
  23525. if (newLength === 0) {
  23526. missingGlyphs[i] = true;
  23527. }
  23528. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  23529. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  23530. }
  23531. writeOffset += newLength;
  23532. itemEncode(locaData, j, writeOffset);
  23533. }
  23534. if (writeOffset === 0) {
  23535. var simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  23536. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  23537. itemEncode(locaData, j, simpleGlyph.length);
  23538. }
  23539. glyf.data = simpleGlyph;
  23540. } else if (dupFirstEntry) {
  23541. var firstEntryLength = itemDecode(locaData, itemSize);
  23542. if (newGlyfData.length > firstEntryLength + writeOffset) {
  23543. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  23544. } else {
  23545. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  23546. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  23547. }
  23548. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  23549. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  23550. } else {
  23551. glyf.data = newGlyfData.subarray(0, writeOffset);
  23552. }
  23553. return {
  23554. missingGlyphs,
  23555. maxSizeOfInstructions
  23556. };
  23557. }
  23558. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  23559. var start = (font.start ? font.start : 0) + post.offset;
  23560. font.pos = start;
  23561. var length = post.length,
  23562. end = start + length;
  23563. var version = font.getInt32();
  23564. font.skip(28);
  23565. var glyphNames;
  23566. var valid = true;
  23567. var i;
  23568. switch (version) {
  23569. case 0x00010000:
  23570. glyphNames = MacStandardGlyphOrdering;
  23571. break;
  23572. case 0x00020000:
  23573. var numGlyphs = font.getUint16();
  23574. if (numGlyphs !== maxpNumGlyphs) {
  23575. valid = false;
  23576. break;
  23577. }
  23578. var glyphNameIndexes = [];
  23579. for (i = 0; i < numGlyphs; ++i) {
  23580. var index = font.getUint16();
  23581. if (index >= 32768) {
  23582. valid = false;
  23583. break;
  23584. }
  23585. glyphNameIndexes.push(index);
  23586. }
  23587. if (!valid) {
  23588. break;
  23589. }
  23590. var customNames = [];
  23591. var strBuf = [];
  23592. while (font.pos < end) {
  23593. var stringLength = font.getByte();
  23594. strBuf.length = stringLength;
  23595. for (i = 0; i < stringLength; ++i) {
  23596. strBuf[i] = String.fromCharCode(font.getByte());
  23597. }
  23598. customNames.push(strBuf.join(""));
  23599. }
  23600. glyphNames = [];
  23601. for (i = 0; i < numGlyphs; ++i) {
  23602. var j = glyphNameIndexes[i];
  23603. if (j < 258) {
  23604. glyphNames.push(MacStandardGlyphOrdering[j]);
  23605. continue;
  23606. }
  23607. glyphNames.push(customNames[j - 258]);
  23608. }
  23609. break;
  23610. case 0x00030000:
  23611. break;
  23612. default:
  23613. (0, _util.warn)("Unknown/unsupported post table version " + version);
  23614. valid = false;
  23615. if (propertiesObj.defaultEncoding) {
  23616. glyphNames = propertiesObj.defaultEncoding;
  23617. }
  23618. break;
  23619. }
  23620. propertiesObj.glyphNames = glyphNames;
  23621. return valid;
  23622. }
  23623. function readNameTable(nameTable) {
  23624. var start = (font.start ? font.start : 0) + nameTable.offset;
  23625. font.pos = start;
  23626. var names = [[], []];
  23627. var length = nameTable.length,
  23628. end = start + length;
  23629. var format = font.getUint16();
  23630. var FORMAT_0_HEADER_LENGTH = 6;
  23631. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  23632. return names;
  23633. }
  23634. var numRecords = font.getUint16();
  23635. var stringsStart = font.getUint16();
  23636. var records = [];
  23637. var NAME_RECORD_LENGTH = 12;
  23638. var i, ii;
  23639. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  23640. var r = {
  23641. platform: font.getUint16(),
  23642. encoding: font.getUint16(),
  23643. language: font.getUint16(),
  23644. name: font.getUint16(),
  23645. length: font.getUint16(),
  23646. offset: font.getUint16()
  23647. };
  23648. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  23649. records.push(r);
  23650. }
  23651. }
  23652. for (i = 0, ii = records.length; i < ii; i++) {
  23653. var record = records[i];
  23654. if (record.length <= 0) {
  23655. continue;
  23656. }
  23657. var pos = start + stringsStart + record.offset;
  23658. if (pos + record.length > end) {
  23659. continue;
  23660. }
  23661. font.pos = pos;
  23662. var nameIndex = record.name;
  23663. if (record.encoding) {
  23664. var str = "";
  23665. for (var j = 0, jj = record.length; j < jj; j += 2) {
  23666. str += String.fromCharCode(font.getUint16());
  23667. }
  23668. names[1][nameIndex] = str;
  23669. } else {
  23670. names[0][nameIndex] = (0, _util.bytesToString)(font.getBytes(record.length));
  23671. }
  23672. }
  23673. return names;
  23674. }
  23675. 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];
  23676. function sanitizeTTProgram(table, ttContext) {
  23677. var data = table.data;
  23678. var i = 0,
  23679. j,
  23680. n,
  23681. b,
  23682. funcId,
  23683. pc,
  23684. lastEndf = 0,
  23685. lastDeff = 0;
  23686. var stack = [];
  23687. var callstack = [];
  23688. var functionsCalled = [];
  23689. var tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  23690. var inFDEF = false,
  23691. ifLevel = 0,
  23692. inELSE = 0;
  23693. for (var ii = data.length; i < ii;) {
  23694. var op = data[i++];
  23695. if (op === 0x40) {
  23696. n = data[i++];
  23697. if (inFDEF || inELSE) {
  23698. i += n;
  23699. } else {
  23700. for (j = 0; j < n; j++) {
  23701. stack.push(data[i++]);
  23702. }
  23703. }
  23704. } else if (op === 0x41) {
  23705. n = data[i++];
  23706. if (inFDEF || inELSE) {
  23707. i += n * 2;
  23708. } else {
  23709. for (j = 0; j < n; j++) {
  23710. b = data[i++];
  23711. stack.push(b << 8 | data[i++]);
  23712. }
  23713. }
  23714. } else if ((op & 0xf8) === 0xb0) {
  23715. n = op - 0xb0 + 1;
  23716. if (inFDEF || inELSE) {
  23717. i += n;
  23718. } else {
  23719. for (j = 0; j < n; j++) {
  23720. stack.push(data[i++]);
  23721. }
  23722. }
  23723. } else if ((op & 0xf8) === 0xb8) {
  23724. n = op - 0xb8 + 1;
  23725. if (inFDEF || inELSE) {
  23726. i += n * 2;
  23727. } else {
  23728. for (j = 0; j < n; j++) {
  23729. b = data[i++];
  23730. stack.push(b << 8 | data[i++]);
  23731. }
  23732. }
  23733. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  23734. if (!inFDEF && !inELSE) {
  23735. funcId = stack[stack.length - 1];
  23736. if (isNaN(funcId)) {
  23737. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  23738. } else {
  23739. ttContext.functionsUsed[funcId] = true;
  23740. if (funcId in ttContext.functionsStackDeltas) {
  23741. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  23742. if (newStackLength < 0) {
  23743. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  23744. ttContext.hintsValid = false;
  23745. return;
  23746. }
  23747. stack.length = newStackLength;
  23748. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  23749. callstack.push({
  23750. data,
  23751. i,
  23752. stackTop: stack.length - 1
  23753. });
  23754. functionsCalled.push(funcId);
  23755. pc = ttContext.functionsDefined[funcId];
  23756. if (!pc) {
  23757. (0, _util.warn)("TT: CALL non-existent function");
  23758. ttContext.hintsValid = false;
  23759. return;
  23760. }
  23761. data = pc.data;
  23762. i = pc.i;
  23763. }
  23764. }
  23765. }
  23766. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  23767. if (inFDEF || inELSE) {
  23768. (0, _util.warn)("TT: nested FDEFs not allowed");
  23769. tooComplexToFollowFunctions = true;
  23770. }
  23771. inFDEF = true;
  23772. lastDeff = i;
  23773. funcId = stack.pop();
  23774. ttContext.functionsDefined[funcId] = {
  23775. data,
  23776. i
  23777. };
  23778. } else if (op === 0x2d) {
  23779. if (inFDEF) {
  23780. inFDEF = false;
  23781. lastEndf = i;
  23782. } else {
  23783. pc = callstack.pop();
  23784. if (!pc) {
  23785. (0, _util.warn)("TT: ENDF bad stack");
  23786. ttContext.hintsValid = false;
  23787. return;
  23788. }
  23789. funcId = functionsCalled.pop();
  23790. data = pc.data;
  23791. i = pc.i;
  23792. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  23793. }
  23794. } else if (op === 0x89) {
  23795. if (inFDEF || inELSE) {
  23796. (0, _util.warn)("TT: nested IDEFs not allowed");
  23797. tooComplexToFollowFunctions = true;
  23798. }
  23799. inFDEF = true;
  23800. lastDeff = i;
  23801. } else if (op === 0x58) {
  23802. ++ifLevel;
  23803. } else if (op === 0x1b) {
  23804. inELSE = ifLevel;
  23805. } else if (op === 0x59) {
  23806. if (inELSE === ifLevel) {
  23807. inELSE = 0;
  23808. }
  23809. --ifLevel;
  23810. } else if (op === 0x1c) {
  23811. if (!inFDEF && !inELSE) {
  23812. var offset = stack[stack.length - 1];
  23813. if (offset > 0) {
  23814. i += offset - 1;
  23815. }
  23816. }
  23817. }
  23818. if (!inFDEF && !inELSE) {
  23819. let stackDelta = 0;
  23820. if (op <= 0x8e) {
  23821. stackDelta = TTOpsStackDeltas[op];
  23822. } else if (op >= 0xc0 && op <= 0xdf) {
  23823. stackDelta = -1;
  23824. } else if (op >= 0xe0) {
  23825. stackDelta = -2;
  23826. }
  23827. if (op >= 0x71 && op <= 0x75) {
  23828. n = stack.pop();
  23829. if (!isNaN(n)) {
  23830. stackDelta = -n * 2;
  23831. }
  23832. }
  23833. while (stackDelta < 0 && stack.length > 0) {
  23834. stack.pop();
  23835. stackDelta++;
  23836. }
  23837. while (stackDelta > 0) {
  23838. stack.push(NaN);
  23839. stackDelta--;
  23840. }
  23841. }
  23842. }
  23843. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  23844. var content = [data];
  23845. if (i > data.length) {
  23846. content.push(new Uint8Array(i - data.length));
  23847. }
  23848. if (lastDeff > lastEndf) {
  23849. (0, _util.warn)("TT: complementing a missing function tail");
  23850. content.push(new Uint8Array([0x22, 0x2d]));
  23851. }
  23852. foldTTTable(table, content);
  23853. }
  23854. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  23855. if (ttContext.tooComplexToFollowFunctions) {
  23856. return;
  23857. }
  23858. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  23859. (0, _util.warn)("TT: more functions defined than expected");
  23860. ttContext.hintsValid = false;
  23861. return;
  23862. }
  23863. for (var j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  23864. if (j > maxFunctionDefs) {
  23865. (0, _util.warn)("TT: invalid function id: " + j);
  23866. ttContext.hintsValid = false;
  23867. return;
  23868. }
  23869. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  23870. (0, _util.warn)("TT: undefined function: " + j);
  23871. ttContext.hintsValid = false;
  23872. return;
  23873. }
  23874. }
  23875. }
  23876. function foldTTTable(table, content) {
  23877. if (content.length > 1) {
  23878. var newLength = 0;
  23879. var j, jj;
  23880. for (j = 0, jj = content.length; j < jj; j++) {
  23881. newLength += content[j].length;
  23882. }
  23883. newLength = newLength + 3 & ~3;
  23884. var result = new Uint8Array(newLength);
  23885. var pos = 0;
  23886. for (j = 0, jj = content.length; j < jj; j++) {
  23887. result.set(content[j], pos);
  23888. pos += content[j].length;
  23889. }
  23890. table.data = result;
  23891. table.length = newLength;
  23892. }
  23893. }
  23894. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  23895. var ttContext = {
  23896. functionsDefined: [],
  23897. functionsUsed: [],
  23898. functionsStackDeltas: [],
  23899. tooComplexToFollowFunctions: false,
  23900. hintsValid: true
  23901. };
  23902. if (fpgm) {
  23903. sanitizeTTProgram(fpgm, ttContext);
  23904. }
  23905. if (prep) {
  23906. sanitizeTTProgram(prep, ttContext);
  23907. }
  23908. if (fpgm) {
  23909. checkInvalidFunctions(ttContext, maxFunctionDefs);
  23910. }
  23911. if (cvt && cvt.length & 1) {
  23912. var cvtData = new Uint8Array(cvt.length + 1);
  23913. cvtData.set(cvt.data);
  23914. cvt.data = cvtData;
  23915. }
  23916. return ttContext.hintsValid;
  23917. }
  23918. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  23919. let header, tables;
  23920. if (isTrueTypeCollectionFile(font)) {
  23921. const ttcData = readTrueTypeCollectionData(font, this.name);
  23922. header = ttcData.header;
  23923. tables = ttcData.tables;
  23924. } else {
  23925. header = readOpenTypeHeader(font);
  23926. tables = readTables(font, header.numTables);
  23927. }
  23928. let cff, cffFile;
  23929. var isTrueType = !tables["CFF "];
  23930. if (!isTrueType) {
  23931. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  23932. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  23933. cffFile = new _stream.Stream(tables["CFF "].data);
  23934. cff = new CFFFont(cffFile, properties);
  23935. adjustWidths(properties);
  23936. return this.convert(name, cff, properties);
  23937. }
  23938. delete tables.glyf;
  23939. delete tables.loca;
  23940. delete tables.fpgm;
  23941. delete tables.prep;
  23942. delete tables["cvt "];
  23943. this.isOpenType = true;
  23944. } else {
  23945. if (!tables.loca) {
  23946. throw new _util.FormatError('Required "loca" table is not found');
  23947. }
  23948. if (!tables.glyf) {
  23949. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  23950. tables.glyf = {
  23951. tag: "glyf",
  23952. data: new Uint8Array(0)
  23953. };
  23954. }
  23955. this.isOpenType = false;
  23956. }
  23957. if (!tables.maxp) {
  23958. throw new _util.FormatError('Required "maxp" table is not found');
  23959. }
  23960. font.pos = (font.start || 0) + tables.maxp.offset;
  23961. var version = font.getInt32();
  23962. const numGlyphs = font.getUint16();
  23963. let numGlyphsOut = numGlyphs + 1;
  23964. let dupFirstEntry = true;
  23965. if (numGlyphsOut > 0xffff) {
  23966. dupFirstEntry = false;
  23967. numGlyphsOut = numGlyphs;
  23968. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  23969. }
  23970. var maxFunctionDefs = 0;
  23971. var maxSizeOfInstructions = 0;
  23972. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  23973. font.pos += 8;
  23974. var maxZones = font.getUint16();
  23975. if (maxZones > 2) {
  23976. tables.maxp.data[14] = 0;
  23977. tables.maxp.data[15] = 2;
  23978. }
  23979. font.pos += 4;
  23980. maxFunctionDefs = font.getUint16();
  23981. font.pos += 4;
  23982. maxSizeOfInstructions = font.getUint16();
  23983. }
  23984. tables.maxp.data[4] = numGlyphsOut >> 8;
  23985. tables.maxp.data[5] = numGlyphsOut & 255;
  23986. var hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  23987. if (!hintsValid) {
  23988. delete tables.fpgm;
  23989. delete tables.prep;
  23990. delete tables["cvt "];
  23991. }
  23992. sanitizeMetrics(font, tables.hhea, tables.hmtx, numGlyphsOut, dupFirstEntry);
  23993. if (!tables.head) {
  23994. throw new _util.FormatError('Required "head" table is not found');
  23995. }
  23996. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  23997. var missingGlyphs = Object.create(null);
  23998. if (isTrueType) {
  23999. var isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  24000. var glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  24001. missingGlyphs = glyphsInfo.missingGlyphs;
  24002. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  24003. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  24004. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  24005. }
  24006. }
  24007. if (!tables.hhea) {
  24008. throw new _util.FormatError('Required "hhea" table is not found');
  24009. }
  24010. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  24011. tables.hhea.data[10] = 0xff;
  24012. tables.hhea.data[11] = 0xff;
  24013. }
  24014. var metricsOverride = {
  24015. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  24016. yMax: int16(tables.head.data[42], tables.head.data[43]),
  24017. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  24018. ascent: int16(tables.hhea.data[4], tables.hhea.data[5]),
  24019. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7])
  24020. };
  24021. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  24022. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  24023. if (tables.post) {
  24024. readPostScriptTable(tables.post, properties, numGlyphs);
  24025. }
  24026. tables.post = {
  24027. tag: "post",
  24028. data: createPostTable(properties)
  24029. };
  24030. const charCodeToGlyphId = [];
  24031. function hasGlyph(glyphId) {
  24032. return !missingGlyphs[glyphId];
  24033. }
  24034. if (properties.composite) {
  24035. var cidToGidMap = properties.cidToGidMap || [];
  24036. var isCidToGidMapEmpty = cidToGidMap.length === 0;
  24037. properties.cMap.forEach(function (charCode, cid) {
  24038. if (cid > 0xffff) {
  24039. throw new _util.FormatError("Max size of CID is 65,535");
  24040. }
  24041. var glyphId = -1;
  24042. if (isCidToGidMapEmpty) {
  24043. glyphId = cid;
  24044. } else if (cidToGidMap[cid] !== undefined) {
  24045. glyphId = cidToGidMap[cid];
  24046. }
  24047. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  24048. charCodeToGlyphId[charCode] = glyphId;
  24049. }
  24050. });
  24051. } else {
  24052. var cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  24053. var cmapPlatformId = cmapTable.platformId;
  24054. var cmapEncodingId = cmapTable.encodingId;
  24055. var cmapMappings = cmapTable.mappings;
  24056. var cmapMappingsLength = cmapMappings.length;
  24057. let baseEncoding = [];
  24058. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  24059. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  24060. }
  24061. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  24062. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24063. for (let charCode = 0; charCode < 256; charCode++) {
  24064. var glyphName, standardGlyphName;
  24065. if (this.differences && charCode in this.differences) {
  24066. glyphName = this.differences[charCode];
  24067. } else if (charCode in baseEncoding && baseEncoding[charCode] !== "") {
  24068. glyphName = baseEncoding[charCode];
  24069. } else {
  24070. glyphName = _encodings.StandardEncoding[charCode];
  24071. }
  24072. if (!glyphName) {
  24073. continue;
  24074. }
  24075. standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  24076. var unicodeOrCharCode;
  24077. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  24078. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  24079. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  24080. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  24081. }
  24082. for (let i = 0; i < cmapMappingsLength; ++i) {
  24083. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  24084. continue;
  24085. }
  24086. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  24087. break;
  24088. }
  24089. }
  24090. } else if (cmapPlatformId === 0) {
  24091. for (let i = 0; i < cmapMappingsLength; ++i) {
  24092. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  24093. }
  24094. } else {
  24095. for (let i = 0; i < cmapMappingsLength; ++i) {
  24096. let charCode = cmapMappings[i].charCode;
  24097. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  24098. charCode &= 0xff;
  24099. }
  24100. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  24101. }
  24102. }
  24103. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  24104. for (let i = 0; i < 256; ++i) {
  24105. if (charCodeToGlyphId[i] !== undefined) {
  24106. continue;
  24107. }
  24108. glyphName = this.differences[i] || baseEncoding[i];
  24109. if (!glyphName) {
  24110. continue;
  24111. }
  24112. const glyphId = properties.glyphNames.indexOf(glyphName);
  24113. if (glyphId > 0 && hasGlyph(glyphId)) {
  24114. charCodeToGlyphId[i] = glyphId;
  24115. }
  24116. }
  24117. }
  24118. }
  24119. if (charCodeToGlyphId.length === 0) {
  24120. charCodeToGlyphId[0] = 0;
  24121. }
  24122. let glyphZeroId = numGlyphsOut - 1;
  24123. if (!dupFirstEntry) {
  24124. glyphZeroId = 0;
  24125. }
  24126. var newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  24127. this.toFontChar = newMapping.toFontChar;
  24128. tables.cmap = {
  24129. tag: "cmap",
  24130. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  24131. };
  24132. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  24133. tables["OS/2"] = {
  24134. tag: "OS/2",
  24135. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  24136. };
  24137. }
  24138. if (!isTrueType) {
  24139. try {
  24140. cffFile = new _stream.Stream(tables["CFF "].data);
  24141. var parser = new _cff_parser.CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  24142. cff = parser.parse();
  24143. cff.duplicateFirstGlyph();
  24144. var compiler = new _cff_parser.CFFCompiler(cff);
  24145. tables["CFF "].data = compiler.compile();
  24146. } catch (e) {
  24147. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  24148. }
  24149. }
  24150. if (!tables.name) {
  24151. tables.name = {
  24152. tag: "name",
  24153. data: createNameTable(this.name)
  24154. };
  24155. } else {
  24156. var namePrototype = readNameTable(tables.name);
  24157. tables.name.data = createNameTable(name, namePrototype);
  24158. }
  24159. var builder = new OpenTypeFileBuilder(header.version);
  24160. for (var tableTag in tables) {
  24161. builder.addTable(tableTag, tables[tableTag].data);
  24162. }
  24163. return builder.toArray();
  24164. },
  24165. convert: function Font_convert(fontName, font, properties) {
  24166. properties.fixedPitch = false;
  24167. if (properties.builtInEncoding) {
  24168. adjustToUnicode(properties, properties.builtInEncoding);
  24169. }
  24170. let glyphZeroId = 1;
  24171. if (font instanceof CFFFont) {
  24172. glyphZeroId = font.numGlyphs - 1;
  24173. }
  24174. var mapping = font.getGlyphMapping(properties);
  24175. var newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  24176. this.toFontChar = newMapping.toFontChar;
  24177. var numGlyphs = font.numGlyphs;
  24178. function getCharCodes(charCodeToGlyphId, glyphId) {
  24179. var charCodes = null;
  24180. for (var charCode in charCodeToGlyphId) {
  24181. if (glyphId === charCodeToGlyphId[charCode]) {
  24182. if (!charCodes) {
  24183. charCodes = [];
  24184. }
  24185. charCodes.push(charCode | 0);
  24186. }
  24187. }
  24188. return charCodes;
  24189. }
  24190. function createCharCode(charCodeToGlyphId, glyphId) {
  24191. for (var charCode in charCodeToGlyphId) {
  24192. if (glyphId === charCodeToGlyphId[charCode]) {
  24193. return charCode | 0;
  24194. }
  24195. }
  24196. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  24197. return newMapping.nextAvailableFontCharCode++;
  24198. }
  24199. var seacs = font.seacs;
  24200. if (SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  24201. var matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  24202. var charset = font.getCharset();
  24203. var seacMap = Object.create(null);
  24204. for (var glyphId in seacs) {
  24205. glyphId |= 0;
  24206. var seac = seacs[glyphId];
  24207. var baseGlyphName = _encodings.StandardEncoding[seac[2]];
  24208. var accentGlyphName = _encodings.StandardEncoding[seac[3]];
  24209. var baseGlyphId = charset.indexOf(baseGlyphName);
  24210. var accentGlyphId = charset.indexOf(accentGlyphName);
  24211. if (baseGlyphId < 0 || accentGlyphId < 0) {
  24212. continue;
  24213. }
  24214. var accentOffset = {
  24215. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  24216. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  24217. };
  24218. var charCodes = getCharCodes(mapping, glyphId);
  24219. if (!charCodes) {
  24220. continue;
  24221. }
  24222. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  24223. var charCode = charCodes[i];
  24224. var charCodeToGlyphId = newMapping.charCodeToGlyphId;
  24225. var baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  24226. var accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  24227. seacMap[charCode] = {
  24228. baseFontCharCode,
  24229. accentFontCharCode,
  24230. accentOffset
  24231. };
  24232. }
  24233. }
  24234. properties.seacMap = seacMap;
  24235. }
  24236. var unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  24237. var builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  24238. builder.addTable("CFF ", font.data);
  24239. builder.addTable("OS/2", createOS2Table(properties, newMapping.charCodeToGlyphId));
  24240. builder.addTable("cmap", createCmapTable(newMapping.charCodeToGlyphId, numGlyphs));
  24241. 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");
  24242. 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));
  24243. builder.addTable("hmtx", function fontFieldsHmtx() {
  24244. var charstrings = font.charstrings;
  24245. var cffWidths = font.cff ? font.cff.widths : null;
  24246. var hmtx = "\x00\x00\x00\x00";
  24247. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  24248. var width = 0;
  24249. if (charstrings) {
  24250. var charstring = charstrings[i - 1];
  24251. width = "width" in charstring ? charstring.width : 0;
  24252. } else if (cffWidths) {
  24253. width = Math.ceil(cffWidths[i] || 0);
  24254. }
  24255. hmtx += string16(width) + string16(0);
  24256. }
  24257. return hmtx;
  24258. }());
  24259. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  24260. builder.addTable("name", createNameTable(fontName));
  24261. builder.addTable("post", createPostTable(properties));
  24262. return builder.toArray();
  24263. },
  24264. get spaceWidth() {
  24265. var possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  24266. var width;
  24267. for (var i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  24268. var glyphName = possibleSpaceReplacements[i];
  24269. if (glyphName in this.widths) {
  24270. width = this.widths[glyphName];
  24271. break;
  24272. }
  24273. var glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24274. var glyphUnicode = glyphsUnicodeMap[glyphName];
  24275. var charcode = 0;
  24276. if (this.composite && this.cMap.contains(glyphUnicode)) {
  24277. charcode = this.cMap.lookup(glyphUnicode);
  24278. }
  24279. if (!charcode && this.toUnicode) {
  24280. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  24281. }
  24282. if (charcode <= 0) {
  24283. charcode = glyphUnicode;
  24284. }
  24285. width = this.widths[charcode];
  24286. if (width) {
  24287. break;
  24288. }
  24289. }
  24290. width = width || this.defaultWidth;
  24291. return (0, _util.shadow)(this, "spaceWidth", width);
  24292. },
  24293. _charToGlyph(charcode, isSpace = false) {
  24294. var fontCharCode, width, operatorListId;
  24295. var widthCode = charcode;
  24296. if (this.cMap && this.cMap.contains(charcode)) {
  24297. widthCode = this.cMap.lookup(charcode);
  24298. }
  24299. width = this.widths[widthCode];
  24300. width = (0, _util.isNum)(width) ? width : this.defaultWidth;
  24301. var vmetric = this.vmetrics && this.vmetrics[widthCode];
  24302. let unicode = this.toUnicode.get(charcode) || this.fallbackToUnicode.get(charcode) || charcode;
  24303. if (typeof unicode === "number") {
  24304. unicode = String.fromCharCode(unicode);
  24305. }
  24306. var isInFont = (charcode in this.toFontChar);
  24307. fontCharCode = this.toFontChar[charcode] || charcode;
  24308. if (this.missingFile) {
  24309. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  24310. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  24311. fontCharCode = 0x20;
  24312. }
  24313. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  24314. }
  24315. if (this.isType3Font) {
  24316. operatorListId = fontCharCode;
  24317. }
  24318. var accent = null;
  24319. if (this.seacMap && this.seacMap[charcode]) {
  24320. isInFont = true;
  24321. var seac = this.seacMap[charcode];
  24322. fontCharCode = seac.baseFontCharCode;
  24323. accent = {
  24324. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  24325. offset: seac.accentOffset
  24326. };
  24327. }
  24328. let fontChar = "";
  24329. if (typeof fontCharCode === "number") {
  24330. if (fontCharCode <= 0x10ffff) {
  24331. fontChar = String.fromCodePoint(fontCharCode);
  24332. } else {
  24333. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  24334. }
  24335. }
  24336. var glyph = this.glyphCache[charcode];
  24337. if (!glyph || !glyph.matchesForCache(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  24338. glyph = new Glyph(fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  24339. this.glyphCache[charcode] = glyph;
  24340. }
  24341. return glyph;
  24342. },
  24343. charsToGlyphs: function Font_charsToGlyphs(chars) {
  24344. var charsCache = this.charsCache;
  24345. var glyphs, glyph, charcode;
  24346. if (charsCache) {
  24347. glyphs = charsCache[chars];
  24348. if (glyphs) {
  24349. return glyphs;
  24350. }
  24351. }
  24352. if (!charsCache) {
  24353. charsCache = this.charsCache = Object.create(null);
  24354. }
  24355. glyphs = [];
  24356. var charsCacheKey = chars;
  24357. var i = 0,
  24358. ii;
  24359. if (this.cMap) {
  24360. var c = Object.create(null);
  24361. while (i < chars.length) {
  24362. this.cMap.readCharCode(chars, i, c);
  24363. charcode = c.charcode;
  24364. var length = c.length;
  24365. i += length;
  24366. var isSpace = length === 1 && chars.charCodeAt(i - 1) === 0x20;
  24367. glyph = this._charToGlyph(charcode, isSpace);
  24368. glyphs.push(glyph);
  24369. }
  24370. } else {
  24371. for (i = 0, ii = chars.length; i < ii; ++i) {
  24372. charcode = chars.charCodeAt(i);
  24373. glyph = this._charToGlyph(charcode, charcode === 0x20);
  24374. glyphs.push(glyph);
  24375. }
  24376. }
  24377. return charsCache[charsCacheKey] = glyphs;
  24378. },
  24379. getCharPositions(chars) {
  24380. const positions = [];
  24381. if (this.cMap) {
  24382. const c = Object.create(null);
  24383. let i = 0;
  24384. while (i < chars.length) {
  24385. this.cMap.readCharCode(chars, i, c);
  24386. const length = c.length;
  24387. positions.push([i, i + length]);
  24388. i += length;
  24389. }
  24390. } else {
  24391. for (let i = 0, ii = chars.length; i < ii; ++i) {
  24392. positions.push([i, i + 1]);
  24393. }
  24394. }
  24395. return positions;
  24396. },
  24397. get glyphCacheValues() {
  24398. return Object.values(this.glyphCache);
  24399. },
  24400. encodeString(str) {
  24401. const buffers = [];
  24402. const currentBuf = [];
  24403. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  24404. for (let i = 0, ii = str.length; i < ii; i++) {
  24405. const unicode = str.codePointAt(i);
  24406. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  24407. i++;
  24408. }
  24409. if (this.toUnicode) {
  24410. const char = String.fromCodePoint(unicode);
  24411. const charCode = this.toUnicode.charCodeOf(char);
  24412. if (charCode !== -1) {
  24413. if (hasCurrentBufErrors()) {
  24414. buffers.push(currentBuf.join(""));
  24415. currentBuf.length = 0;
  24416. }
  24417. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  24418. for (let j = charCodeLength - 1; j >= 0; j--) {
  24419. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  24420. }
  24421. continue;
  24422. }
  24423. }
  24424. if (!hasCurrentBufErrors()) {
  24425. buffers.push(currentBuf.join(""));
  24426. currentBuf.length = 0;
  24427. }
  24428. currentBuf.push(String.fromCodePoint(unicode));
  24429. }
  24430. buffers.push(currentBuf.join(""));
  24431. return buffers;
  24432. }
  24433. };
  24434. return Font;
  24435. }();
  24436. exports.Font = Font;
  24437. var ErrorFont = function ErrorFontClosure() {
  24438. function ErrorFont(error) {
  24439. this.error = error;
  24440. this.loadedName = "g_font_error";
  24441. this.missingFile = true;
  24442. }
  24443. ErrorFont.prototype = {
  24444. charsToGlyphs: function ErrorFont_charsToGlyphs() {
  24445. return [];
  24446. },
  24447. encodeString: function ErrorFont_encodeString(chars) {
  24448. return [chars];
  24449. },
  24450. exportData(extraProperties = false) {
  24451. return {
  24452. error: this.error
  24453. };
  24454. }
  24455. };
  24456. return ErrorFont;
  24457. }();
  24458. exports.ErrorFont = ErrorFont;
  24459. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  24460. var charCodeToGlyphId = Object.create(null);
  24461. var glyphId, charCode, baseEncoding;
  24462. var isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  24463. if (properties.baseEncodingName) {
  24464. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  24465. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24466. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24467. if (glyphId >= 0) {
  24468. charCodeToGlyphId[charCode] = glyphId;
  24469. } else {
  24470. charCodeToGlyphId[charCode] = 0;
  24471. }
  24472. }
  24473. } else if (isSymbolicFont) {
  24474. for (charCode in builtInEncoding) {
  24475. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  24476. }
  24477. } else {
  24478. baseEncoding = _encodings.StandardEncoding;
  24479. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  24480. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  24481. if (glyphId >= 0) {
  24482. charCodeToGlyphId[charCode] = glyphId;
  24483. } else {
  24484. charCodeToGlyphId[charCode] = 0;
  24485. }
  24486. }
  24487. }
  24488. var differences = properties.differences,
  24489. glyphsUnicodeMap;
  24490. if (differences) {
  24491. for (charCode in differences) {
  24492. var glyphName = differences[charCode];
  24493. glyphId = glyphNames.indexOf(glyphName);
  24494. if (glyphId === -1) {
  24495. if (!glyphsUnicodeMap) {
  24496. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  24497. }
  24498. var standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  24499. if (standardGlyphName !== glyphName) {
  24500. glyphId = glyphNames.indexOf(standardGlyphName);
  24501. }
  24502. }
  24503. if (glyphId >= 0) {
  24504. charCodeToGlyphId[charCode] = glyphId;
  24505. } else {
  24506. charCodeToGlyphId[charCode] = 0;
  24507. }
  24508. }
  24509. }
  24510. return charCodeToGlyphId;
  24511. }
  24512. var Type1Font = function Type1FontClosure() {
  24513. function findBlock(streamBytes, signature, startIndex) {
  24514. var streamBytesLength = streamBytes.length;
  24515. var signatureLength = signature.length;
  24516. var scanLength = streamBytesLength - signatureLength;
  24517. var i = startIndex,
  24518. j,
  24519. found = false;
  24520. while (i < scanLength) {
  24521. j = 0;
  24522. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  24523. j++;
  24524. }
  24525. if (j >= signatureLength) {
  24526. i += j;
  24527. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  24528. i++;
  24529. }
  24530. found = true;
  24531. break;
  24532. }
  24533. i++;
  24534. }
  24535. return {
  24536. found,
  24537. length: i
  24538. };
  24539. }
  24540. function getHeaderBlock(stream, suggestedLength) {
  24541. var EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  24542. var streamStartPos = stream.pos;
  24543. var headerBytes, headerBytesLength, block;
  24544. try {
  24545. headerBytes = stream.getBytes(suggestedLength);
  24546. headerBytesLength = headerBytes.length;
  24547. } catch (ex) {
  24548. if (ex instanceof _core_utils.MissingDataException) {
  24549. throw ex;
  24550. }
  24551. }
  24552. if (headerBytesLength === suggestedLength) {
  24553. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  24554. if (block.found && block.length === suggestedLength) {
  24555. return {
  24556. stream: new _stream.Stream(headerBytes),
  24557. length: suggestedLength
  24558. };
  24559. }
  24560. }
  24561. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  24562. stream.pos = streamStartPos;
  24563. var SCAN_BLOCK_LENGTH = 2048;
  24564. var actualLength;
  24565. while (true) {
  24566. var scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  24567. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  24568. if (block.length === 0) {
  24569. break;
  24570. }
  24571. stream.pos += block.length;
  24572. if (block.found) {
  24573. actualLength = stream.pos - streamStartPos;
  24574. break;
  24575. }
  24576. }
  24577. stream.pos = streamStartPos;
  24578. if (actualLength) {
  24579. return {
  24580. stream: new _stream.Stream(stream.getBytes(actualLength)),
  24581. length: actualLength
  24582. };
  24583. }
  24584. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  24585. return {
  24586. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  24587. length: suggestedLength
  24588. };
  24589. }
  24590. function getEexecBlock(stream, suggestedLength) {
  24591. var eexecBytes = stream.getBytes();
  24592. return {
  24593. stream: new _stream.Stream(eexecBytes),
  24594. length: eexecBytes.length
  24595. };
  24596. }
  24597. function Type1Font(name, file, properties) {
  24598. var PFB_HEADER_SIZE = 6;
  24599. var headerBlockLength = properties.length1;
  24600. var eexecBlockLength = properties.length2;
  24601. var pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  24602. var pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  24603. if (pfbHeaderPresent) {
  24604. file.skip(PFB_HEADER_SIZE);
  24605. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  24606. }
  24607. var headerBlock = getHeaderBlock(file, headerBlockLength);
  24608. var headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  24609. headerBlockParser.extractFontHeader(properties);
  24610. if (pfbHeaderPresent) {
  24611. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  24612. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  24613. }
  24614. var eexecBlock = getEexecBlock(file, eexecBlockLength);
  24615. var eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  24616. var data = eexecBlockParser.extractFontProgram(properties);
  24617. for (const key in data.properties) {
  24618. properties[key] = data.properties[key];
  24619. }
  24620. var charstrings = data.charstrings;
  24621. var type2Charstrings = this.getType2Charstrings(charstrings);
  24622. var subrs = this.getType2Subrs(data.subrs);
  24623. this.charstrings = charstrings;
  24624. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  24625. this.seacs = this.getSeacs(data.charstrings);
  24626. }
  24627. Type1Font.prototype = {
  24628. get numGlyphs() {
  24629. return this.charstrings.length + 1;
  24630. },
  24631. getCharset: function Type1Font_getCharset() {
  24632. var charset = [".notdef"];
  24633. var charstrings = this.charstrings;
  24634. for (var glyphId = 0; glyphId < charstrings.length; glyphId++) {
  24635. charset.push(charstrings[glyphId].glyphName);
  24636. }
  24637. return charset;
  24638. },
  24639. getGlyphMapping: function Type1Font_getGlyphMapping(properties) {
  24640. var charstrings = this.charstrings;
  24641. if (properties.composite) {
  24642. const charCodeToGlyphId = Object.create(null);
  24643. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  24644. const charCode = properties.cMap.charCodeOf(glyphId);
  24645. charCodeToGlyphId[charCode] = glyphId + 1;
  24646. }
  24647. return charCodeToGlyphId;
  24648. }
  24649. var glyphNames = [".notdef"],
  24650. glyphId;
  24651. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  24652. glyphNames.push(charstrings[glyphId].glyphName);
  24653. }
  24654. var encoding = properties.builtInEncoding;
  24655. if (encoding) {
  24656. var builtInEncoding = Object.create(null);
  24657. for (var charCode in encoding) {
  24658. glyphId = glyphNames.indexOf(encoding[charCode]);
  24659. if (glyphId >= 0) {
  24660. builtInEncoding[charCode] = glyphId;
  24661. }
  24662. }
  24663. }
  24664. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  24665. },
  24666. hasGlyphId: function Type1Font_hasGlyphID(id) {
  24667. if (id < 0 || id >= this.numGlyphs) {
  24668. return false;
  24669. }
  24670. if (id === 0) {
  24671. return true;
  24672. }
  24673. var glyph = this.charstrings[id - 1];
  24674. return glyph.charstring.length > 0;
  24675. },
  24676. getSeacs: function Type1Font_getSeacs(charstrings) {
  24677. var i, ii;
  24678. var seacMap = [];
  24679. for (i = 0, ii = charstrings.length; i < ii; i++) {
  24680. var charstring = charstrings[i];
  24681. if (charstring.seac) {
  24682. seacMap[i + 1] = charstring.seac;
  24683. }
  24684. }
  24685. return seacMap;
  24686. },
  24687. getType2Charstrings: function Type1Font_getType2Charstrings(type1Charstrings) {
  24688. var type2Charstrings = [];
  24689. for (var i = 0, ii = type1Charstrings.length; i < ii; i++) {
  24690. type2Charstrings.push(type1Charstrings[i].charstring);
  24691. }
  24692. return type2Charstrings;
  24693. },
  24694. getType2Subrs: function Type1Font_getType2Subrs(type1Subrs) {
  24695. var bias = 0;
  24696. var count = type1Subrs.length;
  24697. if (count < 1133) {
  24698. bias = 107;
  24699. } else if (count < 33769) {
  24700. bias = 1131;
  24701. } else {
  24702. bias = 32768;
  24703. }
  24704. var type2Subrs = [];
  24705. var i;
  24706. for (i = 0; i < bias; i++) {
  24707. type2Subrs.push([0x0b]);
  24708. }
  24709. for (i = 0; i < count; i++) {
  24710. type2Subrs.push(type1Subrs[i]);
  24711. }
  24712. return type2Subrs;
  24713. },
  24714. wrap: function Type1Font_wrap(name, glyphs, charstrings, subrs, properties) {
  24715. var cff = new _cff_parser.CFF();
  24716. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  24717. cff.names = [name];
  24718. var topDict = new _cff_parser.CFFTopDict();
  24719. topDict.setByName("version", 391);
  24720. topDict.setByName("Notice", 392);
  24721. topDict.setByName("FullName", 393);
  24722. topDict.setByName("FamilyName", 394);
  24723. topDict.setByName("Weight", 395);
  24724. topDict.setByName("Encoding", null);
  24725. topDict.setByName("FontMatrix", properties.fontMatrix);
  24726. topDict.setByName("FontBBox", properties.bbox);
  24727. topDict.setByName("charset", null);
  24728. topDict.setByName("CharStrings", null);
  24729. topDict.setByName("Private", null);
  24730. cff.topDict = topDict;
  24731. var strings = new _cff_parser.CFFStrings();
  24732. strings.add("Version 0.11");
  24733. strings.add("See original notice");
  24734. strings.add(name);
  24735. strings.add(name);
  24736. strings.add("Medium");
  24737. cff.strings = strings;
  24738. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  24739. var count = glyphs.length;
  24740. var charsetArray = [".notdef"];
  24741. var i, ii;
  24742. for (i = 0; i < count; i++) {
  24743. const glyphName = charstrings[i].glyphName;
  24744. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  24745. if (index === -1) {
  24746. strings.add(glyphName);
  24747. }
  24748. charsetArray.push(glyphName);
  24749. }
  24750. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  24751. var charStringsIndex = new _cff_parser.CFFIndex();
  24752. charStringsIndex.add([0x8b, 0x0e]);
  24753. for (i = 0; i < count; i++) {
  24754. charStringsIndex.add(glyphs[i]);
  24755. }
  24756. cff.charStrings = charStringsIndex;
  24757. var privateDict = new _cff_parser.CFFPrivateDict();
  24758. privateDict.setByName("Subrs", null);
  24759. var fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  24760. for (i = 0, ii = fields.length; i < ii; i++) {
  24761. var field = fields[i];
  24762. if (!(field in properties.privateData)) {
  24763. continue;
  24764. }
  24765. var value = properties.privateData[field];
  24766. if (Array.isArray(value)) {
  24767. for (var j = value.length - 1; j > 0; j--) {
  24768. value[j] -= value[j - 1];
  24769. }
  24770. }
  24771. privateDict.setByName(field, value);
  24772. }
  24773. cff.topDict.privateDict = privateDict;
  24774. var subrIndex = new _cff_parser.CFFIndex();
  24775. for (i = 0, ii = subrs.length; i < ii; i++) {
  24776. subrIndex.add(subrs[i]);
  24777. }
  24778. privateDict.subrsIndex = subrIndex;
  24779. var compiler = new _cff_parser.CFFCompiler(cff);
  24780. return compiler.compile();
  24781. }
  24782. };
  24783. return Type1Font;
  24784. }();
  24785. var CFFFont = function CFFFontClosure() {
  24786. function CFFFont(file, properties) {
  24787. this.properties = properties;
  24788. var parser = new _cff_parser.CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  24789. this.cff = parser.parse();
  24790. this.cff.duplicateFirstGlyph();
  24791. var compiler = new _cff_parser.CFFCompiler(this.cff);
  24792. this.seacs = this.cff.seacs;
  24793. try {
  24794. this.data = compiler.compile();
  24795. } catch (e) {
  24796. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  24797. this.data = file;
  24798. }
  24799. }
  24800. CFFFont.prototype = {
  24801. get numGlyphs() {
  24802. return this.cff.charStrings.count;
  24803. },
  24804. getCharset: function CFFFont_getCharset() {
  24805. return this.cff.charset.charset;
  24806. },
  24807. getGlyphMapping: function CFFFont_getGlyphMapping() {
  24808. var cff = this.cff;
  24809. var properties = this.properties;
  24810. var charsets = cff.charset.charset;
  24811. var charCodeToGlyphId;
  24812. var glyphId;
  24813. if (properties.composite) {
  24814. charCodeToGlyphId = Object.create(null);
  24815. let charCode;
  24816. if (cff.isCIDFont) {
  24817. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  24818. var cid = charsets[glyphId];
  24819. charCode = properties.cMap.charCodeOf(cid);
  24820. charCodeToGlyphId[charCode] = glyphId;
  24821. }
  24822. } else {
  24823. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  24824. charCode = properties.cMap.charCodeOf(glyphId);
  24825. charCodeToGlyphId[charCode] = glyphId;
  24826. }
  24827. }
  24828. return charCodeToGlyphId;
  24829. }
  24830. var encoding = cff.encoding ? cff.encoding.encoding : null;
  24831. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  24832. return charCodeToGlyphId;
  24833. },
  24834. hasGlyphId: function CFFFont_hasGlyphID(id) {
  24835. return this.cff.hasGlyphId(id);
  24836. }
  24837. };
  24838. return CFFFont;
  24839. }();
  24840. /***/ }),
  24841. /* 32 */
  24842. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24843. Object.defineProperty(exports, "__esModule", ({
  24844. value: true
  24845. }));
  24846. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  24847. var _util = __w_pdfjs_require__(2);
  24848. var _charsets = __w_pdfjs_require__(33);
  24849. var _encodings = __w_pdfjs_require__(34);
  24850. const MAX_SUBR_NESTING = 10;
  24851. const 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"];
  24852. exports.CFFStandardStrings = CFFStandardStrings;
  24853. const NUM_STANDARD_CFF_STRINGS = 391;
  24854. const CFFParser = function CFFParserClosure() {
  24855. const CharstringValidationData = [null, {
  24856. id: "hstem",
  24857. min: 2,
  24858. stackClearing: true,
  24859. stem: true
  24860. }, null, {
  24861. id: "vstem",
  24862. min: 2,
  24863. stackClearing: true,
  24864. stem: true
  24865. }, {
  24866. id: "vmoveto",
  24867. min: 1,
  24868. stackClearing: true
  24869. }, {
  24870. id: "rlineto",
  24871. min: 2,
  24872. resetStack: true
  24873. }, {
  24874. id: "hlineto",
  24875. min: 1,
  24876. resetStack: true
  24877. }, {
  24878. id: "vlineto",
  24879. min: 1,
  24880. resetStack: true
  24881. }, {
  24882. id: "rrcurveto",
  24883. min: 6,
  24884. resetStack: true
  24885. }, null, {
  24886. id: "callsubr",
  24887. min: 1,
  24888. undefStack: true
  24889. }, {
  24890. id: "return",
  24891. min: 0,
  24892. undefStack: true
  24893. }, null, null, {
  24894. id: "endchar",
  24895. min: 0,
  24896. stackClearing: true
  24897. }, null, null, null, {
  24898. id: "hstemhm",
  24899. min: 2,
  24900. stackClearing: true,
  24901. stem: true
  24902. }, {
  24903. id: "hintmask",
  24904. min: 0,
  24905. stackClearing: true
  24906. }, {
  24907. id: "cntrmask",
  24908. min: 0,
  24909. stackClearing: true
  24910. }, {
  24911. id: "rmoveto",
  24912. min: 2,
  24913. stackClearing: true
  24914. }, {
  24915. id: "hmoveto",
  24916. min: 1,
  24917. stackClearing: true
  24918. }, {
  24919. id: "vstemhm",
  24920. min: 2,
  24921. stackClearing: true,
  24922. stem: true
  24923. }, {
  24924. id: "rcurveline",
  24925. min: 8,
  24926. resetStack: true
  24927. }, {
  24928. id: "rlinecurve",
  24929. min: 8,
  24930. resetStack: true
  24931. }, {
  24932. id: "vvcurveto",
  24933. min: 4,
  24934. resetStack: true
  24935. }, {
  24936. id: "hhcurveto",
  24937. min: 4,
  24938. resetStack: true
  24939. }, null, {
  24940. id: "callgsubr",
  24941. min: 1,
  24942. undefStack: true
  24943. }, {
  24944. id: "vhcurveto",
  24945. min: 4,
  24946. resetStack: true
  24947. }, {
  24948. id: "hvcurveto",
  24949. min: 4,
  24950. resetStack: true
  24951. }];
  24952. const CharstringValidationData12 = [null, null, null, {
  24953. id: "and",
  24954. min: 2,
  24955. stackDelta: -1
  24956. }, {
  24957. id: "or",
  24958. min: 2,
  24959. stackDelta: -1
  24960. }, {
  24961. id: "not",
  24962. min: 1,
  24963. stackDelta: 0
  24964. }, null, null, null, {
  24965. id: "abs",
  24966. min: 1,
  24967. stackDelta: 0
  24968. }, {
  24969. id: "add",
  24970. min: 2,
  24971. stackDelta: -1,
  24972. stackFn: function stack_div(stack, index) {
  24973. stack[index - 2] = stack[index - 2] + stack[index - 1];
  24974. }
  24975. }, {
  24976. id: "sub",
  24977. min: 2,
  24978. stackDelta: -1,
  24979. stackFn: function stack_div(stack, index) {
  24980. stack[index - 2] = stack[index - 2] - stack[index - 1];
  24981. }
  24982. }, {
  24983. id: "div",
  24984. min: 2,
  24985. stackDelta: -1,
  24986. stackFn: function stack_div(stack, index) {
  24987. stack[index - 2] = stack[index - 2] / stack[index - 1];
  24988. }
  24989. }, null, {
  24990. id: "neg",
  24991. min: 1,
  24992. stackDelta: 0,
  24993. stackFn: function stack_div(stack, index) {
  24994. stack[index - 1] = -stack[index - 1];
  24995. }
  24996. }, {
  24997. id: "eq",
  24998. min: 2,
  24999. stackDelta: -1
  25000. }, null, null, {
  25001. id: "drop",
  25002. min: 1,
  25003. stackDelta: -1
  25004. }, null, {
  25005. id: "put",
  25006. min: 2,
  25007. stackDelta: -2
  25008. }, {
  25009. id: "get",
  25010. min: 1,
  25011. stackDelta: 0
  25012. }, {
  25013. id: "ifelse",
  25014. min: 4,
  25015. stackDelta: -3
  25016. }, {
  25017. id: "random",
  25018. min: 0,
  25019. stackDelta: 1
  25020. }, {
  25021. id: "mul",
  25022. min: 2,
  25023. stackDelta: -1,
  25024. stackFn: function stack_div(stack, index) {
  25025. stack[index - 2] = stack[index - 2] * stack[index - 1];
  25026. }
  25027. }, null, {
  25028. id: "sqrt",
  25029. min: 1,
  25030. stackDelta: 0
  25031. }, {
  25032. id: "dup",
  25033. min: 1,
  25034. stackDelta: 1
  25035. }, {
  25036. id: "exch",
  25037. min: 2,
  25038. stackDelta: 0
  25039. }, {
  25040. id: "index",
  25041. min: 2,
  25042. stackDelta: 0
  25043. }, {
  25044. id: "roll",
  25045. min: 3,
  25046. stackDelta: -2
  25047. }, null, null, null, {
  25048. id: "hflex",
  25049. min: 7,
  25050. resetStack: true
  25051. }, {
  25052. id: "flex",
  25053. min: 13,
  25054. resetStack: true
  25055. }, {
  25056. id: "hflex1",
  25057. min: 9,
  25058. resetStack: true
  25059. }, {
  25060. id: "flex1",
  25061. min: 11,
  25062. resetStack: true
  25063. }];
  25064. class CFFParser {
  25065. constructor(file, properties, seacAnalysisEnabled) {
  25066. this.bytes = file.getBytes();
  25067. this.properties = properties;
  25068. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  25069. }
  25070. parse() {
  25071. const properties = this.properties;
  25072. const cff = new CFF();
  25073. this.cff = cff;
  25074. const header = this.parseHeader();
  25075. const nameIndex = this.parseIndex(header.endPos);
  25076. const topDictIndex = this.parseIndex(nameIndex.endPos);
  25077. const stringIndex = this.parseIndex(topDictIndex.endPos);
  25078. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  25079. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  25080. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  25081. cff.header = header.obj;
  25082. cff.names = this.parseNameIndex(nameIndex.obj);
  25083. cff.strings = this.parseStringIndex(stringIndex.obj);
  25084. cff.topDict = topDict;
  25085. cff.globalSubrIndex = globalSubrIndex.obj;
  25086. this.parsePrivateDict(cff.topDict);
  25087. cff.isCIDFont = topDict.hasName("ROS");
  25088. const charStringOffset = topDict.getByName("CharStrings");
  25089. const charStringIndex = this.parseIndex(charStringOffset).obj;
  25090. const fontMatrix = topDict.getByName("FontMatrix");
  25091. if (fontMatrix) {
  25092. properties.fontMatrix = fontMatrix;
  25093. }
  25094. const fontBBox = topDict.getByName("FontBBox");
  25095. if (fontBBox) {
  25096. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  25097. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  25098. properties.ascentScaled = true;
  25099. }
  25100. let charset, encoding;
  25101. if (cff.isCIDFont) {
  25102. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  25103. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  25104. const dictRaw = fdArrayIndex.get(i);
  25105. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  25106. this.parsePrivateDict(fontDict);
  25107. cff.fdArray.push(fontDict);
  25108. }
  25109. encoding = null;
  25110. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  25111. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  25112. } else {
  25113. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  25114. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  25115. }
  25116. cff.charset = charset;
  25117. cff.encoding = encoding;
  25118. const charStringsAndSeacs = this.parseCharStrings({
  25119. charStrings: charStringIndex,
  25120. localSubrIndex: topDict.privateDict.subrsIndex,
  25121. globalSubrIndex: globalSubrIndex.obj,
  25122. fdSelect: cff.fdSelect,
  25123. fdArray: cff.fdArray,
  25124. privateDict: topDict.privateDict
  25125. });
  25126. cff.charStrings = charStringsAndSeacs.charStrings;
  25127. cff.seacs = charStringsAndSeacs.seacs;
  25128. cff.widths = charStringsAndSeacs.widths;
  25129. return cff;
  25130. }
  25131. parseHeader() {
  25132. let bytes = this.bytes;
  25133. const bytesLength = bytes.length;
  25134. let offset = 0;
  25135. while (offset < bytesLength && bytes[offset] !== 1) {
  25136. ++offset;
  25137. }
  25138. if (offset >= bytesLength) {
  25139. throw new _util.FormatError("Invalid CFF header");
  25140. }
  25141. if (offset !== 0) {
  25142. (0, _util.info)("cff data is shifted");
  25143. bytes = bytes.subarray(offset);
  25144. this.bytes = bytes;
  25145. }
  25146. const major = bytes[0];
  25147. const minor = bytes[1];
  25148. const hdrSize = bytes[2];
  25149. const offSize = bytes[3];
  25150. const header = new CFFHeader(major, minor, hdrSize, offSize);
  25151. return {
  25152. obj: header,
  25153. endPos: hdrSize
  25154. };
  25155. }
  25156. parseDict(dict) {
  25157. let pos = 0;
  25158. function parseOperand() {
  25159. let value = dict[pos++];
  25160. if (value === 30) {
  25161. return parseFloatOperand();
  25162. } else if (value === 28) {
  25163. value = dict[pos++];
  25164. value = (value << 24 | dict[pos++] << 16) >> 16;
  25165. return value;
  25166. } else if (value === 29) {
  25167. value = dict[pos++];
  25168. value = value << 8 | dict[pos++];
  25169. value = value << 8 | dict[pos++];
  25170. value = value << 8 | dict[pos++];
  25171. return value;
  25172. } else if (value >= 32 && value <= 246) {
  25173. return value - 139;
  25174. } else if (value >= 247 && value <= 250) {
  25175. return (value - 247) * 256 + dict[pos++] + 108;
  25176. } else if (value >= 251 && value <= 254) {
  25177. return -((value - 251) * 256) - dict[pos++] - 108;
  25178. }
  25179. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  25180. return NaN;
  25181. }
  25182. function parseFloatOperand() {
  25183. let str = "";
  25184. const eof = 15;
  25185. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  25186. const length = dict.length;
  25187. while (pos < length) {
  25188. const b = dict[pos++];
  25189. const b1 = b >> 4;
  25190. const b2 = b & 15;
  25191. if (b1 === eof) {
  25192. break;
  25193. }
  25194. str += lookup[b1];
  25195. if (b2 === eof) {
  25196. break;
  25197. }
  25198. str += lookup[b2];
  25199. }
  25200. return parseFloat(str);
  25201. }
  25202. let operands = [];
  25203. const entries = [];
  25204. pos = 0;
  25205. const end = dict.length;
  25206. while (pos < end) {
  25207. let b = dict[pos];
  25208. if (b <= 21) {
  25209. if (b === 12) {
  25210. b = b << 8 | dict[++pos];
  25211. }
  25212. entries.push([b, operands]);
  25213. operands = [];
  25214. ++pos;
  25215. } else {
  25216. operands.push(parseOperand());
  25217. }
  25218. }
  25219. return entries;
  25220. }
  25221. parseIndex(pos) {
  25222. const cffIndex = new CFFIndex();
  25223. const bytes = this.bytes;
  25224. const count = bytes[pos++] << 8 | bytes[pos++];
  25225. const offsets = [];
  25226. let end = pos;
  25227. let i, ii;
  25228. if (count !== 0) {
  25229. const offsetSize = bytes[pos++];
  25230. const startPos = pos + (count + 1) * offsetSize - 1;
  25231. for (i = 0, ii = count + 1; i < ii; ++i) {
  25232. let offset = 0;
  25233. for (let j = 0; j < offsetSize; ++j) {
  25234. offset <<= 8;
  25235. offset += bytes[pos++];
  25236. }
  25237. offsets.push(startPos + offset);
  25238. }
  25239. end = offsets[count];
  25240. }
  25241. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  25242. const offsetStart = offsets[i];
  25243. const offsetEnd = offsets[i + 1];
  25244. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  25245. }
  25246. return {
  25247. obj: cffIndex,
  25248. endPos: end
  25249. };
  25250. }
  25251. parseNameIndex(index) {
  25252. const names = [];
  25253. for (let i = 0, ii = index.count; i < ii; ++i) {
  25254. const name = index.get(i);
  25255. names.push((0, _util.bytesToString)(name));
  25256. }
  25257. return names;
  25258. }
  25259. parseStringIndex(index) {
  25260. const strings = new CFFStrings();
  25261. for (let i = 0, ii = index.count; i < ii; ++i) {
  25262. const data = index.get(i);
  25263. strings.add((0, _util.bytesToString)(data));
  25264. }
  25265. return strings;
  25266. }
  25267. createDict(Type, dict, strings) {
  25268. const cffDict = new Type(strings);
  25269. for (let i = 0, ii = dict.length; i < ii; ++i) {
  25270. const pair = dict[i];
  25271. const key = pair[0];
  25272. const value = pair[1];
  25273. cffDict.setByKey(key, value);
  25274. }
  25275. return cffDict;
  25276. }
  25277. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  25278. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  25279. return false;
  25280. }
  25281. let stackSize = state.stackSize;
  25282. const stack = state.stack;
  25283. const length = data.length;
  25284. for (let j = 0; j < length;) {
  25285. const value = data[j++];
  25286. let validationCommand = null;
  25287. if (value === 12) {
  25288. const q = data[j++];
  25289. if (q === 0) {
  25290. data[j - 2] = 139;
  25291. data[j - 1] = 22;
  25292. stackSize = 0;
  25293. } else {
  25294. validationCommand = CharstringValidationData12[q];
  25295. }
  25296. } else if (value === 28) {
  25297. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  25298. j += 2;
  25299. stackSize++;
  25300. } else if (value === 14) {
  25301. if (stackSize >= 4) {
  25302. stackSize -= 4;
  25303. if (this.seacAnalysisEnabled) {
  25304. state.seac = stack.slice(stackSize, stackSize + 4);
  25305. return false;
  25306. }
  25307. }
  25308. validationCommand = CharstringValidationData[value];
  25309. } else if (value >= 32 && value <= 246) {
  25310. stack[stackSize] = value - 139;
  25311. stackSize++;
  25312. } else if (value >= 247 && value <= 254) {
  25313. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  25314. j++;
  25315. stackSize++;
  25316. } else if (value === 255) {
  25317. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  25318. j += 4;
  25319. stackSize++;
  25320. } else if (value === 19 || value === 20) {
  25321. state.hints += stackSize >> 1;
  25322. j += state.hints + 7 >> 3;
  25323. stackSize %= 2;
  25324. validationCommand = CharstringValidationData[value];
  25325. } else if (value === 10 || value === 29) {
  25326. let subrsIndex;
  25327. if (value === 10) {
  25328. subrsIndex = localSubrIndex;
  25329. } else {
  25330. subrsIndex = globalSubrIndex;
  25331. }
  25332. if (!subrsIndex) {
  25333. validationCommand = CharstringValidationData[value];
  25334. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  25335. return false;
  25336. }
  25337. let bias = 32768;
  25338. if (subrsIndex.count < 1240) {
  25339. bias = 107;
  25340. } else if (subrsIndex.count < 33900) {
  25341. bias = 1131;
  25342. }
  25343. const subrNumber = stack[--stackSize] + bias;
  25344. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  25345. validationCommand = CharstringValidationData[value];
  25346. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  25347. return false;
  25348. }
  25349. state.stackSize = stackSize;
  25350. state.callDepth++;
  25351. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  25352. if (!valid) {
  25353. return false;
  25354. }
  25355. state.callDepth--;
  25356. stackSize = state.stackSize;
  25357. continue;
  25358. } else if (value === 11) {
  25359. state.stackSize = stackSize;
  25360. return true;
  25361. } else {
  25362. validationCommand = CharstringValidationData[value];
  25363. }
  25364. if (validationCommand) {
  25365. if (validationCommand.stem) {
  25366. state.hints += stackSize >> 1;
  25367. if (value === 3 || value === 23) {
  25368. state.hasVStems = true;
  25369. } else if (state.hasVStems && (value === 1 || value === 18)) {
  25370. (0, _util.warn)("CFF stem hints are in wrong order");
  25371. data[j - 1] = value === 1 ? 3 : 23;
  25372. }
  25373. }
  25374. if ("min" in validationCommand) {
  25375. if (!state.undefStack && stackSize < validationCommand.min) {
  25376. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  25377. return false;
  25378. }
  25379. }
  25380. if (state.firstStackClearing && validationCommand.stackClearing) {
  25381. state.firstStackClearing = false;
  25382. stackSize -= validationCommand.min;
  25383. if (stackSize >= 2 && validationCommand.stem) {
  25384. stackSize %= 2;
  25385. } else if (stackSize > 1) {
  25386. (0, _util.warn)("Found too many parameters for stack-clearing command");
  25387. }
  25388. if (stackSize > 0 && stack[stackSize - 1] >= 0) {
  25389. state.width = stack[stackSize - 1];
  25390. }
  25391. }
  25392. if ("stackDelta" in validationCommand) {
  25393. if ("stackFn" in validationCommand) {
  25394. validationCommand.stackFn(stack, stackSize);
  25395. }
  25396. stackSize += validationCommand.stackDelta;
  25397. } else if (validationCommand.stackClearing) {
  25398. stackSize = 0;
  25399. } else if (validationCommand.resetStack) {
  25400. stackSize = 0;
  25401. state.undefStack = false;
  25402. } else if (validationCommand.undefStack) {
  25403. stackSize = 0;
  25404. state.undefStack = true;
  25405. state.firstStackClearing = false;
  25406. }
  25407. }
  25408. }
  25409. state.stackSize = stackSize;
  25410. return true;
  25411. }
  25412. parseCharStrings({
  25413. charStrings,
  25414. localSubrIndex,
  25415. globalSubrIndex,
  25416. fdSelect,
  25417. fdArray,
  25418. privateDict
  25419. }) {
  25420. const seacs = [];
  25421. const widths = [];
  25422. const count = charStrings.count;
  25423. for (let i = 0; i < count; i++) {
  25424. const charstring = charStrings.get(i);
  25425. const state = {
  25426. callDepth: 0,
  25427. stackSize: 0,
  25428. stack: [],
  25429. undefStack: true,
  25430. hints: 0,
  25431. firstStackClearing: true,
  25432. seac: null,
  25433. width: null,
  25434. hasVStems: false
  25435. };
  25436. let valid = true;
  25437. let localSubrToUse = null;
  25438. let privateDictToUse = privateDict;
  25439. if (fdSelect && fdArray.length) {
  25440. const fdIndex = fdSelect.getFDIndex(i);
  25441. if (fdIndex === -1) {
  25442. (0, _util.warn)("Glyph index is not in fd select.");
  25443. valid = false;
  25444. }
  25445. if (fdIndex >= fdArray.length) {
  25446. (0, _util.warn)("Invalid fd index for glyph index.");
  25447. valid = false;
  25448. }
  25449. if (valid) {
  25450. privateDictToUse = fdArray[fdIndex].privateDict;
  25451. localSubrToUse = privateDictToUse.subrsIndex;
  25452. }
  25453. } else if (localSubrIndex) {
  25454. localSubrToUse = localSubrIndex;
  25455. }
  25456. if (valid) {
  25457. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  25458. }
  25459. if (state.width !== null) {
  25460. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  25461. widths[i] = nominalWidth + state.width;
  25462. } else {
  25463. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  25464. widths[i] = defaultWidth;
  25465. }
  25466. if (state.seac !== null) {
  25467. seacs[i] = state.seac;
  25468. }
  25469. if (!valid) {
  25470. charStrings.set(i, new Uint8Array([14]));
  25471. }
  25472. }
  25473. return {
  25474. charStrings,
  25475. seacs,
  25476. widths
  25477. };
  25478. }
  25479. emptyPrivateDictionary(parentDict) {
  25480. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  25481. parentDict.setByKey(18, [0, 0]);
  25482. parentDict.privateDict = privateDict;
  25483. }
  25484. parsePrivateDict(parentDict) {
  25485. if (!parentDict.hasName("Private")) {
  25486. this.emptyPrivateDictionary(parentDict);
  25487. return;
  25488. }
  25489. const privateOffset = parentDict.getByName("Private");
  25490. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  25491. parentDict.removeByName("Private");
  25492. return;
  25493. }
  25494. const size = privateOffset[0];
  25495. const offset = privateOffset[1];
  25496. if (size === 0 || offset >= this.bytes.length) {
  25497. this.emptyPrivateDictionary(parentDict);
  25498. return;
  25499. }
  25500. const privateDictEnd = offset + size;
  25501. const dictData = this.bytes.subarray(offset, privateDictEnd);
  25502. const dict = this.parseDict(dictData);
  25503. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  25504. parentDict.privateDict = privateDict;
  25505. if (!privateDict.getByName("Subrs")) {
  25506. return;
  25507. }
  25508. const subrsOffset = privateDict.getByName("Subrs");
  25509. const relativeOffset = offset + subrsOffset;
  25510. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  25511. this.emptyPrivateDictionary(parentDict);
  25512. return;
  25513. }
  25514. const subrsIndex = this.parseIndex(relativeOffset);
  25515. privateDict.subrsIndex = subrsIndex.obj;
  25516. }
  25517. parseCharsets(pos, length, strings, cid) {
  25518. if (pos === 0) {
  25519. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  25520. } else if (pos === 1) {
  25521. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  25522. } else if (pos === 2) {
  25523. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  25524. }
  25525. const bytes = this.bytes;
  25526. const start = pos;
  25527. const format = bytes[pos++];
  25528. const charset = [cid ? 0 : ".notdef"];
  25529. let id, count, i;
  25530. length -= 1;
  25531. switch (format) {
  25532. case 0:
  25533. for (i = 0; i < length; i++) {
  25534. id = bytes[pos++] << 8 | bytes[pos++];
  25535. charset.push(cid ? id : strings.get(id));
  25536. }
  25537. break;
  25538. case 1:
  25539. while (charset.length <= length) {
  25540. id = bytes[pos++] << 8 | bytes[pos++];
  25541. count = bytes[pos++];
  25542. for (i = 0; i <= count; i++) {
  25543. charset.push(cid ? id++ : strings.get(id++));
  25544. }
  25545. }
  25546. break;
  25547. case 2:
  25548. while (charset.length <= length) {
  25549. id = bytes[pos++] << 8 | bytes[pos++];
  25550. count = bytes[pos++] << 8 | bytes[pos++];
  25551. for (i = 0; i <= count; i++) {
  25552. charset.push(cid ? id++ : strings.get(id++));
  25553. }
  25554. }
  25555. break;
  25556. default:
  25557. throw new _util.FormatError("Unknown charset format");
  25558. }
  25559. const end = pos;
  25560. const raw = bytes.subarray(start, end);
  25561. return new CFFCharset(false, format, charset, raw);
  25562. }
  25563. parseEncoding(pos, properties, strings, charset) {
  25564. const encoding = Object.create(null);
  25565. const bytes = this.bytes;
  25566. let predefined = false;
  25567. let format, i, ii;
  25568. let raw = null;
  25569. function readSupplement() {
  25570. const supplementsCount = bytes[pos++];
  25571. for (i = 0; i < supplementsCount; i++) {
  25572. const code = bytes[pos++];
  25573. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  25574. encoding[code] = charset.indexOf(strings.get(sid));
  25575. }
  25576. }
  25577. if (pos === 0 || pos === 1) {
  25578. predefined = true;
  25579. format = pos;
  25580. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  25581. for (i = 0, ii = charset.length; i < ii; i++) {
  25582. const index = baseEncoding.indexOf(charset[i]);
  25583. if (index !== -1) {
  25584. encoding[index] = i;
  25585. }
  25586. }
  25587. } else {
  25588. const dataStart = pos;
  25589. format = bytes[pos++];
  25590. switch (format & 0x7f) {
  25591. case 0:
  25592. const glyphsCount = bytes[pos++];
  25593. for (i = 1; i <= glyphsCount; i++) {
  25594. encoding[bytes[pos++]] = i;
  25595. }
  25596. break;
  25597. case 1:
  25598. const rangesCount = bytes[pos++];
  25599. let gid = 1;
  25600. for (i = 0; i < rangesCount; i++) {
  25601. const start = bytes[pos++];
  25602. const left = bytes[pos++];
  25603. for (let j = start; j <= start + left; j++) {
  25604. encoding[j] = gid++;
  25605. }
  25606. }
  25607. break;
  25608. default:
  25609. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  25610. }
  25611. const dataEnd = pos;
  25612. if (format & 0x80) {
  25613. bytes[dataStart] &= 0x7f;
  25614. readSupplement();
  25615. }
  25616. raw = bytes.subarray(dataStart, dataEnd);
  25617. }
  25618. format = format & 0x7f;
  25619. return new CFFEncoding(predefined, format, encoding, raw);
  25620. }
  25621. parseFDSelect(pos, length) {
  25622. const bytes = this.bytes;
  25623. const format = bytes[pos++];
  25624. const fdSelect = [];
  25625. let i;
  25626. switch (format) {
  25627. case 0:
  25628. for (i = 0; i < length; ++i) {
  25629. const id = bytes[pos++];
  25630. fdSelect.push(id);
  25631. }
  25632. break;
  25633. case 3:
  25634. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  25635. for (i = 0; i < rangesCount; ++i) {
  25636. let first = bytes[pos++] << 8 | bytes[pos++];
  25637. if (i === 0 && first !== 0) {
  25638. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  25639. first = 0;
  25640. }
  25641. const fdIndex = bytes[pos++];
  25642. const next = bytes[pos] << 8 | bytes[pos + 1];
  25643. for (let j = first; j < next; ++j) {
  25644. fdSelect.push(fdIndex);
  25645. }
  25646. }
  25647. pos += 2;
  25648. break;
  25649. default:
  25650. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  25651. }
  25652. if (fdSelect.length !== length) {
  25653. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  25654. }
  25655. return new CFFFDSelect(format, fdSelect);
  25656. }
  25657. }
  25658. return CFFParser;
  25659. }();
  25660. exports.CFFParser = CFFParser;
  25661. class CFF {
  25662. constructor() {
  25663. this.header = null;
  25664. this.names = [];
  25665. this.topDict = null;
  25666. this.strings = new CFFStrings();
  25667. this.globalSubrIndex = null;
  25668. this.encoding = null;
  25669. this.charset = null;
  25670. this.charStrings = null;
  25671. this.fdArray = [];
  25672. this.fdSelect = null;
  25673. this.isCIDFont = false;
  25674. }
  25675. duplicateFirstGlyph() {
  25676. if (this.charStrings.count >= 65535) {
  25677. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  25678. return;
  25679. }
  25680. const glyphZero = this.charStrings.get(0);
  25681. this.charStrings.add(glyphZero);
  25682. if (this.isCIDFont) {
  25683. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  25684. }
  25685. }
  25686. hasGlyphId(id) {
  25687. if (id < 0 || id >= this.charStrings.count) {
  25688. return false;
  25689. }
  25690. const glyph = this.charStrings.get(id);
  25691. return glyph.length > 0;
  25692. }
  25693. }
  25694. exports.CFF = CFF;
  25695. class CFFHeader {
  25696. constructor(major, minor, hdrSize, offSize) {
  25697. this.major = major;
  25698. this.minor = minor;
  25699. this.hdrSize = hdrSize;
  25700. this.offSize = offSize;
  25701. }
  25702. }
  25703. exports.CFFHeader = CFFHeader;
  25704. class CFFStrings {
  25705. constructor() {
  25706. this.strings = [];
  25707. }
  25708. get(index) {
  25709. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  25710. return CFFStandardStrings[index];
  25711. }
  25712. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  25713. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  25714. }
  25715. return CFFStandardStrings[0];
  25716. }
  25717. getSID(str) {
  25718. let index = CFFStandardStrings.indexOf(str);
  25719. if (index !== -1) {
  25720. return index;
  25721. }
  25722. index = this.strings.indexOf(str);
  25723. if (index !== -1) {
  25724. return index + NUM_STANDARD_CFF_STRINGS;
  25725. }
  25726. return -1;
  25727. }
  25728. add(value) {
  25729. this.strings.push(value);
  25730. }
  25731. get count() {
  25732. return this.strings.length;
  25733. }
  25734. }
  25735. exports.CFFStrings = CFFStrings;
  25736. class CFFIndex {
  25737. constructor() {
  25738. this.objects = [];
  25739. this.length = 0;
  25740. }
  25741. add(data) {
  25742. this.length += data.length;
  25743. this.objects.push(data);
  25744. }
  25745. set(index, data) {
  25746. this.length += data.length - this.objects[index].length;
  25747. this.objects[index] = data;
  25748. }
  25749. get(index) {
  25750. return this.objects[index];
  25751. }
  25752. get count() {
  25753. return this.objects.length;
  25754. }
  25755. }
  25756. exports.CFFIndex = CFFIndex;
  25757. class CFFDict {
  25758. constructor(tables, strings) {
  25759. this.keyToNameMap = tables.keyToNameMap;
  25760. this.nameToKeyMap = tables.nameToKeyMap;
  25761. this.defaults = tables.defaults;
  25762. this.types = tables.types;
  25763. this.opcodes = tables.opcodes;
  25764. this.order = tables.order;
  25765. this.strings = strings;
  25766. this.values = Object.create(null);
  25767. }
  25768. setByKey(key, value) {
  25769. if (!(key in this.keyToNameMap)) {
  25770. return false;
  25771. }
  25772. const valueLength = value.length;
  25773. if (valueLength === 0) {
  25774. return true;
  25775. }
  25776. for (let i = 0; i < valueLength; i++) {
  25777. if (isNaN(value[i])) {
  25778. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  25779. return true;
  25780. }
  25781. }
  25782. const type = this.types[key];
  25783. if (type === "num" || type === "sid" || type === "offset") {
  25784. value = value[0];
  25785. }
  25786. this.values[key] = value;
  25787. return true;
  25788. }
  25789. setByName(name, value) {
  25790. if (!(name in this.nameToKeyMap)) {
  25791. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  25792. }
  25793. this.values[this.nameToKeyMap[name]] = value;
  25794. }
  25795. hasName(name) {
  25796. return this.nameToKeyMap[name] in this.values;
  25797. }
  25798. getByName(name) {
  25799. if (!(name in this.nameToKeyMap)) {
  25800. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  25801. }
  25802. const key = this.nameToKeyMap[name];
  25803. if (!(key in this.values)) {
  25804. return this.defaults[key];
  25805. }
  25806. return this.values[key];
  25807. }
  25808. removeByName(name) {
  25809. delete this.values[this.nameToKeyMap[name]];
  25810. }
  25811. static createTables(layout) {
  25812. const tables = {
  25813. keyToNameMap: {},
  25814. nameToKeyMap: {},
  25815. defaults: {},
  25816. types: {},
  25817. opcodes: {},
  25818. order: []
  25819. };
  25820. for (let i = 0, ii = layout.length; i < ii; ++i) {
  25821. const entry = layout[i];
  25822. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  25823. tables.keyToNameMap[key] = entry[1];
  25824. tables.nameToKeyMap[entry[1]] = key;
  25825. tables.types[key] = entry[2];
  25826. tables.defaults[key] = entry[3];
  25827. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  25828. tables.order.push(key);
  25829. }
  25830. return tables;
  25831. }
  25832. }
  25833. const CFFTopDict = function CFFTopDictClosure() {
  25834. const 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]];
  25835. let tables = null;
  25836. class CFFTopDict extends CFFDict {
  25837. constructor(strings) {
  25838. if (tables === null) {
  25839. tables = CFFDict.createTables(layout);
  25840. }
  25841. super(tables, strings);
  25842. this.privateDict = null;
  25843. }
  25844. }
  25845. return CFFTopDict;
  25846. }();
  25847. exports.CFFTopDict = CFFTopDict;
  25848. const CFFPrivateDict = function CFFPrivateDictClosure() {
  25849. const 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]];
  25850. let tables = null;
  25851. class CFFPrivateDict extends CFFDict {
  25852. constructor(strings) {
  25853. if (tables === null) {
  25854. tables = CFFDict.createTables(layout);
  25855. }
  25856. super(tables, strings);
  25857. this.subrsIndex = null;
  25858. }
  25859. }
  25860. return CFFPrivateDict;
  25861. }();
  25862. exports.CFFPrivateDict = CFFPrivateDict;
  25863. const CFFCharsetPredefinedTypes = {
  25864. ISO_ADOBE: 0,
  25865. EXPERT: 1,
  25866. EXPERT_SUBSET: 2
  25867. };
  25868. class CFFCharset {
  25869. constructor(predefined, format, charset, raw) {
  25870. this.predefined = predefined;
  25871. this.format = format;
  25872. this.charset = charset;
  25873. this.raw = raw;
  25874. }
  25875. }
  25876. exports.CFFCharset = CFFCharset;
  25877. class CFFEncoding {
  25878. constructor(predefined, format, encoding, raw) {
  25879. this.predefined = predefined;
  25880. this.format = format;
  25881. this.encoding = encoding;
  25882. this.raw = raw;
  25883. }
  25884. }
  25885. class CFFFDSelect {
  25886. constructor(format, fdSelect) {
  25887. this.format = format;
  25888. this.fdSelect = fdSelect;
  25889. }
  25890. getFDIndex(glyphIndex) {
  25891. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  25892. return -1;
  25893. }
  25894. return this.fdSelect[glyphIndex];
  25895. }
  25896. }
  25897. exports.CFFFDSelect = CFFFDSelect;
  25898. class CFFOffsetTracker {
  25899. constructor() {
  25900. this.offsets = Object.create(null);
  25901. }
  25902. isTracking(key) {
  25903. return key in this.offsets;
  25904. }
  25905. track(key, location) {
  25906. if (key in this.offsets) {
  25907. throw new _util.FormatError(`Already tracking location of ${key}`);
  25908. }
  25909. this.offsets[key] = location;
  25910. }
  25911. offset(value) {
  25912. for (const key in this.offsets) {
  25913. this.offsets[key] += value;
  25914. }
  25915. }
  25916. setEntryLocation(key, values, output) {
  25917. if (!(key in this.offsets)) {
  25918. throw new _util.FormatError(`Not tracking location of ${key}`);
  25919. }
  25920. const data = output.data;
  25921. const dataOffset = this.offsets[key];
  25922. const size = 5;
  25923. for (let i = 0, ii = values.length; i < ii; ++i) {
  25924. const offset0 = i * size + dataOffset;
  25925. const offset1 = offset0 + 1;
  25926. const offset2 = offset0 + 2;
  25927. const offset3 = offset0 + 3;
  25928. const offset4 = offset0 + 4;
  25929. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  25930. throw new _util.FormatError("writing to an offset that is not empty");
  25931. }
  25932. const value = values[i];
  25933. data[offset0] = 0x1d;
  25934. data[offset1] = value >> 24 & 0xff;
  25935. data[offset2] = value >> 16 & 0xff;
  25936. data[offset3] = value >> 8 & 0xff;
  25937. data[offset4] = value & 0xff;
  25938. }
  25939. }
  25940. }
  25941. class CFFCompiler {
  25942. constructor(cff) {
  25943. this.cff = cff;
  25944. }
  25945. compile() {
  25946. const cff = this.cff;
  25947. const output = {
  25948. data: [],
  25949. length: 0,
  25950. add: function CFFCompiler_add(data) {
  25951. this.data = this.data.concat(data);
  25952. this.length = this.data.length;
  25953. }
  25954. };
  25955. const header = this.compileHeader(cff.header);
  25956. output.add(header);
  25957. const nameIndex = this.compileNameIndex(cff.names);
  25958. output.add(nameIndex);
  25959. if (cff.isCIDFont) {
  25960. if (cff.topDict.hasName("FontMatrix")) {
  25961. const base = cff.topDict.getByName("FontMatrix");
  25962. cff.topDict.removeByName("FontMatrix");
  25963. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  25964. const subDict = cff.fdArray[i];
  25965. let matrix = base.slice(0);
  25966. if (subDict.hasName("FontMatrix")) {
  25967. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  25968. }
  25969. subDict.setByName("FontMatrix", matrix);
  25970. }
  25971. }
  25972. }
  25973. const xuid = cff.topDict.getByName("XUID");
  25974. if (xuid && xuid.length > 16) {
  25975. cff.topDict.removeByName("XUID");
  25976. }
  25977. cff.topDict.setByName("charset", 0);
  25978. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  25979. output.add(compiled.output);
  25980. const topDictTracker = compiled.trackers[0];
  25981. const stringIndex = this.compileStringIndex(cff.strings.strings);
  25982. output.add(stringIndex);
  25983. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  25984. output.add(globalSubrIndex);
  25985. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  25986. if (cff.encoding.predefined) {
  25987. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  25988. } else {
  25989. const encoding = this.compileEncoding(cff.encoding);
  25990. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  25991. output.add(encoding);
  25992. }
  25993. }
  25994. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  25995. topDictTracker.setEntryLocation("charset", [output.length], output);
  25996. output.add(charset);
  25997. const charStrings = this.compileCharStrings(cff.charStrings);
  25998. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  25999. output.add(charStrings);
  26000. if (cff.isCIDFont) {
  26001. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  26002. const fdSelect = this.compileFDSelect(cff.fdSelect);
  26003. output.add(fdSelect);
  26004. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  26005. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  26006. output.add(compiled.output);
  26007. const fontDictTrackers = compiled.trackers;
  26008. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  26009. }
  26010. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  26011. output.add([0]);
  26012. return output.data;
  26013. }
  26014. encodeNumber(value) {
  26015. if (Number.isInteger(value)) {
  26016. return this.encodeInteger(value);
  26017. }
  26018. return this.encodeFloat(value);
  26019. }
  26020. static get EncodeFloatRegExp() {
  26021. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  26022. }
  26023. encodeFloat(num) {
  26024. let value = num.toString();
  26025. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  26026. if (m) {
  26027. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  26028. value = (Math.round(num * epsilon) / epsilon).toString();
  26029. }
  26030. let nibbles = "";
  26031. let i, ii;
  26032. for (i = 0, ii = value.length; i < ii; ++i) {
  26033. const a = value[i];
  26034. if (a === "e") {
  26035. nibbles += value[++i] === "-" ? "c" : "b";
  26036. } else if (a === ".") {
  26037. nibbles += "a";
  26038. } else if (a === "-") {
  26039. nibbles += "e";
  26040. } else {
  26041. nibbles += a;
  26042. }
  26043. }
  26044. nibbles += nibbles.length & 1 ? "f" : "ff";
  26045. const out = [30];
  26046. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  26047. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  26048. }
  26049. return out;
  26050. }
  26051. encodeInteger(value) {
  26052. let code;
  26053. if (value >= -107 && value <= 107) {
  26054. code = [value + 139];
  26055. } else if (value >= 108 && value <= 1131) {
  26056. value = value - 108;
  26057. code = [(value >> 8) + 247, value & 0xff];
  26058. } else if (value >= -1131 && value <= -108) {
  26059. value = -value - 108;
  26060. code = [(value >> 8) + 251, value & 0xff];
  26061. } else if (value >= -32768 && value <= 32767) {
  26062. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  26063. } else {
  26064. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  26065. }
  26066. return code;
  26067. }
  26068. compileHeader(header) {
  26069. return [header.major, header.minor, 4, header.offSize];
  26070. }
  26071. compileNameIndex(names) {
  26072. const nameIndex = new CFFIndex();
  26073. for (let i = 0, ii = names.length; i < ii; ++i) {
  26074. const name = names[i];
  26075. const length = Math.min(name.length, 127);
  26076. let sanitizedName = new Array(length);
  26077. for (let j = 0; j < length; j++) {
  26078. let char = name[j];
  26079. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  26080. char = "_";
  26081. }
  26082. sanitizedName[j] = char;
  26083. }
  26084. sanitizedName = sanitizedName.join("");
  26085. if (sanitizedName === "") {
  26086. sanitizedName = "Bad_Font_Name";
  26087. }
  26088. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  26089. }
  26090. return this.compileIndex(nameIndex);
  26091. }
  26092. compileTopDicts(dicts, length, removeCidKeys) {
  26093. const fontDictTrackers = [];
  26094. let fdArrayIndex = new CFFIndex();
  26095. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  26096. const fontDict = dicts[i];
  26097. if (removeCidKeys) {
  26098. fontDict.removeByName("CIDFontVersion");
  26099. fontDict.removeByName("CIDFontRevision");
  26100. fontDict.removeByName("CIDFontType");
  26101. fontDict.removeByName("CIDCount");
  26102. fontDict.removeByName("UIDBase");
  26103. }
  26104. const fontDictTracker = new CFFOffsetTracker();
  26105. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  26106. fontDictTrackers.push(fontDictTracker);
  26107. fdArrayIndex.add(fontDictData);
  26108. fontDictTracker.offset(length);
  26109. }
  26110. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  26111. return {
  26112. trackers: fontDictTrackers,
  26113. output: fdArrayIndex
  26114. };
  26115. }
  26116. compilePrivateDicts(dicts, trackers, output) {
  26117. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  26118. const fontDict = dicts[i];
  26119. const privateDict = fontDict.privateDict;
  26120. if (!privateDict || !fontDict.hasName("Private")) {
  26121. throw new _util.FormatError("There must be a private dictionary.");
  26122. }
  26123. const privateDictTracker = new CFFOffsetTracker();
  26124. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  26125. let outputLength = output.length;
  26126. privateDictTracker.offset(outputLength);
  26127. if (!privateDictData.length) {
  26128. outputLength = 0;
  26129. }
  26130. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  26131. output.add(privateDictData);
  26132. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  26133. const subrs = this.compileIndex(privateDict.subrsIndex);
  26134. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  26135. output.add(subrs);
  26136. }
  26137. }
  26138. }
  26139. compileDict(dict, offsetTracker) {
  26140. let out = [];
  26141. const order = dict.order;
  26142. for (let i = 0; i < order.length; ++i) {
  26143. const key = order[i];
  26144. if (!(key in dict.values)) {
  26145. continue;
  26146. }
  26147. let values = dict.values[key];
  26148. let types = dict.types[key];
  26149. if (!Array.isArray(types)) {
  26150. types = [types];
  26151. }
  26152. if (!Array.isArray(values)) {
  26153. values = [values];
  26154. }
  26155. if (values.length === 0) {
  26156. continue;
  26157. }
  26158. for (let j = 0, jj = types.length; j < jj; ++j) {
  26159. const type = types[j];
  26160. const value = values[j];
  26161. switch (type) {
  26162. case "num":
  26163. case "sid":
  26164. out = out.concat(this.encodeNumber(value));
  26165. break;
  26166. case "offset":
  26167. const name = dict.keyToNameMap[key];
  26168. if (!offsetTracker.isTracking(name)) {
  26169. offsetTracker.track(name, out.length);
  26170. }
  26171. out = out.concat([0x1d, 0, 0, 0, 0]);
  26172. break;
  26173. case "array":
  26174. case "delta":
  26175. out = out.concat(this.encodeNumber(value));
  26176. for (let k = 1, kk = values.length; k < kk; ++k) {
  26177. out = out.concat(this.encodeNumber(values[k]));
  26178. }
  26179. break;
  26180. default:
  26181. throw new _util.FormatError(`Unknown data type of ${type}`);
  26182. }
  26183. }
  26184. out = out.concat(dict.opcodes[key]);
  26185. }
  26186. return out;
  26187. }
  26188. compileStringIndex(strings) {
  26189. const stringIndex = new CFFIndex();
  26190. for (let i = 0, ii = strings.length; i < ii; ++i) {
  26191. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  26192. }
  26193. return this.compileIndex(stringIndex);
  26194. }
  26195. compileGlobalSubrIndex() {
  26196. const globalSubrIndex = this.cff.globalSubrIndex;
  26197. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  26198. }
  26199. compileCharStrings(charStrings) {
  26200. const charStringsIndex = new CFFIndex();
  26201. for (let i = 0; i < charStrings.count; i++) {
  26202. const glyph = charStrings.get(i);
  26203. if (glyph.length === 0) {
  26204. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  26205. continue;
  26206. }
  26207. charStringsIndex.add(glyph);
  26208. }
  26209. return this.compileIndex(charStringsIndex);
  26210. }
  26211. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  26212. let out;
  26213. const numGlyphsLessNotDef = numGlyphs - 1;
  26214. if (isCIDFont) {
  26215. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  26216. } else {
  26217. const length = 1 + numGlyphsLessNotDef * 2;
  26218. out = new Uint8Array(length);
  26219. out[0] = 0;
  26220. let charsetIndex = 0;
  26221. const numCharsets = charset.charset.length;
  26222. let warned = false;
  26223. for (let i = 1; i < out.length; i += 2) {
  26224. let sid = 0;
  26225. if (charsetIndex < numCharsets) {
  26226. const name = charset.charset[charsetIndex++];
  26227. sid = strings.getSID(name);
  26228. if (sid === -1) {
  26229. sid = 0;
  26230. if (!warned) {
  26231. warned = true;
  26232. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  26233. }
  26234. }
  26235. }
  26236. out[i] = sid >> 8 & 0xff;
  26237. out[i + 1] = sid & 0xff;
  26238. }
  26239. }
  26240. return this.compileTypedArray(out);
  26241. }
  26242. compileEncoding(encoding) {
  26243. return this.compileTypedArray(encoding.raw);
  26244. }
  26245. compileFDSelect(fdSelect) {
  26246. const format = fdSelect.format;
  26247. let out, i;
  26248. switch (format) {
  26249. case 0:
  26250. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  26251. out[0] = format;
  26252. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  26253. out[i + 1] = fdSelect.fdSelect[i];
  26254. }
  26255. break;
  26256. case 3:
  26257. const start = 0;
  26258. let lastFD = fdSelect.fdSelect[0];
  26259. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  26260. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  26261. const currentFD = fdSelect.fdSelect[i];
  26262. if (currentFD !== lastFD) {
  26263. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  26264. lastFD = currentFD;
  26265. }
  26266. }
  26267. const numRanges = (ranges.length - 3) / 3;
  26268. ranges[1] = numRanges >> 8 & 0xff;
  26269. ranges[2] = numRanges & 0xff;
  26270. ranges.push(i >> 8 & 0xff, i & 0xff);
  26271. out = new Uint8Array(ranges);
  26272. break;
  26273. }
  26274. return this.compileTypedArray(out);
  26275. }
  26276. compileTypedArray(data) {
  26277. const out = [];
  26278. for (let i = 0, ii = data.length; i < ii; ++i) {
  26279. out[i] = data[i];
  26280. }
  26281. return out;
  26282. }
  26283. compileIndex(index, trackers = []) {
  26284. const objects = index.objects;
  26285. const count = objects.length;
  26286. if (count === 0) {
  26287. return [0, 0, 0];
  26288. }
  26289. const data = [count >> 8 & 0xff, count & 0xff];
  26290. let lastOffset = 1,
  26291. i;
  26292. for (i = 0; i < count; ++i) {
  26293. lastOffset += objects[i].length;
  26294. }
  26295. let offsetSize;
  26296. if (lastOffset < 0x100) {
  26297. offsetSize = 1;
  26298. } else if (lastOffset < 0x10000) {
  26299. offsetSize = 2;
  26300. } else if (lastOffset < 0x1000000) {
  26301. offsetSize = 3;
  26302. } else {
  26303. offsetSize = 4;
  26304. }
  26305. data.push(offsetSize);
  26306. let relativeOffset = 1;
  26307. for (i = 0; i < count + 1; i++) {
  26308. if (offsetSize === 1) {
  26309. data.push(relativeOffset & 0xff);
  26310. } else if (offsetSize === 2) {
  26311. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  26312. } else if (offsetSize === 3) {
  26313. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  26314. } else {
  26315. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  26316. }
  26317. if (objects[i]) {
  26318. relativeOffset += objects[i].length;
  26319. }
  26320. }
  26321. for (i = 0; i < count; i++) {
  26322. if (trackers[i]) {
  26323. trackers[i].offset(data.length);
  26324. }
  26325. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  26326. data.push(objects[i][j]);
  26327. }
  26328. }
  26329. return data;
  26330. }
  26331. }
  26332. exports.CFFCompiler = CFFCompiler;
  26333. /***/ }),
  26334. /* 33 */
  26335. /***/ ((__unused_webpack_module, exports) => {
  26336. Object.defineProperty(exports, "__esModule", ({
  26337. value: true
  26338. }));
  26339. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  26340. 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"];
  26341. exports.ISOAdobeCharset = ISOAdobeCharset;
  26342. 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"];
  26343. exports.ExpertCharset = ExpertCharset;
  26344. 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"];
  26345. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  26346. /***/ }),
  26347. /* 34 */
  26348. /***/ ((__unused_webpack_module, exports) => {
  26349. Object.defineProperty(exports, "__esModule", ({
  26350. value: true
  26351. }));
  26352. exports.getEncoding = getEncoding;
  26353. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  26354. 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"];
  26355. exports.ExpertEncoding = ExpertEncoding;
  26356. 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", "", "", "", ""];
  26357. 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"];
  26358. exports.MacRomanEncoding = MacRomanEncoding;
  26359. 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", "", "", "", ""];
  26360. exports.StandardEncoding = StandardEncoding;
  26361. 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"];
  26362. exports.WinAnsiEncoding = WinAnsiEncoding;
  26363. 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", ""];
  26364. exports.SymbolSetEncoding = SymbolSetEncoding;
  26365. 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", ""];
  26366. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  26367. function getEncoding(encodingName) {
  26368. switch (encodingName) {
  26369. case "WinAnsiEncoding":
  26370. return WinAnsiEncoding;
  26371. case "StandardEncoding":
  26372. return StandardEncoding;
  26373. case "MacRomanEncoding":
  26374. return MacRomanEncoding;
  26375. case "SymbolSetEncoding":
  26376. return SymbolSetEncoding;
  26377. case "ZapfDingbatsEncoding":
  26378. return ZapfDingbatsEncoding;
  26379. case "ExpertEncoding":
  26380. return ExpertEncoding;
  26381. case "MacExpertEncoding":
  26382. return MacExpertEncoding;
  26383. default:
  26384. return null;
  26385. }
  26386. }
  26387. /***/ }),
  26388. /* 35 */
  26389. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  26390. __w_pdfjs_require__.r(__webpack_exports__);
  26391. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  26392. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  26393. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  26394. /* harmony export */ });
  26395. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  26396. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  26397. return [
  26398. "A",
  26399. 0x0041,
  26400. "AE",
  26401. 0x00c6,
  26402. "AEacute",
  26403. 0x01fc,
  26404. "AEmacron",
  26405. 0x01e2,
  26406. "AEsmall",
  26407. 0xf7e6,
  26408. "Aacute",
  26409. 0x00c1,
  26410. "Aacutesmall",
  26411. 0xf7e1,
  26412. "Abreve",
  26413. 0x0102,
  26414. "Abreveacute",
  26415. 0x1eae,
  26416. "Abrevecyrillic",
  26417. 0x04d0,
  26418. "Abrevedotbelow",
  26419. 0x1eb6,
  26420. "Abrevegrave",
  26421. 0x1eb0,
  26422. "Abrevehookabove",
  26423. 0x1eb2,
  26424. "Abrevetilde",
  26425. 0x1eb4,
  26426. "Acaron",
  26427. 0x01cd,
  26428. "Acircle",
  26429. 0x24b6,
  26430. "Acircumflex",
  26431. 0x00c2,
  26432. "Acircumflexacute",
  26433. 0x1ea4,
  26434. "Acircumflexdotbelow",
  26435. 0x1eac,
  26436. "Acircumflexgrave",
  26437. 0x1ea6,
  26438. "Acircumflexhookabove",
  26439. 0x1ea8,
  26440. "Acircumflexsmall",
  26441. 0xf7e2,
  26442. "Acircumflextilde",
  26443. 0x1eaa,
  26444. "Acute",
  26445. 0xf6c9,
  26446. "Acutesmall",
  26447. 0xf7b4,
  26448. "Acyrillic",
  26449. 0x0410,
  26450. "Adblgrave",
  26451. 0x0200,
  26452. "Adieresis",
  26453. 0x00c4,
  26454. "Adieresiscyrillic",
  26455. 0x04d2,
  26456. "Adieresismacron",
  26457. 0x01de,
  26458. "Adieresissmall",
  26459. 0xf7e4,
  26460. "Adotbelow",
  26461. 0x1ea0,
  26462. "Adotmacron",
  26463. 0x01e0,
  26464. "Agrave",
  26465. 0x00c0,
  26466. "Agravesmall",
  26467. 0xf7e0,
  26468. "Ahookabove",
  26469. 0x1ea2,
  26470. "Aiecyrillic",
  26471. 0x04d4,
  26472. "Ainvertedbreve",
  26473. 0x0202,
  26474. "Alpha",
  26475. 0x0391,
  26476. "Alphatonos",
  26477. 0x0386,
  26478. "Amacron",
  26479. 0x0100,
  26480. "Amonospace",
  26481. 0xff21,
  26482. "Aogonek",
  26483. 0x0104,
  26484. "Aring",
  26485. 0x00c5,
  26486. "Aringacute",
  26487. 0x01fa,
  26488. "Aringbelow",
  26489. 0x1e00,
  26490. "Aringsmall",
  26491. 0xf7e5,
  26492. "Asmall",
  26493. 0xf761,
  26494. "Atilde",
  26495. 0x00c3,
  26496. "Atildesmall",
  26497. 0xf7e3,
  26498. "Aybarmenian",
  26499. 0x0531,
  26500. "B",
  26501. 0x0042,
  26502. "Bcircle",
  26503. 0x24b7,
  26504. "Bdotaccent",
  26505. 0x1e02,
  26506. "Bdotbelow",
  26507. 0x1e04,
  26508. "Becyrillic",
  26509. 0x0411,
  26510. "Benarmenian",
  26511. 0x0532,
  26512. "Beta",
  26513. 0x0392,
  26514. "Bhook",
  26515. 0x0181,
  26516. "Blinebelow",
  26517. 0x1e06,
  26518. "Bmonospace",
  26519. 0xff22,
  26520. "Brevesmall",
  26521. 0xf6f4,
  26522. "Bsmall",
  26523. 0xf762,
  26524. "Btopbar",
  26525. 0x0182,
  26526. "C",
  26527. 0x0043,
  26528. "Caarmenian",
  26529. 0x053e,
  26530. "Cacute",
  26531. 0x0106,
  26532. "Caron",
  26533. 0xf6ca,
  26534. "Caronsmall",
  26535. 0xf6f5,
  26536. "Ccaron",
  26537. 0x010c,
  26538. "Ccedilla",
  26539. 0x00c7,
  26540. "Ccedillaacute",
  26541. 0x1e08,
  26542. "Ccedillasmall",
  26543. 0xf7e7,
  26544. "Ccircle",
  26545. 0x24b8,
  26546. "Ccircumflex",
  26547. 0x0108,
  26548. "Cdot",
  26549. 0x010a,
  26550. "Cdotaccent",
  26551. 0x010a,
  26552. "Cedillasmall",
  26553. 0xf7b8,
  26554. "Chaarmenian",
  26555. 0x0549,
  26556. "Cheabkhasiancyrillic",
  26557. 0x04bc,
  26558. "Checyrillic",
  26559. 0x0427,
  26560. "Chedescenderabkhasiancyrillic",
  26561. 0x04be,
  26562. "Chedescendercyrillic",
  26563. 0x04b6,
  26564. "Chedieresiscyrillic",
  26565. 0x04f4,
  26566. "Cheharmenian",
  26567. 0x0543,
  26568. "Chekhakassiancyrillic",
  26569. 0x04cb,
  26570. "Cheverticalstrokecyrillic",
  26571. 0x04b8,
  26572. "Chi",
  26573. 0x03a7,
  26574. "Chook",
  26575. 0x0187,
  26576. "Circumflexsmall",
  26577. 0xf6f6,
  26578. "Cmonospace",
  26579. 0xff23,
  26580. "Coarmenian",
  26581. 0x0551,
  26582. "Csmall",
  26583. 0xf763,
  26584. "D",
  26585. 0x0044,
  26586. "DZ",
  26587. 0x01f1,
  26588. "DZcaron",
  26589. 0x01c4,
  26590. "Daarmenian",
  26591. 0x0534,
  26592. "Dafrican",
  26593. 0x0189,
  26594. "Dcaron",
  26595. 0x010e,
  26596. "Dcedilla",
  26597. 0x1e10,
  26598. "Dcircle",
  26599. 0x24b9,
  26600. "Dcircumflexbelow",
  26601. 0x1e12,
  26602. "Dcroat",
  26603. 0x0110,
  26604. "Ddotaccent",
  26605. 0x1e0a,
  26606. "Ddotbelow",
  26607. 0x1e0c,
  26608. "Decyrillic",
  26609. 0x0414,
  26610. "Deicoptic",
  26611. 0x03ee,
  26612. "Delta",
  26613. 0x2206,
  26614. "Deltagreek",
  26615. 0x0394,
  26616. "Dhook",
  26617. 0x018a,
  26618. "Dieresis",
  26619. 0xf6cb,
  26620. "DieresisAcute",
  26621. 0xf6cc,
  26622. "DieresisGrave",
  26623. 0xf6cd,
  26624. "Dieresissmall",
  26625. 0xf7a8,
  26626. "Digammagreek",
  26627. 0x03dc,
  26628. "Djecyrillic",
  26629. 0x0402,
  26630. "Dlinebelow",
  26631. 0x1e0e,
  26632. "Dmonospace",
  26633. 0xff24,
  26634. "Dotaccentsmall",
  26635. 0xf6f7,
  26636. "Dslash",
  26637. 0x0110,
  26638. "Dsmall",
  26639. 0xf764,
  26640. "Dtopbar",
  26641. 0x018b,
  26642. "Dz",
  26643. 0x01f2,
  26644. "Dzcaron",
  26645. 0x01c5,
  26646. "Dzeabkhasiancyrillic",
  26647. 0x04e0,
  26648. "Dzecyrillic",
  26649. 0x0405,
  26650. "Dzhecyrillic",
  26651. 0x040f,
  26652. "E",
  26653. 0x0045,
  26654. "Eacute",
  26655. 0x00c9,
  26656. "Eacutesmall",
  26657. 0xf7e9,
  26658. "Ebreve",
  26659. 0x0114,
  26660. "Ecaron",
  26661. 0x011a,
  26662. "Ecedillabreve",
  26663. 0x1e1c,
  26664. "Echarmenian",
  26665. 0x0535,
  26666. "Ecircle",
  26667. 0x24ba,
  26668. "Ecircumflex",
  26669. 0x00ca,
  26670. "Ecircumflexacute",
  26671. 0x1ebe,
  26672. "Ecircumflexbelow",
  26673. 0x1e18,
  26674. "Ecircumflexdotbelow",
  26675. 0x1ec6,
  26676. "Ecircumflexgrave",
  26677. 0x1ec0,
  26678. "Ecircumflexhookabove",
  26679. 0x1ec2,
  26680. "Ecircumflexsmall",
  26681. 0xf7ea,
  26682. "Ecircumflextilde",
  26683. 0x1ec4,
  26684. "Ecyrillic",
  26685. 0x0404,
  26686. "Edblgrave",
  26687. 0x0204,
  26688. "Edieresis",
  26689. 0x00cb,
  26690. "Edieresissmall",
  26691. 0xf7eb,
  26692. "Edot",
  26693. 0x0116,
  26694. "Edotaccent",
  26695. 0x0116,
  26696. "Edotbelow",
  26697. 0x1eb8,
  26698. "Efcyrillic",
  26699. 0x0424,
  26700. "Egrave",
  26701. 0x00c8,
  26702. "Egravesmall",
  26703. 0xf7e8,
  26704. "Eharmenian",
  26705. 0x0537,
  26706. "Ehookabove",
  26707. 0x1eba,
  26708. "Eightroman",
  26709. 0x2167,
  26710. "Einvertedbreve",
  26711. 0x0206,
  26712. "Eiotifiedcyrillic",
  26713. 0x0464,
  26714. "Elcyrillic",
  26715. 0x041b,
  26716. "Elevenroman",
  26717. 0x216a,
  26718. "Emacron",
  26719. 0x0112,
  26720. "Emacronacute",
  26721. 0x1e16,
  26722. "Emacrongrave",
  26723. 0x1e14,
  26724. "Emcyrillic",
  26725. 0x041c,
  26726. "Emonospace",
  26727. 0xff25,
  26728. "Encyrillic",
  26729. 0x041d,
  26730. "Endescendercyrillic",
  26731. 0x04a2,
  26732. "Eng",
  26733. 0x014a,
  26734. "Enghecyrillic",
  26735. 0x04a4,
  26736. "Enhookcyrillic",
  26737. 0x04c7,
  26738. "Eogonek",
  26739. 0x0118,
  26740. "Eopen",
  26741. 0x0190,
  26742. "Epsilon",
  26743. 0x0395,
  26744. "Epsilontonos",
  26745. 0x0388,
  26746. "Ercyrillic",
  26747. 0x0420,
  26748. "Ereversed",
  26749. 0x018e,
  26750. "Ereversedcyrillic",
  26751. 0x042d,
  26752. "Escyrillic",
  26753. 0x0421,
  26754. "Esdescendercyrillic",
  26755. 0x04aa,
  26756. "Esh",
  26757. 0x01a9,
  26758. "Esmall",
  26759. 0xf765,
  26760. "Eta",
  26761. 0x0397,
  26762. "Etarmenian",
  26763. 0x0538,
  26764. "Etatonos",
  26765. 0x0389,
  26766. "Eth",
  26767. 0x00d0,
  26768. "Ethsmall",
  26769. 0xf7f0,
  26770. "Etilde",
  26771. 0x1ebc,
  26772. "Etildebelow",
  26773. 0x1e1a,
  26774. "Euro",
  26775. 0x20ac,
  26776. "Ezh",
  26777. 0x01b7,
  26778. "Ezhcaron",
  26779. 0x01ee,
  26780. "Ezhreversed",
  26781. 0x01b8,
  26782. "F",
  26783. 0x0046,
  26784. "Fcircle",
  26785. 0x24bb,
  26786. "Fdotaccent",
  26787. 0x1e1e,
  26788. "Feharmenian",
  26789. 0x0556,
  26790. "Feicoptic",
  26791. 0x03e4,
  26792. "Fhook",
  26793. 0x0191,
  26794. "Fitacyrillic",
  26795. 0x0472,
  26796. "Fiveroman",
  26797. 0x2164,
  26798. "Fmonospace",
  26799. 0xff26,
  26800. "Fourroman",
  26801. 0x2163,
  26802. "Fsmall",
  26803. 0xf766,
  26804. "G",
  26805. 0x0047,
  26806. "GBsquare",
  26807. 0x3387,
  26808. "Gacute",
  26809. 0x01f4,
  26810. "Gamma",
  26811. 0x0393,
  26812. "Gammaafrican",
  26813. 0x0194,
  26814. "Gangiacoptic",
  26815. 0x03ea,
  26816. "Gbreve",
  26817. 0x011e,
  26818. "Gcaron",
  26819. 0x01e6,
  26820. "Gcedilla",
  26821. 0x0122,
  26822. "Gcircle",
  26823. 0x24bc,
  26824. "Gcircumflex",
  26825. 0x011c,
  26826. "Gcommaaccent",
  26827. 0x0122,
  26828. "Gdot",
  26829. 0x0120,
  26830. "Gdotaccent",
  26831. 0x0120,
  26832. "Gecyrillic",
  26833. 0x0413,
  26834. "Ghadarmenian",
  26835. 0x0542,
  26836. "Ghemiddlehookcyrillic",
  26837. 0x0494,
  26838. "Ghestrokecyrillic",
  26839. 0x0492,
  26840. "Gheupturncyrillic",
  26841. 0x0490,
  26842. "Ghook",
  26843. 0x0193,
  26844. "Gimarmenian",
  26845. 0x0533,
  26846. "Gjecyrillic",
  26847. 0x0403,
  26848. "Gmacron",
  26849. 0x1e20,
  26850. "Gmonospace",
  26851. 0xff27,
  26852. "Grave",
  26853. 0xf6ce,
  26854. "Gravesmall",
  26855. 0xf760,
  26856. "Gsmall",
  26857. 0xf767,
  26858. "Gsmallhook",
  26859. 0x029b,
  26860. "Gstroke",
  26861. 0x01e4,
  26862. "H",
  26863. 0x0048,
  26864. "H18533",
  26865. 0x25cf,
  26866. "H18543",
  26867. 0x25aa,
  26868. "H18551",
  26869. 0x25ab,
  26870. "H22073",
  26871. 0x25a1,
  26872. "HPsquare",
  26873. 0x33cb,
  26874. "Haabkhasiancyrillic",
  26875. 0x04a8,
  26876. "Hadescendercyrillic",
  26877. 0x04b2,
  26878. "Hardsigncyrillic",
  26879. 0x042a,
  26880. "Hbar",
  26881. 0x0126,
  26882. "Hbrevebelow",
  26883. 0x1e2a,
  26884. "Hcedilla",
  26885. 0x1e28,
  26886. "Hcircle",
  26887. 0x24bd,
  26888. "Hcircumflex",
  26889. 0x0124,
  26890. "Hdieresis",
  26891. 0x1e26,
  26892. "Hdotaccent",
  26893. 0x1e22,
  26894. "Hdotbelow",
  26895. 0x1e24,
  26896. "Hmonospace",
  26897. 0xff28,
  26898. "Hoarmenian",
  26899. 0x0540,
  26900. "Horicoptic",
  26901. 0x03e8,
  26902. "Hsmall",
  26903. 0xf768,
  26904. "Hungarumlaut",
  26905. 0xf6cf,
  26906. "Hungarumlautsmall",
  26907. 0xf6f8,
  26908. "Hzsquare",
  26909. 0x3390,
  26910. "I",
  26911. 0x0049,
  26912. "IAcyrillic",
  26913. 0x042f,
  26914. "IJ",
  26915. 0x0132,
  26916. "IUcyrillic",
  26917. 0x042e,
  26918. "Iacute",
  26919. 0x00cd,
  26920. "Iacutesmall",
  26921. 0xf7ed,
  26922. "Ibreve",
  26923. 0x012c,
  26924. "Icaron",
  26925. 0x01cf,
  26926. "Icircle",
  26927. 0x24be,
  26928. "Icircumflex",
  26929. 0x00ce,
  26930. "Icircumflexsmall",
  26931. 0xf7ee,
  26932. "Icyrillic",
  26933. 0x0406,
  26934. "Idblgrave",
  26935. 0x0208,
  26936. "Idieresis",
  26937. 0x00cf,
  26938. "Idieresisacute",
  26939. 0x1e2e,
  26940. "Idieresiscyrillic",
  26941. 0x04e4,
  26942. "Idieresissmall",
  26943. 0xf7ef,
  26944. "Idot",
  26945. 0x0130,
  26946. "Idotaccent",
  26947. 0x0130,
  26948. "Idotbelow",
  26949. 0x1eca,
  26950. "Iebrevecyrillic",
  26951. 0x04d6,
  26952. "Iecyrillic",
  26953. 0x0415,
  26954. "Ifraktur",
  26955. 0x2111,
  26956. "Igrave",
  26957. 0x00cc,
  26958. "Igravesmall",
  26959. 0xf7ec,
  26960. "Ihookabove",
  26961. 0x1ec8,
  26962. "Iicyrillic",
  26963. 0x0418,
  26964. "Iinvertedbreve",
  26965. 0x020a,
  26966. "Iishortcyrillic",
  26967. 0x0419,
  26968. "Imacron",
  26969. 0x012a,
  26970. "Imacroncyrillic",
  26971. 0x04e2,
  26972. "Imonospace",
  26973. 0xff29,
  26974. "Iniarmenian",
  26975. 0x053b,
  26976. "Iocyrillic",
  26977. 0x0401,
  26978. "Iogonek",
  26979. 0x012e,
  26980. "Iota",
  26981. 0x0399,
  26982. "Iotaafrican",
  26983. 0x0196,
  26984. "Iotadieresis",
  26985. 0x03aa,
  26986. "Iotatonos",
  26987. 0x038a,
  26988. "Ismall",
  26989. 0xf769,
  26990. "Istroke",
  26991. 0x0197,
  26992. "Itilde",
  26993. 0x0128,
  26994. "Itildebelow",
  26995. 0x1e2c,
  26996. "Izhitsacyrillic",
  26997. 0x0474,
  26998. "Izhitsadblgravecyrillic",
  26999. 0x0476,
  27000. "J",
  27001. 0x004a,
  27002. "Jaarmenian",
  27003. 0x0541,
  27004. "Jcircle",
  27005. 0x24bf,
  27006. "Jcircumflex",
  27007. 0x0134,
  27008. "Jecyrillic",
  27009. 0x0408,
  27010. "Jheharmenian",
  27011. 0x054b,
  27012. "Jmonospace",
  27013. 0xff2a,
  27014. "Jsmall",
  27015. 0xf76a,
  27016. "K",
  27017. 0x004b,
  27018. "KBsquare",
  27019. 0x3385,
  27020. "KKsquare",
  27021. 0x33cd,
  27022. "Kabashkircyrillic",
  27023. 0x04a0,
  27024. "Kacute",
  27025. 0x1e30,
  27026. "Kacyrillic",
  27027. 0x041a,
  27028. "Kadescendercyrillic",
  27029. 0x049a,
  27030. "Kahookcyrillic",
  27031. 0x04c3,
  27032. "Kappa",
  27033. 0x039a,
  27034. "Kastrokecyrillic",
  27035. 0x049e,
  27036. "Kaverticalstrokecyrillic",
  27037. 0x049c,
  27038. "Kcaron",
  27039. 0x01e8,
  27040. "Kcedilla",
  27041. 0x0136,
  27042. "Kcircle",
  27043. 0x24c0,
  27044. "Kcommaaccent",
  27045. 0x0136,
  27046. "Kdotbelow",
  27047. 0x1e32,
  27048. "Keharmenian",
  27049. 0x0554,
  27050. "Kenarmenian",
  27051. 0x053f,
  27052. "Khacyrillic",
  27053. 0x0425,
  27054. "Kheicoptic",
  27055. 0x03e6,
  27056. "Khook",
  27057. 0x0198,
  27058. "Kjecyrillic",
  27059. 0x040c,
  27060. "Klinebelow",
  27061. 0x1e34,
  27062. "Kmonospace",
  27063. 0xff2b,
  27064. "Koppacyrillic",
  27065. 0x0480,
  27066. "Koppagreek",
  27067. 0x03de,
  27068. "Ksicyrillic",
  27069. 0x046e,
  27070. "Ksmall",
  27071. 0xf76b,
  27072. "L",
  27073. 0x004c,
  27074. "LJ",
  27075. 0x01c7,
  27076. "LL",
  27077. 0xf6bf,
  27078. "Lacute",
  27079. 0x0139,
  27080. "Lambda",
  27081. 0x039b,
  27082. "Lcaron",
  27083. 0x013d,
  27084. "Lcedilla",
  27085. 0x013b,
  27086. "Lcircle",
  27087. 0x24c1,
  27088. "Lcircumflexbelow",
  27089. 0x1e3c,
  27090. "Lcommaaccent",
  27091. 0x013b,
  27092. "Ldot",
  27093. 0x013f,
  27094. "Ldotaccent",
  27095. 0x013f,
  27096. "Ldotbelow",
  27097. 0x1e36,
  27098. "Ldotbelowmacron",
  27099. 0x1e38,
  27100. "Liwnarmenian",
  27101. 0x053c,
  27102. "Lj",
  27103. 0x01c8,
  27104. "Ljecyrillic",
  27105. 0x0409,
  27106. "Llinebelow",
  27107. 0x1e3a,
  27108. "Lmonospace",
  27109. 0xff2c,
  27110. "Lslash",
  27111. 0x0141,
  27112. "Lslashsmall",
  27113. 0xf6f9,
  27114. "Lsmall",
  27115. 0xf76c,
  27116. "M",
  27117. 0x004d,
  27118. "MBsquare",
  27119. 0x3386,
  27120. "Macron",
  27121. 0xf6d0,
  27122. "Macronsmall",
  27123. 0xf7af,
  27124. "Macute",
  27125. 0x1e3e,
  27126. "Mcircle",
  27127. 0x24c2,
  27128. "Mdotaccent",
  27129. 0x1e40,
  27130. "Mdotbelow",
  27131. 0x1e42,
  27132. "Menarmenian",
  27133. 0x0544,
  27134. "Mmonospace",
  27135. 0xff2d,
  27136. "Msmall",
  27137. 0xf76d,
  27138. "Mturned",
  27139. 0x019c,
  27140. "Mu",
  27141. 0x039c,
  27142. "N",
  27143. 0x004e,
  27144. "NJ",
  27145. 0x01ca,
  27146. "Nacute",
  27147. 0x0143,
  27148. "Ncaron",
  27149. 0x0147,
  27150. "Ncedilla",
  27151. 0x0145,
  27152. "Ncircle",
  27153. 0x24c3,
  27154. "Ncircumflexbelow",
  27155. 0x1e4a,
  27156. "Ncommaaccent",
  27157. 0x0145,
  27158. "Ndotaccent",
  27159. 0x1e44,
  27160. "Ndotbelow",
  27161. 0x1e46,
  27162. "Nhookleft",
  27163. 0x019d,
  27164. "Nineroman",
  27165. 0x2168,
  27166. "Nj",
  27167. 0x01cb,
  27168. "Njecyrillic",
  27169. 0x040a,
  27170. "Nlinebelow",
  27171. 0x1e48,
  27172. "Nmonospace",
  27173. 0xff2e,
  27174. "Nowarmenian",
  27175. 0x0546,
  27176. "Nsmall",
  27177. 0xf76e,
  27178. "Ntilde",
  27179. 0x00d1,
  27180. "Ntildesmall",
  27181. 0xf7f1,
  27182. "Nu",
  27183. 0x039d,
  27184. "O",
  27185. 0x004f,
  27186. "OE",
  27187. 0x0152,
  27188. "OEsmall",
  27189. 0xf6fa,
  27190. "Oacute",
  27191. 0x00d3,
  27192. "Oacutesmall",
  27193. 0xf7f3,
  27194. "Obarredcyrillic",
  27195. 0x04e8,
  27196. "Obarreddieresiscyrillic",
  27197. 0x04ea,
  27198. "Obreve",
  27199. 0x014e,
  27200. "Ocaron",
  27201. 0x01d1,
  27202. "Ocenteredtilde",
  27203. 0x019f,
  27204. "Ocircle",
  27205. 0x24c4,
  27206. "Ocircumflex",
  27207. 0x00d4,
  27208. "Ocircumflexacute",
  27209. 0x1ed0,
  27210. "Ocircumflexdotbelow",
  27211. 0x1ed8,
  27212. "Ocircumflexgrave",
  27213. 0x1ed2,
  27214. "Ocircumflexhookabove",
  27215. 0x1ed4,
  27216. "Ocircumflexsmall",
  27217. 0xf7f4,
  27218. "Ocircumflextilde",
  27219. 0x1ed6,
  27220. "Ocyrillic",
  27221. 0x041e,
  27222. "Odblacute",
  27223. 0x0150,
  27224. "Odblgrave",
  27225. 0x020c,
  27226. "Odieresis",
  27227. 0x00d6,
  27228. "Odieresiscyrillic",
  27229. 0x04e6,
  27230. "Odieresissmall",
  27231. 0xf7f6,
  27232. "Odotbelow",
  27233. 0x1ecc,
  27234. "Ogoneksmall",
  27235. 0xf6fb,
  27236. "Ograve",
  27237. 0x00d2,
  27238. "Ogravesmall",
  27239. 0xf7f2,
  27240. "Oharmenian",
  27241. 0x0555,
  27242. "Ohm",
  27243. 0x2126,
  27244. "Ohookabove",
  27245. 0x1ece,
  27246. "Ohorn",
  27247. 0x01a0,
  27248. "Ohornacute",
  27249. 0x1eda,
  27250. "Ohorndotbelow",
  27251. 0x1ee2,
  27252. "Ohorngrave",
  27253. 0x1edc,
  27254. "Ohornhookabove",
  27255. 0x1ede,
  27256. "Ohorntilde",
  27257. 0x1ee0,
  27258. "Ohungarumlaut",
  27259. 0x0150,
  27260. "Oi",
  27261. 0x01a2,
  27262. "Oinvertedbreve",
  27263. 0x020e,
  27264. "Omacron",
  27265. 0x014c,
  27266. "Omacronacute",
  27267. 0x1e52,
  27268. "Omacrongrave",
  27269. 0x1e50,
  27270. "Omega",
  27271. 0x2126,
  27272. "Omegacyrillic",
  27273. 0x0460,
  27274. "Omegagreek",
  27275. 0x03a9,
  27276. "Omegaroundcyrillic",
  27277. 0x047a,
  27278. "Omegatitlocyrillic",
  27279. 0x047c,
  27280. "Omegatonos",
  27281. 0x038f,
  27282. "Omicron",
  27283. 0x039f,
  27284. "Omicrontonos",
  27285. 0x038c,
  27286. "Omonospace",
  27287. 0xff2f,
  27288. "Oneroman",
  27289. 0x2160,
  27290. "Oogonek",
  27291. 0x01ea,
  27292. "Oogonekmacron",
  27293. 0x01ec,
  27294. "Oopen",
  27295. 0x0186,
  27296. "Oslash",
  27297. 0x00d8,
  27298. "Oslashacute",
  27299. 0x01fe,
  27300. "Oslashsmall",
  27301. 0xf7f8,
  27302. "Osmall",
  27303. 0xf76f,
  27304. "Ostrokeacute",
  27305. 0x01fe,
  27306. "Otcyrillic",
  27307. 0x047e,
  27308. "Otilde",
  27309. 0x00d5,
  27310. "Otildeacute",
  27311. 0x1e4c,
  27312. "Otildedieresis",
  27313. 0x1e4e,
  27314. "Otildesmall",
  27315. 0xf7f5,
  27316. "P",
  27317. 0x0050,
  27318. "Pacute",
  27319. 0x1e54,
  27320. "Pcircle",
  27321. 0x24c5,
  27322. "Pdotaccent",
  27323. 0x1e56,
  27324. "Pecyrillic",
  27325. 0x041f,
  27326. "Peharmenian",
  27327. 0x054a,
  27328. "Pemiddlehookcyrillic",
  27329. 0x04a6,
  27330. "Phi",
  27331. 0x03a6,
  27332. "Phook",
  27333. 0x01a4,
  27334. "Pi",
  27335. 0x03a0,
  27336. "Piwrarmenian",
  27337. 0x0553,
  27338. "Pmonospace",
  27339. 0xff30,
  27340. "Psi",
  27341. 0x03a8,
  27342. "Psicyrillic",
  27343. 0x0470,
  27344. "Psmall",
  27345. 0xf770,
  27346. "Q",
  27347. 0x0051,
  27348. "Qcircle",
  27349. 0x24c6,
  27350. "Qmonospace",
  27351. 0xff31,
  27352. "Qsmall",
  27353. 0xf771,
  27354. "R",
  27355. 0x0052,
  27356. "Raarmenian",
  27357. 0x054c,
  27358. "Racute",
  27359. 0x0154,
  27360. "Rcaron",
  27361. 0x0158,
  27362. "Rcedilla",
  27363. 0x0156,
  27364. "Rcircle",
  27365. 0x24c7,
  27366. "Rcommaaccent",
  27367. 0x0156,
  27368. "Rdblgrave",
  27369. 0x0210,
  27370. "Rdotaccent",
  27371. 0x1e58,
  27372. "Rdotbelow",
  27373. 0x1e5a,
  27374. "Rdotbelowmacron",
  27375. 0x1e5c,
  27376. "Reharmenian",
  27377. 0x0550,
  27378. "Rfraktur",
  27379. 0x211c,
  27380. "Rho",
  27381. 0x03a1,
  27382. "Ringsmall",
  27383. 0xf6fc,
  27384. "Rinvertedbreve",
  27385. 0x0212,
  27386. "Rlinebelow",
  27387. 0x1e5e,
  27388. "Rmonospace",
  27389. 0xff32,
  27390. "Rsmall",
  27391. 0xf772,
  27392. "Rsmallinverted",
  27393. 0x0281,
  27394. "Rsmallinvertedsuperior",
  27395. 0x02b6,
  27396. "S",
  27397. 0x0053,
  27398. "SF010000",
  27399. 0x250c,
  27400. "SF020000",
  27401. 0x2514,
  27402. "SF030000",
  27403. 0x2510,
  27404. "SF040000",
  27405. 0x2518,
  27406. "SF050000",
  27407. 0x253c,
  27408. "SF060000",
  27409. 0x252c,
  27410. "SF070000",
  27411. 0x2534,
  27412. "SF080000",
  27413. 0x251c,
  27414. "SF090000",
  27415. 0x2524,
  27416. "SF100000",
  27417. 0x2500,
  27418. "SF110000",
  27419. 0x2502,
  27420. "SF190000",
  27421. 0x2561,
  27422. "SF200000",
  27423. 0x2562,
  27424. "SF210000",
  27425. 0x2556,
  27426. "SF220000",
  27427. 0x2555,
  27428. "SF230000",
  27429. 0x2563,
  27430. "SF240000",
  27431. 0x2551,
  27432. "SF250000",
  27433. 0x2557,
  27434. "SF260000",
  27435. 0x255d,
  27436. "SF270000",
  27437. 0x255c,
  27438. "SF280000",
  27439. 0x255b,
  27440. "SF360000",
  27441. 0x255e,
  27442. "SF370000",
  27443. 0x255f,
  27444. "SF380000",
  27445. 0x255a,
  27446. "SF390000",
  27447. 0x2554,
  27448. "SF400000",
  27449. 0x2569,
  27450. "SF410000",
  27451. 0x2566,
  27452. "SF420000",
  27453. 0x2560,
  27454. "SF430000",
  27455. 0x2550,
  27456. "SF440000",
  27457. 0x256c,
  27458. "SF450000",
  27459. 0x2567,
  27460. "SF460000",
  27461. 0x2568,
  27462. "SF470000",
  27463. 0x2564,
  27464. "SF480000",
  27465. 0x2565,
  27466. "SF490000",
  27467. 0x2559,
  27468. "SF500000",
  27469. 0x2558,
  27470. "SF510000",
  27471. 0x2552,
  27472. "SF520000",
  27473. 0x2553,
  27474. "SF530000",
  27475. 0x256b,
  27476. "SF540000",
  27477. 0x256a,
  27478. "Sacute",
  27479. 0x015a,
  27480. "Sacutedotaccent",
  27481. 0x1e64,
  27482. "Sampigreek",
  27483. 0x03e0,
  27484. "Scaron",
  27485. 0x0160,
  27486. "Scarondotaccent",
  27487. 0x1e66,
  27488. "Scaronsmall",
  27489. 0xf6fd,
  27490. "Scedilla",
  27491. 0x015e,
  27492. "Schwa",
  27493. 0x018f,
  27494. "Schwacyrillic",
  27495. 0x04d8,
  27496. "Schwadieresiscyrillic",
  27497. 0x04da,
  27498. "Scircle",
  27499. 0x24c8,
  27500. "Scircumflex",
  27501. 0x015c,
  27502. "Scommaaccent",
  27503. 0x0218,
  27504. "Sdotaccent",
  27505. 0x1e60,
  27506. "Sdotbelow",
  27507. 0x1e62,
  27508. "Sdotbelowdotaccent",
  27509. 0x1e68,
  27510. "Seharmenian",
  27511. 0x054d,
  27512. "Sevenroman",
  27513. 0x2166,
  27514. "Shaarmenian",
  27515. 0x0547,
  27516. "Shacyrillic",
  27517. 0x0428,
  27518. "Shchacyrillic",
  27519. 0x0429,
  27520. "Sheicoptic",
  27521. 0x03e2,
  27522. "Shhacyrillic",
  27523. 0x04ba,
  27524. "Shimacoptic",
  27525. 0x03ec,
  27526. "Sigma",
  27527. 0x03a3,
  27528. "Sixroman",
  27529. 0x2165,
  27530. "Smonospace",
  27531. 0xff33,
  27532. "Softsigncyrillic",
  27533. 0x042c,
  27534. "Ssmall",
  27535. 0xf773,
  27536. "Stigmagreek",
  27537. 0x03da,
  27538. "T",
  27539. 0x0054,
  27540. "Tau",
  27541. 0x03a4,
  27542. "Tbar",
  27543. 0x0166,
  27544. "Tcaron",
  27545. 0x0164,
  27546. "Tcedilla",
  27547. 0x0162,
  27548. "Tcircle",
  27549. 0x24c9,
  27550. "Tcircumflexbelow",
  27551. 0x1e70,
  27552. "Tcommaaccent",
  27553. 0x0162,
  27554. "Tdotaccent",
  27555. 0x1e6a,
  27556. "Tdotbelow",
  27557. 0x1e6c,
  27558. "Tecyrillic",
  27559. 0x0422,
  27560. "Tedescendercyrillic",
  27561. 0x04ac,
  27562. "Tenroman",
  27563. 0x2169,
  27564. "Tetsecyrillic",
  27565. 0x04b4,
  27566. "Theta",
  27567. 0x0398,
  27568. "Thook",
  27569. 0x01ac,
  27570. "Thorn",
  27571. 0x00de,
  27572. "Thornsmall",
  27573. 0xf7fe,
  27574. "Threeroman",
  27575. 0x2162,
  27576. "Tildesmall",
  27577. 0xf6fe,
  27578. "Tiwnarmenian",
  27579. 0x054f,
  27580. "Tlinebelow",
  27581. 0x1e6e,
  27582. "Tmonospace",
  27583. 0xff34,
  27584. "Toarmenian",
  27585. 0x0539,
  27586. "Tonefive",
  27587. 0x01bc,
  27588. "Tonesix",
  27589. 0x0184,
  27590. "Tonetwo",
  27591. 0x01a7,
  27592. "Tretroflexhook",
  27593. 0x01ae,
  27594. "Tsecyrillic",
  27595. 0x0426,
  27596. "Tshecyrillic",
  27597. 0x040b,
  27598. "Tsmall",
  27599. 0xf774,
  27600. "Twelveroman",
  27601. 0x216b,
  27602. "Tworoman",
  27603. 0x2161,
  27604. "U",
  27605. 0x0055,
  27606. "Uacute",
  27607. 0x00da,
  27608. "Uacutesmall",
  27609. 0xf7fa,
  27610. "Ubreve",
  27611. 0x016c,
  27612. "Ucaron",
  27613. 0x01d3,
  27614. "Ucircle",
  27615. 0x24ca,
  27616. "Ucircumflex",
  27617. 0x00db,
  27618. "Ucircumflexbelow",
  27619. 0x1e76,
  27620. "Ucircumflexsmall",
  27621. 0xf7fb,
  27622. "Ucyrillic",
  27623. 0x0423,
  27624. "Udblacute",
  27625. 0x0170,
  27626. "Udblgrave",
  27627. 0x0214,
  27628. "Udieresis",
  27629. 0x00dc,
  27630. "Udieresisacute",
  27631. 0x01d7,
  27632. "Udieresisbelow",
  27633. 0x1e72,
  27634. "Udieresiscaron",
  27635. 0x01d9,
  27636. "Udieresiscyrillic",
  27637. 0x04f0,
  27638. "Udieresisgrave",
  27639. 0x01db,
  27640. "Udieresismacron",
  27641. 0x01d5,
  27642. "Udieresissmall",
  27643. 0xf7fc,
  27644. "Udotbelow",
  27645. 0x1ee4,
  27646. "Ugrave",
  27647. 0x00d9,
  27648. "Ugravesmall",
  27649. 0xf7f9,
  27650. "Uhookabove",
  27651. 0x1ee6,
  27652. "Uhorn",
  27653. 0x01af,
  27654. "Uhornacute",
  27655. 0x1ee8,
  27656. "Uhorndotbelow",
  27657. 0x1ef0,
  27658. "Uhorngrave",
  27659. 0x1eea,
  27660. "Uhornhookabove",
  27661. 0x1eec,
  27662. "Uhorntilde",
  27663. 0x1eee,
  27664. "Uhungarumlaut",
  27665. 0x0170,
  27666. "Uhungarumlautcyrillic",
  27667. 0x04f2,
  27668. "Uinvertedbreve",
  27669. 0x0216,
  27670. "Ukcyrillic",
  27671. 0x0478,
  27672. "Umacron",
  27673. 0x016a,
  27674. "Umacroncyrillic",
  27675. 0x04ee,
  27676. "Umacrondieresis",
  27677. 0x1e7a,
  27678. "Umonospace",
  27679. 0xff35,
  27680. "Uogonek",
  27681. 0x0172,
  27682. "Upsilon",
  27683. 0x03a5,
  27684. "Upsilon1",
  27685. 0x03d2,
  27686. "Upsilonacutehooksymbolgreek",
  27687. 0x03d3,
  27688. "Upsilonafrican",
  27689. 0x01b1,
  27690. "Upsilondieresis",
  27691. 0x03ab,
  27692. "Upsilondieresishooksymbolgreek",
  27693. 0x03d4,
  27694. "Upsilonhooksymbol",
  27695. 0x03d2,
  27696. "Upsilontonos",
  27697. 0x038e,
  27698. "Uring",
  27699. 0x016e,
  27700. "Ushortcyrillic",
  27701. 0x040e,
  27702. "Usmall",
  27703. 0xf775,
  27704. "Ustraightcyrillic",
  27705. 0x04ae,
  27706. "Ustraightstrokecyrillic",
  27707. 0x04b0,
  27708. "Utilde",
  27709. 0x0168,
  27710. "Utildeacute",
  27711. 0x1e78,
  27712. "Utildebelow",
  27713. 0x1e74,
  27714. "V",
  27715. 0x0056,
  27716. "Vcircle",
  27717. 0x24cb,
  27718. "Vdotbelow",
  27719. 0x1e7e,
  27720. "Vecyrillic",
  27721. 0x0412,
  27722. "Vewarmenian",
  27723. 0x054e,
  27724. "Vhook",
  27725. 0x01b2,
  27726. "Vmonospace",
  27727. 0xff36,
  27728. "Voarmenian",
  27729. 0x0548,
  27730. "Vsmall",
  27731. 0xf776,
  27732. "Vtilde",
  27733. 0x1e7c,
  27734. "W",
  27735. 0x0057,
  27736. "Wacute",
  27737. 0x1e82,
  27738. "Wcircle",
  27739. 0x24cc,
  27740. "Wcircumflex",
  27741. 0x0174,
  27742. "Wdieresis",
  27743. 0x1e84,
  27744. "Wdotaccent",
  27745. 0x1e86,
  27746. "Wdotbelow",
  27747. 0x1e88,
  27748. "Wgrave",
  27749. 0x1e80,
  27750. "Wmonospace",
  27751. 0xff37,
  27752. "Wsmall",
  27753. 0xf777,
  27754. "X",
  27755. 0x0058,
  27756. "Xcircle",
  27757. 0x24cd,
  27758. "Xdieresis",
  27759. 0x1e8c,
  27760. "Xdotaccent",
  27761. 0x1e8a,
  27762. "Xeharmenian",
  27763. 0x053d,
  27764. "Xi",
  27765. 0x039e,
  27766. "Xmonospace",
  27767. 0xff38,
  27768. "Xsmall",
  27769. 0xf778,
  27770. "Y",
  27771. 0x0059,
  27772. "Yacute",
  27773. 0x00dd,
  27774. "Yacutesmall",
  27775. 0xf7fd,
  27776. "Yatcyrillic",
  27777. 0x0462,
  27778. "Ycircle",
  27779. 0x24ce,
  27780. "Ycircumflex",
  27781. 0x0176,
  27782. "Ydieresis",
  27783. 0x0178,
  27784. "Ydieresissmall",
  27785. 0xf7ff,
  27786. "Ydotaccent",
  27787. 0x1e8e,
  27788. "Ydotbelow",
  27789. 0x1ef4,
  27790. "Yericyrillic",
  27791. 0x042b,
  27792. "Yerudieresiscyrillic",
  27793. 0x04f8,
  27794. "Ygrave",
  27795. 0x1ef2,
  27796. "Yhook",
  27797. 0x01b3,
  27798. "Yhookabove",
  27799. 0x1ef6,
  27800. "Yiarmenian",
  27801. 0x0545,
  27802. "Yicyrillic",
  27803. 0x0407,
  27804. "Yiwnarmenian",
  27805. 0x0552,
  27806. "Ymonospace",
  27807. 0xff39,
  27808. "Ysmall",
  27809. 0xf779,
  27810. "Ytilde",
  27811. 0x1ef8,
  27812. "Yusbigcyrillic",
  27813. 0x046a,
  27814. "Yusbigiotifiedcyrillic",
  27815. 0x046c,
  27816. "Yuslittlecyrillic",
  27817. 0x0466,
  27818. "Yuslittleiotifiedcyrillic",
  27819. 0x0468,
  27820. "Z",
  27821. 0x005a,
  27822. "Zaarmenian",
  27823. 0x0536,
  27824. "Zacute",
  27825. 0x0179,
  27826. "Zcaron",
  27827. 0x017d,
  27828. "Zcaronsmall",
  27829. 0xf6ff,
  27830. "Zcircle",
  27831. 0x24cf,
  27832. "Zcircumflex",
  27833. 0x1e90,
  27834. "Zdot",
  27835. 0x017b,
  27836. "Zdotaccent",
  27837. 0x017b,
  27838. "Zdotbelow",
  27839. 0x1e92,
  27840. "Zecyrillic",
  27841. 0x0417,
  27842. "Zedescendercyrillic",
  27843. 0x0498,
  27844. "Zedieresiscyrillic",
  27845. 0x04de,
  27846. "Zeta",
  27847. 0x0396,
  27848. "Zhearmenian",
  27849. 0x053a,
  27850. "Zhebrevecyrillic",
  27851. 0x04c1,
  27852. "Zhecyrillic",
  27853. 0x0416,
  27854. "Zhedescendercyrillic",
  27855. 0x0496,
  27856. "Zhedieresiscyrillic",
  27857. 0x04dc,
  27858. "Zlinebelow",
  27859. 0x1e94,
  27860. "Zmonospace",
  27861. 0xff3a,
  27862. "Zsmall",
  27863. 0xf77a,
  27864. "Zstroke",
  27865. 0x01b5,
  27866. "a",
  27867. 0x0061,
  27868. "aabengali",
  27869. 0x0986,
  27870. "aacute",
  27871. 0x00e1,
  27872. "aadeva",
  27873. 0x0906,
  27874. "aagujarati",
  27875. 0x0a86,
  27876. "aagurmukhi",
  27877. 0x0a06,
  27878. "aamatragurmukhi",
  27879. 0x0a3e,
  27880. "aarusquare",
  27881. 0x3303,
  27882. "aavowelsignbengali",
  27883. 0x09be,
  27884. "aavowelsigndeva",
  27885. 0x093e,
  27886. "aavowelsigngujarati",
  27887. 0x0abe,
  27888. "abbreviationmarkarmenian",
  27889. 0x055f,
  27890. "abbreviationsigndeva",
  27891. 0x0970,
  27892. "abengali",
  27893. 0x0985,
  27894. "abopomofo",
  27895. 0x311a,
  27896. "abreve",
  27897. 0x0103,
  27898. "abreveacute",
  27899. 0x1eaf,
  27900. "abrevecyrillic",
  27901. 0x04d1,
  27902. "abrevedotbelow",
  27903. 0x1eb7,
  27904. "abrevegrave",
  27905. 0x1eb1,
  27906. "abrevehookabove",
  27907. 0x1eb3,
  27908. "abrevetilde",
  27909. 0x1eb5,
  27910. "acaron",
  27911. 0x01ce,
  27912. "acircle",
  27913. 0x24d0,
  27914. "acircumflex",
  27915. 0x00e2,
  27916. "acircumflexacute",
  27917. 0x1ea5,
  27918. "acircumflexdotbelow",
  27919. 0x1ead,
  27920. "acircumflexgrave",
  27921. 0x1ea7,
  27922. "acircumflexhookabove",
  27923. 0x1ea9,
  27924. "acircumflextilde",
  27925. 0x1eab,
  27926. "acute",
  27927. 0x00b4,
  27928. "acutebelowcmb",
  27929. 0x0317,
  27930. "acutecmb",
  27931. 0x0301,
  27932. "acutecomb",
  27933. 0x0301,
  27934. "acutedeva",
  27935. 0x0954,
  27936. "acutelowmod",
  27937. 0x02cf,
  27938. "acutetonecmb",
  27939. 0x0341,
  27940. "acyrillic",
  27941. 0x0430,
  27942. "adblgrave",
  27943. 0x0201,
  27944. "addakgurmukhi",
  27945. 0x0a71,
  27946. "adeva",
  27947. 0x0905,
  27948. "adieresis",
  27949. 0x00e4,
  27950. "adieresiscyrillic",
  27951. 0x04d3,
  27952. "adieresismacron",
  27953. 0x01df,
  27954. "adotbelow",
  27955. 0x1ea1,
  27956. "adotmacron",
  27957. 0x01e1,
  27958. "ae",
  27959. 0x00e6,
  27960. "aeacute",
  27961. 0x01fd,
  27962. "aekorean",
  27963. 0x3150,
  27964. "aemacron",
  27965. 0x01e3,
  27966. "afii00208",
  27967. 0x2015,
  27968. "afii08941",
  27969. 0x20a4,
  27970. "afii10017",
  27971. 0x0410,
  27972. "afii10018",
  27973. 0x0411,
  27974. "afii10019",
  27975. 0x0412,
  27976. "afii10020",
  27977. 0x0413,
  27978. "afii10021",
  27979. 0x0414,
  27980. "afii10022",
  27981. 0x0415,
  27982. "afii10023",
  27983. 0x0401,
  27984. "afii10024",
  27985. 0x0416,
  27986. "afii10025",
  27987. 0x0417,
  27988. "afii10026",
  27989. 0x0418,
  27990. "afii10027",
  27991. 0x0419,
  27992. "afii10028",
  27993. 0x041a,
  27994. "afii10029",
  27995. 0x041b,
  27996. "afii10030",
  27997. 0x041c,
  27998. "afii10031",
  27999. 0x041d,
  28000. "afii10032",
  28001. 0x041e,
  28002. "afii10033",
  28003. 0x041f,
  28004. "afii10034",
  28005. 0x0420,
  28006. "afii10035",
  28007. 0x0421,
  28008. "afii10036",
  28009. 0x0422,
  28010. "afii10037",
  28011. 0x0423,
  28012. "afii10038",
  28013. 0x0424,
  28014. "afii10039",
  28015. 0x0425,
  28016. "afii10040",
  28017. 0x0426,
  28018. "afii10041",
  28019. 0x0427,
  28020. "afii10042",
  28021. 0x0428,
  28022. "afii10043",
  28023. 0x0429,
  28024. "afii10044",
  28025. 0x042a,
  28026. "afii10045",
  28027. 0x042b,
  28028. "afii10046",
  28029. 0x042c,
  28030. "afii10047",
  28031. 0x042d,
  28032. "afii10048",
  28033. 0x042e,
  28034. "afii10049",
  28035. 0x042f,
  28036. "afii10050",
  28037. 0x0490,
  28038. "afii10051",
  28039. 0x0402,
  28040. "afii10052",
  28041. 0x0403,
  28042. "afii10053",
  28043. 0x0404,
  28044. "afii10054",
  28045. 0x0405,
  28046. "afii10055",
  28047. 0x0406,
  28048. "afii10056",
  28049. 0x0407,
  28050. "afii10057",
  28051. 0x0408,
  28052. "afii10058",
  28053. 0x0409,
  28054. "afii10059",
  28055. 0x040a,
  28056. "afii10060",
  28057. 0x040b,
  28058. "afii10061",
  28059. 0x040c,
  28060. "afii10062",
  28061. 0x040e,
  28062. "afii10063",
  28063. 0xf6c4,
  28064. "afii10064",
  28065. 0xf6c5,
  28066. "afii10065",
  28067. 0x0430,
  28068. "afii10066",
  28069. 0x0431,
  28070. "afii10067",
  28071. 0x0432,
  28072. "afii10068",
  28073. 0x0433,
  28074. "afii10069",
  28075. 0x0434,
  28076. "afii10070",
  28077. 0x0435,
  28078. "afii10071",
  28079. 0x0451,
  28080. "afii10072",
  28081. 0x0436,
  28082. "afii10073",
  28083. 0x0437,
  28084. "afii10074",
  28085. 0x0438,
  28086. "afii10075",
  28087. 0x0439,
  28088. "afii10076",
  28089. 0x043a,
  28090. "afii10077",
  28091. 0x043b,
  28092. "afii10078",
  28093. 0x043c,
  28094. "afii10079",
  28095. 0x043d,
  28096. "afii10080",
  28097. 0x043e,
  28098. "afii10081",
  28099. 0x043f,
  28100. "afii10082",
  28101. 0x0440,
  28102. "afii10083",
  28103. 0x0441,
  28104. "afii10084",
  28105. 0x0442,
  28106. "afii10085",
  28107. 0x0443,
  28108. "afii10086",
  28109. 0x0444,
  28110. "afii10087",
  28111. 0x0445,
  28112. "afii10088",
  28113. 0x0446,
  28114. "afii10089",
  28115. 0x0447,
  28116. "afii10090",
  28117. 0x0448,
  28118. "afii10091",
  28119. 0x0449,
  28120. "afii10092",
  28121. 0x044a,
  28122. "afii10093",
  28123. 0x044b,
  28124. "afii10094",
  28125. 0x044c,
  28126. "afii10095",
  28127. 0x044d,
  28128. "afii10096",
  28129. 0x044e,
  28130. "afii10097",
  28131. 0x044f,
  28132. "afii10098",
  28133. 0x0491,
  28134. "afii10099",
  28135. 0x0452,
  28136. "afii10100",
  28137. 0x0453,
  28138. "afii10101",
  28139. 0x0454,
  28140. "afii10102",
  28141. 0x0455,
  28142. "afii10103",
  28143. 0x0456,
  28144. "afii10104",
  28145. 0x0457,
  28146. "afii10105",
  28147. 0x0458,
  28148. "afii10106",
  28149. 0x0459,
  28150. "afii10107",
  28151. 0x045a,
  28152. "afii10108",
  28153. 0x045b,
  28154. "afii10109",
  28155. 0x045c,
  28156. "afii10110",
  28157. 0x045e,
  28158. "afii10145",
  28159. 0x040f,
  28160. "afii10146",
  28161. 0x0462,
  28162. "afii10147",
  28163. 0x0472,
  28164. "afii10148",
  28165. 0x0474,
  28166. "afii10192",
  28167. 0xf6c6,
  28168. "afii10193",
  28169. 0x045f,
  28170. "afii10194",
  28171. 0x0463,
  28172. "afii10195",
  28173. 0x0473,
  28174. "afii10196",
  28175. 0x0475,
  28176. "afii10831",
  28177. 0xf6c7,
  28178. "afii10832",
  28179. 0xf6c8,
  28180. "afii10846",
  28181. 0x04d9,
  28182. "afii299",
  28183. 0x200e,
  28184. "afii300",
  28185. 0x200f,
  28186. "afii301",
  28187. 0x200d,
  28188. "afii57381",
  28189. 0x066a,
  28190. "afii57388",
  28191. 0x060c,
  28192. "afii57392",
  28193. 0x0660,
  28194. "afii57393",
  28195. 0x0661,
  28196. "afii57394",
  28197. 0x0662,
  28198. "afii57395",
  28199. 0x0663,
  28200. "afii57396",
  28201. 0x0664,
  28202. "afii57397",
  28203. 0x0665,
  28204. "afii57398",
  28205. 0x0666,
  28206. "afii57399",
  28207. 0x0667,
  28208. "afii57400",
  28209. 0x0668,
  28210. "afii57401",
  28211. 0x0669,
  28212. "afii57403",
  28213. 0x061b,
  28214. "afii57407",
  28215. 0x061f,
  28216. "afii57409",
  28217. 0x0621,
  28218. "afii57410",
  28219. 0x0622,
  28220. "afii57411",
  28221. 0x0623,
  28222. "afii57412",
  28223. 0x0624,
  28224. "afii57413",
  28225. 0x0625,
  28226. "afii57414",
  28227. 0x0626,
  28228. "afii57415",
  28229. 0x0627,
  28230. "afii57416",
  28231. 0x0628,
  28232. "afii57417",
  28233. 0x0629,
  28234. "afii57418",
  28235. 0x062a,
  28236. "afii57419",
  28237. 0x062b,
  28238. "afii57420",
  28239. 0x062c,
  28240. "afii57421",
  28241. 0x062d,
  28242. "afii57422",
  28243. 0x062e,
  28244. "afii57423",
  28245. 0x062f,
  28246. "afii57424",
  28247. 0x0630,
  28248. "afii57425",
  28249. 0x0631,
  28250. "afii57426",
  28251. 0x0632,
  28252. "afii57427",
  28253. 0x0633,
  28254. "afii57428",
  28255. 0x0634,
  28256. "afii57429",
  28257. 0x0635,
  28258. "afii57430",
  28259. 0x0636,
  28260. "afii57431",
  28261. 0x0637,
  28262. "afii57432",
  28263. 0x0638,
  28264. "afii57433",
  28265. 0x0639,
  28266. "afii57434",
  28267. 0x063a,
  28268. "afii57440",
  28269. 0x0640,
  28270. "afii57441",
  28271. 0x0641,
  28272. "afii57442",
  28273. 0x0642,
  28274. "afii57443",
  28275. 0x0643,
  28276. "afii57444",
  28277. 0x0644,
  28278. "afii57445",
  28279. 0x0645,
  28280. "afii57446",
  28281. 0x0646,
  28282. "afii57448",
  28283. 0x0648,
  28284. "afii57449",
  28285. 0x0649,
  28286. "afii57450",
  28287. 0x064a,
  28288. "afii57451",
  28289. 0x064b,
  28290. "afii57452",
  28291. 0x064c,
  28292. "afii57453",
  28293. 0x064d,
  28294. "afii57454",
  28295. 0x064e,
  28296. "afii57455",
  28297. 0x064f,
  28298. "afii57456",
  28299. 0x0650,
  28300. "afii57457",
  28301. 0x0651,
  28302. "afii57458",
  28303. 0x0652,
  28304. "afii57470",
  28305. 0x0647,
  28306. "afii57505",
  28307. 0x06a4,
  28308. "afii57506",
  28309. 0x067e,
  28310. "afii57507",
  28311. 0x0686,
  28312. "afii57508",
  28313. 0x0698,
  28314. "afii57509",
  28315. 0x06af,
  28316. "afii57511",
  28317. 0x0679,
  28318. "afii57512",
  28319. 0x0688,
  28320. "afii57513",
  28321. 0x0691,
  28322. "afii57514",
  28323. 0x06ba,
  28324. "afii57519",
  28325. 0x06d2,
  28326. "afii57534",
  28327. 0x06d5,
  28328. "afii57636",
  28329. 0x20aa,
  28330. "afii57645",
  28331. 0x05be,
  28332. "afii57658",
  28333. 0x05c3,
  28334. "afii57664",
  28335. 0x05d0,
  28336. "afii57665",
  28337. 0x05d1,
  28338. "afii57666",
  28339. 0x05d2,
  28340. "afii57667",
  28341. 0x05d3,
  28342. "afii57668",
  28343. 0x05d4,
  28344. "afii57669",
  28345. 0x05d5,
  28346. "afii57670",
  28347. 0x05d6,
  28348. "afii57671",
  28349. 0x05d7,
  28350. "afii57672",
  28351. 0x05d8,
  28352. "afii57673",
  28353. 0x05d9,
  28354. "afii57674",
  28355. 0x05da,
  28356. "afii57675",
  28357. 0x05db,
  28358. "afii57676",
  28359. 0x05dc,
  28360. "afii57677",
  28361. 0x05dd,
  28362. "afii57678",
  28363. 0x05de,
  28364. "afii57679",
  28365. 0x05df,
  28366. "afii57680",
  28367. 0x05e0,
  28368. "afii57681",
  28369. 0x05e1,
  28370. "afii57682",
  28371. 0x05e2,
  28372. "afii57683",
  28373. 0x05e3,
  28374. "afii57684",
  28375. 0x05e4,
  28376. "afii57685",
  28377. 0x05e5,
  28378. "afii57686",
  28379. 0x05e6,
  28380. "afii57687",
  28381. 0x05e7,
  28382. "afii57688",
  28383. 0x05e8,
  28384. "afii57689",
  28385. 0x05e9,
  28386. "afii57690",
  28387. 0x05ea,
  28388. "afii57694",
  28389. 0xfb2a,
  28390. "afii57695",
  28391. 0xfb2b,
  28392. "afii57700",
  28393. 0xfb4b,
  28394. "afii57705",
  28395. 0xfb1f,
  28396. "afii57716",
  28397. 0x05f0,
  28398. "afii57717",
  28399. 0x05f1,
  28400. "afii57718",
  28401. 0x05f2,
  28402. "afii57723",
  28403. 0xfb35,
  28404. "afii57793",
  28405. 0x05b4,
  28406. "afii57794",
  28407. 0x05b5,
  28408. "afii57795",
  28409. 0x05b6,
  28410. "afii57796",
  28411. 0x05bb,
  28412. "afii57797",
  28413. 0x05b8,
  28414. "afii57798",
  28415. 0x05b7,
  28416. "afii57799",
  28417. 0x05b0,
  28418. "afii57800",
  28419. 0x05b2,
  28420. "afii57801",
  28421. 0x05b1,
  28422. "afii57802",
  28423. 0x05b3,
  28424. "afii57803",
  28425. 0x05c2,
  28426. "afii57804",
  28427. 0x05c1,
  28428. "afii57806",
  28429. 0x05b9,
  28430. "afii57807",
  28431. 0x05bc,
  28432. "afii57839",
  28433. 0x05bd,
  28434. "afii57841",
  28435. 0x05bf,
  28436. "afii57842",
  28437. 0x05c0,
  28438. "afii57929",
  28439. 0x02bc,
  28440. "afii61248",
  28441. 0x2105,
  28442. "afii61289",
  28443. 0x2113,
  28444. "afii61352",
  28445. 0x2116,
  28446. "afii61573",
  28447. 0x202c,
  28448. "afii61574",
  28449. 0x202d,
  28450. "afii61575",
  28451. 0x202e,
  28452. "afii61664",
  28453. 0x200c,
  28454. "afii63167",
  28455. 0x066d,
  28456. "afii64937",
  28457. 0x02bd,
  28458. "agrave",
  28459. 0x00e0,
  28460. "agujarati",
  28461. 0x0a85,
  28462. "agurmukhi",
  28463. 0x0a05,
  28464. "ahiragana",
  28465. 0x3042,
  28466. "ahookabove",
  28467. 0x1ea3,
  28468. "aibengali",
  28469. 0x0990,
  28470. "aibopomofo",
  28471. 0x311e,
  28472. "aideva",
  28473. 0x0910,
  28474. "aiecyrillic",
  28475. 0x04d5,
  28476. "aigujarati",
  28477. 0x0a90,
  28478. "aigurmukhi",
  28479. 0x0a10,
  28480. "aimatragurmukhi",
  28481. 0x0a48,
  28482. "ainarabic",
  28483. 0x0639,
  28484. "ainfinalarabic",
  28485. 0xfeca,
  28486. "aininitialarabic",
  28487. 0xfecb,
  28488. "ainmedialarabic",
  28489. 0xfecc,
  28490. "ainvertedbreve",
  28491. 0x0203,
  28492. "aivowelsignbengali",
  28493. 0x09c8,
  28494. "aivowelsigndeva",
  28495. 0x0948,
  28496. "aivowelsigngujarati",
  28497. 0x0ac8,
  28498. "akatakana",
  28499. 0x30a2,
  28500. "akatakanahalfwidth",
  28501. 0xff71,
  28502. "akorean",
  28503. 0x314f,
  28504. "alef",
  28505. 0x05d0,
  28506. "alefarabic",
  28507. 0x0627,
  28508. "alefdageshhebrew",
  28509. 0xfb30,
  28510. "aleffinalarabic",
  28511. 0xfe8e,
  28512. "alefhamzaabovearabic",
  28513. 0x0623,
  28514. "alefhamzaabovefinalarabic",
  28515. 0xfe84,
  28516. "alefhamzabelowarabic",
  28517. 0x0625,
  28518. "alefhamzabelowfinalarabic",
  28519. 0xfe88,
  28520. "alefhebrew",
  28521. 0x05d0,
  28522. "aleflamedhebrew",
  28523. 0xfb4f,
  28524. "alefmaddaabovearabic",
  28525. 0x0622,
  28526. "alefmaddaabovefinalarabic",
  28527. 0xfe82,
  28528. "alefmaksuraarabic",
  28529. 0x0649,
  28530. "alefmaksurafinalarabic",
  28531. 0xfef0,
  28532. "alefmaksurainitialarabic",
  28533. 0xfef3,
  28534. "alefmaksuramedialarabic",
  28535. 0xfef4,
  28536. "alefpatahhebrew",
  28537. 0xfb2e,
  28538. "alefqamatshebrew",
  28539. 0xfb2f,
  28540. "aleph",
  28541. 0x2135,
  28542. "allequal",
  28543. 0x224c,
  28544. "alpha",
  28545. 0x03b1,
  28546. "alphatonos",
  28547. 0x03ac,
  28548. "amacron",
  28549. 0x0101,
  28550. "amonospace",
  28551. 0xff41,
  28552. "ampersand",
  28553. 0x0026,
  28554. "ampersandmonospace",
  28555. 0xff06,
  28556. "ampersandsmall",
  28557. 0xf726,
  28558. "amsquare",
  28559. 0x33c2,
  28560. "anbopomofo",
  28561. 0x3122,
  28562. "angbopomofo",
  28563. 0x3124,
  28564. "angbracketleft",
  28565. 0x3008,
  28566. "angbracketright",
  28567. 0x3009,
  28568. "angkhankhuthai",
  28569. 0x0e5a,
  28570. "angle",
  28571. 0x2220,
  28572. "anglebracketleft",
  28573. 0x3008,
  28574. "anglebracketleftvertical",
  28575. 0xfe3f,
  28576. "anglebracketright",
  28577. 0x3009,
  28578. "anglebracketrightvertical",
  28579. 0xfe40,
  28580. "angleleft",
  28581. 0x2329,
  28582. "angleright",
  28583. 0x232a,
  28584. "angstrom",
  28585. 0x212b,
  28586. "anoteleia",
  28587. 0x0387,
  28588. "anudattadeva",
  28589. 0x0952,
  28590. "anusvarabengali",
  28591. 0x0982,
  28592. "anusvaradeva",
  28593. 0x0902,
  28594. "anusvaragujarati",
  28595. 0x0a82,
  28596. "aogonek",
  28597. 0x0105,
  28598. "apaatosquare",
  28599. 0x3300,
  28600. "aparen",
  28601. 0x249c,
  28602. "apostrophearmenian",
  28603. 0x055a,
  28604. "apostrophemod",
  28605. 0x02bc,
  28606. "apple",
  28607. 0xf8ff,
  28608. "approaches",
  28609. 0x2250,
  28610. "approxequal",
  28611. 0x2248,
  28612. "approxequalorimage",
  28613. 0x2252,
  28614. "approximatelyequal",
  28615. 0x2245,
  28616. "araeaekorean",
  28617. 0x318e,
  28618. "araeakorean",
  28619. 0x318d,
  28620. "arc",
  28621. 0x2312,
  28622. "arighthalfring",
  28623. 0x1e9a,
  28624. "aring",
  28625. 0x00e5,
  28626. "aringacute",
  28627. 0x01fb,
  28628. "aringbelow",
  28629. 0x1e01,
  28630. "arrowboth",
  28631. 0x2194,
  28632. "arrowdashdown",
  28633. 0x21e3,
  28634. "arrowdashleft",
  28635. 0x21e0,
  28636. "arrowdashright",
  28637. 0x21e2,
  28638. "arrowdashup",
  28639. 0x21e1,
  28640. "arrowdblboth",
  28641. 0x21d4,
  28642. "arrowdbldown",
  28643. 0x21d3,
  28644. "arrowdblleft",
  28645. 0x21d0,
  28646. "arrowdblright",
  28647. 0x21d2,
  28648. "arrowdblup",
  28649. 0x21d1,
  28650. "arrowdown",
  28651. 0x2193,
  28652. "arrowdownleft",
  28653. 0x2199,
  28654. "arrowdownright",
  28655. 0x2198,
  28656. "arrowdownwhite",
  28657. 0x21e9,
  28658. "arrowheaddownmod",
  28659. 0x02c5,
  28660. "arrowheadleftmod",
  28661. 0x02c2,
  28662. "arrowheadrightmod",
  28663. 0x02c3,
  28664. "arrowheadupmod",
  28665. 0x02c4,
  28666. "arrowhorizex",
  28667. 0xf8e7,
  28668. "arrowleft",
  28669. 0x2190,
  28670. "arrowleftdbl",
  28671. 0x21d0,
  28672. "arrowleftdblstroke",
  28673. 0x21cd,
  28674. "arrowleftoverright",
  28675. 0x21c6,
  28676. "arrowleftwhite",
  28677. 0x21e6,
  28678. "arrowright",
  28679. 0x2192,
  28680. "arrowrightdblstroke",
  28681. 0x21cf,
  28682. "arrowrightheavy",
  28683. 0x279e,
  28684. "arrowrightoverleft",
  28685. 0x21c4,
  28686. "arrowrightwhite",
  28687. 0x21e8,
  28688. "arrowtableft",
  28689. 0x21e4,
  28690. "arrowtabright",
  28691. 0x21e5,
  28692. "arrowup",
  28693. 0x2191,
  28694. "arrowupdn",
  28695. 0x2195,
  28696. "arrowupdnbse",
  28697. 0x21a8,
  28698. "arrowupdownbase",
  28699. 0x21a8,
  28700. "arrowupleft",
  28701. 0x2196,
  28702. "arrowupleftofdown",
  28703. 0x21c5,
  28704. "arrowupright",
  28705. 0x2197,
  28706. "arrowupwhite",
  28707. 0x21e7,
  28708. "arrowvertex",
  28709. 0xf8e6,
  28710. "asciicircum",
  28711. 0x005e,
  28712. "asciicircummonospace",
  28713. 0xff3e,
  28714. "asciitilde",
  28715. 0x007e,
  28716. "asciitildemonospace",
  28717. 0xff5e,
  28718. "ascript",
  28719. 0x0251,
  28720. "ascriptturned",
  28721. 0x0252,
  28722. "asmallhiragana",
  28723. 0x3041,
  28724. "asmallkatakana",
  28725. 0x30a1,
  28726. "asmallkatakanahalfwidth",
  28727. 0xff67,
  28728. "asterisk",
  28729. 0x002a,
  28730. "asteriskaltonearabic",
  28731. 0x066d,
  28732. "asteriskarabic",
  28733. 0x066d,
  28734. "asteriskmath",
  28735. 0x2217,
  28736. "asteriskmonospace",
  28737. 0xff0a,
  28738. "asterisksmall",
  28739. 0xfe61,
  28740. "asterism",
  28741. 0x2042,
  28742. "asuperior",
  28743. 0xf6e9,
  28744. "asymptoticallyequal",
  28745. 0x2243,
  28746. "at",
  28747. 0x0040,
  28748. "atilde",
  28749. 0x00e3,
  28750. "atmonospace",
  28751. 0xff20,
  28752. "atsmall",
  28753. 0xfe6b,
  28754. "aturned",
  28755. 0x0250,
  28756. "aubengali",
  28757. 0x0994,
  28758. "aubopomofo",
  28759. 0x3120,
  28760. "audeva",
  28761. 0x0914,
  28762. "augujarati",
  28763. 0x0a94,
  28764. "augurmukhi",
  28765. 0x0a14,
  28766. "aulengthmarkbengali",
  28767. 0x09d7,
  28768. "aumatragurmukhi",
  28769. 0x0a4c,
  28770. "auvowelsignbengali",
  28771. 0x09cc,
  28772. "auvowelsigndeva",
  28773. 0x094c,
  28774. "auvowelsigngujarati",
  28775. 0x0acc,
  28776. "avagrahadeva",
  28777. 0x093d,
  28778. "aybarmenian",
  28779. 0x0561,
  28780. "ayin",
  28781. 0x05e2,
  28782. "ayinaltonehebrew",
  28783. 0xfb20,
  28784. "ayinhebrew",
  28785. 0x05e2,
  28786. "b",
  28787. 0x0062,
  28788. "babengali",
  28789. 0x09ac,
  28790. "backslash",
  28791. 0x005c,
  28792. "backslashmonospace",
  28793. 0xff3c,
  28794. "badeva",
  28795. 0x092c,
  28796. "bagujarati",
  28797. 0x0aac,
  28798. "bagurmukhi",
  28799. 0x0a2c,
  28800. "bahiragana",
  28801. 0x3070,
  28802. "bahtthai",
  28803. 0x0e3f,
  28804. "bakatakana",
  28805. 0x30d0,
  28806. "bar",
  28807. 0x007c,
  28808. "barmonospace",
  28809. 0xff5c,
  28810. "bbopomofo",
  28811. 0x3105,
  28812. "bcircle",
  28813. 0x24d1,
  28814. "bdotaccent",
  28815. 0x1e03,
  28816. "bdotbelow",
  28817. 0x1e05,
  28818. "beamedsixteenthnotes",
  28819. 0x266c,
  28820. "because",
  28821. 0x2235,
  28822. "becyrillic",
  28823. 0x0431,
  28824. "beharabic",
  28825. 0x0628,
  28826. "behfinalarabic",
  28827. 0xfe90,
  28828. "behinitialarabic",
  28829. 0xfe91,
  28830. "behiragana",
  28831. 0x3079,
  28832. "behmedialarabic",
  28833. 0xfe92,
  28834. "behmeeminitialarabic",
  28835. 0xfc9f,
  28836. "behmeemisolatedarabic",
  28837. 0xfc08,
  28838. "behnoonfinalarabic",
  28839. 0xfc6d,
  28840. "bekatakana",
  28841. 0x30d9,
  28842. "benarmenian",
  28843. 0x0562,
  28844. "bet",
  28845. 0x05d1,
  28846. "beta",
  28847. 0x03b2,
  28848. "betasymbolgreek",
  28849. 0x03d0,
  28850. "betdagesh",
  28851. 0xfb31,
  28852. "betdageshhebrew",
  28853. 0xfb31,
  28854. "bethebrew",
  28855. 0x05d1,
  28856. "betrafehebrew",
  28857. 0xfb4c,
  28858. "bhabengali",
  28859. 0x09ad,
  28860. "bhadeva",
  28861. 0x092d,
  28862. "bhagujarati",
  28863. 0x0aad,
  28864. "bhagurmukhi",
  28865. 0x0a2d,
  28866. "bhook",
  28867. 0x0253,
  28868. "bihiragana",
  28869. 0x3073,
  28870. "bikatakana",
  28871. 0x30d3,
  28872. "bilabialclick",
  28873. 0x0298,
  28874. "bindigurmukhi",
  28875. 0x0a02,
  28876. "birusquare",
  28877. 0x3331,
  28878. "blackcircle",
  28879. 0x25cf,
  28880. "blackdiamond",
  28881. 0x25c6,
  28882. "blackdownpointingtriangle",
  28883. 0x25bc,
  28884. "blackleftpointingpointer",
  28885. 0x25c4,
  28886. "blackleftpointingtriangle",
  28887. 0x25c0,
  28888. "blacklenticularbracketleft",
  28889. 0x3010,
  28890. "blacklenticularbracketleftvertical",
  28891. 0xfe3b,
  28892. "blacklenticularbracketright",
  28893. 0x3011,
  28894. "blacklenticularbracketrightvertical",
  28895. 0xfe3c,
  28896. "blacklowerlefttriangle",
  28897. 0x25e3,
  28898. "blacklowerrighttriangle",
  28899. 0x25e2,
  28900. "blackrectangle",
  28901. 0x25ac,
  28902. "blackrightpointingpointer",
  28903. 0x25ba,
  28904. "blackrightpointingtriangle",
  28905. 0x25b6,
  28906. "blacksmallsquare",
  28907. 0x25aa,
  28908. "blacksmilingface",
  28909. 0x263b,
  28910. "blacksquare",
  28911. 0x25a0,
  28912. "blackstar",
  28913. 0x2605,
  28914. "blackupperlefttriangle",
  28915. 0x25e4,
  28916. "blackupperrighttriangle",
  28917. 0x25e5,
  28918. "blackuppointingsmalltriangle",
  28919. 0x25b4,
  28920. "blackuppointingtriangle",
  28921. 0x25b2,
  28922. "blank",
  28923. 0x2423,
  28924. "blinebelow",
  28925. 0x1e07,
  28926. "block",
  28927. 0x2588,
  28928. "bmonospace",
  28929. 0xff42,
  28930. "bobaimaithai",
  28931. 0x0e1a,
  28932. "bohiragana",
  28933. 0x307c,
  28934. "bokatakana",
  28935. 0x30dc,
  28936. "bparen",
  28937. 0x249d,
  28938. "bqsquare",
  28939. 0x33c3,
  28940. "braceex",
  28941. 0xf8f4,
  28942. "braceleft",
  28943. 0x007b,
  28944. "braceleftbt",
  28945. 0xf8f3,
  28946. "braceleftmid",
  28947. 0xf8f2,
  28948. "braceleftmonospace",
  28949. 0xff5b,
  28950. "braceleftsmall",
  28951. 0xfe5b,
  28952. "bracelefttp",
  28953. 0xf8f1,
  28954. "braceleftvertical",
  28955. 0xfe37,
  28956. "braceright",
  28957. 0x007d,
  28958. "bracerightbt",
  28959. 0xf8fe,
  28960. "bracerightmid",
  28961. 0xf8fd,
  28962. "bracerightmonospace",
  28963. 0xff5d,
  28964. "bracerightsmall",
  28965. 0xfe5c,
  28966. "bracerighttp",
  28967. 0xf8fc,
  28968. "bracerightvertical",
  28969. 0xfe38,
  28970. "bracketleft",
  28971. 0x005b,
  28972. "bracketleftbt",
  28973. 0xf8f0,
  28974. "bracketleftex",
  28975. 0xf8ef,
  28976. "bracketleftmonospace",
  28977. 0xff3b,
  28978. "bracketlefttp",
  28979. 0xf8ee,
  28980. "bracketright",
  28981. 0x005d,
  28982. "bracketrightbt",
  28983. 0xf8fb,
  28984. "bracketrightex",
  28985. 0xf8fa,
  28986. "bracketrightmonospace",
  28987. 0xff3d,
  28988. "bracketrighttp",
  28989. 0xf8f9,
  28990. "breve",
  28991. 0x02d8,
  28992. "brevebelowcmb",
  28993. 0x032e,
  28994. "brevecmb",
  28995. 0x0306,
  28996. "breveinvertedbelowcmb",
  28997. 0x032f,
  28998. "breveinvertedcmb",
  28999. 0x0311,
  29000. "breveinverteddoublecmb",
  29001. 0x0361,
  29002. "bridgebelowcmb",
  29003. 0x032a,
  29004. "bridgeinvertedbelowcmb",
  29005. 0x033a,
  29006. "brokenbar",
  29007. 0x00a6,
  29008. "bstroke",
  29009. 0x0180,
  29010. "bsuperior",
  29011. 0xf6ea,
  29012. "btopbar",
  29013. 0x0183,
  29014. "buhiragana",
  29015. 0x3076,
  29016. "bukatakana",
  29017. 0x30d6,
  29018. "bullet",
  29019. 0x2022,
  29020. "bulletinverse",
  29021. 0x25d8,
  29022. "bulletoperator",
  29023. 0x2219,
  29024. "bullseye",
  29025. 0x25ce,
  29026. "c",
  29027. 0x0063,
  29028. "caarmenian",
  29029. 0x056e,
  29030. "cabengali",
  29031. 0x099a,
  29032. "cacute",
  29033. 0x0107,
  29034. "cadeva",
  29035. 0x091a,
  29036. "cagujarati",
  29037. 0x0a9a,
  29038. "cagurmukhi",
  29039. 0x0a1a,
  29040. "calsquare",
  29041. 0x3388,
  29042. "candrabindubengali",
  29043. 0x0981,
  29044. "candrabinducmb",
  29045. 0x0310,
  29046. "candrabindudeva",
  29047. 0x0901,
  29048. "candrabindugujarati",
  29049. 0x0a81,
  29050. "capslock",
  29051. 0x21ea,
  29052. "careof",
  29053. 0x2105,
  29054. "caron",
  29055. 0x02c7,
  29056. "caronbelowcmb",
  29057. 0x032c,
  29058. "caroncmb",
  29059. 0x030c,
  29060. "carriagereturn",
  29061. 0x21b5,
  29062. "cbopomofo",
  29063. 0x3118,
  29064. "ccaron",
  29065. 0x010d,
  29066. "ccedilla",
  29067. 0x00e7,
  29068. "ccedillaacute",
  29069. 0x1e09,
  29070. "ccircle",
  29071. 0x24d2,
  29072. "ccircumflex",
  29073. 0x0109,
  29074. "ccurl",
  29075. 0x0255,
  29076. "cdot",
  29077. 0x010b,
  29078. "cdotaccent",
  29079. 0x010b,
  29080. "cdsquare",
  29081. 0x33c5,
  29082. "cedilla",
  29083. 0x00b8,
  29084. "cedillacmb",
  29085. 0x0327,
  29086. "cent",
  29087. 0x00a2,
  29088. "centigrade",
  29089. 0x2103,
  29090. "centinferior",
  29091. 0xf6df,
  29092. "centmonospace",
  29093. 0xffe0,
  29094. "centoldstyle",
  29095. 0xf7a2,
  29096. "centsuperior",
  29097. 0xf6e0,
  29098. "chaarmenian",
  29099. 0x0579,
  29100. "chabengali",
  29101. 0x099b,
  29102. "chadeva",
  29103. 0x091b,
  29104. "chagujarati",
  29105. 0x0a9b,
  29106. "chagurmukhi",
  29107. 0x0a1b,
  29108. "chbopomofo",
  29109. 0x3114,
  29110. "cheabkhasiancyrillic",
  29111. 0x04bd,
  29112. "checkmark",
  29113. 0x2713,
  29114. "checyrillic",
  29115. 0x0447,
  29116. "chedescenderabkhasiancyrillic",
  29117. 0x04bf,
  29118. "chedescendercyrillic",
  29119. 0x04b7,
  29120. "chedieresiscyrillic",
  29121. 0x04f5,
  29122. "cheharmenian",
  29123. 0x0573,
  29124. "chekhakassiancyrillic",
  29125. 0x04cc,
  29126. "cheverticalstrokecyrillic",
  29127. 0x04b9,
  29128. "chi",
  29129. 0x03c7,
  29130. "chieuchacirclekorean",
  29131. 0x3277,
  29132. "chieuchaparenkorean",
  29133. 0x3217,
  29134. "chieuchcirclekorean",
  29135. 0x3269,
  29136. "chieuchkorean",
  29137. 0x314a,
  29138. "chieuchparenkorean",
  29139. 0x3209,
  29140. "chochangthai",
  29141. 0x0e0a,
  29142. "chochanthai",
  29143. 0x0e08,
  29144. "chochingthai",
  29145. 0x0e09,
  29146. "chochoethai",
  29147. 0x0e0c,
  29148. "chook",
  29149. 0x0188,
  29150. "cieucacirclekorean",
  29151. 0x3276,
  29152. "cieucaparenkorean",
  29153. 0x3216,
  29154. "cieuccirclekorean",
  29155. 0x3268,
  29156. "cieuckorean",
  29157. 0x3148,
  29158. "cieucparenkorean",
  29159. 0x3208,
  29160. "cieucuparenkorean",
  29161. 0x321c,
  29162. "circle",
  29163. 0x25cb,
  29164. "circlecopyrt",
  29165. 0x00a9,
  29166. "circlemultiply",
  29167. 0x2297,
  29168. "circleot",
  29169. 0x2299,
  29170. "circleplus",
  29171. 0x2295,
  29172. "circlepostalmark",
  29173. 0x3036,
  29174. "circlewithlefthalfblack",
  29175. 0x25d0,
  29176. "circlewithrighthalfblack",
  29177. 0x25d1,
  29178. "circumflex",
  29179. 0x02c6,
  29180. "circumflexbelowcmb",
  29181. 0x032d,
  29182. "circumflexcmb",
  29183. 0x0302,
  29184. "clear",
  29185. 0x2327,
  29186. "clickalveolar",
  29187. 0x01c2,
  29188. "clickdental",
  29189. 0x01c0,
  29190. "clicklateral",
  29191. 0x01c1,
  29192. "clickretroflex",
  29193. 0x01c3,
  29194. "club",
  29195. 0x2663,
  29196. "clubsuitblack",
  29197. 0x2663,
  29198. "clubsuitwhite",
  29199. 0x2667,
  29200. "cmcubedsquare",
  29201. 0x33a4,
  29202. "cmonospace",
  29203. 0xff43,
  29204. "cmsquaredsquare",
  29205. 0x33a0,
  29206. "coarmenian",
  29207. 0x0581,
  29208. "colon",
  29209. 0x003a,
  29210. "colonmonetary",
  29211. 0x20a1,
  29212. "colonmonospace",
  29213. 0xff1a,
  29214. "colonsign",
  29215. 0x20a1,
  29216. "colonsmall",
  29217. 0xfe55,
  29218. "colontriangularhalfmod",
  29219. 0x02d1,
  29220. "colontriangularmod",
  29221. 0x02d0,
  29222. "comma",
  29223. 0x002c,
  29224. "commaabovecmb",
  29225. 0x0313,
  29226. "commaaboverightcmb",
  29227. 0x0315,
  29228. "commaaccent",
  29229. 0xf6c3,
  29230. "commaarabic",
  29231. 0x060c,
  29232. "commaarmenian",
  29233. 0x055d,
  29234. "commainferior",
  29235. 0xf6e1,
  29236. "commamonospace",
  29237. 0xff0c,
  29238. "commareversedabovecmb",
  29239. 0x0314,
  29240. "commareversedmod",
  29241. 0x02bd,
  29242. "commasmall",
  29243. 0xfe50,
  29244. "commasuperior",
  29245. 0xf6e2,
  29246. "commaturnedabovecmb",
  29247. 0x0312,
  29248. "commaturnedmod",
  29249. 0x02bb,
  29250. "compass",
  29251. 0x263c,
  29252. "congruent",
  29253. 0x2245,
  29254. "contourintegral",
  29255. 0x222e,
  29256. "control",
  29257. 0x2303,
  29258. "controlACK",
  29259. 0x0006,
  29260. "controlBEL",
  29261. 0x0007,
  29262. "controlBS",
  29263. 0x0008,
  29264. "controlCAN",
  29265. 0x0018,
  29266. "controlCR",
  29267. 0x000d,
  29268. "controlDC1",
  29269. 0x0011,
  29270. "controlDC2",
  29271. 0x0012,
  29272. "controlDC3",
  29273. 0x0013,
  29274. "controlDC4",
  29275. 0x0014,
  29276. "controlDEL",
  29277. 0x007f,
  29278. "controlDLE",
  29279. 0x0010,
  29280. "controlEM",
  29281. 0x0019,
  29282. "controlENQ",
  29283. 0x0005,
  29284. "controlEOT",
  29285. 0x0004,
  29286. "controlESC",
  29287. 0x001b,
  29288. "controlETB",
  29289. 0x0017,
  29290. "controlETX",
  29291. 0x0003,
  29292. "controlFF",
  29293. 0x000c,
  29294. "controlFS",
  29295. 0x001c,
  29296. "controlGS",
  29297. 0x001d,
  29298. "controlHT",
  29299. 0x0009,
  29300. "controlLF",
  29301. 0x000a,
  29302. "controlNAK",
  29303. 0x0015,
  29304. "controlNULL",
  29305. 0x0000,
  29306. "controlRS",
  29307. 0x001e,
  29308. "controlSI",
  29309. 0x000f,
  29310. "controlSO",
  29311. 0x000e,
  29312. "controlSOT",
  29313. 0x0002,
  29314. "controlSTX",
  29315. 0x0001,
  29316. "controlSUB",
  29317. 0x001a,
  29318. "controlSYN",
  29319. 0x0016,
  29320. "controlUS",
  29321. 0x001f,
  29322. "controlVT",
  29323. 0x000b,
  29324. "copyright",
  29325. 0x00a9,
  29326. "copyrightsans",
  29327. 0xf8e9,
  29328. "copyrightserif",
  29329. 0xf6d9,
  29330. "cornerbracketleft",
  29331. 0x300c,
  29332. "cornerbracketlefthalfwidth",
  29333. 0xff62,
  29334. "cornerbracketleftvertical",
  29335. 0xfe41,
  29336. "cornerbracketright",
  29337. 0x300d,
  29338. "cornerbracketrighthalfwidth",
  29339. 0xff63,
  29340. "cornerbracketrightvertical",
  29341. 0xfe42,
  29342. "corporationsquare",
  29343. 0x337f,
  29344. "cosquare",
  29345. 0x33c7,
  29346. "coverkgsquare",
  29347. 0x33c6,
  29348. "cparen",
  29349. 0x249e,
  29350. "cruzeiro",
  29351. 0x20a2,
  29352. "cstretched",
  29353. 0x0297,
  29354. "curlyand",
  29355. 0x22cf,
  29356. "curlyor",
  29357. 0x22ce,
  29358. "currency",
  29359. 0x00a4,
  29360. "cyrBreve",
  29361. 0xf6d1,
  29362. "cyrFlex",
  29363. 0xf6d2,
  29364. "cyrbreve",
  29365. 0xf6d4,
  29366. "cyrflex",
  29367. 0xf6d5,
  29368. "d",
  29369. 0x0064,
  29370. "daarmenian",
  29371. 0x0564,
  29372. "dabengali",
  29373. 0x09a6,
  29374. "dadarabic",
  29375. 0x0636,
  29376. "dadeva",
  29377. 0x0926,
  29378. "dadfinalarabic",
  29379. 0xfebe,
  29380. "dadinitialarabic",
  29381. 0xfebf,
  29382. "dadmedialarabic",
  29383. 0xfec0,
  29384. "dagesh",
  29385. 0x05bc,
  29386. "dageshhebrew",
  29387. 0x05bc,
  29388. "dagger",
  29389. 0x2020,
  29390. "daggerdbl",
  29391. 0x2021,
  29392. "dagujarati",
  29393. 0x0aa6,
  29394. "dagurmukhi",
  29395. 0x0a26,
  29396. "dahiragana",
  29397. 0x3060,
  29398. "dakatakana",
  29399. 0x30c0,
  29400. "dalarabic",
  29401. 0x062f,
  29402. "dalet",
  29403. 0x05d3,
  29404. "daletdagesh",
  29405. 0xfb33,
  29406. "daletdageshhebrew",
  29407. 0xfb33,
  29408. "dalethebrew",
  29409. 0x05d3,
  29410. "dalfinalarabic",
  29411. 0xfeaa,
  29412. "dammaarabic",
  29413. 0x064f,
  29414. "dammalowarabic",
  29415. 0x064f,
  29416. "dammatanaltonearabic",
  29417. 0x064c,
  29418. "dammatanarabic",
  29419. 0x064c,
  29420. "danda",
  29421. 0x0964,
  29422. "dargahebrew",
  29423. 0x05a7,
  29424. "dargalefthebrew",
  29425. 0x05a7,
  29426. "dasiapneumatacyrilliccmb",
  29427. 0x0485,
  29428. "dblGrave",
  29429. 0xf6d3,
  29430. "dblanglebracketleft",
  29431. 0x300a,
  29432. "dblanglebracketleftvertical",
  29433. 0xfe3d,
  29434. "dblanglebracketright",
  29435. 0x300b,
  29436. "dblanglebracketrightvertical",
  29437. 0xfe3e,
  29438. "dblarchinvertedbelowcmb",
  29439. 0x032b,
  29440. "dblarrowleft",
  29441. 0x21d4,
  29442. "dblarrowright",
  29443. 0x21d2,
  29444. "dbldanda",
  29445. 0x0965,
  29446. "dblgrave",
  29447. 0xf6d6,
  29448. "dblgravecmb",
  29449. 0x030f,
  29450. "dblintegral",
  29451. 0x222c,
  29452. "dbllowline",
  29453. 0x2017,
  29454. "dbllowlinecmb",
  29455. 0x0333,
  29456. "dbloverlinecmb",
  29457. 0x033f,
  29458. "dblprimemod",
  29459. 0x02ba,
  29460. "dblverticalbar",
  29461. 0x2016,
  29462. "dblverticallineabovecmb",
  29463. 0x030e,
  29464. "dbopomofo",
  29465. 0x3109,
  29466. "dbsquare",
  29467. 0x33c8,
  29468. "dcaron",
  29469. 0x010f,
  29470. "dcedilla",
  29471. 0x1e11,
  29472. "dcircle",
  29473. 0x24d3,
  29474. "dcircumflexbelow",
  29475. 0x1e13,
  29476. "dcroat",
  29477. 0x0111,
  29478. "ddabengali",
  29479. 0x09a1,
  29480. "ddadeva",
  29481. 0x0921,
  29482. "ddagujarati",
  29483. 0x0aa1,
  29484. "ddagurmukhi",
  29485. 0x0a21,
  29486. "ddalarabic",
  29487. 0x0688,
  29488. "ddalfinalarabic",
  29489. 0xfb89,
  29490. "dddhadeva",
  29491. 0x095c,
  29492. "ddhabengali",
  29493. 0x09a2,
  29494. "ddhadeva",
  29495. 0x0922,
  29496. "ddhagujarati",
  29497. 0x0aa2,
  29498. "ddhagurmukhi",
  29499. 0x0a22,
  29500. "ddotaccent",
  29501. 0x1e0b,
  29502. "ddotbelow",
  29503. 0x1e0d,
  29504. "decimalseparatorarabic",
  29505. 0x066b,
  29506. "decimalseparatorpersian",
  29507. 0x066b,
  29508. "decyrillic",
  29509. 0x0434,
  29510. "degree",
  29511. 0x00b0,
  29512. "dehihebrew",
  29513. 0x05ad,
  29514. "dehiragana",
  29515. 0x3067,
  29516. "deicoptic",
  29517. 0x03ef,
  29518. "dekatakana",
  29519. 0x30c7,
  29520. "deleteleft",
  29521. 0x232b,
  29522. "deleteright",
  29523. 0x2326,
  29524. "delta",
  29525. 0x03b4,
  29526. "deltaturned",
  29527. 0x018d,
  29528. "denominatorminusonenumeratorbengali",
  29529. 0x09f8,
  29530. "dezh",
  29531. 0x02a4,
  29532. "dhabengali",
  29533. 0x09a7,
  29534. "dhadeva",
  29535. 0x0927,
  29536. "dhagujarati",
  29537. 0x0aa7,
  29538. "dhagurmukhi",
  29539. 0x0a27,
  29540. "dhook",
  29541. 0x0257,
  29542. "dialytikatonos",
  29543. 0x0385,
  29544. "dialytikatonoscmb",
  29545. 0x0344,
  29546. "diamond",
  29547. 0x2666,
  29548. "diamondsuitwhite",
  29549. 0x2662,
  29550. "dieresis",
  29551. 0x00a8,
  29552. "dieresisacute",
  29553. 0xf6d7,
  29554. "dieresisbelowcmb",
  29555. 0x0324,
  29556. "dieresiscmb",
  29557. 0x0308,
  29558. "dieresisgrave",
  29559. 0xf6d8,
  29560. "dieresistonos",
  29561. 0x0385,
  29562. "dihiragana",
  29563. 0x3062,
  29564. "dikatakana",
  29565. 0x30c2,
  29566. "dittomark",
  29567. 0x3003,
  29568. "divide",
  29569. 0x00f7,
  29570. "divides",
  29571. 0x2223,
  29572. "divisionslash",
  29573. 0x2215,
  29574. "djecyrillic",
  29575. 0x0452,
  29576. "dkshade",
  29577. 0x2593,
  29578. "dlinebelow",
  29579. 0x1e0f,
  29580. "dlsquare",
  29581. 0x3397,
  29582. "dmacron",
  29583. 0x0111,
  29584. "dmonospace",
  29585. 0xff44,
  29586. "dnblock",
  29587. 0x2584,
  29588. "dochadathai",
  29589. 0x0e0e,
  29590. "dodekthai",
  29591. 0x0e14,
  29592. "dohiragana",
  29593. 0x3069,
  29594. "dokatakana",
  29595. 0x30c9,
  29596. "dollar",
  29597. 0x0024,
  29598. "dollarinferior",
  29599. 0xf6e3,
  29600. "dollarmonospace",
  29601. 0xff04,
  29602. "dollaroldstyle",
  29603. 0xf724,
  29604. "dollarsmall",
  29605. 0xfe69,
  29606. "dollarsuperior",
  29607. 0xf6e4,
  29608. "dong",
  29609. 0x20ab,
  29610. "dorusquare",
  29611. 0x3326,
  29612. "dotaccent",
  29613. 0x02d9,
  29614. "dotaccentcmb",
  29615. 0x0307,
  29616. "dotbelowcmb",
  29617. 0x0323,
  29618. "dotbelowcomb",
  29619. 0x0323,
  29620. "dotkatakana",
  29621. 0x30fb,
  29622. "dotlessi",
  29623. 0x0131,
  29624. "dotlessj",
  29625. 0xf6be,
  29626. "dotlessjstrokehook",
  29627. 0x0284,
  29628. "dotmath",
  29629. 0x22c5,
  29630. "dottedcircle",
  29631. 0x25cc,
  29632. "doubleyodpatah",
  29633. 0xfb1f,
  29634. "doubleyodpatahhebrew",
  29635. 0xfb1f,
  29636. "downtackbelowcmb",
  29637. 0x031e,
  29638. "downtackmod",
  29639. 0x02d5,
  29640. "dparen",
  29641. 0x249f,
  29642. "dsuperior",
  29643. 0xf6eb,
  29644. "dtail",
  29645. 0x0256,
  29646. "dtopbar",
  29647. 0x018c,
  29648. "duhiragana",
  29649. 0x3065,
  29650. "dukatakana",
  29651. 0x30c5,
  29652. "dz",
  29653. 0x01f3,
  29654. "dzaltone",
  29655. 0x02a3,
  29656. "dzcaron",
  29657. 0x01c6,
  29658. "dzcurl",
  29659. 0x02a5,
  29660. "dzeabkhasiancyrillic",
  29661. 0x04e1,
  29662. "dzecyrillic",
  29663. 0x0455,
  29664. "dzhecyrillic",
  29665. 0x045f,
  29666. "e",
  29667. 0x0065,
  29668. "eacute",
  29669. 0x00e9,
  29670. "earth",
  29671. 0x2641,
  29672. "ebengali",
  29673. 0x098f,
  29674. "ebopomofo",
  29675. 0x311c,
  29676. "ebreve",
  29677. 0x0115,
  29678. "ecandradeva",
  29679. 0x090d,
  29680. "ecandragujarati",
  29681. 0x0a8d,
  29682. "ecandravowelsigndeva",
  29683. 0x0945,
  29684. "ecandravowelsigngujarati",
  29685. 0x0ac5,
  29686. "ecaron",
  29687. 0x011b,
  29688. "ecedillabreve",
  29689. 0x1e1d,
  29690. "echarmenian",
  29691. 0x0565,
  29692. "echyiwnarmenian",
  29693. 0x0587,
  29694. "ecircle",
  29695. 0x24d4,
  29696. "ecircumflex",
  29697. 0x00ea,
  29698. "ecircumflexacute",
  29699. 0x1ebf,
  29700. "ecircumflexbelow",
  29701. 0x1e19,
  29702. "ecircumflexdotbelow",
  29703. 0x1ec7,
  29704. "ecircumflexgrave",
  29705. 0x1ec1,
  29706. "ecircumflexhookabove",
  29707. 0x1ec3,
  29708. "ecircumflextilde",
  29709. 0x1ec5,
  29710. "ecyrillic",
  29711. 0x0454,
  29712. "edblgrave",
  29713. 0x0205,
  29714. "edeva",
  29715. 0x090f,
  29716. "edieresis",
  29717. 0x00eb,
  29718. "edot",
  29719. 0x0117,
  29720. "edotaccent",
  29721. 0x0117,
  29722. "edotbelow",
  29723. 0x1eb9,
  29724. "eegurmukhi",
  29725. 0x0a0f,
  29726. "eematragurmukhi",
  29727. 0x0a47,
  29728. "efcyrillic",
  29729. 0x0444,
  29730. "egrave",
  29731. 0x00e8,
  29732. "egujarati",
  29733. 0x0a8f,
  29734. "eharmenian",
  29735. 0x0567,
  29736. "ehbopomofo",
  29737. 0x311d,
  29738. "ehiragana",
  29739. 0x3048,
  29740. "ehookabove",
  29741. 0x1ebb,
  29742. "eibopomofo",
  29743. 0x311f,
  29744. "eight",
  29745. 0x0038,
  29746. "eightarabic",
  29747. 0x0668,
  29748. "eightbengali",
  29749. 0x09ee,
  29750. "eightcircle",
  29751. 0x2467,
  29752. "eightcircleinversesansserif",
  29753. 0x2791,
  29754. "eightdeva",
  29755. 0x096e,
  29756. "eighteencircle",
  29757. 0x2471,
  29758. "eighteenparen",
  29759. 0x2485,
  29760. "eighteenperiod",
  29761. 0x2499,
  29762. "eightgujarati",
  29763. 0x0aee,
  29764. "eightgurmukhi",
  29765. 0x0a6e,
  29766. "eighthackarabic",
  29767. 0x0668,
  29768. "eighthangzhou",
  29769. 0x3028,
  29770. "eighthnotebeamed",
  29771. 0x266b,
  29772. "eightideographicparen",
  29773. 0x3227,
  29774. "eightinferior",
  29775. 0x2088,
  29776. "eightmonospace",
  29777. 0xff18,
  29778. "eightoldstyle",
  29779. 0xf738,
  29780. "eightparen",
  29781. 0x247b,
  29782. "eightperiod",
  29783. 0x248f,
  29784. "eightpersian",
  29785. 0x06f8,
  29786. "eightroman",
  29787. 0x2177,
  29788. "eightsuperior",
  29789. 0x2078,
  29790. "eightthai",
  29791. 0x0e58,
  29792. "einvertedbreve",
  29793. 0x0207,
  29794. "eiotifiedcyrillic",
  29795. 0x0465,
  29796. "ekatakana",
  29797. 0x30a8,
  29798. "ekatakanahalfwidth",
  29799. 0xff74,
  29800. "ekonkargurmukhi",
  29801. 0x0a74,
  29802. "ekorean",
  29803. 0x3154,
  29804. "elcyrillic",
  29805. 0x043b,
  29806. "element",
  29807. 0x2208,
  29808. "elevencircle",
  29809. 0x246a,
  29810. "elevenparen",
  29811. 0x247e,
  29812. "elevenperiod",
  29813. 0x2492,
  29814. "elevenroman",
  29815. 0x217a,
  29816. "ellipsis",
  29817. 0x2026,
  29818. "ellipsisvertical",
  29819. 0x22ee,
  29820. "emacron",
  29821. 0x0113,
  29822. "emacronacute",
  29823. 0x1e17,
  29824. "emacrongrave",
  29825. 0x1e15,
  29826. "emcyrillic",
  29827. 0x043c,
  29828. "emdash",
  29829. 0x2014,
  29830. "emdashvertical",
  29831. 0xfe31,
  29832. "emonospace",
  29833. 0xff45,
  29834. "emphasismarkarmenian",
  29835. 0x055b,
  29836. "emptyset",
  29837. 0x2205,
  29838. "enbopomofo",
  29839. 0x3123,
  29840. "encyrillic",
  29841. 0x043d,
  29842. "endash",
  29843. 0x2013,
  29844. "endashvertical",
  29845. 0xfe32,
  29846. "endescendercyrillic",
  29847. 0x04a3,
  29848. "eng",
  29849. 0x014b,
  29850. "engbopomofo",
  29851. 0x3125,
  29852. "enghecyrillic",
  29853. 0x04a5,
  29854. "enhookcyrillic",
  29855. 0x04c8,
  29856. "enspace",
  29857. 0x2002,
  29858. "eogonek",
  29859. 0x0119,
  29860. "eokorean",
  29861. 0x3153,
  29862. "eopen",
  29863. 0x025b,
  29864. "eopenclosed",
  29865. 0x029a,
  29866. "eopenreversed",
  29867. 0x025c,
  29868. "eopenreversedclosed",
  29869. 0x025e,
  29870. "eopenreversedhook",
  29871. 0x025d,
  29872. "eparen",
  29873. 0x24a0,
  29874. "epsilon",
  29875. 0x03b5,
  29876. "epsilontonos",
  29877. 0x03ad,
  29878. "equal",
  29879. 0x003d,
  29880. "equalmonospace",
  29881. 0xff1d,
  29882. "equalsmall",
  29883. 0xfe66,
  29884. "equalsuperior",
  29885. 0x207c,
  29886. "equivalence",
  29887. 0x2261,
  29888. "erbopomofo",
  29889. 0x3126,
  29890. "ercyrillic",
  29891. 0x0440,
  29892. "ereversed",
  29893. 0x0258,
  29894. "ereversedcyrillic",
  29895. 0x044d,
  29896. "escyrillic",
  29897. 0x0441,
  29898. "esdescendercyrillic",
  29899. 0x04ab,
  29900. "esh",
  29901. 0x0283,
  29902. "eshcurl",
  29903. 0x0286,
  29904. "eshortdeva",
  29905. 0x090e,
  29906. "eshortvowelsigndeva",
  29907. 0x0946,
  29908. "eshreversedloop",
  29909. 0x01aa,
  29910. "eshsquatreversed",
  29911. 0x0285,
  29912. "esmallhiragana",
  29913. 0x3047,
  29914. "esmallkatakana",
  29915. 0x30a7,
  29916. "esmallkatakanahalfwidth",
  29917. 0xff6a,
  29918. "estimated",
  29919. 0x212e,
  29920. "esuperior",
  29921. 0xf6ec,
  29922. "eta",
  29923. 0x03b7,
  29924. "etarmenian",
  29925. 0x0568,
  29926. "etatonos",
  29927. 0x03ae,
  29928. "eth",
  29929. 0x00f0,
  29930. "etilde",
  29931. 0x1ebd,
  29932. "etildebelow",
  29933. 0x1e1b,
  29934. "etnahtafoukhhebrew",
  29935. 0x0591,
  29936. "etnahtafoukhlefthebrew",
  29937. 0x0591,
  29938. "etnahtahebrew",
  29939. 0x0591,
  29940. "etnahtalefthebrew",
  29941. 0x0591,
  29942. "eturned",
  29943. 0x01dd,
  29944. "eukorean",
  29945. 0x3161,
  29946. "euro",
  29947. 0x20ac,
  29948. "evowelsignbengali",
  29949. 0x09c7,
  29950. "evowelsigndeva",
  29951. 0x0947,
  29952. "evowelsigngujarati",
  29953. 0x0ac7,
  29954. "exclam",
  29955. 0x0021,
  29956. "exclamarmenian",
  29957. 0x055c,
  29958. "exclamdbl",
  29959. 0x203c,
  29960. "exclamdown",
  29961. 0x00a1,
  29962. "exclamdownsmall",
  29963. 0xf7a1,
  29964. "exclammonospace",
  29965. 0xff01,
  29966. "exclamsmall",
  29967. 0xf721,
  29968. "existential",
  29969. 0x2203,
  29970. "ezh",
  29971. 0x0292,
  29972. "ezhcaron",
  29973. 0x01ef,
  29974. "ezhcurl",
  29975. 0x0293,
  29976. "ezhreversed",
  29977. 0x01b9,
  29978. "ezhtail",
  29979. 0x01ba,
  29980. "f",
  29981. 0x0066,
  29982. "fadeva",
  29983. 0x095e,
  29984. "fagurmukhi",
  29985. 0x0a5e,
  29986. "fahrenheit",
  29987. 0x2109,
  29988. "fathaarabic",
  29989. 0x064e,
  29990. "fathalowarabic",
  29991. 0x064e,
  29992. "fathatanarabic",
  29993. 0x064b,
  29994. "fbopomofo",
  29995. 0x3108,
  29996. "fcircle",
  29997. 0x24d5,
  29998. "fdotaccent",
  29999. 0x1e1f,
  30000. "feharabic",
  30001. 0x0641,
  30002. "feharmenian",
  30003. 0x0586,
  30004. "fehfinalarabic",
  30005. 0xfed2,
  30006. "fehinitialarabic",
  30007. 0xfed3,
  30008. "fehmedialarabic",
  30009. 0xfed4,
  30010. "feicoptic",
  30011. 0x03e5,
  30012. "female",
  30013. 0x2640,
  30014. "ff",
  30015. 0xfb00,
  30016. "f_f",
  30017. 0xfb00,
  30018. "ffi",
  30019. 0xfb03,
  30020. "ffl",
  30021. 0xfb04,
  30022. "fi",
  30023. 0xfb01,
  30024. "fifteencircle",
  30025. 0x246e,
  30026. "fifteenparen",
  30027. 0x2482,
  30028. "fifteenperiod",
  30029. 0x2496,
  30030. "figuredash",
  30031. 0x2012,
  30032. "filledbox",
  30033. 0x25a0,
  30034. "filledrect",
  30035. 0x25ac,
  30036. "finalkaf",
  30037. 0x05da,
  30038. "finalkafdagesh",
  30039. 0xfb3a,
  30040. "finalkafdageshhebrew",
  30041. 0xfb3a,
  30042. "finalkafhebrew",
  30043. 0x05da,
  30044. "finalmem",
  30045. 0x05dd,
  30046. "finalmemhebrew",
  30047. 0x05dd,
  30048. "finalnun",
  30049. 0x05df,
  30050. "finalnunhebrew",
  30051. 0x05df,
  30052. "finalpe",
  30053. 0x05e3,
  30054. "finalpehebrew",
  30055. 0x05e3,
  30056. "finaltsadi",
  30057. 0x05e5,
  30058. "finaltsadihebrew",
  30059. 0x05e5,
  30060. "firsttonechinese",
  30061. 0x02c9,
  30062. "fisheye",
  30063. 0x25c9,
  30064. "fitacyrillic",
  30065. 0x0473,
  30066. "five",
  30067. 0x0035,
  30068. "fivearabic",
  30069. 0x0665,
  30070. "fivebengali",
  30071. 0x09eb,
  30072. "fivecircle",
  30073. 0x2464,
  30074. "fivecircleinversesansserif",
  30075. 0x278e,
  30076. "fivedeva",
  30077. 0x096b,
  30078. "fiveeighths",
  30079. 0x215d,
  30080. "fivegujarati",
  30081. 0x0aeb,
  30082. "fivegurmukhi",
  30083. 0x0a6b,
  30084. "fivehackarabic",
  30085. 0x0665,
  30086. "fivehangzhou",
  30087. 0x3025,
  30088. "fiveideographicparen",
  30089. 0x3224,
  30090. "fiveinferior",
  30091. 0x2085,
  30092. "fivemonospace",
  30093. 0xff15,
  30094. "fiveoldstyle",
  30095. 0xf735,
  30096. "fiveparen",
  30097. 0x2478,
  30098. "fiveperiod",
  30099. 0x248c,
  30100. "fivepersian",
  30101. 0x06f5,
  30102. "fiveroman",
  30103. 0x2174,
  30104. "fivesuperior",
  30105. 0x2075,
  30106. "fivethai",
  30107. 0x0e55,
  30108. "fl",
  30109. 0xfb02,
  30110. "florin",
  30111. 0x0192,
  30112. "fmonospace",
  30113. 0xff46,
  30114. "fmsquare",
  30115. 0x3399,
  30116. "fofanthai",
  30117. 0x0e1f,
  30118. "fofathai",
  30119. 0x0e1d,
  30120. "fongmanthai",
  30121. 0x0e4f,
  30122. "forall",
  30123. 0x2200,
  30124. "four",
  30125. 0x0034,
  30126. "fourarabic",
  30127. 0x0664,
  30128. "fourbengali",
  30129. 0x09ea,
  30130. "fourcircle",
  30131. 0x2463,
  30132. "fourcircleinversesansserif",
  30133. 0x278d,
  30134. "fourdeva",
  30135. 0x096a,
  30136. "fourgujarati",
  30137. 0x0aea,
  30138. "fourgurmukhi",
  30139. 0x0a6a,
  30140. "fourhackarabic",
  30141. 0x0664,
  30142. "fourhangzhou",
  30143. 0x3024,
  30144. "fourideographicparen",
  30145. 0x3223,
  30146. "fourinferior",
  30147. 0x2084,
  30148. "fourmonospace",
  30149. 0xff14,
  30150. "fournumeratorbengali",
  30151. 0x09f7,
  30152. "fouroldstyle",
  30153. 0xf734,
  30154. "fourparen",
  30155. 0x2477,
  30156. "fourperiod",
  30157. 0x248b,
  30158. "fourpersian",
  30159. 0x06f4,
  30160. "fourroman",
  30161. 0x2173,
  30162. "foursuperior",
  30163. 0x2074,
  30164. "fourteencircle",
  30165. 0x246d,
  30166. "fourteenparen",
  30167. 0x2481,
  30168. "fourteenperiod",
  30169. 0x2495,
  30170. "fourthai",
  30171. 0x0e54,
  30172. "fourthtonechinese",
  30173. 0x02cb,
  30174. "fparen",
  30175. 0x24a1,
  30176. "fraction",
  30177. 0x2044,
  30178. "franc",
  30179. 0x20a3,
  30180. "g",
  30181. 0x0067,
  30182. "gabengali",
  30183. 0x0997,
  30184. "gacute",
  30185. 0x01f5,
  30186. "gadeva",
  30187. 0x0917,
  30188. "gafarabic",
  30189. 0x06af,
  30190. "gaffinalarabic",
  30191. 0xfb93,
  30192. "gafinitialarabic",
  30193. 0xfb94,
  30194. "gafmedialarabic",
  30195. 0xfb95,
  30196. "gagujarati",
  30197. 0x0a97,
  30198. "gagurmukhi",
  30199. 0x0a17,
  30200. "gahiragana",
  30201. 0x304c,
  30202. "gakatakana",
  30203. 0x30ac,
  30204. "gamma",
  30205. 0x03b3,
  30206. "gammalatinsmall",
  30207. 0x0263,
  30208. "gammasuperior",
  30209. 0x02e0,
  30210. "gangiacoptic",
  30211. 0x03eb,
  30212. "gbopomofo",
  30213. 0x310d,
  30214. "gbreve",
  30215. 0x011f,
  30216. "gcaron",
  30217. 0x01e7,
  30218. "gcedilla",
  30219. 0x0123,
  30220. "gcircle",
  30221. 0x24d6,
  30222. "gcircumflex",
  30223. 0x011d,
  30224. "gcommaaccent",
  30225. 0x0123,
  30226. "gdot",
  30227. 0x0121,
  30228. "gdotaccent",
  30229. 0x0121,
  30230. "gecyrillic",
  30231. 0x0433,
  30232. "gehiragana",
  30233. 0x3052,
  30234. "gekatakana",
  30235. 0x30b2,
  30236. "geometricallyequal",
  30237. 0x2251,
  30238. "gereshaccenthebrew",
  30239. 0x059c,
  30240. "gereshhebrew",
  30241. 0x05f3,
  30242. "gereshmuqdamhebrew",
  30243. 0x059d,
  30244. "germandbls",
  30245. 0x00df,
  30246. "gershayimaccenthebrew",
  30247. 0x059e,
  30248. "gershayimhebrew",
  30249. 0x05f4,
  30250. "getamark",
  30251. 0x3013,
  30252. "ghabengali",
  30253. 0x0998,
  30254. "ghadarmenian",
  30255. 0x0572,
  30256. "ghadeva",
  30257. 0x0918,
  30258. "ghagujarati",
  30259. 0x0a98,
  30260. "ghagurmukhi",
  30261. 0x0a18,
  30262. "ghainarabic",
  30263. 0x063a,
  30264. "ghainfinalarabic",
  30265. 0xfece,
  30266. "ghaininitialarabic",
  30267. 0xfecf,
  30268. "ghainmedialarabic",
  30269. 0xfed0,
  30270. "ghemiddlehookcyrillic",
  30271. 0x0495,
  30272. "ghestrokecyrillic",
  30273. 0x0493,
  30274. "gheupturncyrillic",
  30275. 0x0491,
  30276. "ghhadeva",
  30277. 0x095a,
  30278. "ghhagurmukhi",
  30279. 0x0a5a,
  30280. "ghook",
  30281. 0x0260,
  30282. "ghzsquare",
  30283. 0x3393,
  30284. "gihiragana",
  30285. 0x304e,
  30286. "gikatakana",
  30287. 0x30ae,
  30288. "gimarmenian",
  30289. 0x0563,
  30290. "gimel",
  30291. 0x05d2,
  30292. "gimeldagesh",
  30293. 0xfb32,
  30294. "gimeldageshhebrew",
  30295. 0xfb32,
  30296. "gimelhebrew",
  30297. 0x05d2,
  30298. "gjecyrillic",
  30299. 0x0453,
  30300. "glottalinvertedstroke",
  30301. 0x01be,
  30302. "glottalstop",
  30303. 0x0294,
  30304. "glottalstopinverted",
  30305. 0x0296,
  30306. "glottalstopmod",
  30307. 0x02c0,
  30308. "glottalstopreversed",
  30309. 0x0295,
  30310. "glottalstopreversedmod",
  30311. 0x02c1,
  30312. "glottalstopreversedsuperior",
  30313. 0x02e4,
  30314. "glottalstopstroke",
  30315. 0x02a1,
  30316. "glottalstopstrokereversed",
  30317. 0x02a2,
  30318. "gmacron",
  30319. 0x1e21,
  30320. "gmonospace",
  30321. 0xff47,
  30322. "gohiragana",
  30323. 0x3054,
  30324. "gokatakana",
  30325. 0x30b4,
  30326. "gparen",
  30327. 0x24a2,
  30328. "gpasquare",
  30329. 0x33ac,
  30330. "gradient",
  30331. 0x2207,
  30332. "grave",
  30333. 0x0060,
  30334. "gravebelowcmb",
  30335. 0x0316,
  30336. "gravecmb",
  30337. 0x0300,
  30338. "gravecomb",
  30339. 0x0300,
  30340. "gravedeva",
  30341. 0x0953,
  30342. "gravelowmod",
  30343. 0x02ce,
  30344. "gravemonospace",
  30345. 0xff40,
  30346. "gravetonecmb",
  30347. 0x0340,
  30348. "greater",
  30349. 0x003e,
  30350. "greaterequal",
  30351. 0x2265,
  30352. "greaterequalorless",
  30353. 0x22db,
  30354. "greatermonospace",
  30355. 0xff1e,
  30356. "greaterorequivalent",
  30357. 0x2273,
  30358. "greaterorless",
  30359. 0x2277,
  30360. "greateroverequal",
  30361. 0x2267,
  30362. "greatersmall",
  30363. 0xfe65,
  30364. "gscript",
  30365. 0x0261,
  30366. "gstroke",
  30367. 0x01e5,
  30368. "guhiragana",
  30369. 0x3050,
  30370. "guillemotleft",
  30371. 0x00ab,
  30372. "guillemotright",
  30373. 0x00bb,
  30374. "guilsinglleft",
  30375. 0x2039,
  30376. "guilsinglright",
  30377. 0x203a,
  30378. "gukatakana",
  30379. 0x30b0,
  30380. "guramusquare",
  30381. 0x3318,
  30382. "gysquare",
  30383. 0x33c9,
  30384. "h",
  30385. 0x0068,
  30386. "haabkhasiancyrillic",
  30387. 0x04a9,
  30388. "haaltonearabic",
  30389. 0x06c1,
  30390. "habengali",
  30391. 0x09b9,
  30392. "hadescendercyrillic",
  30393. 0x04b3,
  30394. "hadeva",
  30395. 0x0939,
  30396. "hagujarati",
  30397. 0x0ab9,
  30398. "hagurmukhi",
  30399. 0x0a39,
  30400. "haharabic",
  30401. 0x062d,
  30402. "hahfinalarabic",
  30403. 0xfea2,
  30404. "hahinitialarabic",
  30405. 0xfea3,
  30406. "hahiragana",
  30407. 0x306f,
  30408. "hahmedialarabic",
  30409. 0xfea4,
  30410. "haitusquare",
  30411. 0x332a,
  30412. "hakatakana",
  30413. 0x30cf,
  30414. "hakatakanahalfwidth",
  30415. 0xff8a,
  30416. "halantgurmukhi",
  30417. 0x0a4d,
  30418. "hamzaarabic",
  30419. 0x0621,
  30420. "hamzalowarabic",
  30421. 0x0621,
  30422. "hangulfiller",
  30423. 0x3164,
  30424. "hardsigncyrillic",
  30425. 0x044a,
  30426. "harpoonleftbarbup",
  30427. 0x21bc,
  30428. "harpoonrightbarbup",
  30429. 0x21c0,
  30430. "hasquare",
  30431. 0x33ca,
  30432. "hatafpatah",
  30433. 0x05b2,
  30434. "hatafpatah16",
  30435. 0x05b2,
  30436. "hatafpatah23",
  30437. 0x05b2,
  30438. "hatafpatah2f",
  30439. 0x05b2,
  30440. "hatafpatahhebrew",
  30441. 0x05b2,
  30442. "hatafpatahnarrowhebrew",
  30443. 0x05b2,
  30444. "hatafpatahquarterhebrew",
  30445. 0x05b2,
  30446. "hatafpatahwidehebrew",
  30447. 0x05b2,
  30448. "hatafqamats",
  30449. 0x05b3,
  30450. "hatafqamats1b",
  30451. 0x05b3,
  30452. "hatafqamats28",
  30453. 0x05b3,
  30454. "hatafqamats34",
  30455. 0x05b3,
  30456. "hatafqamatshebrew",
  30457. 0x05b3,
  30458. "hatafqamatsnarrowhebrew",
  30459. 0x05b3,
  30460. "hatafqamatsquarterhebrew",
  30461. 0x05b3,
  30462. "hatafqamatswidehebrew",
  30463. 0x05b3,
  30464. "hatafsegol",
  30465. 0x05b1,
  30466. "hatafsegol17",
  30467. 0x05b1,
  30468. "hatafsegol24",
  30469. 0x05b1,
  30470. "hatafsegol30",
  30471. 0x05b1,
  30472. "hatafsegolhebrew",
  30473. 0x05b1,
  30474. "hatafsegolnarrowhebrew",
  30475. 0x05b1,
  30476. "hatafsegolquarterhebrew",
  30477. 0x05b1,
  30478. "hatafsegolwidehebrew",
  30479. 0x05b1,
  30480. "hbar",
  30481. 0x0127,
  30482. "hbopomofo",
  30483. 0x310f,
  30484. "hbrevebelow",
  30485. 0x1e2b,
  30486. "hcedilla",
  30487. 0x1e29,
  30488. "hcircle",
  30489. 0x24d7,
  30490. "hcircumflex",
  30491. 0x0125,
  30492. "hdieresis",
  30493. 0x1e27,
  30494. "hdotaccent",
  30495. 0x1e23,
  30496. "hdotbelow",
  30497. 0x1e25,
  30498. "he",
  30499. 0x05d4,
  30500. "heart",
  30501. 0x2665,
  30502. "heartsuitblack",
  30503. 0x2665,
  30504. "heartsuitwhite",
  30505. 0x2661,
  30506. "hedagesh",
  30507. 0xfb34,
  30508. "hedageshhebrew",
  30509. 0xfb34,
  30510. "hehaltonearabic",
  30511. 0x06c1,
  30512. "heharabic",
  30513. 0x0647,
  30514. "hehebrew",
  30515. 0x05d4,
  30516. "hehfinalaltonearabic",
  30517. 0xfba7,
  30518. "hehfinalalttwoarabic",
  30519. 0xfeea,
  30520. "hehfinalarabic",
  30521. 0xfeea,
  30522. "hehhamzaabovefinalarabic",
  30523. 0xfba5,
  30524. "hehhamzaaboveisolatedarabic",
  30525. 0xfba4,
  30526. "hehinitialaltonearabic",
  30527. 0xfba8,
  30528. "hehinitialarabic",
  30529. 0xfeeb,
  30530. "hehiragana",
  30531. 0x3078,
  30532. "hehmedialaltonearabic",
  30533. 0xfba9,
  30534. "hehmedialarabic",
  30535. 0xfeec,
  30536. "heiseierasquare",
  30537. 0x337b,
  30538. "hekatakana",
  30539. 0x30d8,
  30540. "hekatakanahalfwidth",
  30541. 0xff8d,
  30542. "hekutaarusquare",
  30543. 0x3336,
  30544. "henghook",
  30545. 0x0267,
  30546. "herutusquare",
  30547. 0x3339,
  30548. "het",
  30549. 0x05d7,
  30550. "hethebrew",
  30551. 0x05d7,
  30552. "hhook",
  30553. 0x0266,
  30554. "hhooksuperior",
  30555. 0x02b1,
  30556. "hieuhacirclekorean",
  30557. 0x327b,
  30558. "hieuhaparenkorean",
  30559. 0x321b,
  30560. "hieuhcirclekorean",
  30561. 0x326d,
  30562. "hieuhkorean",
  30563. 0x314e,
  30564. "hieuhparenkorean",
  30565. 0x320d,
  30566. "hihiragana",
  30567. 0x3072,
  30568. "hikatakana",
  30569. 0x30d2,
  30570. "hikatakanahalfwidth",
  30571. 0xff8b,
  30572. "hiriq",
  30573. 0x05b4,
  30574. "hiriq14",
  30575. 0x05b4,
  30576. "hiriq21",
  30577. 0x05b4,
  30578. "hiriq2d",
  30579. 0x05b4,
  30580. "hiriqhebrew",
  30581. 0x05b4,
  30582. "hiriqnarrowhebrew",
  30583. 0x05b4,
  30584. "hiriqquarterhebrew",
  30585. 0x05b4,
  30586. "hiriqwidehebrew",
  30587. 0x05b4,
  30588. "hlinebelow",
  30589. 0x1e96,
  30590. "hmonospace",
  30591. 0xff48,
  30592. "hoarmenian",
  30593. 0x0570,
  30594. "hohipthai",
  30595. 0x0e2b,
  30596. "hohiragana",
  30597. 0x307b,
  30598. "hokatakana",
  30599. 0x30db,
  30600. "hokatakanahalfwidth",
  30601. 0xff8e,
  30602. "holam",
  30603. 0x05b9,
  30604. "holam19",
  30605. 0x05b9,
  30606. "holam26",
  30607. 0x05b9,
  30608. "holam32",
  30609. 0x05b9,
  30610. "holamhebrew",
  30611. 0x05b9,
  30612. "holamnarrowhebrew",
  30613. 0x05b9,
  30614. "holamquarterhebrew",
  30615. 0x05b9,
  30616. "holamwidehebrew",
  30617. 0x05b9,
  30618. "honokhukthai",
  30619. 0x0e2e,
  30620. "hookabovecomb",
  30621. 0x0309,
  30622. "hookcmb",
  30623. 0x0309,
  30624. "hookpalatalizedbelowcmb",
  30625. 0x0321,
  30626. "hookretroflexbelowcmb",
  30627. 0x0322,
  30628. "hoonsquare",
  30629. 0x3342,
  30630. "horicoptic",
  30631. 0x03e9,
  30632. "horizontalbar",
  30633. 0x2015,
  30634. "horncmb",
  30635. 0x031b,
  30636. "hotsprings",
  30637. 0x2668,
  30638. "house",
  30639. 0x2302,
  30640. "hparen",
  30641. 0x24a3,
  30642. "hsuperior",
  30643. 0x02b0,
  30644. "hturned",
  30645. 0x0265,
  30646. "huhiragana",
  30647. 0x3075,
  30648. "huiitosquare",
  30649. 0x3333,
  30650. "hukatakana",
  30651. 0x30d5,
  30652. "hukatakanahalfwidth",
  30653. 0xff8c,
  30654. "hungarumlaut",
  30655. 0x02dd,
  30656. "hungarumlautcmb",
  30657. 0x030b,
  30658. "hv",
  30659. 0x0195,
  30660. "hyphen",
  30661. 0x002d,
  30662. "hypheninferior",
  30663. 0xf6e5,
  30664. "hyphenmonospace",
  30665. 0xff0d,
  30666. "hyphensmall",
  30667. 0xfe63,
  30668. "hyphensuperior",
  30669. 0xf6e6,
  30670. "hyphentwo",
  30671. 0x2010,
  30672. "i",
  30673. 0x0069,
  30674. "iacute",
  30675. 0x00ed,
  30676. "iacyrillic",
  30677. 0x044f,
  30678. "ibengali",
  30679. 0x0987,
  30680. "ibopomofo",
  30681. 0x3127,
  30682. "ibreve",
  30683. 0x012d,
  30684. "icaron",
  30685. 0x01d0,
  30686. "icircle",
  30687. 0x24d8,
  30688. "icircumflex",
  30689. 0x00ee,
  30690. "icyrillic",
  30691. 0x0456,
  30692. "idblgrave",
  30693. 0x0209,
  30694. "ideographearthcircle",
  30695. 0x328f,
  30696. "ideographfirecircle",
  30697. 0x328b,
  30698. "ideographicallianceparen",
  30699. 0x323f,
  30700. "ideographiccallparen",
  30701. 0x323a,
  30702. "ideographiccentrecircle",
  30703. 0x32a5,
  30704. "ideographicclose",
  30705. 0x3006,
  30706. "ideographiccomma",
  30707. 0x3001,
  30708. "ideographiccommaleft",
  30709. 0xff64,
  30710. "ideographiccongratulationparen",
  30711. 0x3237,
  30712. "ideographiccorrectcircle",
  30713. 0x32a3,
  30714. "ideographicearthparen",
  30715. 0x322f,
  30716. "ideographicenterpriseparen",
  30717. 0x323d,
  30718. "ideographicexcellentcircle",
  30719. 0x329d,
  30720. "ideographicfestivalparen",
  30721. 0x3240,
  30722. "ideographicfinancialcircle",
  30723. 0x3296,
  30724. "ideographicfinancialparen",
  30725. 0x3236,
  30726. "ideographicfireparen",
  30727. 0x322b,
  30728. "ideographichaveparen",
  30729. 0x3232,
  30730. "ideographichighcircle",
  30731. 0x32a4,
  30732. "ideographiciterationmark",
  30733. 0x3005,
  30734. "ideographiclaborcircle",
  30735. 0x3298,
  30736. "ideographiclaborparen",
  30737. 0x3238,
  30738. "ideographicleftcircle",
  30739. 0x32a7,
  30740. "ideographiclowcircle",
  30741. 0x32a6,
  30742. "ideographicmedicinecircle",
  30743. 0x32a9,
  30744. "ideographicmetalparen",
  30745. 0x322e,
  30746. "ideographicmoonparen",
  30747. 0x322a,
  30748. "ideographicnameparen",
  30749. 0x3234,
  30750. "ideographicperiod",
  30751. 0x3002,
  30752. "ideographicprintcircle",
  30753. 0x329e,
  30754. "ideographicreachparen",
  30755. 0x3243,
  30756. "ideographicrepresentparen",
  30757. 0x3239,
  30758. "ideographicresourceparen",
  30759. 0x323e,
  30760. "ideographicrightcircle",
  30761. 0x32a8,
  30762. "ideographicsecretcircle",
  30763. 0x3299,
  30764. "ideographicselfparen",
  30765. 0x3242,
  30766. "ideographicsocietyparen",
  30767. 0x3233,
  30768. "ideographicspace",
  30769. 0x3000,
  30770. "ideographicspecialparen",
  30771. 0x3235,
  30772. "ideographicstockparen",
  30773. 0x3231,
  30774. "ideographicstudyparen",
  30775. 0x323b,
  30776. "ideographicsunparen",
  30777. 0x3230,
  30778. "ideographicsuperviseparen",
  30779. 0x323c,
  30780. "ideographicwaterparen",
  30781. 0x322c,
  30782. "ideographicwoodparen",
  30783. 0x322d,
  30784. "ideographiczero",
  30785. 0x3007,
  30786. "ideographmetalcircle",
  30787. 0x328e,
  30788. "ideographmooncircle",
  30789. 0x328a,
  30790. "ideographnamecircle",
  30791. 0x3294,
  30792. "ideographsuncircle",
  30793. 0x3290,
  30794. "ideographwatercircle",
  30795. 0x328c,
  30796. "ideographwoodcircle",
  30797. 0x328d,
  30798. "ideva",
  30799. 0x0907,
  30800. "idieresis",
  30801. 0x00ef,
  30802. "idieresisacute",
  30803. 0x1e2f,
  30804. "idieresiscyrillic",
  30805. 0x04e5,
  30806. "idotbelow",
  30807. 0x1ecb,
  30808. "iebrevecyrillic",
  30809. 0x04d7,
  30810. "iecyrillic",
  30811. 0x0435,
  30812. "ieungacirclekorean",
  30813. 0x3275,
  30814. "ieungaparenkorean",
  30815. 0x3215,
  30816. "ieungcirclekorean",
  30817. 0x3267,
  30818. "ieungkorean",
  30819. 0x3147,
  30820. "ieungparenkorean",
  30821. 0x3207,
  30822. "igrave",
  30823. 0x00ec,
  30824. "igujarati",
  30825. 0x0a87,
  30826. "igurmukhi",
  30827. 0x0a07,
  30828. "ihiragana",
  30829. 0x3044,
  30830. "ihookabove",
  30831. 0x1ec9,
  30832. "iibengali",
  30833. 0x0988,
  30834. "iicyrillic",
  30835. 0x0438,
  30836. "iideva",
  30837. 0x0908,
  30838. "iigujarati",
  30839. 0x0a88,
  30840. "iigurmukhi",
  30841. 0x0a08,
  30842. "iimatragurmukhi",
  30843. 0x0a40,
  30844. "iinvertedbreve",
  30845. 0x020b,
  30846. "iishortcyrillic",
  30847. 0x0439,
  30848. "iivowelsignbengali",
  30849. 0x09c0,
  30850. "iivowelsigndeva",
  30851. 0x0940,
  30852. "iivowelsigngujarati",
  30853. 0x0ac0,
  30854. "ij",
  30855. 0x0133,
  30856. "ikatakana",
  30857. 0x30a4,
  30858. "ikatakanahalfwidth",
  30859. 0xff72,
  30860. "ikorean",
  30861. 0x3163,
  30862. "ilde",
  30863. 0x02dc,
  30864. "iluyhebrew",
  30865. 0x05ac,
  30866. "imacron",
  30867. 0x012b,
  30868. "imacroncyrillic",
  30869. 0x04e3,
  30870. "imageorapproximatelyequal",
  30871. 0x2253,
  30872. "imatragurmukhi",
  30873. 0x0a3f,
  30874. "imonospace",
  30875. 0xff49,
  30876. "increment",
  30877. 0x2206,
  30878. "infinity",
  30879. 0x221e,
  30880. "iniarmenian",
  30881. 0x056b,
  30882. "integral",
  30883. 0x222b,
  30884. "integralbottom",
  30885. 0x2321,
  30886. "integralbt",
  30887. 0x2321,
  30888. "integralex",
  30889. 0xf8f5,
  30890. "integraltop",
  30891. 0x2320,
  30892. "integraltp",
  30893. 0x2320,
  30894. "intersection",
  30895. 0x2229,
  30896. "intisquare",
  30897. 0x3305,
  30898. "invbullet",
  30899. 0x25d8,
  30900. "invcircle",
  30901. 0x25d9,
  30902. "invsmileface",
  30903. 0x263b,
  30904. "iocyrillic",
  30905. 0x0451,
  30906. "iogonek",
  30907. 0x012f,
  30908. "iota",
  30909. 0x03b9,
  30910. "iotadieresis",
  30911. 0x03ca,
  30912. "iotadieresistonos",
  30913. 0x0390,
  30914. "iotalatin",
  30915. 0x0269,
  30916. "iotatonos",
  30917. 0x03af,
  30918. "iparen",
  30919. 0x24a4,
  30920. "irigurmukhi",
  30921. 0x0a72,
  30922. "ismallhiragana",
  30923. 0x3043,
  30924. "ismallkatakana",
  30925. 0x30a3,
  30926. "ismallkatakanahalfwidth",
  30927. 0xff68,
  30928. "issharbengali",
  30929. 0x09fa,
  30930. "istroke",
  30931. 0x0268,
  30932. "isuperior",
  30933. 0xf6ed,
  30934. "iterationhiragana",
  30935. 0x309d,
  30936. "iterationkatakana",
  30937. 0x30fd,
  30938. "itilde",
  30939. 0x0129,
  30940. "itildebelow",
  30941. 0x1e2d,
  30942. "iubopomofo",
  30943. 0x3129,
  30944. "iucyrillic",
  30945. 0x044e,
  30946. "ivowelsignbengali",
  30947. 0x09bf,
  30948. "ivowelsigndeva",
  30949. 0x093f,
  30950. "ivowelsigngujarati",
  30951. 0x0abf,
  30952. "izhitsacyrillic",
  30953. 0x0475,
  30954. "izhitsadblgravecyrillic",
  30955. 0x0477,
  30956. "j",
  30957. 0x006a,
  30958. "jaarmenian",
  30959. 0x0571,
  30960. "jabengali",
  30961. 0x099c,
  30962. "jadeva",
  30963. 0x091c,
  30964. "jagujarati",
  30965. 0x0a9c,
  30966. "jagurmukhi",
  30967. 0x0a1c,
  30968. "jbopomofo",
  30969. 0x3110,
  30970. "jcaron",
  30971. 0x01f0,
  30972. "jcircle",
  30973. 0x24d9,
  30974. "jcircumflex",
  30975. 0x0135,
  30976. "jcrossedtail",
  30977. 0x029d,
  30978. "jdotlessstroke",
  30979. 0x025f,
  30980. "jecyrillic",
  30981. 0x0458,
  30982. "jeemarabic",
  30983. 0x062c,
  30984. "jeemfinalarabic",
  30985. 0xfe9e,
  30986. "jeeminitialarabic",
  30987. 0xfe9f,
  30988. "jeemmedialarabic",
  30989. 0xfea0,
  30990. "jeharabic",
  30991. 0x0698,
  30992. "jehfinalarabic",
  30993. 0xfb8b,
  30994. "jhabengali",
  30995. 0x099d,
  30996. "jhadeva",
  30997. 0x091d,
  30998. "jhagujarati",
  30999. 0x0a9d,
  31000. "jhagurmukhi",
  31001. 0x0a1d,
  31002. "jheharmenian",
  31003. 0x057b,
  31004. "jis",
  31005. 0x3004,
  31006. "jmonospace",
  31007. 0xff4a,
  31008. "jparen",
  31009. 0x24a5,
  31010. "jsuperior",
  31011. 0x02b2,
  31012. "k",
  31013. 0x006b,
  31014. "kabashkircyrillic",
  31015. 0x04a1,
  31016. "kabengali",
  31017. 0x0995,
  31018. "kacute",
  31019. 0x1e31,
  31020. "kacyrillic",
  31021. 0x043a,
  31022. "kadescendercyrillic",
  31023. 0x049b,
  31024. "kadeva",
  31025. 0x0915,
  31026. "kaf",
  31027. 0x05db,
  31028. "kafarabic",
  31029. 0x0643,
  31030. "kafdagesh",
  31031. 0xfb3b,
  31032. "kafdageshhebrew",
  31033. 0xfb3b,
  31034. "kaffinalarabic",
  31035. 0xfeda,
  31036. "kafhebrew",
  31037. 0x05db,
  31038. "kafinitialarabic",
  31039. 0xfedb,
  31040. "kafmedialarabic",
  31041. 0xfedc,
  31042. "kafrafehebrew",
  31043. 0xfb4d,
  31044. "kagujarati",
  31045. 0x0a95,
  31046. "kagurmukhi",
  31047. 0x0a15,
  31048. "kahiragana",
  31049. 0x304b,
  31050. "kahookcyrillic",
  31051. 0x04c4,
  31052. "kakatakana",
  31053. 0x30ab,
  31054. "kakatakanahalfwidth",
  31055. 0xff76,
  31056. "kappa",
  31057. 0x03ba,
  31058. "kappasymbolgreek",
  31059. 0x03f0,
  31060. "kapyeounmieumkorean",
  31061. 0x3171,
  31062. "kapyeounphieuphkorean",
  31063. 0x3184,
  31064. "kapyeounpieupkorean",
  31065. 0x3178,
  31066. "kapyeounssangpieupkorean",
  31067. 0x3179,
  31068. "karoriisquare",
  31069. 0x330d,
  31070. "kashidaautoarabic",
  31071. 0x0640,
  31072. "kashidaautonosidebearingarabic",
  31073. 0x0640,
  31074. "kasmallkatakana",
  31075. 0x30f5,
  31076. "kasquare",
  31077. 0x3384,
  31078. "kasraarabic",
  31079. 0x0650,
  31080. "kasratanarabic",
  31081. 0x064d,
  31082. "kastrokecyrillic",
  31083. 0x049f,
  31084. "katahiraprolongmarkhalfwidth",
  31085. 0xff70,
  31086. "kaverticalstrokecyrillic",
  31087. 0x049d,
  31088. "kbopomofo",
  31089. 0x310e,
  31090. "kcalsquare",
  31091. 0x3389,
  31092. "kcaron",
  31093. 0x01e9,
  31094. "kcedilla",
  31095. 0x0137,
  31096. "kcircle",
  31097. 0x24da,
  31098. "kcommaaccent",
  31099. 0x0137,
  31100. "kdotbelow",
  31101. 0x1e33,
  31102. "keharmenian",
  31103. 0x0584,
  31104. "kehiragana",
  31105. 0x3051,
  31106. "kekatakana",
  31107. 0x30b1,
  31108. "kekatakanahalfwidth",
  31109. 0xff79,
  31110. "kenarmenian",
  31111. 0x056f,
  31112. "kesmallkatakana",
  31113. 0x30f6,
  31114. "kgreenlandic",
  31115. 0x0138,
  31116. "khabengali",
  31117. 0x0996,
  31118. "khacyrillic",
  31119. 0x0445,
  31120. "khadeva",
  31121. 0x0916,
  31122. "khagujarati",
  31123. 0x0a96,
  31124. "khagurmukhi",
  31125. 0x0a16,
  31126. "khaharabic",
  31127. 0x062e,
  31128. "khahfinalarabic",
  31129. 0xfea6,
  31130. "khahinitialarabic",
  31131. 0xfea7,
  31132. "khahmedialarabic",
  31133. 0xfea8,
  31134. "kheicoptic",
  31135. 0x03e7,
  31136. "khhadeva",
  31137. 0x0959,
  31138. "khhagurmukhi",
  31139. 0x0a59,
  31140. "khieukhacirclekorean",
  31141. 0x3278,
  31142. "khieukhaparenkorean",
  31143. 0x3218,
  31144. "khieukhcirclekorean",
  31145. 0x326a,
  31146. "khieukhkorean",
  31147. 0x314b,
  31148. "khieukhparenkorean",
  31149. 0x320a,
  31150. "khokhaithai",
  31151. 0x0e02,
  31152. "khokhonthai",
  31153. 0x0e05,
  31154. "khokhuatthai",
  31155. 0x0e03,
  31156. "khokhwaithai",
  31157. 0x0e04,
  31158. "khomutthai",
  31159. 0x0e5b,
  31160. "khook",
  31161. 0x0199,
  31162. "khorakhangthai",
  31163. 0x0e06,
  31164. "khzsquare",
  31165. 0x3391,
  31166. "kihiragana",
  31167. 0x304d,
  31168. "kikatakana",
  31169. 0x30ad,
  31170. "kikatakanahalfwidth",
  31171. 0xff77,
  31172. "kiroguramusquare",
  31173. 0x3315,
  31174. "kiromeetorusquare",
  31175. 0x3316,
  31176. "kirosquare",
  31177. 0x3314,
  31178. "kiyeokacirclekorean",
  31179. 0x326e,
  31180. "kiyeokaparenkorean",
  31181. 0x320e,
  31182. "kiyeokcirclekorean",
  31183. 0x3260,
  31184. "kiyeokkorean",
  31185. 0x3131,
  31186. "kiyeokparenkorean",
  31187. 0x3200,
  31188. "kiyeoksioskorean",
  31189. 0x3133,
  31190. "kjecyrillic",
  31191. 0x045c,
  31192. "klinebelow",
  31193. 0x1e35,
  31194. "klsquare",
  31195. 0x3398,
  31196. "kmcubedsquare",
  31197. 0x33a6,
  31198. "kmonospace",
  31199. 0xff4b,
  31200. "kmsquaredsquare",
  31201. 0x33a2,
  31202. "kohiragana",
  31203. 0x3053,
  31204. "kohmsquare",
  31205. 0x33c0,
  31206. "kokaithai",
  31207. 0x0e01,
  31208. "kokatakana",
  31209. 0x30b3,
  31210. "kokatakanahalfwidth",
  31211. 0xff7a,
  31212. "kooposquare",
  31213. 0x331e,
  31214. "koppacyrillic",
  31215. 0x0481,
  31216. "koreanstandardsymbol",
  31217. 0x327f,
  31218. "koroniscmb",
  31219. 0x0343,
  31220. "kparen",
  31221. 0x24a6,
  31222. "kpasquare",
  31223. 0x33aa,
  31224. "ksicyrillic",
  31225. 0x046f,
  31226. "ktsquare",
  31227. 0x33cf,
  31228. "kturned",
  31229. 0x029e,
  31230. "kuhiragana",
  31231. 0x304f,
  31232. "kukatakana",
  31233. 0x30af,
  31234. "kukatakanahalfwidth",
  31235. 0xff78,
  31236. "kvsquare",
  31237. 0x33b8,
  31238. "kwsquare",
  31239. 0x33be,
  31240. "l",
  31241. 0x006c,
  31242. "labengali",
  31243. 0x09b2,
  31244. "lacute",
  31245. 0x013a,
  31246. "ladeva",
  31247. 0x0932,
  31248. "lagujarati",
  31249. 0x0ab2,
  31250. "lagurmukhi",
  31251. 0x0a32,
  31252. "lakkhangyaothai",
  31253. 0x0e45,
  31254. "lamaleffinalarabic",
  31255. 0xfefc,
  31256. "lamalefhamzaabovefinalarabic",
  31257. 0xfef8,
  31258. "lamalefhamzaaboveisolatedarabic",
  31259. 0xfef7,
  31260. "lamalefhamzabelowfinalarabic",
  31261. 0xfefa,
  31262. "lamalefhamzabelowisolatedarabic",
  31263. 0xfef9,
  31264. "lamalefisolatedarabic",
  31265. 0xfefb,
  31266. "lamalefmaddaabovefinalarabic",
  31267. 0xfef6,
  31268. "lamalefmaddaaboveisolatedarabic",
  31269. 0xfef5,
  31270. "lamarabic",
  31271. 0x0644,
  31272. "lambda",
  31273. 0x03bb,
  31274. "lambdastroke",
  31275. 0x019b,
  31276. "lamed",
  31277. 0x05dc,
  31278. "lameddagesh",
  31279. 0xfb3c,
  31280. "lameddageshhebrew",
  31281. 0xfb3c,
  31282. "lamedhebrew",
  31283. 0x05dc,
  31284. "lamfinalarabic",
  31285. 0xfede,
  31286. "lamhahinitialarabic",
  31287. 0xfcca,
  31288. "laminitialarabic",
  31289. 0xfedf,
  31290. "lamjeeminitialarabic",
  31291. 0xfcc9,
  31292. "lamkhahinitialarabic",
  31293. 0xfccb,
  31294. "lamlamhehisolatedarabic",
  31295. 0xfdf2,
  31296. "lammedialarabic",
  31297. 0xfee0,
  31298. "lammeemhahinitialarabic",
  31299. 0xfd88,
  31300. "lammeeminitialarabic",
  31301. 0xfccc,
  31302. "largecircle",
  31303. 0x25ef,
  31304. "lbar",
  31305. 0x019a,
  31306. "lbelt",
  31307. 0x026c,
  31308. "lbopomofo",
  31309. 0x310c,
  31310. "lcaron",
  31311. 0x013e,
  31312. "lcedilla",
  31313. 0x013c,
  31314. "lcircle",
  31315. 0x24db,
  31316. "lcircumflexbelow",
  31317. 0x1e3d,
  31318. "lcommaaccent",
  31319. 0x013c,
  31320. "ldot",
  31321. 0x0140,
  31322. "ldotaccent",
  31323. 0x0140,
  31324. "ldotbelow",
  31325. 0x1e37,
  31326. "ldotbelowmacron",
  31327. 0x1e39,
  31328. "leftangleabovecmb",
  31329. 0x031a,
  31330. "lefttackbelowcmb",
  31331. 0x0318,
  31332. "less",
  31333. 0x003c,
  31334. "lessequal",
  31335. 0x2264,
  31336. "lessequalorgreater",
  31337. 0x22da,
  31338. "lessmonospace",
  31339. 0xff1c,
  31340. "lessorequivalent",
  31341. 0x2272,
  31342. "lessorgreater",
  31343. 0x2276,
  31344. "lessoverequal",
  31345. 0x2266,
  31346. "lesssmall",
  31347. 0xfe64,
  31348. "lezh",
  31349. 0x026e,
  31350. "lfblock",
  31351. 0x258c,
  31352. "lhookretroflex",
  31353. 0x026d,
  31354. "lira",
  31355. 0x20a4,
  31356. "liwnarmenian",
  31357. 0x056c,
  31358. "lj",
  31359. 0x01c9,
  31360. "ljecyrillic",
  31361. 0x0459,
  31362. "ll",
  31363. 0xf6c0,
  31364. "lladeva",
  31365. 0x0933,
  31366. "llagujarati",
  31367. 0x0ab3,
  31368. "llinebelow",
  31369. 0x1e3b,
  31370. "llladeva",
  31371. 0x0934,
  31372. "llvocalicbengali",
  31373. 0x09e1,
  31374. "llvocalicdeva",
  31375. 0x0961,
  31376. "llvocalicvowelsignbengali",
  31377. 0x09e3,
  31378. "llvocalicvowelsigndeva",
  31379. 0x0963,
  31380. "lmiddletilde",
  31381. 0x026b,
  31382. "lmonospace",
  31383. 0xff4c,
  31384. "lmsquare",
  31385. 0x33d0,
  31386. "lochulathai",
  31387. 0x0e2c,
  31388. "logicaland",
  31389. 0x2227,
  31390. "logicalnot",
  31391. 0x00ac,
  31392. "logicalnotreversed",
  31393. 0x2310,
  31394. "logicalor",
  31395. 0x2228,
  31396. "lolingthai",
  31397. 0x0e25,
  31398. "longs",
  31399. 0x017f,
  31400. "lowlinecenterline",
  31401. 0xfe4e,
  31402. "lowlinecmb",
  31403. 0x0332,
  31404. "lowlinedashed",
  31405. 0xfe4d,
  31406. "lozenge",
  31407. 0x25ca,
  31408. "lparen",
  31409. 0x24a7,
  31410. "lslash",
  31411. 0x0142,
  31412. "lsquare",
  31413. 0x2113,
  31414. "lsuperior",
  31415. 0xf6ee,
  31416. "ltshade",
  31417. 0x2591,
  31418. "luthai",
  31419. 0x0e26,
  31420. "lvocalicbengali",
  31421. 0x098c,
  31422. "lvocalicdeva",
  31423. 0x090c,
  31424. "lvocalicvowelsignbengali",
  31425. 0x09e2,
  31426. "lvocalicvowelsigndeva",
  31427. 0x0962,
  31428. "lxsquare",
  31429. 0x33d3,
  31430. "m",
  31431. 0x006d,
  31432. "mabengali",
  31433. 0x09ae,
  31434. "macron",
  31435. 0x00af,
  31436. "macronbelowcmb",
  31437. 0x0331,
  31438. "macroncmb",
  31439. 0x0304,
  31440. "macronlowmod",
  31441. 0x02cd,
  31442. "macronmonospace",
  31443. 0xffe3,
  31444. "macute",
  31445. 0x1e3f,
  31446. "madeva",
  31447. 0x092e,
  31448. "magujarati",
  31449. 0x0aae,
  31450. "magurmukhi",
  31451. 0x0a2e,
  31452. "mahapakhhebrew",
  31453. 0x05a4,
  31454. "mahapakhlefthebrew",
  31455. 0x05a4,
  31456. "mahiragana",
  31457. 0x307e,
  31458. "maichattawalowleftthai",
  31459. 0xf895,
  31460. "maichattawalowrightthai",
  31461. 0xf894,
  31462. "maichattawathai",
  31463. 0x0e4b,
  31464. "maichattawaupperleftthai",
  31465. 0xf893,
  31466. "maieklowleftthai",
  31467. 0xf88c,
  31468. "maieklowrightthai",
  31469. 0xf88b,
  31470. "maiekthai",
  31471. 0x0e48,
  31472. "maiekupperleftthai",
  31473. 0xf88a,
  31474. "maihanakatleftthai",
  31475. 0xf884,
  31476. "maihanakatthai",
  31477. 0x0e31,
  31478. "maitaikhuleftthai",
  31479. 0xf889,
  31480. "maitaikhuthai",
  31481. 0x0e47,
  31482. "maitholowleftthai",
  31483. 0xf88f,
  31484. "maitholowrightthai",
  31485. 0xf88e,
  31486. "maithothai",
  31487. 0x0e49,
  31488. "maithoupperleftthai",
  31489. 0xf88d,
  31490. "maitrilowleftthai",
  31491. 0xf892,
  31492. "maitrilowrightthai",
  31493. 0xf891,
  31494. "maitrithai",
  31495. 0x0e4a,
  31496. "maitriupperleftthai",
  31497. 0xf890,
  31498. "maiyamokthai",
  31499. 0x0e46,
  31500. "makatakana",
  31501. 0x30de,
  31502. "makatakanahalfwidth",
  31503. 0xff8f,
  31504. "male",
  31505. 0x2642,
  31506. "mansyonsquare",
  31507. 0x3347,
  31508. "maqafhebrew",
  31509. 0x05be,
  31510. "mars",
  31511. 0x2642,
  31512. "masoracirclehebrew",
  31513. 0x05af,
  31514. "masquare",
  31515. 0x3383,
  31516. "mbopomofo",
  31517. 0x3107,
  31518. "mbsquare",
  31519. 0x33d4,
  31520. "mcircle",
  31521. 0x24dc,
  31522. "mcubedsquare",
  31523. 0x33a5,
  31524. "mdotaccent",
  31525. 0x1e41,
  31526. "mdotbelow",
  31527. 0x1e43,
  31528. "meemarabic",
  31529. 0x0645,
  31530. "meemfinalarabic",
  31531. 0xfee2,
  31532. "meeminitialarabic",
  31533. 0xfee3,
  31534. "meemmedialarabic",
  31535. 0xfee4,
  31536. "meemmeeminitialarabic",
  31537. 0xfcd1,
  31538. "meemmeemisolatedarabic",
  31539. 0xfc48,
  31540. "meetorusquare",
  31541. 0x334d,
  31542. "mehiragana",
  31543. 0x3081,
  31544. "meizierasquare",
  31545. 0x337e,
  31546. "mekatakana",
  31547. 0x30e1,
  31548. "mekatakanahalfwidth",
  31549. 0xff92,
  31550. "mem",
  31551. 0x05de,
  31552. "memdagesh",
  31553. 0xfb3e,
  31554. "memdageshhebrew",
  31555. 0xfb3e,
  31556. "memhebrew",
  31557. 0x05de,
  31558. "menarmenian",
  31559. 0x0574,
  31560. "merkhahebrew",
  31561. 0x05a5,
  31562. "merkhakefulahebrew",
  31563. 0x05a6,
  31564. "merkhakefulalefthebrew",
  31565. 0x05a6,
  31566. "merkhalefthebrew",
  31567. 0x05a5,
  31568. "mhook",
  31569. 0x0271,
  31570. "mhzsquare",
  31571. 0x3392,
  31572. "middledotkatakanahalfwidth",
  31573. 0xff65,
  31574. "middot",
  31575. 0x00b7,
  31576. "mieumacirclekorean",
  31577. 0x3272,
  31578. "mieumaparenkorean",
  31579. 0x3212,
  31580. "mieumcirclekorean",
  31581. 0x3264,
  31582. "mieumkorean",
  31583. 0x3141,
  31584. "mieumpansioskorean",
  31585. 0x3170,
  31586. "mieumparenkorean",
  31587. 0x3204,
  31588. "mieumpieupkorean",
  31589. 0x316e,
  31590. "mieumsioskorean",
  31591. 0x316f,
  31592. "mihiragana",
  31593. 0x307f,
  31594. "mikatakana",
  31595. 0x30df,
  31596. "mikatakanahalfwidth",
  31597. 0xff90,
  31598. "minus",
  31599. 0x2212,
  31600. "minusbelowcmb",
  31601. 0x0320,
  31602. "minuscircle",
  31603. 0x2296,
  31604. "minusmod",
  31605. 0x02d7,
  31606. "minusplus",
  31607. 0x2213,
  31608. "minute",
  31609. 0x2032,
  31610. "miribaarusquare",
  31611. 0x334a,
  31612. "mirisquare",
  31613. 0x3349,
  31614. "mlonglegturned",
  31615. 0x0270,
  31616. "mlsquare",
  31617. 0x3396,
  31618. "mmcubedsquare",
  31619. 0x33a3,
  31620. "mmonospace",
  31621. 0xff4d,
  31622. "mmsquaredsquare",
  31623. 0x339f,
  31624. "mohiragana",
  31625. 0x3082,
  31626. "mohmsquare",
  31627. 0x33c1,
  31628. "mokatakana",
  31629. 0x30e2,
  31630. "mokatakanahalfwidth",
  31631. 0xff93,
  31632. "molsquare",
  31633. 0x33d6,
  31634. "momathai",
  31635. 0x0e21,
  31636. "moverssquare",
  31637. 0x33a7,
  31638. "moverssquaredsquare",
  31639. 0x33a8,
  31640. "mparen",
  31641. 0x24a8,
  31642. "mpasquare",
  31643. 0x33ab,
  31644. "mssquare",
  31645. 0x33b3,
  31646. "msuperior",
  31647. 0xf6ef,
  31648. "mturned",
  31649. 0x026f,
  31650. "mu",
  31651. 0x00b5,
  31652. "mu1",
  31653. 0x00b5,
  31654. "muasquare",
  31655. 0x3382,
  31656. "muchgreater",
  31657. 0x226b,
  31658. "muchless",
  31659. 0x226a,
  31660. "mufsquare",
  31661. 0x338c,
  31662. "mugreek",
  31663. 0x03bc,
  31664. "mugsquare",
  31665. 0x338d,
  31666. "muhiragana",
  31667. 0x3080,
  31668. "mukatakana",
  31669. 0x30e0,
  31670. "mukatakanahalfwidth",
  31671. 0xff91,
  31672. "mulsquare",
  31673. 0x3395,
  31674. "multiply",
  31675. 0x00d7,
  31676. "mumsquare",
  31677. 0x339b,
  31678. "munahhebrew",
  31679. 0x05a3,
  31680. "munahlefthebrew",
  31681. 0x05a3,
  31682. "musicalnote",
  31683. 0x266a,
  31684. "musicalnotedbl",
  31685. 0x266b,
  31686. "musicflatsign",
  31687. 0x266d,
  31688. "musicsharpsign",
  31689. 0x266f,
  31690. "mussquare",
  31691. 0x33b2,
  31692. "muvsquare",
  31693. 0x33b6,
  31694. "muwsquare",
  31695. 0x33bc,
  31696. "mvmegasquare",
  31697. 0x33b9,
  31698. "mvsquare",
  31699. 0x33b7,
  31700. "mwmegasquare",
  31701. 0x33bf,
  31702. "mwsquare",
  31703. 0x33bd,
  31704. "n",
  31705. 0x006e,
  31706. "nabengali",
  31707. 0x09a8,
  31708. "nabla",
  31709. 0x2207,
  31710. "nacute",
  31711. 0x0144,
  31712. "nadeva",
  31713. 0x0928,
  31714. "nagujarati",
  31715. 0x0aa8,
  31716. "nagurmukhi",
  31717. 0x0a28,
  31718. "nahiragana",
  31719. 0x306a,
  31720. "nakatakana",
  31721. 0x30ca,
  31722. "nakatakanahalfwidth",
  31723. 0xff85,
  31724. "napostrophe",
  31725. 0x0149,
  31726. "nasquare",
  31727. 0x3381,
  31728. "nbopomofo",
  31729. 0x310b,
  31730. "nbspace",
  31731. 0x00a0,
  31732. "ncaron",
  31733. 0x0148,
  31734. "ncedilla",
  31735. 0x0146,
  31736. "ncircle",
  31737. 0x24dd,
  31738. "ncircumflexbelow",
  31739. 0x1e4b,
  31740. "ncommaaccent",
  31741. 0x0146,
  31742. "ndotaccent",
  31743. 0x1e45,
  31744. "ndotbelow",
  31745. 0x1e47,
  31746. "nehiragana",
  31747. 0x306d,
  31748. "nekatakana",
  31749. 0x30cd,
  31750. "nekatakanahalfwidth",
  31751. 0xff88,
  31752. "newsheqelsign",
  31753. 0x20aa,
  31754. "nfsquare",
  31755. 0x338b,
  31756. "ngabengali",
  31757. 0x0999,
  31758. "ngadeva",
  31759. 0x0919,
  31760. "ngagujarati",
  31761. 0x0a99,
  31762. "ngagurmukhi",
  31763. 0x0a19,
  31764. "ngonguthai",
  31765. 0x0e07,
  31766. "nhiragana",
  31767. 0x3093,
  31768. "nhookleft",
  31769. 0x0272,
  31770. "nhookretroflex",
  31771. 0x0273,
  31772. "nieunacirclekorean",
  31773. 0x326f,
  31774. "nieunaparenkorean",
  31775. 0x320f,
  31776. "nieuncieuckorean",
  31777. 0x3135,
  31778. "nieuncirclekorean",
  31779. 0x3261,
  31780. "nieunhieuhkorean",
  31781. 0x3136,
  31782. "nieunkorean",
  31783. 0x3134,
  31784. "nieunpansioskorean",
  31785. 0x3168,
  31786. "nieunparenkorean",
  31787. 0x3201,
  31788. "nieunsioskorean",
  31789. 0x3167,
  31790. "nieuntikeutkorean",
  31791. 0x3166,
  31792. "nihiragana",
  31793. 0x306b,
  31794. "nikatakana",
  31795. 0x30cb,
  31796. "nikatakanahalfwidth",
  31797. 0xff86,
  31798. "nikhahitleftthai",
  31799. 0xf899,
  31800. "nikhahitthai",
  31801. 0x0e4d,
  31802. "nine",
  31803. 0x0039,
  31804. "ninearabic",
  31805. 0x0669,
  31806. "ninebengali",
  31807. 0x09ef,
  31808. "ninecircle",
  31809. 0x2468,
  31810. "ninecircleinversesansserif",
  31811. 0x2792,
  31812. "ninedeva",
  31813. 0x096f,
  31814. "ninegujarati",
  31815. 0x0aef,
  31816. "ninegurmukhi",
  31817. 0x0a6f,
  31818. "ninehackarabic",
  31819. 0x0669,
  31820. "ninehangzhou",
  31821. 0x3029,
  31822. "nineideographicparen",
  31823. 0x3228,
  31824. "nineinferior",
  31825. 0x2089,
  31826. "ninemonospace",
  31827. 0xff19,
  31828. "nineoldstyle",
  31829. 0xf739,
  31830. "nineparen",
  31831. 0x247c,
  31832. "nineperiod",
  31833. 0x2490,
  31834. "ninepersian",
  31835. 0x06f9,
  31836. "nineroman",
  31837. 0x2178,
  31838. "ninesuperior",
  31839. 0x2079,
  31840. "nineteencircle",
  31841. 0x2472,
  31842. "nineteenparen",
  31843. 0x2486,
  31844. "nineteenperiod",
  31845. 0x249a,
  31846. "ninethai",
  31847. 0x0e59,
  31848. "nj",
  31849. 0x01cc,
  31850. "njecyrillic",
  31851. 0x045a,
  31852. "nkatakana",
  31853. 0x30f3,
  31854. "nkatakanahalfwidth",
  31855. 0xff9d,
  31856. "nlegrightlong",
  31857. 0x019e,
  31858. "nlinebelow",
  31859. 0x1e49,
  31860. "nmonospace",
  31861. 0xff4e,
  31862. "nmsquare",
  31863. 0x339a,
  31864. "nnabengali",
  31865. 0x09a3,
  31866. "nnadeva",
  31867. 0x0923,
  31868. "nnagujarati",
  31869. 0x0aa3,
  31870. "nnagurmukhi",
  31871. 0x0a23,
  31872. "nnnadeva",
  31873. 0x0929,
  31874. "nohiragana",
  31875. 0x306e,
  31876. "nokatakana",
  31877. 0x30ce,
  31878. "nokatakanahalfwidth",
  31879. 0xff89,
  31880. "nonbreakingspace",
  31881. 0x00a0,
  31882. "nonenthai",
  31883. 0x0e13,
  31884. "nonuthai",
  31885. 0x0e19,
  31886. "noonarabic",
  31887. 0x0646,
  31888. "noonfinalarabic",
  31889. 0xfee6,
  31890. "noonghunnaarabic",
  31891. 0x06ba,
  31892. "noonghunnafinalarabic",
  31893. 0xfb9f,
  31894. "nooninitialarabic",
  31895. 0xfee7,
  31896. "noonjeeminitialarabic",
  31897. 0xfcd2,
  31898. "noonjeemisolatedarabic",
  31899. 0xfc4b,
  31900. "noonmedialarabic",
  31901. 0xfee8,
  31902. "noonmeeminitialarabic",
  31903. 0xfcd5,
  31904. "noonmeemisolatedarabic",
  31905. 0xfc4e,
  31906. "noonnoonfinalarabic",
  31907. 0xfc8d,
  31908. "notcontains",
  31909. 0x220c,
  31910. "notelement",
  31911. 0x2209,
  31912. "notelementof",
  31913. 0x2209,
  31914. "notequal",
  31915. 0x2260,
  31916. "notgreater",
  31917. 0x226f,
  31918. "notgreaternorequal",
  31919. 0x2271,
  31920. "notgreaternorless",
  31921. 0x2279,
  31922. "notidentical",
  31923. 0x2262,
  31924. "notless",
  31925. 0x226e,
  31926. "notlessnorequal",
  31927. 0x2270,
  31928. "notparallel",
  31929. 0x2226,
  31930. "notprecedes",
  31931. 0x2280,
  31932. "notsubset",
  31933. 0x2284,
  31934. "notsucceeds",
  31935. 0x2281,
  31936. "notsuperset",
  31937. 0x2285,
  31938. "nowarmenian",
  31939. 0x0576,
  31940. "nparen",
  31941. 0x24a9,
  31942. "nssquare",
  31943. 0x33b1,
  31944. "nsuperior",
  31945. 0x207f,
  31946. "ntilde",
  31947. 0x00f1,
  31948. "nu",
  31949. 0x03bd,
  31950. "nuhiragana",
  31951. 0x306c,
  31952. "nukatakana",
  31953. 0x30cc,
  31954. "nukatakanahalfwidth",
  31955. 0xff87,
  31956. "nuktabengali",
  31957. 0x09bc,
  31958. "nuktadeva",
  31959. 0x093c,
  31960. "nuktagujarati",
  31961. 0x0abc,
  31962. "nuktagurmukhi",
  31963. 0x0a3c,
  31964. "numbersign",
  31965. 0x0023,
  31966. "numbersignmonospace",
  31967. 0xff03,
  31968. "numbersignsmall",
  31969. 0xfe5f,
  31970. "numeralsigngreek",
  31971. 0x0374,
  31972. "numeralsignlowergreek",
  31973. 0x0375,
  31974. "numero",
  31975. 0x2116,
  31976. "nun",
  31977. 0x05e0,
  31978. "nundagesh",
  31979. 0xfb40,
  31980. "nundageshhebrew",
  31981. 0xfb40,
  31982. "nunhebrew",
  31983. 0x05e0,
  31984. "nvsquare",
  31985. 0x33b5,
  31986. "nwsquare",
  31987. 0x33bb,
  31988. "nyabengali",
  31989. 0x099e,
  31990. "nyadeva",
  31991. 0x091e,
  31992. "nyagujarati",
  31993. 0x0a9e,
  31994. "nyagurmukhi",
  31995. 0x0a1e,
  31996. "o",
  31997. 0x006f,
  31998. "oacute",
  31999. 0x00f3,
  32000. "oangthai",
  32001. 0x0e2d,
  32002. "obarred",
  32003. 0x0275,
  32004. "obarredcyrillic",
  32005. 0x04e9,
  32006. "obarreddieresiscyrillic",
  32007. 0x04eb,
  32008. "obengali",
  32009. 0x0993,
  32010. "obopomofo",
  32011. 0x311b,
  32012. "obreve",
  32013. 0x014f,
  32014. "ocandradeva",
  32015. 0x0911,
  32016. "ocandragujarati",
  32017. 0x0a91,
  32018. "ocandravowelsigndeva",
  32019. 0x0949,
  32020. "ocandravowelsigngujarati",
  32021. 0x0ac9,
  32022. "ocaron",
  32023. 0x01d2,
  32024. "ocircle",
  32025. 0x24de,
  32026. "ocircumflex",
  32027. 0x00f4,
  32028. "ocircumflexacute",
  32029. 0x1ed1,
  32030. "ocircumflexdotbelow",
  32031. 0x1ed9,
  32032. "ocircumflexgrave",
  32033. 0x1ed3,
  32034. "ocircumflexhookabove",
  32035. 0x1ed5,
  32036. "ocircumflextilde",
  32037. 0x1ed7,
  32038. "ocyrillic",
  32039. 0x043e,
  32040. "odblacute",
  32041. 0x0151,
  32042. "odblgrave",
  32043. 0x020d,
  32044. "odeva",
  32045. 0x0913,
  32046. "odieresis",
  32047. 0x00f6,
  32048. "odieresiscyrillic",
  32049. 0x04e7,
  32050. "odotbelow",
  32051. 0x1ecd,
  32052. "oe",
  32053. 0x0153,
  32054. "oekorean",
  32055. 0x315a,
  32056. "ogonek",
  32057. 0x02db,
  32058. "ogonekcmb",
  32059. 0x0328,
  32060. "ograve",
  32061. 0x00f2,
  32062. "ogujarati",
  32063. 0x0a93,
  32064. "oharmenian",
  32065. 0x0585,
  32066. "ohiragana",
  32067. 0x304a,
  32068. "ohookabove",
  32069. 0x1ecf,
  32070. "ohorn",
  32071. 0x01a1,
  32072. "ohornacute",
  32073. 0x1edb,
  32074. "ohorndotbelow",
  32075. 0x1ee3,
  32076. "ohorngrave",
  32077. 0x1edd,
  32078. "ohornhookabove",
  32079. 0x1edf,
  32080. "ohorntilde",
  32081. 0x1ee1,
  32082. "ohungarumlaut",
  32083. 0x0151,
  32084. "oi",
  32085. 0x01a3,
  32086. "oinvertedbreve",
  32087. 0x020f,
  32088. "okatakana",
  32089. 0x30aa,
  32090. "okatakanahalfwidth",
  32091. 0xff75,
  32092. "okorean",
  32093. 0x3157,
  32094. "olehebrew",
  32095. 0x05ab,
  32096. "omacron",
  32097. 0x014d,
  32098. "omacronacute",
  32099. 0x1e53,
  32100. "omacrongrave",
  32101. 0x1e51,
  32102. "omdeva",
  32103. 0x0950,
  32104. "omega",
  32105. 0x03c9,
  32106. "omega1",
  32107. 0x03d6,
  32108. "omegacyrillic",
  32109. 0x0461,
  32110. "omegalatinclosed",
  32111. 0x0277,
  32112. "omegaroundcyrillic",
  32113. 0x047b,
  32114. "omegatitlocyrillic",
  32115. 0x047d,
  32116. "omegatonos",
  32117. 0x03ce,
  32118. "omgujarati",
  32119. 0x0ad0,
  32120. "omicron",
  32121. 0x03bf,
  32122. "omicrontonos",
  32123. 0x03cc,
  32124. "omonospace",
  32125. 0xff4f,
  32126. "one",
  32127. 0x0031,
  32128. "onearabic",
  32129. 0x0661,
  32130. "onebengali",
  32131. 0x09e7,
  32132. "onecircle",
  32133. 0x2460,
  32134. "onecircleinversesansserif",
  32135. 0x278a,
  32136. "onedeva",
  32137. 0x0967,
  32138. "onedotenleader",
  32139. 0x2024,
  32140. "oneeighth",
  32141. 0x215b,
  32142. "onefitted",
  32143. 0xf6dc,
  32144. "onegujarati",
  32145. 0x0ae7,
  32146. "onegurmukhi",
  32147. 0x0a67,
  32148. "onehackarabic",
  32149. 0x0661,
  32150. "onehalf",
  32151. 0x00bd,
  32152. "onehangzhou",
  32153. 0x3021,
  32154. "oneideographicparen",
  32155. 0x3220,
  32156. "oneinferior",
  32157. 0x2081,
  32158. "onemonospace",
  32159. 0xff11,
  32160. "onenumeratorbengali",
  32161. 0x09f4,
  32162. "oneoldstyle",
  32163. 0xf731,
  32164. "oneparen",
  32165. 0x2474,
  32166. "oneperiod",
  32167. 0x2488,
  32168. "onepersian",
  32169. 0x06f1,
  32170. "onequarter",
  32171. 0x00bc,
  32172. "oneroman",
  32173. 0x2170,
  32174. "onesuperior",
  32175. 0x00b9,
  32176. "onethai",
  32177. 0x0e51,
  32178. "onethird",
  32179. 0x2153,
  32180. "oogonek",
  32181. 0x01eb,
  32182. "oogonekmacron",
  32183. 0x01ed,
  32184. "oogurmukhi",
  32185. 0x0a13,
  32186. "oomatragurmukhi",
  32187. 0x0a4b,
  32188. "oopen",
  32189. 0x0254,
  32190. "oparen",
  32191. 0x24aa,
  32192. "openbullet",
  32193. 0x25e6,
  32194. "option",
  32195. 0x2325,
  32196. "ordfeminine",
  32197. 0x00aa,
  32198. "ordmasculine",
  32199. 0x00ba,
  32200. "orthogonal",
  32201. 0x221f,
  32202. "oshortdeva",
  32203. 0x0912,
  32204. "oshortvowelsigndeva",
  32205. 0x094a,
  32206. "oslash",
  32207. 0x00f8,
  32208. "oslashacute",
  32209. 0x01ff,
  32210. "osmallhiragana",
  32211. 0x3049,
  32212. "osmallkatakana",
  32213. 0x30a9,
  32214. "osmallkatakanahalfwidth",
  32215. 0xff6b,
  32216. "ostrokeacute",
  32217. 0x01ff,
  32218. "osuperior",
  32219. 0xf6f0,
  32220. "otcyrillic",
  32221. 0x047f,
  32222. "otilde",
  32223. 0x00f5,
  32224. "otildeacute",
  32225. 0x1e4d,
  32226. "otildedieresis",
  32227. 0x1e4f,
  32228. "oubopomofo",
  32229. 0x3121,
  32230. "overline",
  32231. 0x203e,
  32232. "overlinecenterline",
  32233. 0xfe4a,
  32234. "overlinecmb",
  32235. 0x0305,
  32236. "overlinedashed",
  32237. 0xfe49,
  32238. "overlinedblwavy",
  32239. 0xfe4c,
  32240. "overlinewavy",
  32241. 0xfe4b,
  32242. "overscore",
  32243. 0x00af,
  32244. "ovowelsignbengali",
  32245. 0x09cb,
  32246. "ovowelsigndeva",
  32247. 0x094b,
  32248. "ovowelsigngujarati",
  32249. 0x0acb,
  32250. "p",
  32251. 0x0070,
  32252. "paampssquare",
  32253. 0x3380,
  32254. "paasentosquare",
  32255. 0x332b,
  32256. "pabengali",
  32257. 0x09aa,
  32258. "pacute",
  32259. 0x1e55,
  32260. "padeva",
  32261. 0x092a,
  32262. "pagedown",
  32263. 0x21df,
  32264. "pageup",
  32265. 0x21de,
  32266. "pagujarati",
  32267. 0x0aaa,
  32268. "pagurmukhi",
  32269. 0x0a2a,
  32270. "pahiragana",
  32271. 0x3071,
  32272. "paiyannoithai",
  32273. 0x0e2f,
  32274. "pakatakana",
  32275. 0x30d1,
  32276. "palatalizationcyrilliccmb",
  32277. 0x0484,
  32278. "palochkacyrillic",
  32279. 0x04c0,
  32280. "pansioskorean",
  32281. 0x317f,
  32282. "paragraph",
  32283. 0x00b6,
  32284. "parallel",
  32285. 0x2225,
  32286. "parenleft",
  32287. 0x0028,
  32288. "parenleftaltonearabic",
  32289. 0xfd3e,
  32290. "parenleftbt",
  32291. 0xf8ed,
  32292. "parenleftex",
  32293. 0xf8ec,
  32294. "parenleftinferior",
  32295. 0x208d,
  32296. "parenleftmonospace",
  32297. 0xff08,
  32298. "parenleftsmall",
  32299. 0xfe59,
  32300. "parenleftsuperior",
  32301. 0x207d,
  32302. "parenlefttp",
  32303. 0xf8eb,
  32304. "parenleftvertical",
  32305. 0xfe35,
  32306. "parenright",
  32307. 0x0029,
  32308. "parenrightaltonearabic",
  32309. 0xfd3f,
  32310. "parenrightbt",
  32311. 0xf8f8,
  32312. "parenrightex",
  32313. 0xf8f7,
  32314. "parenrightinferior",
  32315. 0x208e,
  32316. "parenrightmonospace",
  32317. 0xff09,
  32318. "parenrightsmall",
  32319. 0xfe5a,
  32320. "parenrightsuperior",
  32321. 0x207e,
  32322. "parenrighttp",
  32323. 0xf8f6,
  32324. "parenrightvertical",
  32325. 0xfe36,
  32326. "partialdiff",
  32327. 0x2202,
  32328. "paseqhebrew",
  32329. 0x05c0,
  32330. "pashtahebrew",
  32331. 0x0599,
  32332. "pasquare",
  32333. 0x33a9,
  32334. "patah",
  32335. 0x05b7,
  32336. "patah11",
  32337. 0x05b7,
  32338. "patah1d",
  32339. 0x05b7,
  32340. "patah2a",
  32341. 0x05b7,
  32342. "patahhebrew",
  32343. 0x05b7,
  32344. "patahnarrowhebrew",
  32345. 0x05b7,
  32346. "patahquarterhebrew",
  32347. 0x05b7,
  32348. "patahwidehebrew",
  32349. 0x05b7,
  32350. "pazerhebrew",
  32351. 0x05a1,
  32352. "pbopomofo",
  32353. 0x3106,
  32354. "pcircle",
  32355. 0x24df,
  32356. "pdotaccent",
  32357. 0x1e57,
  32358. "pe",
  32359. 0x05e4,
  32360. "pecyrillic",
  32361. 0x043f,
  32362. "pedagesh",
  32363. 0xfb44,
  32364. "pedageshhebrew",
  32365. 0xfb44,
  32366. "peezisquare",
  32367. 0x333b,
  32368. "pefinaldageshhebrew",
  32369. 0xfb43,
  32370. "peharabic",
  32371. 0x067e,
  32372. "peharmenian",
  32373. 0x057a,
  32374. "pehebrew",
  32375. 0x05e4,
  32376. "pehfinalarabic",
  32377. 0xfb57,
  32378. "pehinitialarabic",
  32379. 0xfb58,
  32380. "pehiragana",
  32381. 0x307a,
  32382. "pehmedialarabic",
  32383. 0xfb59,
  32384. "pekatakana",
  32385. 0x30da,
  32386. "pemiddlehookcyrillic",
  32387. 0x04a7,
  32388. "perafehebrew",
  32389. 0xfb4e,
  32390. "percent",
  32391. 0x0025,
  32392. "percentarabic",
  32393. 0x066a,
  32394. "percentmonospace",
  32395. 0xff05,
  32396. "percentsmall",
  32397. 0xfe6a,
  32398. "period",
  32399. 0x002e,
  32400. "periodarmenian",
  32401. 0x0589,
  32402. "periodcentered",
  32403. 0x00b7,
  32404. "periodhalfwidth",
  32405. 0xff61,
  32406. "periodinferior",
  32407. 0xf6e7,
  32408. "periodmonospace",
  32409. 0xff0e,
  32410. "periodsmall",
  32411. 0xfe52,
  32412. "periodsuperior",
  32413. 0xf6e8,
  32414. "perispomenigreekcmb",
  32415. 0x0342,
  32416. "perpendicular",
  32417. 0x22a5,
  32418. "perthousand",
  32419. 0x2030,
  32420. "peseta",
  32421. 0x20a7,
  32422. "pfsquare",
  32423. 0x338a,
  32424. "phabengali",
  32425. 0x09ab,
  32426. "phadeva",
  32427. 0x092b,
  32428. "phagujarati",
  32429. 0x0aab,
  32430. "phagurmukhi",
  32431. 0x0a2b,
  32432. "phi",
  32433. 0x03c6,
  32434. "phi1",
  32435. 0x03d5,
  32436. "phieuphacirclekorean",
  32437. 0x327a,
  32438. "phieuphaparenkorean",
  32439. 0x321a,
  32440. "phieuphcirclekorean",
  32441. 0x326c,
  32442. "phieuphkorean",
  32443. 0x314d,
  32444. "phieuphparenkorean",
  32445. 0x320c,
  32446. "philatin",
  32447. 0x0278,
  32448. "phinthuthai",
  32449. 0x0e3a,
  32450. "phisymbolgreek",
  32451. 0x03d5,
  32452. "phook",
  32453. 0x01a5,
  32454. "phophanthai",
  32455. 0x0e1e,
  32456. "phophungthai",
  32457. 0x0e1c,
  32458. "phosamphaothai",
  32459. 0x0e20,
  32460. "pi",
  32461. 0x03c0,
  32462. "pieupacirclekorean",
  32463. 0x3273,
  32464. "pieupaparenkorean",
  32465. 0x3213,
  32466. "pieupcieuckorean",
  32467. 0x3176,
  32468. "pieupcirclekorean",
  32469. 0x3265,
  32470. "pieupkiyeokkorean",
  32471. 0x3172,
  32472. "pieupkorean",
  32473. 0x3142,
  32474. "pieupparenkorean",
  32475. 0x3205,
  32476. "pieupsioskiyeokkorean",
  32477. 0x3174,
  32478. "pieupsioskorean",
  32479. 0x3144,
  32480. "pieupsiostikeutkorean",
  32481. 0x3175,
  32482. "pieupthieuthkorean",
  32483. 0x3177,
  32484. "pieuptikeutkorean",
  32485. 0x3173,
  32486. "pihiragana",
  32487. 0x3074,
  32488. "pikatakana",
  32489. 0x30d4,
  32490. "pisymbolgreek",
  32491. 0x03d6,
  32492. "piwrarmenian",
  32493. 0x0583,
  32494. "plus",
  32495. 0x002b,
  32496. "plusbelowcmb",
  32497. 0x031f,
  32498. "pluscircle",
  32499. 0x2295,
  32500. "plusminus",
  32501. 0x00b1,
  32502. "plusmod",
  32503. 0x02d6,
  32504. "plusmonospace",
  32505. 0xff0b,
  32506. "plussmall",
  32507. 0xfe62,
  32508. "plussuperior",
  32509. 0x207a,
  32510. "pmonospace",
  32511. 0xff50,
  32512. "pmsquare",
  32513. 0x33d8,
  32514. "pohiragana",
  32515. 0x307d,
  32516. "pointingindexdownwhite",
  32517. 0x261f,
  32518. "pointingindexleftwhite",
  32519. 0x261c,
  32520. "pointingindexrightwhite",
  32521. 0x261e,
  32522. "pointingindexupwhite",
  32523. 0x261d,
  32524. "pokatakana",
  32525. 0x30dd,
  32526. "poplathai",
  32527. 0x0e1b,
  32528. "postalmark",
  32529. 0x3012,
  32530. "postalmarkface",
  32531. 0x3020,
  32532. "pparen",
  32533. 0x24ab,
  32534. "precedes",
  32535. 0x227a,
  32536. "prescription",
  32537. 0x211e,
  32538. "primemod",
  32539. 0x02b9,
  32540. "primereversed",
  32541. 0x2035,
  32542. "product",
  32543. 0x220f,
  32544. "projective",
  32545. 0x2305,
  32546. "prolongedkana",
  32547. 0x30fc,
  32548. "propellor",
  32549. 0x2318,
  32550. "propersubset",
  32551. 0x2282,
  32552. "propersuperset",
  32553. 0x2283,
  32554. "proportion",
  32555. 0x2237,
  32556. "proportional",
  32557. 0x221d,
  32558. "psi",
  32559. 0x03c8,
  32560. "psicyrillic",
  32561. 0x0471,
  32562. "psilipneumatacyrilliccmb",
  32563. 0x0486,
  32564. "pssquare",
  32565. 0x33b0,
  32566. "puhiragana",
  32567. 0x3077,
  32568. "pukatakana",
  32569. 0x30d7,
  32570. "pvsquare",
  32571. 0x33b4,
  32572. "pwsquare",
  32573. 0x33ba,
  32574. "q",
  32575. 0x0071,
  32576. "qadeva",
  32577. 0x0958,
  32578. "qadmahebrew",
  32579. 0x05a8,
  32580. "qafarabic",
  32581. 0x0642,
  32582. "qaffinalarabic",
  32583. 0xfed6,
  32584. "qafinitialarabic",
  32585. 0xfed7,
  32586. "qafmedialarabic",
  32587. 0xfed8,
  32588. "qamats",
  32589. 0x05b8,
  32590. "qamats10",
  32591. 0x05b8,
  32592. "qamats1a",
  32593. 0x05b8,
  32594. "qamats1c",
  32595. 0x05b8,
  32596. "qamats27",
  32597. 0x05b8,
  32598. "qamats29",
  32599. 0x05b8,
  32600. "qamats33",
  32601. 0x05b8,
  32602. "qamatsde",
  32603. 0x05b8,
  32604. "qamatshebrew",
  32605. 0x05b8,
  32606. "qamatsnarrowhebrew",
  32607. 0x05b8,
  32608. "qamatsqatanhebrew",
  32609. 0x05b8,
  32610. "qamatsqatannarrowhebrew",
  32611. 0x05b8,
  32612. "qamatsqatanquarterhebrew",
  32613. 0x05b8,
  32614. "qamatsqatanwidehebrew",
  32615. 0x05b8,
  32616. "qamatsquarterhebrew",
  32617. 0x05b8,
  32618. "qamatswidehebrew",
  32619. 0x05b8,
  32620. "qarneyparahebrew",
  32621. 0x059f,
  32622. "qbopomofo",
  32623. 0x3111,
  32624. "qcircle",
  32625. 0x24e0,
  32626. "qhook",
  32627. 0x02a0,
  32628. "qmonospace",
  32629. 0xff51,
  32630. "qof",
  32631. 0x05e7,
  32632. "qofdagesh",
  32633. 0xfb47,
  32634. "qofdageshhebrew",
  32635. 0xfb47,
  32636. "qofhebrew",
  32637. 0x05e7,
  32638. "qparen",
  32639. 0x24ac,
  32640. "quarternote",
  32641. 0x2669,
  32642. "qubuts",
  32643. 0x05bb,
  32644. "qubuts18",
  32645. 0x05bb,
  32646. "qubuts25",
  32647. 0x05bb,
  32648. "qubuts31",
  32649. 0x05bb,
  32650. "qubutshebrew",
  32651. 0x05bb,
  32652. "qubutsnarrowhebrew",
  32653. 0x05bb,
  32654. "qubutsquarterhebrew",
  32655. 0x05bb,
  32656. "qubutswidehebrew",
  32657. 0x05bb,
  32658. "question",
  32659. 0x003f,
  32660. "questionarabic",
  32661. 0x061f,
  32662. "questionarmenian",
  32663. 0x055e,
  32664. "questiondown",
  32665. 0x00bf,
  32666. "questiondownsmall",
  32667. 0xf7bf,
  32668. "questiongreek",
  32669. 0x037e,
  32670. "questionmonospace",
  32671. 0xff1f,
  32672. "questionsmall",
  32673. 0xf73f,
  32674. "quotedbl",
  32675. 0x0022,
  32676. "quotedblbase",
  32677. 0x201e,
  32678. "quotedblleft",
  32679. 0x201c,
  32680. "quotedblmonospace",
  32681. 0xff02,
  32682. "quotedblprime",
  32683. 0x301e,
  32684. "quotedblprimereversed",
  32685. 0x301d,
  32686. "quotedblright",
  32687. 0x201d,
  32688. "quoteleft",
  32689. 0x2018,
  32690. "quoteleftreversed",
  32691. 0x201b,
  32692. "quotereversed",
  32693. 0x201b,
  32694. "quoteright",
  32695. 0x2019,
  32696. "quoterightn",
  32697. 0x0149,
  32698. "quotesinglbase",
  32699. 0x201a,
  32700. "quotesingle",
  32701. 0x0027,
  32702. "quotesinglemonospace",
  32703. 0xff07,
  32704. "r",
  32705. 0x0072,
  32706. "raarmenian",
  32707. 0x057c,
  32708. "rabengali",
  32709. 0x09b0,
  32710. "racute",
  32711. 0x0155,
  32712. "radeva",
  32713. 0x0930,
  32714. "radical",
  32715. 0x221a,
  32716. "radicalex",
  32717. 0xf8e5,
  32718. "radoverssquare",
  32719. 0x33ae,
  32720. "radoverssquaredsquare",
  32721. 0x33af,
  32722. "radsquare",
  32723. 0x33ad,
  32724. "rafe",
  32725. 0x05bf,
  32726. "rafehebrew",
  32727. 0x05bf,
  32728. "ragujarati",
  32729. 0x0ab0,
  32730. "ragurmukhi",
  32731. 0x0a30,
  32732. "rahiragana",
  32733. 0x3089,
  32734. "rakatakana",
  32735. 0x30e9,
  32736. "rakatakanahalfwidth",
  32737. 0xff97,
  32738. "ralowerdiagonalbengali",
  32739. 0x09f1,
  32740. "ramiddlediagonalbengali",
  32741. 0x09f0,
  32742. "ramshorn",
  32743. 0x0264,
  32744. "ratio",
  32745. 0x2236,
  32746. "rbopomofo",
  32747. 0x3116,
  32748. "rcaron",
  32749. 0x0159,
  32750. "rcedilla",
  32751. 0x0157,
  32752. "rcircle",
  32753. 0x24e1,
  32754. "rcommaaccent",
  32755. 0x0157,
  32756. "rdblgrave",
  32757. 0x0211,
  32758. "rdotaccent",
  32759. 0x1e59,
  32760. "rdotbelow",
  32761. 0x1e5b,
  32762. "rdotbelowmacron",
  32763. 0x1e5d,
  32764. "referencemark",
  32765. 0x203b,
  32766. "reflexsubset",
  32767. 0x2286,
  32768. "reflexsuperset",
  32769. 0x2287,
  32770. "registered",
  32771. 0x00ae,
  32772. "registersans",
  32773. 0xf8e8,
  32774. "registerserif",
  32775. 0xf6da,
  32776. "reharabic",
  32777. 0x0631,
  32778. "reharmenian",
  32779. 0x0580,
  32780. "rehfinalarabic",
  32781. 0xfeae,
  32782. "rehiragana",
  32783. 0x308c,
  32784. "rekatakana",
  32785. 0x30ec,
  32786. "rekatakanahalfwidth",
  32787. 0xff9a,
  32788. "resh",
  32789. 0x05e8,
  32790. "reshdageshhebrew",
  32791. 0xfb48,
  32792. "reshhebrew",
  32793. 0x05e8,
  32794. "reversedtilde",
  32795. 0x223d,
  32796. "reviahebrew",
  32797. 0x0597,
  32798. "reviamugrashhebrew",
  32799. 0x0597,
  32800. "revlogicalnot",
  32801. 0x2310,
  32802. "rfishhook",
  32803. 0x027e,
  32804. "rfishhookreversed",
  32805. 0x027f,
  32806. "rhabengali",
  32807. 0x09dd,
  32808. "rhadeva",
  32809. 0x095d,
  32810. "rho",
  32811. 0x03c1,
  32812. "rhook",
  32813. 0x027d,
  32814. "rhookturned",
  32815. 0x027b,
  32816. "rhookturnedsuperior",
  32817. 0x02b5,
  32818. "rhosymbolgreek",
  32819. 0x03f1,
  32820. "rhotichookmod",
  32821. 0x02de,
  32822. "rieulacirclekorean",
  32823. 0x3271,
  32824. "rieulaparenkorean",
  32825. 0x3211,
  32826. "rieulcirclekorean",
  32827. 0x3263,
  32828. "rieulhieuhkorean",
  32829. 0x3140,
  32830. "rieulkiyeokkorean",
  32831. 0x313a,
  32832. "rieulkiyeoksioskorean",
  32833. 0x3169,
  32834. "rieulkorean",
  32835. 0x3139,
  32836. "rieulmieumkorean",
  32837. 0x313b,
  32838. "rieulpansioskorean",
  32839. 0x316c,
  32840. "rieulparenkorean",
  32841. 0x3203,
  32842. "rieulphieuphkorean",
  32843. 0x313f,
  32844. "rieulpieupkorean",
  32845. 0x313c,
  32846. "rieulpieupsioskorean",
  32847. 0x316b,
  32848. "rieulsioskorean",
  32849. 0x313d,
  32850. "rieulthieuthkorean",
  32851. 0x313e,
  32852. "rieultikeutkorean",
  32853. 0x316a,
  32854. "rieulyeorinhieuhkorean",
  32855. 0x316d,
  32856. "rightangle",
  32857. 0x221f,
  32858. "righttackbelowcmb",
  32859. 0x0319,
  32860. "righttriangle",
  32861. 0x22bf,
  32862. "rihiragana",
  32863. 0x308a,
  32864. "rikatakana",
  32865. 0x30ea,
  32866. "rikatakanahalfwidth",
  32867. 0xff98,
  32868. "ring",
  32869. 0x02da,
  32870. "ringbelowcmb",
  32871. 0x0325,
  32872. "ringcmb",
  32873. 0x030a,
  32874. "ringhalfleft",
  32875. 0x02bf,
  32876. "ringhalfleftarmenian",
  32877. 0x0559,
  32878. "ringhalfleftbelowcmb",
  32879. 0x031c,
  32880. "ringhalfleftcentered",
  32881. 0x02d3,
  32882. "ringhalfright",
  32883. 0x02be,
  32884. "ringhalfrightbelowcmb",
  32885. 0x0339,
  32886. "ringhalfrightcentered",
  32887. 0x02d2,
  32888. "rinvertedbreve",
  32889. 0x0213,
  32890. "rittorusquare",
  32891. 0x3351,
  32892. "rlinebelow",
  32893. 0x1e5f,
  32894. "rlongleg",
  32895. 0x027c,
  32896. "rlonglegturned",
  32897. 0x027a,
  32898. "rmonospace",
  32899. 0xff52,
  32900. "rohiragana",
  32901. 0x308d,
  32902. "rokatakana",
  32903. 0x30ed,
  32904. "rokatakanahalfwidth",
  32905. 0xff9b,
  32906. "roruathai",
  32907. 0x0e23,
  32908. "rparen",
  32909. 0x24ad,
  32910. "rrabengali",
  32911. 0x09dc,
  32912. "rradeva",
  32913. 0x0931,
  32914. "rragurmukhi",
  32915. 0x0a5c,
  32916. "rreharabic",
  32917. 0x0691,
  32918. "rrehfinalarabic",
  32919. 0xfb8d,
  32920. "rrvocalicbengali",
  32921. 0x09e0,
  32922. "rrvocalicdeva",
  32923. 0x0960,
  32924. "rrvocalicgujarati",
  32925. 0x0ae0,
  32926. "rrvocalicvowelsignbengali",
  32927. 0x09c4,
  32928. "rrvocalicvowelsigndeva",
  32929. 0x0944,
  32930. "rrvocalicvowelsigngujarati",
  32931. 0x0ac4,
  32932. "rsuperior",
  32933. 0xf6f1,
  32934. "rtblock",
  32935. 0x2590,
  32936. "rturned",
  32937. 0x0279,
  32938. "rturnedsuperior",
  32939. 0x02b4,
  32940. "ruhiragana",
  32941. 0x308b,
  32942. "rukatakana",
  32943. 0x30eb,
  32944. "rukatakanahalfwidth",
  32945. 0xff99,
  32946. "rupeemarkbengali",
  32947. 0x09f2,
  32948. "rupeesignbengali",
  32949. 0x09f3,
  32950. "rupiah",
  32951. 0xf6dd,
  32952. "ruthai",
  32953. 0x0e24,
  32954. "rvocalicbengali",
  32955. 0x098b,
  32956. "rvocalicdeva",
  32957. 0x090b,
  32958. "rvocalicgujarati",
  32959. 0x0a8b,
  32960. "rvocalicvowelsignbengali",
  32961. 0x09c3,
  32962. "rvocalicvowelsigndeva",
  32963. 0x0943,
  32964. "rvocalicvowelsigngujarati",
  32965. 0x0ac3,
  32966. "s",
  32967. 0x0073,
  32968. "sabengali",
  32969. 0x09b8,
  32970. "sacute",
  32971. 0x015b,
  32972. "sacutedotaccent",
  32973. 0x1e65,
  32974. "sadarabic",
  32975. 0x0635,
  32976. "sadeva",
  32977. 0x0938,
  32978. "sadfinalarabic",
  32979. 0xfeba,
  32980. "sadinitialarabic",
  32981. 0xfebb,
  32982. "sadmedialarabic",
  32983. 0xfebc,
  32984. "sagujarati",
  32985. 0x0ab8,
  32986. "sagurmukhi",
  32987. 0x0a38,
  32988. "sahiragana",
  32989. 0x3055,
  32990. "sakatakana",
  32991. 0x30b5,
  32992. "sakatakanahalfwidth",
  32993. 0xff7b,
  32994. "sallallahoualayhewasallamarabic",
  32995. 0xfdfa,
  32996. "samekh",
  32997. 0x05e1,
  32998. "samekhdagesh",
  32999. 0xfb41,
  33000. "samekhdageshhebrew",
  33001. 0xfb41,
  33002. "samekhhebrew",
  33003. 0x05e1,
  33004. "saraaathai",
  33005. 0x0e32,
  33006. "saraaethai",
  33007. 0x0e41,
  33008. "saraaimaimalaithai",
  33009. 0x0e44,
  33010. "saraaimaimuanthai",
  33011. 0x0e43,
  33012. "saraamthai",
  33013. 0x0e33,
  33014. "saraathai",
  33015. 0x0e30,
  33016. "saraethai",
  33017. 0x0e40,
  33018. "saraiileftthai",
  33019. 0xf886,
  33020. "saraiithai",
  33021. 0x0e35,
  33022. "saraileftthai",
  33023. 0xf885,
  33024. "saraithai",
  33025. 0x0e34,
  33026. "saraothai",
  33027. 0x0e42,
  33028. "saraueeleftthai",
  33029. 0xf888,
  33030. "saraueethai",
  33031. 0x0e37,
  33032. "saraueleftthai",
  33033. 0xf887,
  33034. "sarauethai",
  33035. 0x0e36,
  33036. "sarauthai",
  33037. 0x0e38,
  33038. "sarauuthai",
  33039. 0x0e39,
  33040. "sbopomofo",
  33041. 0x3119,
  33042. "scaron",
  33043. 0x0161,
  33044. "scarondotaccent",
  33045. 0x1e67,
  33046. "scedilla",
  33047. 0x015f,
  33048. "schwa",
  33049. 0x0259,
  33050. "schwacyrillic",
  33051. 0x04d9,
  33052. "schwadieresiscyrillic",
  33053. 0x04db,
  33054. "schwahook",
  33055. 0x025a,
  33056. "scircle",
  33057. 0x24e2,
  33058. "scircumflex",
  33059. 0x015d,
  33060. "scommaaccent",
  33061. 0x0219,
  33062. "sdotaccent",
  33063. 0x1e61,
  33064. "sdotbelow",
  33065. 0x1e63,
  33066. "sdotbelowdotaccent",
  33067. 0x1e69,
  33068. "seagullbelowcmb",
  33069. 0x033c,
  33070. "second",
  33071. 0x2033,
  33072. "secondtonechinese",
  33073. 0x02ca,
  33074. "section",
  33075. 0x00a7,
  33076. "seenarabic",
  33077. 0x0633,
  33078. "seenfinalarabic",
  33079. 0xfeb2,
  33080. "seeninitialarabic",
  33081. 0xfeb3,
  33082. "seenmedialarabic",
  33083. 0xfeb4,
  33084. "segol",
  33085. 0x05b6,
  33086. "segol13",
  33087. 0x05b6,
  33088. "segol1f",
  33089. 0x05b6,
  33090. "segol2c",
  33091. 0x05b6,
  33092. "segolhebrew",
  33093. 0x05b6,
  33094. "segolnarrowhebrew",
  33095. 0x05b6,
  33096. "segolquarterhebrew",
  33097. 0x05b6,
  33098. "segoltahebrew",
  33099. 0x0592,
  33100. "segolwidehebrew",
  33101. 0x05b6,
  33102. "seharmenian",
  33103. 0x057d,
  33104. "sehiragana",
  33105. 0x305b,
  33106. "sekatakana",
  33107. 0x30bb,
  33108. "sekatakanahalfwidth",
  33109. 0xff7e,
  33110. "semicolon",
  33111. 0x003b,
  33112. "semicolonarabic",
  33113. 0x061b,
  33114. "semicolonmonospace",
  33115. 0xff1b,
  33116. "semicolonsmall",
  33117. 0xfe54,
  33118. "semivoicedmarkkana",
  33119. 0x309c,
  33120. "semivoicedmarkkanahalfwidth",
  33121. 0xff9f,
  33122. "sentisquare",
  33123. 0x3322,
  33124. "sentosquare",
  33125. 0x3323,
  33126. "seven",
  33127. 0x0037,
  33128. "sevenarabic",
  33129. 0x0667,
  33130. "sevenbengali",
  33131. 0x09ed,
  33132. "sevencircle",
  33133. 0x2466,
  33134. "sevencircleinversesansserif",
  33135. 0x2790,
  33136. "sevendeva",
  33137. 0x096d,
  33138. "seveneighths",
  33139. 0x215e,
  33140. "sevengujarati",
  33141. 0x0aed,
  33142. "sevengurmukhi",
  33143. 0x0a6d,
  33144. "sevenhackarabic",
  33145. 0x0667,
  33146. "sevenhangzhou",
  33147. 0x3027,
  33148. "sevenideographicparen",
  33149. 0x3226,
  33150. "seveninferior",
  33151. 0x2087,
  33152. "sevenmonospace",
  33153. 0xff17,
  33154. "sevenoldstyle",
  33155. 0xf737,
  33156. "sevenparen",
  33157. 0x247a,
  33158. "sevenperiod",
  33159. 0x248e,
  33160. "sevenpersian",
  33161. 0x06f7,
  33162. "sevenroman",
  33163. 0x2176,
  33164. "sevensuperior",
  33165. 0x2077,
  33166. "seventeencircle",
  33167. 0x2470,
  33168. "seventeenparen",
  33169. 0x2484,
  33170. "seventeenperiod",
  33171. 0x2498,
  33172. "seventhai",
  33173. 0x0e57,
  33174. "sfthyphen",
  33175. 0x00ad,
  33176. "shaarmenian",
  33177. 0x0577,
  33178. "shabengali",
  33179. 0x09b6,
  33180. "shacyrillic",
  33181. 0x0448,
  33182. "shaddaarabic",
  33183. 0x0651,
  33184. "shaddadammaarabic",
  33185. 0xfc61,
  33186. "shaddadammatanarabic",
  33187. 0xfc5e,
  33188. "shaddafathaarabic",
  33189. 0xfc60,
  33190. "shaddakasraarabic",
  33191. 0xfc62,
  33192. "shaddakasratanarabic",
  33193. 0xfc5f,
  33194. "shade",
  33195. 0x2592,
  33196. "shadedark",
  33197. 0x2593,
  33198. "shadelight",
  33199. 0x2591,
  33200. "shademedium",
  33201. 0x2592,
  33202. "shadeva",
  33203. 0x0936,
  33204. "shagujarati",
  33205. 0x0ab6,
  33206. "shagurmukhi",
  33207. 0x0a36,
  33208. "shalshelethebrew",
  33209. 0x0593,
  33210. "shbopomofo",
  33211. 0x3115,
  33212. "shchacyrillic",
  33213. 0x0449,
  33214. "sheenarabic",
  33215. 0x0634,
  33216. "sheenfinalarabic",
  33217. 0xfeb6,
  33218. "sheeninitialarabic",
  33219. 0xfeb7,
  33220. "sheenmedialarabic",
  33221. 0xfeb8,
  33222. "sheicoptic",
  33223. 0x03e3,
  33224. "sheqel",
  33225. 0x20aa,
  33226. "sheqelhebrew",
  33227. 0x20aa,
  33228. "sheva",
  33229. 0x05b0,
  33230. "sheva115",
  33231. 0x05b0,
  33232. "sheva15",
  33233. 0x05b0,
  33234. "sheva22",
  33235. 0x05b0,
  33236. "sheva2e",
  33237. 0x05b0,
  33238. "shevahebrew",
  33239. 0x05b0,
  33240. "shevanarrowhebrew",
  33241. 0x05b0,
  33242. "shevaquarterhebrew",
  33243. 0x05b0,
  33244. "shevawidehebrew",
  33245. 0x05b0,
  33246. "shhacyrillic",
  33247. 0x04bb,
  33248. "shimacoptic",
  33249. 0x03ed,
  33250. "shin",
  33251. 0x05e9,
  33252. "shindagesh",
  33253. 0xfb49,
  33254. "shindageshhebrew",
  33255. 0xfb49,
  33256. "shindageshshindot",
  33257. 0xfb2c,
  33258. "shindageshshindothebrew",
  33259. 0xfb2c,
  33260. "shindageshsindot",
  33261. 0xfb2d,
  33262. "shindageshsindothebrew",
  33263. 0xfb2d,
  33264. "shindothebrew",
  33265. 0x05c1,
  33266. "shinhebrew",
  33267. 0x05e9,
  33268. "shinshindot",
  33269. 0xfb2a,
  33270. "shinshindothebrew",
  33271. 0xfb2a,
  33272. "shinsindot",
  33273. 0xfb2b,
  33274. "shinsindothebrew",
  33275. 0xfb2b,
  33276. "shook",
  33277. 0x0282,
  33278. "sigma",
  33279. 0x03c3,
  33280. "sigma1",
  33281. 0x03c2,
  33282. "sigmafinal",
  33283. 0x03c2,
  33284. "sigmalunatesymbolgreek",
  33285. 0x03f2,
  33286. "sihiragana",
  33287. 0x3057,
  33288. "sikatakana",
  33289. 0x30b7,
  33290. "sikatakanahalfwidth",
  33291. 0xff7c,
  33292. "siluqhebrew",
  33293. 0x05bd,
  33294. "siluqlefthebrew",
  33295. 0x05bd,
  33296. "similar",
  33297. 0x223c,
  33298. "sindothebrew",
  33299. 0x05c2,
  33300. "siosacirclekorean",
  33301. 0x3274,
  33302. "siosaparenkorean",
  33303. 0x3214,
  33304. "sioscieuckorean",
  33305. 0x317e,
  33306. "sioscirclekorean",
  33307. 0x3266,
  33308. "sioskiyeokkorean",
  33309. 0x317a,
  33310. "sioskorean",
  33311. 0x3145,
  33312. "siosnieunkorean",
  33313. 0x317b,
  33314. "siosparenkorean",
  33315. 0x3206,
  33316. "siospieupkorean",
  33317. 0x317d,
  33318. "siostikeutkorean",
  33319. 0x317c,
  33320. "six",
  33321. 0x0036,
  33322. "sixarabic",
  33323. 0x0666,
  33324. "sixbengali",
  33325. 0x09ec,
  33326. "sixcircle",
  33327. 0x2465,
  33328. "sixcircleinversesansserif",
  33329. 0x278f,
  33330. "sixdeva",
  33331. 0x096c,
  33332. "sixgujarati",
  33333. 0x0aec,
  33334. "sixgurmukhi",
  33335. 0x0a6c,
  33336. "sixhackarabic",
  33337. 0x0666,
  33338. "sixhangzhou",
  33339. 0x3026,
  33340. "sixideographicparen",
  33341. 0x3225,
  33342. "sixinferior",
  33343. 0x2086,
  33344. "sixmonospace",
  33345. 0xff16,
  33346. "sixoldstyle",
  33347. 0xf736,
  33348. "sixparen",
  33349. 0x2479,
  33350. "sixperiod",
  33351. 0x248d,
  33352. "sixpersian",
  33353. 0x06f6,
  33354. "sixroman",
  33355. 0x2175,
  33356. "sixsuperior",
  33357. 0x2076,
  33358. "sixteencircle",
  33359. 0x246f,
  33360. "sixteencurrencydenominatorbengali",
  33361. 0x09f9,
  33362. "sixteenparen",
  33363. 0x2483,
  33364. "sixteenperiod",
  33365. 0x2497,
  33366. "sixthai",
  33367. 0x0e56,
  33368. "slash",
  33369. 0x002f,
  33370. "slashmonospace",
  33371. 0xff0f,
  33372. "slong",
  33373. 0x017f,
  33374. "slongdotaccent",
  33375. 0x1e9b,
  33376. "smileface",
  33377. 0x263a,
  33378. "smonospace",
  33379. 0xff53,
  33380. "sofpasuqhebrew",
  33381. 0x05c3,
  33382. "softhyphen",
  33383. 0x00ad,
  33384. "softsigncyrillic",
  33385. 0x044c,
  33386. "sohiragana",
  33387. 0x305d,
  33388. "sokatakana",
  33389. 0x30bd,
  33390. "sokatakanahalfwidth",
  33391. 0xff7f,
  33392. "soliduslongoverlaycmb",
  33393. 0x0338,
  33394. "solidusshortoverlaycmb",
  33395. 0x0337,
  33396. "sorusithai",
  33397. 0x0e29,
  33398. "sosalathai",
  33399. 0x0e28,
  33400. "sosothai",
  33401. 0x0e0b,
  33402. "sosuathai",
  33403. 0x0e2a,
  33404. "space",
  33405. 0x0020,
  33406. "spacehackarabic",
  33407. 0x0020,
  33408. "spade",
  33409. 0x2660,
  33410. "spadesuitblack",
  33411. 0x2660,
  33412. "spadesuitwhite",
  33413. 0x2664,
  33414. "sparen",
  33415. 0x24ae,
  33416. "squarebelowcmb",
  33417. 0x033b,
  33418. "squarecc",
  33419. 0x33c4,
  33420. "squarecm",
  33421. 0x339d,
  33422. "squarediagonalcrosshatchfill",
  33423. 0x25a9,
  33424. "squarehorizontalfill",
  33425. 0x25a4,
  33426. "squarekg",
  33427. 0x338f,
  33428. "squarekm",
  33429. 0x339e,
  33430. "squarekmcapital",
  33431. 0x33ce,
  33432. "squareln",
  33433. 0x33d1,
  33434. "squarelog",
  33435. 0x33d2,
  33436. "squaremg",
  33437. 0x338e,
  33438. "squaremil",
  33439. 0x33d5,
  33440. "squaremm",
  33441. 0x339c,
  33442. "squaremsquared",
  33443. 0x33a1,
  33444. "squareorthogonalcrosshatchfill",
  33445. 0x25a6,
  33446. "squareupperlefttolowerrightfill",
  33447. 0x25a7,
  33448. "squareupperrighttolowerleftfill",
  33449. 0x25a8,
  33450. "squareverticalfill",
  33451. 0x25a5,
  33452. "squarewhitewithsmallblack",
  33453. 0x25a3,
  33454. "srsquare",
  33455. 0x33db,
  33456. "ssabengali",
  33457. 0x09b7,
  33458. "ssadeva",
  33459. 0x0937,
  33460. "ssagujarati",
  33461. 0x0ab7,
  33462. "ssangcieuckorean",
  33463. 0x3149,
  33464. "ssanghieuhkorean",
  33465. 0x3185,
  33466. "ssangieungkorean",
  33467. 0x3180,
  33468. "ssangkiyeokkorean",
  33469. 0x3132,
  33470. "ssangnieunkorean",
  33471. 0x3165,
  33472. "ssangpieupkorean",
  33473. 0x3143,
  33474. "ssangsioskorean",
  33475. 0x3146,
  33476. "ssangtikeutkorean",
  33477. 0x3138,
  33478. "ssuperior",
  33479. 0xf6f2,
  33480. "sterling",
  33481. 0x00a3,
  33482. "sterlingmonospace",
  33483. 0xffe1,
  33484. "strokelongoverlaycmb",
  33485. 0x0336,
  33486. "strokeshortoverlaycmb",
  33487. 0x0335,
  33488. "subset",
  33489. 0x2282,
  33490. "subsetnotequal",
  33491. 0x228a,
  33492. "subsetorequal",
  33493. 0x2286,
  33494. "succeeds",
  33495. 0x227b,
  33496. "suchthat",
  33497. 0x220b,
  33498. "suhiragana",
  33499. 0x3059,
  33500. "sukatakana",
  33501. 0x30b9,
  33502. "sukatakanahalfwidth",
  33503. 0xff7d,
  33504. "sukunarabic",
  33505. 0x0652,
  33506. "summation",
  33507. 0x2211,
  33508. "sun",
  33509. 0x263c,
  33510. "superset",
  33511. 0x2283,
  33512. "supersetnotequal",
  33513. 0x228b,
  33514. "supersetorequal",
  33515. 0x2287,
  33516. "svsquare",
  33517. 0x33dc,
  33518. "syouwaerasquare",
  33519. 0x337c,
  33520. "t",
  33521. 0x0074,
  33522. "tabengali",
  33523. 0x09a4,
  33524. "tackdown",
  33525. 0x22a4,
  33526. "tackleft",
  33527. 0x22a3,
  33528. "tadeva",
  33529. 0x0924,
  33530. "tagujarati",
  33531. 0x0aa4,
  33532. "tagurmukhi",
  33533. 0x0a24,
  33534. "taharabic",
  33535. 0x0637,
  33536. "tahfinalarabic",
  33537. 0xfec2,
  33538. "tahinitialarabic",
  33539. 0xfec3,
  33540. "tahiragana",
  33541. 0x305f,
  33542. "tahmedialarabic",
  33543. 0xfec4,
  33544. "taisyouerasquare",
  33545. 0x337d,
  33546. "takatakana",
  33547. 0x30bf,
  33548. "takatakanahalfwidth",
  33549. 0xff80,
  33550. "tatweelarabic",
  33551. 0x0640,
  33552. "tau",
  33553. 0x03c4,
  33554. "tav",
  33555. 0x05ea,
  33556. "tavdages",
  33557. 0xfb4a,
  33558. "tavdagesh",
  33559. 0xfb4a,
  33560. "tavdageshhebrew",
  33561. 0xfb4a,
  33562. "tavhebrew",
  33563. 0x05ea,
  33564. "tbar",
  33565. 0x0167,
  33566. "tbopomofo",
  33567. 0x310a,
  33568. "tcaron",
  33569. 0x0165,
  33570. "tccurl",
  33571. 0x02a8,
  33572. "tcedilla",
  33573. 0x0163,
  33574. "tcheharabic",
  33575. 0x0686,
  33576. "tchehfinalarabic",
  33577. 0xfb7b,
  33578. "tchehinitialarabic",
  33579. 0xfb7c,
  33580. "tchehmedialarabic",
  33581. 0xfb7d,
  33582. "tcircle",
  33583. 0x24e3,
  33584. "tcircumflexbelow",
  33585. 0x1e71,
  33586. "tcommaaccent",
  33587. 0x0163,
  33588. "tdieresis",
  33589. 0x1e97,
  33590. "tdotaccent",
  33591. 0x1e6b,
  33592. "tdotbelow",
  33593. 0x1e6d,
  33594. "tecyrillic",
  33595. 0x0442,
  33596. "tedescendercyrillic",
  33597. 0x04ad,
  33598. "teharabic",
  33599. 0x062a,
  33600. "tehfinalarabic",
  33601. 0xfe96,
  33602. "tehhahinitialarabic",
  33603. 0xfca2,
  33604. "tehhahisolatedarabic",
  33605. 0xfc0c,
  33606. "tehinitialarabic",
  33607. 0xfe97,
  33608. "tehiragana",
  33609. 0x3066,
  33610. "tehjeeminitialarabic",
  33611. 0xfca1,
  33612. "tehjeemisolatedarabic",
  33613. 0xfc0b,
  33614. "tehmarbutaarabic",
  33615. 0x0629,
  33616. "tehmarbutafinalarabic",
  33617. 0xfe94,
  33618. "tehmedialarabic",
  33619. 0xfe98,
  33620. "tehmeeminitialarabic",
  33621. 0xfca4,
  33622. "tehmeemisolatedarabic",
  33623. 0xfc0e,
  33624. "tehnoonfinalarabic",
  33625. 0xfc73,
  33626. "tekatakana",
  33627. 0x30c6,
  33628. "tekatakanahalfwidth",
  33629. 0xff83,
  33630. "telephone",
  33631. 0x2121,
  33632. "telephoneblack",
  33633. 0x260e,
  33634. "telishagedolahebrew",
  33635. 0x05a0,
  33636. "telishaqetanahebrew",
  33637. 0x05a9,
  33638. "tencircle",
  33639. 0x2469,
  33640. "tenideographicparen",
  33641. 0x3229,
  33642. "tenparen",
  33643. 0x247d,
  33644. "tenperiod",
  33645. 0x2491,
  33646. "tenroman",
  33647. 0x2179,
  33648. "tesh",
  33649. 0x02a7,
  33650. "tet",
  33651. 0x05d8,
  33652. "tetdagesh",
  33653. 0xfb38,
  33654. "tetdageshhebrew",
  33655. 0xfb38,
  33656. "tethebrew",
  33657. 0x05d8,
  33658. "tetsecyrillic",
  33659. 0x04b5,
  33660. "tevirhebrew",
  33661. 0x059b,
  33662. "tevirlefthebrew",
  33663. 0x059b,
  33664. "thabengali",
  33665. 0x09a5,
  33666. "thadeva",
  33667. 0x0925,
  33668. "thagujarati",
  33669. 0x0aa5,
  33670. "thagurmukhi",
  33671. 0x0a25,
  33672. "thalarabic",
  33673. 0x0630,
  33674. "thalfinalarabic",
  33675. 0xfeac,
  33676. "thanthakhatlowleftthai",
  33677. 0xf898,
  33678. "thanthakhatlowrightthai",
  33679. 0xf897,
  33680. "thanthakhatthai",
  33681. 0x0e4c,
  33682. "thanthakhatupperleftthai",
  33683. 0xf896,
  33684. "theharabic",
  33685. 0x062b,
  33686. "thehfinalarabic",
  33687. 0xfe9a,
  33688. "thehinitialarabic",
  33689. 0xfe9b,
  33690. "thehmedialarabic",
  33691. 0xfe9c,
  33692. "thereexists",
  33693. 0x2203,
  33694. "therefore",
  33695. 0x2234,
  33696. "theta",
  33697. 0x03b8,
  33698. "theta1",
  33699. 0x03d1,
  33700. "thetasymbolgreek",
  33701. 0x03d1,
  33702. "thieuthacirclekorean",
  33703. 0x3279,
  33704. "thieuthaparenkorean",
  33705. 0x3219,
  33706. "thieuthcirclekorean",
  33707. 0x326b,
  33708. "thieuthkorean",
  33709. 0x314c,
  33710. "thieuthparenkorean",
  33711. 0x320b,
  33712. "thirteencircle",
  33713. 0x246c,
  33714. "thirteenparen",
  33715. 0x2480,
  33716. "thirteenperiod",
  33717. 0x2494,
  33718. "thonangmonthothai",
  33719. 0x0e11,
  33720. "thook",
  33721. 0x01ad,
  33722. "thophuthaothai",
  33723. 0x0e12,
  33724. "thorn",
  33725. 0x00fe,
  33726. "thothahanthai",
  33727. 0x0e17,
  33728. "thothanthai",
  33729. 0x0e10,
  33730. "thothongthai",
  33731. 0x0e18,
  33732. "thothungthai",
  33733. 0x0e16,
  33734. "thousandcyrillic",
  33735. 0x0482,
  33736. "thousandsseparatorarabic",
  33737. 0x066c,
  33738. "thousandsseparatorpersian",
  33739. 0x066c,
  33740. "three",
  33741. 0x0033,
  33742. "threearabic",
  33743. 0x0663,
  33744. "threebengali",
  33745. 0x09e9,
  33746. "threecircle",
  33747. 0x2462,
  33748. "threecircleinversesansserif",
  33749. 0x278c,
  33750. "threedeva",
  33751. 0x0969,
  33752. "threeeighths",
  33753. 0x215c,
  33754. "threegujarati",
  33755. 0x0ae9,
  33756. "threegurmukhi",
  33757. 0x0a69,
  33758. "threehackarabic",
  33759. 0x0663,
  33760. "threehangzhou",
  33761. 0x3023,
  33762. "threeideographicparen",
  33763. 0x3222,
  33764. "threeinferior",
  33765. 0x2083,
  33766. "threemonospace",
  33767. 0xff13,
  33768. "threenumeratorbengali",
  33769. 0x09f6,
  33770. "threeoldstyle",
  33771. 0xf733,
  33772. "threeparen",
  33773. 0x2476,
  33774. "threeperiod",
  33775. 0x248a,
  33776. "threepersian",
  33777. 0x06f3,
  33778. "threequarters",
  33779. 0x00be,
  33780. "threequartersemdash",
  33781. 0xf6de,
  33782. "threeroman",
  33783. 0x2172,
  33784. "threesuperior",
  33785. 0x00b3,
  33786. "threethai",
  33787. 0x0e53,
  33788. "thzsquare",
  33789. 0x3394,
  33790. "tihiragana",
  33791. 0x3061,
  33792. "tikatakana",
  33793. 0x30c1,
  33794. "tikatakanahalfwidth",
  33795. 0xff81,
  33796. "tikeutacirclekorean",
  33797. 0x3270,
  33798. "tikeutaparenkorean",
  33799. 0x3210,
  33800. "tikeutcirclekorean",
  33801. 0x3262,
  33802. "tikeutkorean",
  33803. 0x3137,
  33804. "tikeutparenkorean",
  33805. 0x3202,
  33806. "tilde",
  33807. 0x02dc,
  33808. "tildebelowcmb",
  33809. 0x0330,
  33810. "tildecmb",
  33811. 0x0303,
  33812. "tildecomb",
  33813. 0x0303,
  33814. "tildedoublecmb",
  33815. 0x0360,
  33816. "tildeoperator",
  33817. 0x223c,
  33818. "tildeoverlaycmb",
  33819. 0x0334,
  33820. "tildeverticalcmb",
  33821. 0x033e,
  33822. "timescircle",
  33823. 0x2297,
  33824. "tipehahebrew",
  33825. 0x0596,
  33826. "tipehalefthebrew",
  33827. 0x0596,
  33828. "tippigurmukhi",
  33829. 0x0a70,
  33830. "titlocyrilliccmb",
  33831. 0x0483,
  33832. "tiwnarmenian",
  33833. 0x057f,
  33834. "tlinebelow",
  33835. 0x1e6f,
  33836. "tmonospace",
  33837. 0xff54,
  33838. "toarmenian",
  33839. 0x0569,
  33840. "tohiragana",
  33841. 0x3068,
  33842. "tokatakana",
  33843. 0x30c8,
  33844. "tokatakanahalfwidth",
  33845. 0xff84,
  33846. "tonebarextrahighmod",
  33847. 0x02e5,
  33848. "tonebarextralowmod",
  33849. 0x02e9,
  33850. "tonebarhighmod",
  33851. 0x02e6,
  33852. "tonebarlowmod",
  33853. 0x02e8,
  33854. "tonebarmidmod",
  33855. 0x02e7,
  33856. "tonefive",
  33857. 0x01bd,
  33858. "tonesix",
  33859. 0x0185,
  33860. "tonetwo",
  33861. 0x01a8,
  33862. "tonos",
  33863. 0x0384,
  33864. "tonsquare",
  33865. 0x3327,
  33866. "topatakthai",
  33867. 0x0e0f,
  33868. "tortoiseshellbracketleft",
  33869. 0x3014,
  33870. "tortoiseshellbracketleftsmall",
  33871. 0xfe5d,
  33872. "tortoiseshellbracketleftvertical",
  33873. 0xfe39,
  33874. "tortoiseshellbracketright",
  33875. 0x3015,
  33876. "tortoiseshellbracketrightsmall",
  33877. 0xfe5e,
  33878. "tortoiseshellbracketrightvertical",
  33879. 0xfe3a,
  33880. "totaothai",
  33881. 0x0e15,
  33882. "tpalatalhook",
  33883. 0x01ab,
  33884. "tparen",
  33885. 0x24af,
  33886. "trademark",
  33887. 0x2122,
  33888. "trademarksans",
  33889. 0xf8ea,
  33890. "trademarkserif",
  33891. 0xf6db,
  33892. "tretroflexhook",
  33893. 0x0288,
  33894. "triagdn",
  33895. 0x25bc,
  33896. "triaglf",
  33897. 0x25c4,
  33898. "triagrt",
  33899. 0x25ba,
  33900. "triagup",
  33901. 0x25b2,
  33902. "ts",
  33903. 0x02a6,
  33904. "tsadi",
  33905. 0x05e6,
  33906. "tsadidagesh",
  33907. 0xfb46,
  33908. "tsadidageshhebrew",
  33909. 0xfb46,
  33910. "tsadihebrew",
  33911. 0x05e6,
  33912. "tsecyrillic",
  33913. 0x0446,
  33914. "tsere",
  33915. 0x05b5,
  33916. "tsere12",
  33917. 0x05b5,
  33918. "tsere1e",
  33919. 0x05b5,
  33920. "tsere2b",
  33921. 0x05b5,
  33922. "tserehebrew",
  33923. 0x05b5,
  33924. "tserenarrowhebrew",
  33925. 0x05b5,
  33926. "tserequarterhebrew",
  33927. 0x05b5,
  33928. "tserewidehebrew",
  33929. 0x05b5,
  33930. "tshecyrillic",
  33931. 0x045b,
  33932. "tsuperior",
  33933. 0xf6f3,
  33934. "ttabengali",
  33935. 0x099f,
  33936. "ttadeva",
  33937. 0x091f,
  33938. "ttagujarati",
  33939. 0x0a9f,
  33940. "ttagurmukhi",
  33941. 0x0a1f,
  33942. "tteharabic",
  33943. 0x0679,
  33944. "ttehfinalarabic",
  33945. 0xfb67,
  33946. "ttehinitialarabic",
  33947. 0xfb68,
  33948. "ttehmedialarabic",
  33949. 0xfb69,
  33950. "tthabengali",
  33951. 0x09a0,
  33952. "tthadeva",
  33953. 0x0920,
  33954. "tthagujarati",
  33955. 0x0aa0,
  33956. "tthagurmukhi",
  33957. 0x0a20,
  33958. "tturned",
  33959. 0x0287,
  33960. "tuhiragana",
  33961. 0x3064,
  33962. "tukatakana",
  33963. 0x30c4,
  33964. "tukatakanahalfwidth",
  33965. 0xff82,
  33966. "tusmallhiragana",
  33967. 0x3063,
  33968. "tusmallkatakana",
  33969. 0x30c3,
  33970. "tusmallkatakanahalfwidth",
  33971. 0xff6f,
  33972. "twelvecircle",
  33973. 0x246b,
  33974. "twelveparen",
  33975. 0x247f,
  33976. "twelveperiod",
  33977. 0x2493,
  33978. "twelveroman",
  33979. 0x217b,
  33980. "twentycircle",
  33981. 0x2473,
  33982. "twentyhangzhou",
  33983. 0x5344,
  33984. "twentyparen",
  33985. 0x2487,
  33986. "twentyperiod",
  33987. 0x249b,
  33988. "two",
  33989. 0x0032,
  33990. "twoarabic",
  33991. 0x0662,
  33992. "twobengali",
  33993. 0x09e8,
  33994. "twocircle",
  33995. 0x2461,
  33996. "twocircleinversesansserif",
  33997. 0x278b,
  33998. "twodeva",
  33999. 0x0968,
  34000. "twodotenleader",
  34001. 0x2025,
  34002. "twodotleader",
  34003. 0x2025,
  34004. "twodotleadervertical",
  34005. 0xfe30,
  34006. "twogujarati",
  34007. 0x0ae8,
  34008. "twogurmukhi",
  34009. 0x0a68,
  34010. "twohackarabic",
  34011. 0x0662,
  34012. "twohangzhou",
  34013. 0x3022,
  34014. "twoideographicparen",
  34015. 0x3221,
  34016. "twoinferior",
  34017. 0x2082,
  34018. "twomonospace",
  34019. 0xff12,
  34020. "twonumeratorbengali",
  34021. 0x09f5,
  34022. "twooldstyle",
  34023. 0xf732,
  34024. "twoparen",
  34025. 0x2475,
  34026. "twoperiod",
  34027. 0x2489,
  34028. "twopersian",
  34029. 0x06f2,
  34030. "tworoman",
  34031. 0x2171,
  34032. "twostroke",
  34033. 0x01bb,
  34034. "twosuperior",
  34035. 0x00b2,
  34036. "twothai",
  34037. 0x0e52,
  34038. "twothirds",
  34039. 0x2154,
  34040. "u",
  34041. 0x0075,
  34042. "uacute",
  34043. 0x00fa,
  34044. "ubar",
  34045. 0x0289,
  34046. "ubengali",
  34047. 0x0989,
  34048. "ubopomofo",
  34049. 0x3128,
  34050. "ubreve",
  34051. 0x016d,
  34052. "ucaron",
  34053. 0x01d4,
  34054. "ucircle",
  34055. 0x24e4,
  34056. "ucircumflex",
  34057. 0x00fb,
  34058. "ucircumflexbelow",
  34059. 0x1e77,
  34060. "ucyrillic",
  34061. 0x0443,
  34062. "udattadeva",
  34063. 0x0951,
  34064. "udblacute",
  34065. 0x0171,
  34066. "udblgrave",
  34067. 0x0215,
  34068. "udeva",
  34069. 0x0909,
  34070. "udieresis",
  34071. 0x00fc,
  34072. "udieresisacute",
  34073. 0x01d8,
  34074. "udieresisbelow",
  34075. 0x1e73,
  34076. "udieresiscaron",
  34077. 0x01da,
  34078. "udieresiscyrillic",
  34079. 0x04f1,
  34080. "udieresisgrave",
  34081. 0x01dc,
  34082. "udieresismacron",
  34083. 0x01d6,
  34084. "udotbelow",
  34085. 0x1ee5,
  34086. "ugrave",
  34087. 0x00f9,
  34088. "ugujarati",
  34089. 0x0a89,
  34090. "ugurmukhi",
  34091. 0x0a09,
  34092. "uhiragana",
  34093. 0x3046,
  34094. "uhookabove",
  34095. 0x1ee7,
  34096. "uhorn",
  34097. 0x01b0,
  34098. "uhornacute",
  34099. 0x1ee9,
  34100. "uhorndotbelow",
  34101. 0x1ef1,
  34102. "uhorngrave",
  34103. 0x1eeb,
  34104. "uhornhookabove",
  34105. 0x1eed,
  34106. "uhorntilde",
  34107. 0x1eef,
  34108. "uhungarumlaut",
  34109. 0x0171,
  34110. "uhungarumlautcyrillic",
  34111. 0x04f3,
  34112. "uinvertedbreve",
  34113. 0x0217,
  34114. "ukatakana",
  34115. 0x30a6,
  34116. "ukatakanahalfwidth",
  34117. 0xff73,
  34118. "ukcyrillic",
  34119. 0x0479,
  34120. "ukorean",
  34121. 0x315c,
  34122. "umacron",
  34123. 0x016b,
  34124. "umacroncyrillic",
  34125. 0x04ef,
  34126. "umacrondieresis",
  34127. 0x1e7b,
  34128. "umatragurmukhi",
  34129. 0x0a41,
  34130. "umonospace",
  34131. 0xff55,
  34132. "underscore",
  34133. 0x005f,
  34134. "underscoredbl",
  34135. 0x2017,
  34136. "underscoremonospace",
  34137. 0xff3f,
  34138. "underscorevertical",
  34139. 0xfe33,
  34140. "underscorewavy",
  34141. 0xfe4f,
  34142. "union",
  34143. 0x222a,
  34144. "universal",
  34145. 0x2200,
  34146. "uogonek",
  34147. 0x0173,
  34148. "uparen",
  34149. 0x24b0,
  34150. "upblock",
  34151. 0x2580,
  34152. "upperdothebrew",
  34153. 0x05c4,
  34154. "upsilon",
  34155. 0x03c5,
  34156. "upsilondieresis",
  34157. 0x03cb,
  34158. "upsilondieresistonos",
  34159. 0x03b0,
  34160. "upsilonlatin",
  34161. 0x028a,
  34162. "upsilontonos",
  34163. 0x03cd,
  34164. "uptackbelowcmb",
  34165. 0x031d,
  34166. "uptackmod",
  34167. 0x02d4,
  34168. "uragurmukhi",
  34169. 0x0a73,
  34170. "uring",
  34171. 0x016f,
  34172. "ushortcyrillic",
  34173. 0x045e,
  34174. "usmallhiragana",
  34175. 0x3045,
  34176. "usmallkatakana",
  34177. 0x30a5,
  34178. "usmallkatakanahalfwidth",
  34179. 0xff69,
  34180. "ustraightcyrillic",
  34181. 0x04af,
  34182. "ustraightstrokecyrillic",
  34183. 0x04b1,
  34184. "utilde",
  34185. 0x0169,
  34186. "utildeacute",
  34187. 0x1e79,
  34188. "utildebelow",
  34189. 0x1e75,
  34190. "uubengali",
  34191. 0x098a,
  34192. "uudeva",
  34193. 0x090a,
  34194. "uugujarati",
  34195. 0x0a8a,
  34196. "uugurmukhi",
  34197. 0x0a0a,
  34198. "uumatragurmukhi",
  34199. 0x0a42,
  34200. "uuvowelsignbengali",
  34201. 0x09c2,
  34202. "uuvowelsigndeva",
  34203. 0x0942,
  34204. "uuvowelsigngujarati",
  34205. 0x0ac2,
  34206. "uvowelsignbengali",
  34207. 0x09c1,
  34208. "uvowelsigndeva",
  34209. 0x0941,
  34210. "uvowelsigngujarati",
  34211. 0x0ac1,
  34212. "v",
  34213. 0x0076,
  34214. "vadeva",
  34215. 0x0935,
  34216. "vagujarati",
  34217. 0x0ab5,
  34218. "vagurmukhi",
  34219. 0x0a35,
  34220. "vakatakana",
  34221. 0x30f7,
  34222. "vav",
  34223. 0x05d5,
  34224. "vavdagesh",
  34225. 0xfb35,
  34226. "vavdagesh65",
  34227. 0xfb35,
  34228. "vavdageshhebrew",
  34229. 0xfb35,
  34230. "vavhebrew",
  34231. 0x05d5,
  34232. "vavholam",
  34233. 0xfb4b,
  34234. "vavholamhebrew",
  34235. 0xfb4b,
  34236. "vavvavhebrew",
  34237. 0x05f0,
  34238. "vavyodhebrew",
  34239. 0x05f1,
  34240. "vcircle",
  34241. 0x24e5,
  34242. "vdotbelow",
  34243. 0x1e7f,
  34244. "vecyrillic",
  34245. 0x0432,
  34246. "veharabic",
  34247. 0x06a4,
  34248. "vehfinalarabic",
  34249. 0xfb6b,
  34250. "vehinitialarabic",
  34251. 0xfb6c,
  34252. "vehmedialarabic",
  34253. 0xfb6d,
  34254. "vekatakana",
  34255. 0x30f9,
  34256. "venus",
  34257. 0x2640,
  34258. "verticalbar",
  34259. 0x007c,
  34260. "verticallineabovecmb",
  34261. 0x030d,
  34262. "verticallinebelowcmb",
  34263. 0x0329,
  34264. "verticallinelowmod",
  34265. 0x02cc,
  34266. "verticallinemod",
  34267. 0x02c8,
  34268. "vewarmenian",
  34269. 0x057e,
  34270. "vhook",
  34271. 0x028b,
  34272. "vikatakana",
  34273. 0x30f8,
  34274. "viramabengali",
  34275. 0x09cd,
  34276. "viramadeva",
  34277. 0x094d,
  34278. "viramagujarati",
  34279. 0x0acd,
  34280. "visargabengali",
  34281. 0x0983,
  34282. "visargadeva",
  34283. 0x0903,
  34284. "visargagujarati",
  34285. 0x0a83,
  34286. "vmonospace",
  34287. 0xff56,
  34288. "voarmenian",
  34289. 0x0578,
  34290. "voicediterationhiragana",
  34291. 0x309e,
  34292. "voicediterationkatakana",
  34293. 0x30fe,
  34294. "voicedmarkkana",
  34295. 0x309b,
  34296. "voicedmarkkanahalfwidth",
  34297. 0xff9e,
  34298. "vokatakana",
  34299. 0x30fa,
  34300. "vparen",
  34301. 0x24b1,
  34302. "vtilde",
  34303. 0x1e7d,
  34304. "vturned",
  34305. 0x028c,
  34306. "vuhiragana",
  34307. 0x3094,
  34308. "vukatakana",
  34309. 0x30f4,
  34310. "w",
  34311. 0x0077,
  34312. "wacute",
  34313. 0x1e83,
  34314. "waekorean",
  34315. 0x3159,
  34316. "wahiragana",
  34317. 0x308f,
  34318. "wakatakana",
  34319. 0x30ef,
  34320. "wakatakanahalfwidth",
  34321. 0xff9c,
  34322. "wakorean",
  34323. 0x3158,
  34324. "wasmallhiragana",
  34325. 0x308e,
  34326. "wasmallkatakana",
  34327. 0x30ee,
  34328. "wattosquare",
  34329. 0x3357,
  34330. "wavedash",
  34331. 0x301c,
  34332. "wavyunderscorevertical",
  34333. 0xfe34,
  34334. "wawarabic",
  34335. 0x0648,
  34336. "wawfinalarabic",
  34337. 0xfeee,
  34338. "wawhamzaabovearabic",
  34339. 0x0624,
  34340. "wawhamzaabovefinalarabic",
  34341. 0xfe86,
  34342. "wbsquare",
  34343. 0x33dd,
  34344. "wcircle",
  34345. 0x24e6,
  34346. "wcircumflex",
  34347. 0x0175,
  34348. "wdieresis",
  34349. 0x1e85,
  34350. "wdotaccent",
  34351. 0x1e87,
  34352. "wdotbelow",
  34353. 0x1e89,
  34354. "wehiragana",
  34355. 0x3091,
  34356. "weierstrass",
  34357. 0x2118,
  34358. "wekatakana",
  34359. 0x30f1,
  34360. "wekorean",
  34361. 0x315e,
  34362. "weokorean",
  34363. 0x315d,
  34364. "wgrave",
  34365. 0x1e81,
  34366. "whitebullet",
  34367. 0x25e6,
  34368. "whitecircle",
  34369. 0x25cb,
  34370. "whitecircleinverse",
  34371. 0x25d9,
  34372. "whitecornerbracketleft",
  34373. 0x300e,
  34374. "whitecornerbracketleftvertical",
  34375. 0xfe43,
  34376. "whitecornerbracketright",
  34377. 0x300f,
  34378. "whitecornerbracketrightvertical",
  34379. 0xfe44,
  34380. "whitediamond",
  34381. 0x25c7,
  34382. "whitediamondcontainingblacksmalldiamond",
  34383. 0x25c8,
  34384. "whitedownpointingsmalltriangle",
  34385. 0x25bf,
  34386. "whitedownpointingtriangle",
  34387. 0x25bd,
  34388. "whiteleftpointingsmalltriangle",
  34389. 0x25c3,
  34390. "whiteleftpointingtriangle",
  34391. 0x25c1,
  34392. "whitelenticularbracketleft",
  34393. 0x3016,
  34394. "whitelenticularbracketright",
  34395. 0x3017,
  34396. "whiterightpointingsmalltriangle",
  34397. 0x25b9,
  34398. "whiterightpointingtriangle",
  34399. 0x25b7,
  34400. "whitesmallsquare",
  34401. 0x25ab,
  34402. "whitesmilingface",
  34403. 0x263a,
  34404. "whitesquare",
  34405. 0x25a1,
  34406. "whitestar",
  34407. 0x2606,
  34408. "whitetelephone",
  34409. 0x260f,
  34410. "whitetortoiseshellbracketleft",
  34411. 0x3018,
  34412. "whitetortoiseshellbracketright",
  34413. 0x3019,
  34414. "whiteuppointingsmalltriangle",
  34415. 0x25b5,
  34416. "whiteuppointingtriangle",
  34417. 0x25b3,
  34418. "wihiragana",
  34419. 0x3090,
  34420. "wikatakana",
  34421. 0x30f0,
  34422. "wikorean",
  34423. 0x315f,
  34424. "wmonospace",
  34425. 0xff57,
  34426. "wohiragana",
  34427. 0x3092,
  34428. "wokatakana",
  34429. 0x30f2,
  34430. "wokatakanahalfwidth",
  34431. 0xff66,
  34432. "won",
  34433. 0x20a9,
  34434. "wonmonospace",
  34435. 0xffe6,
  34436. "wowaenthai",
  34437. 0x0e27,
  34438. "wparen",
  34439. 0x24b2,
  34440. "wring",
  34441. 0x1e98,
  34442. "wsuperior",
  34443. 0x02b7,
  34444. "wturned",
  34445. 0x028d,
  34446. "wynn",
  34447. 0x01bf,
  34448. "x",
  34449. 0x0078,
  34450. "xabovecmb",
  34451. 0x033d,
  34452. "xbopomofo",
  34453. 0x3112,
  34454. "xcircle",
  34455. 0x24e7,
  34456. "xdieresis",
  34457. 0x1e8d,
  34458. "xdotaccent",
  34459. 0x1e8b,
  34460. "xeharmenian",
  34461. 0x056d,
  34462. "xi",
  34463. 0x03be,
  34464. "xmonospace",
  34465. 0xff58,
  34466. "xparen",
  34467. 0x24b3,
  34468. "xsuperior",
  34469. 0x02e3,
  34470. "y",
  34471. 0x0079,
  34472. "yaadosquare",
  34473. 0x334e,
  34474. "yabengali",
  34475. 0x09af,
  34476. "yacute",
  34477. 0x00fd,
  34478. "yadeva",
  34479. 0x092f,
  34480. "yaekorean",
  34481. 0x3152,
  34482. "yagujarati",
  34483. 0x0aaf,
  34484. "yagurmukhi",
  34485. 0x0a2f,
  34486. "yahiragana",
  34487. 0x3084,
  34488. "yakatakana",
  34489. 0x30e4,
  34490. "yakatakanahalfwidth",
  34491. 0xff94,
  34492. "yakorean",
  34493. 0x3151,
  34494. "yamakkanthai",
  34495. 0x0e4e,
  34496. "yasmallhiragana",
  34497. 0x3083,
  34498. "yasmallkatakana",
  34499. 0x30e3,
  34500. "yasmallkatakanahalfwidth",
  34501. 0xff6c,
  34502. "yatcyrillic",
  34503. 0x0463,
  34504. "ycircle",
  34505. 0x24e8,
  34506. "ycircumflex",
  34507. 0x0177,
  34508. "ydieresis",
  34509. 0x00ff,
  34510. "ydotaccent",
  34511. 0x1e8f,
  34512. "ydotbelow",
  34513. 0x1ef5,
  34514. "yeharabic",
  34515. 0x064a,
  34516. "yehbarreearabic",
  34517. 0x06d2,
  34518. "yehbarreefinalarabic",
  34519. 0xfbaf,
  34520. "yehfinalarabic",
  34521. 0xfef2,
  34522. "yehhamzaabovearabic",
  34523. 0x0626,
  34524. "yehhamzaabovefinalarabic",
  34525. 0xfe8a,
  34526. "yehhamzaaboveinitialarabic",
  34527. 0xfe8b,
  34528. "yehhamzaabovemedialarabic",
  34529. 0xfe8c,
  34530. "yehinitialarabic",
  34531. 0xfef3,
  34532. "yehmedialarabic",
  34533. 0xfef4,
  34534. "yehmeeminitialarabic",
  34535. 0xfcdd,
  34536. "yehmeemisolatedarabic",
  34537. 0xfc58,
  34538. "yehnoonfinalarabic",
  34539. 0xfc94,
  34540. "yehthreedotsbelowarabic",
  34541. 0x06d1,
  34542. "yekorean",
  34543. 0x3156,
  34544. "yen",
  34545. 0x00a5,
  34546. "yenmonospace",
  34547. 0xffe5,
  34548. "yeokorean",
  34549. 0x3155,
  34550. "yeorinhieuhkorean",
  34551. 0x3186,
  34552. "yerahbenyomohebrew",
  34553. 0x05aa,
  34554. "yerahbenyomolefthebrew",
  34555. 0x05aa,
  34556. "yericyrillic",
  34557. 0x044b,
  34558. "yerudieresiscyrillic",
  34559. 0x04f9,
  34560. "yesieungkorean",
  34561. 0x3181,
  34562. "yesieungpansioskorean",
  34563. 0x3183,
  34564. "yesieungsioskorean",
  34565. 0x3182,
  34566. "yetivhebrew",
  34567. 0x059a,
  34568. "ygrave",
  34569. 0x1ef3,
  34570. "yhook",
  34571. 0x01b4,
  34572. "yhookabove",
  34573. 0x1ef7,
  34574. "yiarmenian",
  34575. 0x0575,
  34576. "yicyrillic",
  34577. 0x0457,
  34578. "yikorean",
  34579. 0x3162,
  34580. "yinyang",
  34581. 0x262f,
  34582. "yiwnarmenian",
  34583. 0x0582,
  34584. "ymonospace",
  34585. 0xff59,
  34586. "yod",
  34587. 0x05d9,
  34588. "yoddagesh",
  34589. 0xfb39,
  34590. "yoddageshhebrew",
  34591. 0xfb39,
  34592. "yodhebrew",
  34593. 0x05d9,
  34594. "yodyodhebrew",
  34595. 0x05f2,
  34596. "yodyodpatahhebrew",
  34597. 0xfb1f,
  34598. "yohiragana",
  34599. 0x3088,
  34600. "yoikorean",
  34601. 0x3189,
  34602. "yokatakana",
  34603. 0x30e8,
  34604. "yokatakanahalfwidth",
  34605. 0xff96,
  34606. "yokorean",
  34607. 0x315b,
  34608. "yosmallhiragana",
  34609. 0x3087,
  34610. "yosmallkatakana",
  34611. 0x30e7,
  34612. "yosmallkatakanahalfwidth",
  34613. 0xff6e,
  34614. "yotgreek",
  34615. 0x03f3,
  34616. "yoyaekorean",
  34617. 0x3188,
  34618. "yoyakorean",
  34619. 0x3187,
  34620. "yoyakthai",
  34621. 0x0e22,
  34622. "yoyingthai",
  34623. 0x0e0d,
  34624. "yparen",
  34625. 0x24b4,
  34626. "ypogegrammeni",
  34627. 0x037a,
  34628. "ypogegrammenigreekcmb",
  34629. 0x0345,
  34630. "yr",
  34631. 0x01a6,
  34632. "yring",
  34633. 0x1e99,
  34634. "ysuperior",
  34635. 0x02b8,
  34636. "ytilde",
  34637. 0x1ef9,
  34638. "yturned",
  34639. 0x028e,
  34640. "yuhiragana",
  34641. 0x3086,
  34642. "yuikorean",
  34643. 0x318c,
  34644. "yukatakana",
  34645. 0x30e6,
  34646. "yukatakanahalfwidth",
  34647. 0xff95,
  34648. "yukorean",
  34649. 0x3160,
  34650. "yusbigcyrillic",
  34651. 0x046b,
  34652. "yusbigiotifiedcyrillic",
  34653. 0x046d,
  34654. "yuslittlecyrillic",
  34655. 0x0467,
  34656. "yuslittleiotifiedcyrillic",
  34657. 0x0469,
  34658. "yusmallhiragana",
  34659. 0x3085,
  34660. "yusmallkatakana",
  34661. 0x30e5,
  34662. "yusmallkatakanahalfwidth",
  34663. 0xff6d,
  34664. "yuyekorean",
  34665. 0x318b,
  34666. "yuyeokorean",
  34667. 0x318a,
  34668. "yyabengali",
  34669. 0x09df,
  34670. "yyadeva",
  34671. 0x095f,
  34672. "z",
  34673. 0x007a,
  34674. "zaarmenian",
  34675. 0x0566,
  34676. "zacute",
  34677. 0x017a,
  34678. "zadeva",
  34679. 0x095b,
  34680. "zagurmukhi",
  34681. 0x0a5b,
  34682. "zaharabic",
  34683. 0x0638,
  34684. "zahfinalarabic",
  34685. 0xfec6,
  34686. "zahinitialarabic",
  34687. 0xfec7,
  34688. "zahiragana",
  34689. 0x3056,
  34690. "zahmedialarabic",
  34691. 0xfec8,
  34692. "zainarabic",
  34693. 0x0632,
  34694. "zainfinalarabic",
  34695. 0xfeb0,
  34696. "zakatakana",
  34697. 0x30b6,
  34698. "zaqefgadolhebrew",
  34699. 0x0595,
  34700. "zaqefqatanhebrew",
  34701. 0x0594,
  34702. "zarqahebrew",
  34703. 0x0598,
  34704. "zayin",
  34705. 0x05d6,
  34706. "zayindagesh",
  34707. 0xfb36,
  34708. "zayindageshhebrew",
  34709. 0xfb36,
  34710. "zayinhebrew",
  34711. 0x05d6,
  34712. "zbopomofo",
  34713. 0x3117,
  34714. "zcaron",
  34715. 0x017e,
  34716. "zcircle",
  34717. 0x24e9,
  34718. "zcircumflex",
  34719. 0x1e91,
  34720. "zcurl",
  34721. 0x0291,
  34722. "zdot",
  34723. 0x017c,
  34724. "zdotaccent",
  34725. 0x017c,
  34726. "zdotbelow",
  34727. 0x1e93,
  34728. "zecyrillic",
  34729. 0x0437,
  34730. "zedescendercyrillic",
  34731. 0x0499,
  34732. "zedieresiscyrillic",
  34733. 0x04df,
  34734. "zehiragana",
  34735. 0x305c,
  34736. "zekatakana",
  34737. 0x30bc,
  34738. "zero",
  34739. 0x0030,
  34740. "zeroarabic",
  34741. 0x0660,
  34742. "zerobengali",
  34743. 0x09e6,
  34744. "zerodeva",
  34745. 0x0966,
  34746. "zerogujarati",
  34747. 0x0ae6,
  34748. "zerogurmukhi",
  34749. 0x0a66,
  34750. "zerohackarabic",
  34751. 0x0660,
  34752. "zeroinferior",
  34753. 0x2080,
  34754. "zeromonospace",
  34755. 0xff10,
  34756. "zerooldstyle",
  34757. 0xf730,
  34758. "zeropersian",
  34759. 0x06f0,
  34760. "zerosuperior",
  34761. 0x2070,
  34762. "zerothai",
  34763. 0x0e50,
  34764. "zerowidthjoiner",
  34765. 0xfeff,
  34766. "zerowidthnonjoiner",
  34767. 0x200c,
  34768. "zerowidthspace",
  34769. 0x200b,
  34770. "zeta",
  34771. 0x03b6,
  34772. "zhbopomofo",
  34773. 0x3113,
  34774. "zhearmenian",
  34775. 0x056a,
  34776. "zhebrevecyrillic",
  34777. 0x04c2,
  34778. "zhecyrillic",
  34779. 0x0436,
  34780. "zhedescendercyrillic",
  34781. 0x0497,
  34782. "zhedieresiscyrillic",
  34783. 0x04dd,
  34784. "zihiragana",
  34785. 0x3058,
  34786. "zikatakana",
  34787. 0x30b8,
  34788. "zinorhebrew",
  34789. 0x05ae,
  34790. "zlinebelow",
  34791. 0x1e95,
  34792. "zmonospace",
  34793. 0xff5a,
  34794. "zohiragana",
  34795. 0x305e,
  34796. "zokatakana",
  34797. 0x30be,
  34798. "zparen",
  34799. 0x24b5,
  34800. "zretroflexhook",
  34801. 0x0290,
  34802. "zstroke",
  34803. 0x01b6,
  34804. "zuhiragana",
  34805. 0x305a,
  34806. "zukatakana",
  34807. 0x30ba,
  34808. ".notdef",
  34809. 0x0000,
  34810. "angbracketleftbig",
  34811. 0x2329,
  34812. "angbracketleftBig",
  34813. 0x2329,
  34814. "angbracketleftbigg",
  34815. 0x2329,
  34816. "angbracketleftBigg",
  34817. 0x2329,
  34818. "angbracketrightBig",
  34819. 0x232a,
  34820. "angbracketrightbig",
  34821. 0x232a,
  34822. "angbracketrightBigg",
  34823. 0x232a,
  34824. "angbracketrightbigg",
  34825. 0x232a,
  34826. "arrowhookleft",
  34827. 0x21aa,
  34828. "arrowhookright",
  34829. 0x21a9,
  34830. "arrowlefttophalf",
  34831. 0x21bc,
  34832. "arrowleftbothalf",
  34833. 0x21bd,
  34834. "arrownortheast",
  34835. 0x2197,
  34836. "arrownorthwest",
  34837. 0x2196,
  34838. "arrowrighttophalf",
  34839. 0x21c0,
  34840. "arrowrightbothalf",
  34841. 0x21c1,
  34842. "arrowsoutheast",
  34843. 0x2198,
  34844. "arrowsouthwest",
  34845. 0x2199,
  34846. "backslashbig",
  34847. 0x2216,
  34848. "backslashBig",
  34849. 0x2216,
  34850. "backslashBigg",
  34851. 0x2216,
  34852. "backslashbigg",
  34853. 0x2216,
  34854. "bardbl",
  34855. 0x2016,
  34856. "bracehtipdownleft",
  34857. 0xfe37,
  34858. "bracehtipdownright",
  34859. 0xfe37,
  34860. "bracehtipupleft",
  34861. 0xfe38,
  34862. "bracehtipupright",
  34863. 0xfe38,
  34864. "braceleftBig",
  34865. 0x007b,
  34866. "braceleftbig",
  34867. 0x007b,
  34868. "braceleftbigg",
  34869. 0x007b,
  34870. "braceleftBigg",
  34871. 0x007b,
  34872. "bracerightBig",
  34873. 0x007d,
  34874. "bracerightbig",
  34875. 0x007d,
  34876. "bracerightbigg",
  34877. 0x007d,
  34878. "bracerightBigg",
  34879. 0x007d,
  34880. "bracketleftbig",
  34881. 0x005b,
  34882. "bracketleftBig",
  34883. 0x005b,
  34884. "bracketleftbigg",
  34885. 0x005b,
  34886. "bracketleftBigg",
  34887. 0x005b,
  34888. "bracketrightBig",
  34889. 0x005d,
  34890. "bracketrightbig",
  34891. 0x005d,
  34892. "bracketrightbigg",
  34893. 0x005d,
  34894. "bracketrightBigg",
  34895. 0x005d,
  34896. "ceilingleftbig",
  34897. 0x2308,
  34898. "ceilingleftBig",
  34899. 0x2308,
  34900. "ceilingleftBigg",
  34901. 0x2308,
  34902. "ceilingleftbigg",
  34903. 0x2308,
  34904. "ceilingrightbig",
  34905. 0x2309,
  34906. "ceilingrightBig",
  34907. 0x2309,
  34908. "ceilingrightbigg",
  34909. 0x2309,
  34910. "ceilingrightBigg",
  34911. 0x2309,
  34912. "circledotdisplay",
  34913. 0x2299,
  34914. "circledottext",
  34915. 0x2299,
  34916. "circlemultiplydisplay",
  34917. 0x2297,
  34918. "circlemultiplytext",
  34919. 0x2297,
  34920. "circleplusdisplay",
  34921. 0x2295,
  34922. "circleplustext",
  34923. 0x2295,
  34924. "contintegraldisplay",
  34925. 0x222e,
  34926. "contintegraltext",
  34927. 0x222e,
  34928. "coproductdisplay",
  34929. 0x2210,
  34930. "coproducttext",
  34931. 0x2210,
  34932. "floorleftBig",
  34933. 0x230a,
  34934. "floorleftbig",
  34935. 0x230a,
  34936. "floorleftbigg",
  34937. 0x230a,
  34938. "floorleftBigg",
  34939. 0x230a,
  34940. "floorrightbig",
  34941. 0x230b,
  34942. "floorrightBig",
  34943. 0x230b,
  34944. "floorrightBigg",
  34945. 0x230b,
  34946. "floorrightbigg",
  34947. 0x230b,
  34948. "hatwide",
  34949. 0x0302,
  34950. "hatwider",
  34951. 0x0302,
  34952. "hatwidest",
  34953. 0x0302,
  34954. "intercal",
  34955. 0x1d40,
  34956. "integraldisplay",
  34957. 0x222b,
  34958. "integraltext",
  34959. 0x222b,
  34960. "intersectiondisplay",
  34961. 0x22c2,
  34962. "intersectiontext",
  34963. 0x22c2,
  34964. "logicalanddisplay",
  34965. 0x2227,
  34966. "logicalandtext",
  34967. 0x2227,
  34968. "logicalordisplay",
  34969. 0x2228,
  34970. "logicalortext",
  34971. 0x2228,
  34972. "parenleftBig",
  34973. 0x0028,
  34974. "parenleftbig",
  34975. 0x0028,
  34976. "parenleftBigg",
  34977. 0x0028,
  34978. "parenleftbigg",
  34979. 0x0028,
  34980. "parenrightBig",
  34981. 0x0029,
  34982. "parenrightbig",
  34983. 0x0029,
  34984. "parenrightBigg",
  34985. 0x0029,
  34986. "parenrightbigg",
  34987. 0x0029,
  34988. "prime",
  34989. 0x2032,
  34990. "productdisplay",
  34991. 0x220f,
  34992. "producttext",
  34993. 0x220f,
  34994. "radicalbig",
  34995. 0x221a,
  34996. "radicalBig",
  34997. 0x221a,
  34998. "radicalBigg",
  34999. 0x221a,
  35000. "radicalbigg",
  35001. 0x221a,
  35002. "radicalbt",
  35003. 0x221a,
  35004. "radicaltp",
  35005. 0x221a,
  35006. "radicalvertex",
  35007. 0x221a,
  35008. "slashbig",
  35009. 0x002f,
  35010. "slashBig",
  35011. 0x002f,
  35012. "slashBigg",
  35013. 0x002f,
  35014. "slashbigg",
  35015. 0x002f,
  35016. "summationdisplay",
  35017. 0x2211,
  35018. "summationtext",
  35019. 0x2211,
  35020. "tildewide",
  35021. 0x02dc,
  35022. "tildewider",
  35023. 0x02dc,
  35024. "tildewidest",
  35025. 0x02dc,
  35026. "uniondisplay",
  35027. 0x22c3,
  35028. "unionmultidisplay",
  35029. 0x228e,
  35030. "unionmultitext",
  35031. 0x228e,
  35032. "unionsqdisplay",
  35033. 0x2294,
  35034. "unionsqtext",
  35035. 0x2294,
  35036. "uniontext",
  35037. 0x22c3,
  35038. "vextenddouble",
  35039. 0x2225,
  35040. "vextendsingle",
  35041. 0x2223
  35042. ];
  35043. });
  35044. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  35045. return [
  35046. "space",
  35047. 0x0020,
  35048. "a1",
  35049. 0x2701,
  35050. "a2",
  35051. 0x2702,
  35052. "a202",
  35053. 0x2703,
  35054. "a3",
  35055. 0x2704,
  35056. "a4",
  35057. 0x260e,
  35058. "a5",
  35059. 0x2706,
  35060. "a119",
  35061. 0x2707,
  35062. "a118",
  35063. 0x2708,
  35064. "a117",
  35065. 0x2709,
  35066. "a11",
  35067. 0x261b,
  35068. "a12",
  35069. 0x261e,
  35070. "a13",
  35071. 0x270c,
  35072. "a14",
  35073. 0x270d,
  35074. "a15",
  35075. 0x270e,
  35076. "a16",
  35077. 0x270f,
  35078. "a105",
  35079. 0x2710,
  35080. "a17",
  35081. 0x2711,
  35082. "a18",
  35083. 0x2712,
  35084. "a19",
  35085. 0x2713,
  35086. "a20",
  35087. 0x2714,
  35088. "a21",
  35089. 0x2715,
  35090. "a22",
  35091. 0x2716,
  35092. "a23",
  35093. 0x2717,
  35094. "a24",
  35095. 0x2718,
  35096. "a25",
  35097. 0x2719,
  35098. "a26",
  35099. 0x271a,
  35100. "a27",
  35101. 0x271b,
  35102. "a28",
  35103. 0x271c,
  35104. "a6",
  35105. 0x271d,
  35106. "a7",
  35107. 0x271e,
  35108. "a8",
  35109. 0x271f,
  35110. "a9",
  35111. 0x2720,
  35112. "a10",
  35113. 0x2721,
  35114. "a29",
  35115. 0x2722,
  35116. "a30",
  35117. 0x2723,
  35118. "a31",
  35119. 0x2724,
  35120. "a32",
  35121. 0x2725,
  35122. "a33",
  35123. 0x2726,
  35124. "a34",
  35125. 0x2727,
  35126. "a35",
  35127. 0x2605,
  35128. "a36",
  35129. 0x2729,
  35130. "a37",
  35131. 0x272a,
  35132. "a38",
  35133. 0x272b,
  35134. "a39",
  35135. 0x272c,
  35136. "a40",
  35137. 0x272d,
  35138. "a41",
  35139. 0x272e,
  35140. "a42",
  35141. 0x272f,
  35142. "a43",
  35143. 0x2730,
  35144. "a44",
  35145. 0x2731,
  35146. "a45",
  35147. 0x2732,
  35148. "a46",
  35149. 0x2733,
  35150. "a47",
  35151. 0x2734,
  35152. "a48",
  35153. 0x2735,
  35154. "a49",
  35155. 0x2736,
  35156. "a50",
  35157. 0x2737,
  35158. "a51",
  35159. 0x2738,
  35160. "a52",
  35161. 0x2739,
  35162. "a53",
  35163. 0x273a,
  35164. "a54",
  35165. 0x273b,
  35166. "a55",
  35167. 0x273c,
  35168. "a56",
  35169. 0x273d,
  35170. "a57",
  35171. 0x273e,
  35172. "a58",
  35173. 0x273f,
  35174. "a59",
  35175. 0x2740,
  35176. "a60",
  35177. 0x2741,
  35178. "a61",
  35179. 0x2742,
  35180. "a62",
  35181. 0x2743,
  35182. "a63",
  35183. 0x2744,
  35184. "a64",
  35185. 0x2745,
  35186. "a65",
  35187. 0x2746,
  35188. "a66",
  35189. 0x2747,
  35190. "a67",
  35191. 0x2748,
  35192. "a68",
  35193. 0x2749,
  35194. "a69",
  35195. 0x274a,
  35196. "a70",
  35197. 0x274b,
  35198. "a71",
  35199. 0x25cf,
  35200. "a72",
  35201. 0x274d,
  35202. "a73",
  35203. 0x25a0,
  35204. "a74",
  35205. 0x274f,
  35206. "a203",
  35207. 0x2750,
  35208. "a75",
  35209. 0x2751,
  35210. "a204",
  35211. 0x2752,
  35212. "a76",
  35213. 0x25b2,
  35214. "a77",
  35215. 0x25bc,
  35216. "a78",
  35217. 0x25c6,
  35218. "a79",
  35219. 0x2756,
  35220. "a81",
  35221. 0x25d7,
  35222. "a82",
  35223. 0x2758,
  35224. "a83",
  35225. 0x2759,
  35226. "a84",
  35227. 0x275a,
  35228. "a97",
  35229. 0x275b,
  35230. "a98",
  35231. 0x275c,
  35232. "a99",
  35233. 0x275d,
  35234. "a100",
  35235. 0x275e,
  35236. "a101",
  35237. 0x2761,
  35238. "a102",
  35239. 0x2762,
  35240. "a103",
  35241. 0x2763,
  35242. "a104",
  35243. 0x2764,
  35244. "a106",
  35245. 0x2765,
  35246. "a107",
  35247. 0x2766,
  35248. "a108",
  35249. 0x2767,
  35250. "a112",
  35251. 0x2663,
  35252. "a111",
  35253. 0x2666,
  35254. "a110",
  35255. 0x2665,
  35256. "a109",
  35257. 0x2660,
  35258. "a120",
  35259. 0x2460,
  35260. "a121",
  35261. 0x2461,
  35262. "a122",
  35263. 0x2462,
  35264. "a123",
  35265. 0x2463,
  35266. "a124",
  35267. 0x2464,
  35268. "a125",
  35269. 0x2465,
  35270. "a126",
  35271. 0x2466,
  35272. "a127",
  35273. 0x2467,
  35274. "a128",
  35275. 0x2468,
  35276. "a129",
  35277. 0x2469,
  35278. "a130",
  35279. 0x2776,
  35280. "a131",
  35281. 0x2777,
  35282. "a132",
  35283. 0x2778,
  35284. "a133",
  35285. 0x2779,
  35286. "a134",
  35287. 0x277a,
  35288. "a135",
  35289. 0x277b,
  35290. "a136",
  35291. 0x277c,
  35292. "a137",
  35293. 0x277d,
  35294. "a138",
  35295. 0x277e,
  35296. "a139",
  35297. 0x277f,
  35298. "a140",
  35299. 0x2780,
  35300. "a141",
  35301. 0x2781,
  35302. "a142",
  35303. 0x2782,
  35304. "a143",
  35305. 0x2783,
  35306. "a144",
  35307. 0x2784,
  35308. "a145",
  35309. 0x2785,
  35310. "a146",
  35311. 0x2786,
  35312. "a147",
  35313. 0x2787,
  35314. "a148",
  35315. 0x2788,
  35316. "a149",
  35317. 0x2789,
  35318. "a150",
  35319. 0x278a,
  35320. "a151",
  35321. 0x278b,
  35322. "a152",
  35323. 0x278c,
  35324. "a153",
  35325. 0x278d,
  35326. "a154",
  35327. 0x278e,
  35328. "a155",
  35329. 0x278f,
  35330. "a156",
  35331. 0x2790,
  35332. "a157",
  35333. 0x2791,
  35334. "a158",
  35335. 0x2792,
  35336. "a159",
  35337. 0x2793,
  35338. "a160",
  35339. 0x2794,
  35340. "a161",
  35341. 0x2192,
  35342. "a163",
  35343. 0x2194,
  35344. "a164",
  35345. 0x2195,
  35346. "a196",
  35347. 0x2798,
  35348. "a165",
  35349. 0x2799,
  35350. "a192",
  35351. 0x279a,
  35352. "a166",
  35353. 0x279b,
  35354. "a167",
  35355. 0x279c,
  35356. "a168",
  35357. 0x279d,
  35358. "a169",
  35359. 0x279e,
  35360. "a170",
  35361. 0x279f,
  35362. "a171",
  35363. 0x27a0,
  35364. "a172",
  35365. 0x27a1,
  35366. "a173",
  35367. 0x27a2,
  35368. "a162",
  35369. 0x27a3,
  35370. "a174",
  35371. 0x27a4,
  35372. "a175",
  35373. 0x27a5,
  35374. "a176",
  35375. 0x27a6,
  35376. "a177",
  35377. 0x27a7,
  35378. "a178",
  35379. 0x27a8,
  35380. "a179",
  35381. 0x27a9,
  35382. "a193",
  35383. 0x27aa,
  35384. "a180",
  35385. 0x27ab,
  35386. "a199",
  35387. 0x27ac,
  35388. "a181",
  35389. 0x27ad,
  35390. "a200",
  35391. 0x27ae,
  35392. "a182",
  35393. 0x27af,
  35394. "a201",
  35395. 0x27b1,
  35396. "a183",
  35397. 0x27b2,
  35398. "a184",
  35399. 0x27b3,
  35400. "a197",
  35401. 0x27b4,
  35402. "a185",
  35403. 0x27b5,
  35404. "a194",
  35405. 0x27b6,
  35406. "a198",
  35407. 0x27b7,
  35408. "a186",
  35409. 0x27b8,
  35410. "a195",
  35411. 0x27b9,
  35412. "a187",
  35413. 0x27ba,
  35414. "a188",
  35415. 0x27bb,
  35416. "a189",
  35417. 0x27bc,
  35418. "a190",
  35419. 0x27bd,
  35420. "a191",
  35421. 0x27be,
  35422. "a89",
  35423. 0x2768,
  35424. "a90",
  35425. 0x2769,
  35426. "a93",
  35427. 0x276a,
  35428. "a94",
  35429. 0x276b,
  35430. "a91",
  35431. 0x276c,
  35432. "a92",
  35433. 0x276d,
  35434. "a205",
  35435. 0x276e,
  35436. "a85",
  35437. 0x276f,
  35438. "a206",
  35439. 0x2770,
  35440. "a86",
  35441. 0x2771,
  35442. "a87",
  35443. 0x2772,
  35444. "a88",
  35445. 0x2773,
  35446. "a95",
  35447. 0x2774,
  35448. "a96",
  35449. 0x2775,
  35450. ".notdef",
  35451. 0x0000
  35452. ];
  35453. });
  35454. /***/ }),
  35455. /* 36 */
  35456. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35457. Object.defineProperty(exports, "__esModule", ({
  35458. value: true
  35459. }));
  35460. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = void 0;
  35461. var _core_utils = __w_pdfjs_require__(8);
  35462. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35463. t.ArialNarrow = "Helvetica";
  35464. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  35465. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  35466. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  35467. t.ArialBlack = "Helvetica";
  35468. t["ArialBlack-Bold"] = "Helvetica-Bold";
  35469. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  35470. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  35471. t["Arial-Black"] = "Helvetica";
  35472. t["Arial-Black-Bold"] = "Helvetica-Bold";
  35473. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  35474. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  35475. t.Arial = "Helvetica";
  35476. t["Arial-Bold"] = "Helvetica-Bold";
  35477. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  35478. t["Arial-Italic"] = "Helvetica-Oblique";
  35479. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  35480. t["Arial-BoldMT"] = "Helvetica-Bold";
  35481. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  35482. t.ArialMT = "Helvetica";
  35483. t["Courier-Bold"] = "Courier-Bold";
  35484. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  35485. t["Courier-Italic"] = "Courier-Oblique";
  35486. t.CourierNew = "Courier";
  35487. t["CourierNew-Bold"] = "Courier-Bold";
  35488. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  35489. t["CourierNew-Italic"] = "Courier-Oblique";
  35490. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  35491. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  35492. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  35493. t.CourierNewPSMT = "Courier";
  35494. t.Helvetica = "Helvetica";
  35495. t["Helvetica-Bold"] = "Helvetica-Bold";
  35496. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  35497. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  35498. t["Helvetica-Italic"] = "Helvetica-Oblique";
  35499. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  35500. t["Symbol-Bold"] = "Symbol";
  35501. t["Symbol-BoldItalic"] = "Symbol";
  35502. t["Symbol-Italic"] = "Symbol";
  35503. t.TimesNewRoman = "Times-Roman";
  35504. t["TimesNewRoman-Bold"] = "Times-Bold";
  35505. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  35506. t["TimesNewRoman-Italic"] = "Times-Italic";
  35507. t.TimesNewRomanPS = "Times-Roman";
  35508. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  35509. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  35510. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  35511. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  35512. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  35513. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  35514. t.TimesNewRomanPSMT = "Times-Roman";
  35515. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  35516. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  35517. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  35518. });
  35519. exports.getStdFontMap = getStdFontMap;
  35520. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35521. t.Calibri = "Helvetica";
  35522. t["Calibri-Bold"] = "Helvetica-Bold";
  35523. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  35524. t["Calibri-Italic"] = "Helvetica-Oblique";
  35525. t.CenturyGothic = "Helvetica";
  35526. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  35527. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  35528. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  35529. t.ComicSansMS = "Comic Sans MS";
  35530. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  35531. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  35532. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  35533. t.LucidaConsole = "Courier";
  35534. t["LucidaConsole-Bold"] = "Courier-Bold";
  35535. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  35536. t["LucidaConsole-Italic"] = "Courier-Oblique";
  35537. t["LucidaSans-Demi"] = "Helvetica-Bold";
  35538. t["MS-Gothic"] = "MS Gothic";
  35539. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  35540. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  35541. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  35542. t["MS-Mincho"] = "MS Mincho";
  35543. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  35544. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  35545. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  35546. t["MS-PGothic"] = "MS PGothic";
  35547. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  35548. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  35549. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  35550. t["MS-PMincho"] = "MS PMincho";
  35551. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  35552. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  35553. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  35554. t.NuptialScript = "Times-Italic";
  35555. t.SegoeUISymbol = "Helvetica";
  35556. t.Wingdings = "ZapfDingbats";
  35557. t["Wingdings-Regular"] = "ZapfDingbats";
  35558. });
  35559. exports.getNonStdFontMap = getNonStdFontMap;
  35560. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  35561. t["Adobe Jenson"] = true;
  35562. t["Adobe Text"] = true;
  35563. t.Albertus = true;
  35564. t.Aldus = true;
  35565. t.Alexandria = true;
  35566. t.Algerian = true;
  35567. t["American Typewriter"] = true;
  35568. t.Antiqua = true;
  35569. t.Apex = true;
  35570. t.Arno = true;
  35571. t.Aster = true;
  35572. t.Aurora = true;
  35573. t.Baskerville = true;
  35574. t.Bell = true;
  35575. t.Bembo = true;
  35576. t["Bembo Schoolbook"] = true;
  35577. t.Benguiat = true;
  35578. t["Berkeley Old Style"] = true;
  35579. t["Bernhard Modern"] = true;
  35580. t["Berthold City"] = true;
  35581. t.Bodoni = true;
  35582. t["Bauer Bodoni"] = true;
  35583. t["Book Antiqua"] = true;
  35584. t.Bookman = true;
  35585. t["Bordeaux Roman"] = true;
  35586. t["Californian FB"] = true;
  35587. t.Calisto = true;
  35588. t.Calvert = true;
  35589. t.Capitals = true;
  35590. t.Cambria = true;
  35591. t.Cartier = true;
  35592. t.Caslon = true;
  35593. t.Catull = true;
  35594. t.Centaur = true;
  35595. t["Century Old Style"] = true;
  35596. t["Century Schoolbook"] = true;
  35597. t.Chaparral = true;
  35598. t["Charis SIL"] = true;
  35599. t.Cheltenham = true;
  35600. t["Cholla Slab"] = true;
  35601. t.Clarendon = true;
  35602. t.Clearface = true;
  35603. t.Cochin = true;
  35604. t.Colonna = true;
  35605. t["Computer Modern"] = true;
  35606. t["Concrete Roman"] = true;
  35607. t.Constantia = true;
  35608. t["Cooper Black"] = true;
  35609. t.Corona = true;
  35610. t.Ecotype = true;
  35611. t.Egyptienne = true;
  35612. t.Elephant = true;
  35613. t.Excelsior = true;
  35614. t.Fairfield = true;
  35615. t["FF Scala"] = true;
  35616. t.Folkard = true;
  35617. t.Footlight = true;
  35618. t.FreeSerif = true;
  35619. t["Friz Quadrata"] = true;
  35620. t.Garamond = true;
  35621. t.Gentium = true;
  35622. t.Georgia = true;
  35623. t.Gloucester = true;
  35624. t["Goudy Old Style"] = true;
  35625. t["Goudy Schoolbook"] = true;
  35626. t["Goudy Pro Font"] = true;
  35627. t.Granjon = true;
  35628. t["Guardian Egyptian"] = true;
  35629. t.Heather = true;
  35630. t.Hercules = true;
  35631. t["High Tower Text"] = true;
  35632. t.Hiroshige = true;
  35633. t["Hoefler Text"] = true;
  35634. t["Humana Serif"] = true;
  35635. t.Imprint = true;
  35636. t["Ionic No. 5"] = true;
  35637. t.Janson = true;
  35638. t.Joanna = true;
  35639. t.Korinna = true;
  35640. t.Lexicon = true;
  35641. t["Liberation Serif"] = true;
  35642. t["Linux Libertine"] = true;
  35643. t.Literaturnaya = true;
  35644. t.Lucida = true;
  35645. t["Lucida Bright"] = true;
  35646. t.Melior = true;
  35647. t.Memphis = true;
  35648. t.Miller = true;
  35649. t.Minion = true;
  35650. t.Modern = true;
  35651. t["Mona Lisa"] = true;
  35652. t["Mrs Eaves"] = true;
  35653. t["MS Serif"] = true;
  35654. t["Museo Slab"] = true;
  35655. t["New York"] = true;
  35656. t["Nimbus Roman"] = true;
  35657. t["NPS Rawlinson Roadway"] = true;
  35658. t.NuptialScript = true;
  35659. t.Palatino = true;
  35660. t.Perpetua = true;
  35661. t.Plantin = true;
  35662. t["Plantin Schoolbook"] = true;
  35663. t.Playbill = true;
  35664. t["Poor Richard"] = true;
  35665. t["Rawlinson Roadway"] = true;
  35666. t.Renault = true;
  35667. t.Requiem = true;
  35668. t.Rockwell = true;
  35669. t.Roman = true;
  35670. t["Rotis Serif"] = true;
  35671. t.Sabon = true;
  35672. t.Scala = true;
  35673. t.Seagull = true;
  35674. t.Sistina = true;
  35675. t.Souvenir = true;
  35676. t.STIX = true;
  35677. t["Stone Informal"] = true;
  35678. t["Stone Serif"] = true;
  35679. t.Sylfaen = true;
  35680. t.Times = true;
  35681. t.Trajan = true;
  35682. t["Trinité"] = true;
  35683. t["Trump Mediaeval"] = true;
  35684. t.Utopia = true;
  35685. t["Vale Type"] = true;
  35686. t["Bitstream Vera"] = true;
  35687. t["Vera Serif"] = true;
  35688. t.Versailles = true;
  35689. t.Wanted = true;
  35690. t.Weiss = true;
  35691. t["Wide Latin"] = true;
  35692. t.Windsor = true;
  35693. t.XITS = true;
  35694. });
  35695. exports.getSerifFonts = getSerifFonts;
  35696. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  35697. t.Dingbats = true;
  35698. t.Symbol = true;
  35699. t.ZapfDingbats = true;
  35700. });
  35701. exports.getSymbolsFonts = getSymbolsFonts;
  35702. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  35703. t[2] = 10;
  35704. t[3] = 32;
  35705. t[4] = 33;
  35706. t[5] = 34;
  35707. t[6] = 35;
  35708. t[7] = 36;
  35709. t[8] = 37;
  35710. t[9] = 38;
  35711. t[10] = 39;
  35712. t[11] = 40;
  35713. t[12] = 41;
  35714. t[13] = 42;
  35715. t[14] = 43;
  35716. t[15] = 44;
  35717. t[16] = 45;
  35718. t[17] = 46;
  35719. t[18] = 47;
  35720. t[19] = 48;
  35721. t[20] = 49;
  35722. t[21] = 50;
  35723. t[22] = 51;
  35724. t[23] = 52;
  35725. t[24] = 53;
  35726. t[25] = 54;
  35727. t[26] = 55;
  35728. t[27] = 56;
  35729. t[28] = 57;
  35730. t[29] = 58;
  35731. t[30] = 894;
  35732. t[31] = 60;
  35733. t[32] = 61;
  35734. t[33] = 62;
  35735. t[34] = 63;
  35736. t[35] = 64;
  35737. t[36] = 65;
  35738. t[37] = 66;
  35739. t[38] = 67;
  35740. t[39] = 68;
  35741. t[40] = 69;
  35742. t[41] = 70;
  35743. t[42] = 71;
  35744. t[43] = 72;
  35745. t[44] = 73;
  35746. t[45] = 74;
  35747. t[46] = 75;
  35748. t[47] = 76;
  35749. t[48] = 77;
  35750. t[49] = 78;
  35751. t[50] = 79;
  35752. t[51] = 80;
  35753. t[52] = 81;
  35754. t[53] = 82;
  35755. t[54] = 83;
  35756. t[55] = 84;
  35757. t[56] = 85;
  35758. t[57] = 86;
  35759. t[58] = 87;
  35760. t[59] = 88;
  35761. t[60] = 89;
  35762. t[61] = 90;
  35763. t[62] = 91;
  35764. t[63] = 92;
  35765. t[64] = 93;
  35766. t[65] = 94;
  35767. t[66] = 95;
  35768. t[67] = 96;
  35769. t[68] = 97;
  35770. t[69] = 98;
  35771. t[70] = 99;
  35772. t[71] = 100;
  35773. t[72] = 101;
  35774. t[73] = 102;
  35775. t[74] = 103;
  35776. t[75] = 104;
  35777. t[76] = 105;
  35778. t[77] = 106;
  35779. t[78] = 107;
  35780. t[79] = 108;
  35781. t[80] = 109;
  35782. t[81] = 110;
  35783. t[82] = 111;
  35784. t[83] = 112;
  35785. t[84] = 113;
  35786. t[85] = 114;
  35787. t[86] = 115;
  35788. t[87] = 116;
  35789. t[88] = 117;
  35790. t[89] = 118;
  35791. t[90] = 119;
  35792. t[91] = 120;
  35793. t[92] = 121;
  35794. t[93] = 122;
  35795. t[94] = 123;
  35796. t[95] = 124;
  35797. t[96] = 125;
  35798. t[97] = 126;
  35799. t[98] = 196;
  35800. t[99] = 197;
  35801. t[100] = 199;
  35802. t[101] = 201;
  35803. t[102] = 209;
  35804. t[103] = 214;
  35805. t[104] = 220;
  35806. t[105] = 225;
  35807. t[106] = 224;
  35808. t[107] = 226;
  35809. t[108] = 228;
  35810. t[109] = 227;
  35811. t[110] = 229;
  35812. t[111] = 231;
  35813. t[112] = 233;
  35814. t[113] = 232;
  35815. t[114] = 234;
  35816. t[115] = 235;
  35817. t[116] = 237;
  35818. t[117] = 236;
  35819. t[118] = 238;
  35820. t[119] = 239;
  35821. t[120] = 241;
  35822. t[121] = 243;
  35823. t[122] = 242;
  35824. t[123] = 244;
  35825. t[124] = 246;
  35826. t[125] = 245;
  35827. t[126] = 250;
  35828. t[127] = 249;
  35829. t[128] = 251;
  35830. t[129] = 252;
  35831. t[130] = 8224;
  35832. t[131] = 176;
  35833. t[132] = 162;
  35834. t[133] = 163;
  35835. t[134] = 167;
  35836. t[135] = 8226;
  35837. t[136] = 182;
  35838. t[137] = 223;
  35839. t[138] = 174;
  35840. t[139] = 169;
  35841. t[140] = 8482;
  35842. t[141] = 180;
  35843. t[142] = 168;
  35844. t[143] = 8800;
  35845. t[144] = 198;
  35846. t[145] = 216;
  35847. t[146] = 8734;
  35848. t[147] = 177;
  35849. t[148] = 8804;
  35850. t[149] = 8805;
  35851. t[150] = 165;
  35852. t[151] = 181;
  35853. t[152] = 8706;
  35854. t[153] = 8721;
  35855. t[154] = 8719;
  35856. t[156] = 8747;
  35857. t[157] = 170;
  35858. t[158] = 186;
  35859. t[159] = 8486;
  35860. t[160] = 230;
  35861. t[161] = 248;
  35862. t[162] = 191;
  35863. t[163] = 161;
  35864. t[164] = 172;
  35865. t[165] = 8730;
  35866. t[166] = 402;
  35867. t[167] = 8776;
  35868. t[168] = 8710;
  35869. t[169] = 171;
  35870. t[170] = 187;
  35871. t[171] = 8230;
  35872. t[210] = 218;
  35873. t[223] = 711;
  35874. t[224] = 321;
  35875. t[225] = 322;
  35876. t[227] = 353;
  35877. t[229] = 382;
  35878. t[234] = 253;
  35879. t[252] = 263;
  35880. t[253] = 268;
  35881. t[254] = 269;
  35882. t[258] = 258;
  35883. t[260] = 260;
  35884. t[261] = 261;
  35885. t[265] = 280;
  35886. t[266] = 281;
  35887. t[268] = 283;
  35888. t[269] = 313;
  35889. t[275] = 323;
  35890. t[276] = 324;
  35891. t[278] = 328;
  35892. t[284] = 345;
  35893. t[285] = 346;
  35894. t[286] = 347;
  35895. t[292] = 367;
  35896. t[295] = 377;
  35897. t[296] = 378;
  35898. t[298] = 380;
  35899. t[305] = 963;
  35900. t[306] = 964;
  35901. t[307] = 966;
  35902. t[308] = 8215;
  35903. t[309] = 8252;
  35904. t[310] = 8319;
  35905. t[311] = 8359;
  35906. t[312] = 8592;
  35907. t[313] = 8593;
  35908. t[337] = 9552;
  35909. t[493] = 1039;
  35910. t[494] = 1040;
  35911. t[705] = 1524;
  35912. t[706] = 8362;
  35913. t[710] = 64288;
  35914. t[711] = 64298;
  35915. t[759] = 1617;
  35916. t[761] = 1776;
  35917. t[763] = 1778;
  35918. t[775] = 1652;
  35919. t[777] = 1764;
  35920. t[778] = 1780;
  35921. t[779] = 1781;
  35922. t[780] = 1782;
  35923. t[782] = 771;
  35924. t[783] = 64726;
  35925. t[786] = 8363;
  35926. t[788] = 8532;
  35927. t[790] = 768;
  35928. t[791] = 769;
  35929. t[792] = 768;
  35930. t[795] = 803;
  35931. t[797] = 64336;
  35932. t[798] = 64337;
  35933. t[799] = 64342;
  35934. t[800] = 64343;
  35935. t[801] = 64344;
  35936. t[802] = 64345;
  35937. t[803] = 64362;
  35938. t[804] = 64363;
  35939. t[805] = 64364;
  35940. t[2424] = 7821;
  35941. t[2425] = 7822;
  35942. t[2426] = 7823;
  35943. t[2427] = 7824;
  35944. t[2428] = 7825;
  35945. t[2429] = 7826;
  35946. t[2430] = 7827;
  35947. t[2433] = 7682;
  35948. t[2678] = 8045;
  35949. t[2679] = 8046;
  35950. t[2830] = 1552;
  35951. t[2838] = 686;
  35952. t[2840] = 751;
  35953. t[2842] = 753;
  35954. t[2843] = 754;
  35955. t[2844] = 755;
  35956. t[2846] = 757;
  35957. t[2856] = 767;
  35958. t[2857] = 848;
  35959. t[2858] = 849;
  35960. t[2862] = 853;
  35961. t[2863] = 854;
  35962. t[2864] = 855;
  35963. t[2865] = 861;
  35964. t[2866] = 862;
  35965. t[2906] = 7460;
  35966. t[2908] = 7462;
  35967. t[2909] = 7463;
  35968. t[2910] = 7464;
  35969. t[2912] = 7466;
  35970. t[2913] = 7467;
  35971. t[2914] = 7468;
  35972. t[2916] = 7470;
  35973. t[2917] = 7471;
  35974. t[2918] = 7472;
  35975. t[2920] = 7474;
  35976. t[2921] = 7475;
  35977. t[2922] = 7476;
  35978. t[2924] = 7478;
  35979. t[2925] = 7479;
  35980. t[2926] = 7480;
  35981. t[2928] = 7482;
  35982. t[2929] = 7483;
  35983. t[2930] = 7484;
  35984. t[2932] = 7486;
  35985. t[2933] = 7487;
  35986. t[2934] = 7488;
  35987. t[2936] = 7490;
  35988. t[2937] = 7491;
  35989. t[2938] = 7492;
  35990. t[2940] = 7494;
  35991. t[2941] = 7495;
  35992. t[2942] = 7496;
  35993. t[2944] = 7498;
  35994. t[2946] = 7500;
  35995. t[2948] = 7502;
  35996. t[2950] = 7504;
  35997. t[2951] = 7505;
  35998. t[2952] = 7506;
  35999. t[2954] = 7508;
  36000. t[2955] = 7509;
  36001. t[2956] = 7510;
  36002. t[2958] = 7512;
  36003. t[2959] = 7513;
  36004. t[2960] = 7514;
  36005. t[2962] = 7516;
  36006. t[2963] = 7517;
  36007. t[2964] = 7518;
  36008. t[2966] = 7520;
  36009. t[2967] = 7521;
  36010. t[2968] = 7522;
  36011. t[2970] = 7524;
  36012. t[2971] = 7525;
  36013. t[2972] = 7526;
  36014. t[2974] = 7528;
  36015. t[2975] = 7529;
  36016. t[2976] = 7530;
  36017. t[2978] = 1537;
  36018. t[2979] = 1538;
  36019. t[2980] = 1539;
  36020. t[2982] = 1549;
  36021. t[2983] = 1551;
  36022. t[2984] = 1552;
  36023. t[2986] = 1554;
  36024. t[2987] = 1555;
  36025. t[2988] = 1556;
  36026. t[2990] = 1623;
  36027. t[2991] = 1624;
  36028. t[2995] = 1775;
  36029. t[2999] = 1791;
  36030. t[3002] = 64290;
  36031. t[3003] = 64291;
  36032. t[3004] = 64292;
  36033. t[3006] = 64294;
  36034. t[3007] = 64295;
  36035. t[3008] = 64296;
  36036. t[3011] = 1900;
  36037. t[3014] = 8223;
  36038. t[3015] = 8244;
  36039. t[3017] = 7532;
  36040. t[3018] = 7533;
  36041. t[3019] = 7534;
  36042. t[3075] = 7590;
  36043. t[3076] = 7591;
  36044. t[3079] = 7594;
  36045. t[3080] = 7595;
  36046. t[3083] = 7598;
  36047. t[3084] = 7599;
  36048. t[3087] = 7602;
  36049. t[3088] = 7603;
  36050. t[3091] = 7606;
  36051. t[3092] = 7607;
  36052. t[3095] = 7610;
  36053. t[3096] = 7611;
  36054. t[3099] = 7614;
  36055. t[3100] = 7615;
  36056. t[3103] = 7618;
  36057. t[3104] = 7619;
  36058. t[3107] = 8337;
  36059. t[3108] = 8338;
  36060. t[3116] = 1884;
  36061. t[3119] = 1885;
  36062. t[3120] = 1885;
  36063. t[3123] = 1886;
  36064. t[3124] = 1886;
  36065. t[3127] = 1887;
  36066. t[3128] = 1887;
  36067. t[3131] = 1888;
  36068. t[3132] = 1888;
  36069. t[3135] = 1889;
  36070. t[3136] = 1889;
  36071. t[3139] = 1890;
  36072. t[3140] = 1890;
  36073. t[3143] = 1891;
  36074. t[3144] = 1891;
  36075. t[3147] = 1892;
  36076. t[3148] = 1892;
  36077. t[3153] = 580;
  36078. t[3154] = 581;
  36079. t[3157] = 584;
  36080. t[3158] = 585;
  36081. t[3161] = 588;
  36082. t[3162] = 589;
  36083. t[3165] = 891;
  36084. t[3166] = 892;
  36085. t[3169] = 1274;
  36086. t[3170] = 1275;
  36087. t[3173] = 1278;
  36088. t[3174] = 1279;
  36089. t[3181] = 7622;
  36090. t[3182] = 7623;
  36091. t[3282] = 11799;
  36092. t[3316] = 578;
  36093. t[3379] = 42785;
  36094. t[3393] = 1159;
  36095. t[3416] = 8377;
  36096. });
  36097. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  36098. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  36099. t[227] = 322;
  36100. t[264] = 261;
  36101. t[291] = 346;
  36102. });
  36103. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  36104. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  36105. t[1] = 32;
  36106. t[4] = 65;
  36107. t[17] = 66;
  36108. t[18] = 67;
  36109. t[24] = 68;
  36110. t[28] = 69;
  36111. t[38] = 70;
  36112. t[39] = 71;
  36113. t[44] = 72;
  36114. t[47] = 73;
  36115. t[58] = 74;
  36116. t[60] = 75;
  36117. t[62] = 76;
  36118. t[68] = 77;
  36119. t[69] = 78;
  36120. t[75] = 79;
  36121. t[87] = 80;
  36122. t[89] = 81;
  36123. t[90] = 82;
  36124. t[94] = 83;
  36125. t[100] = 84;
  36126. t[104] = 85;
  36127. t[115] = 86;
  36128. t[116] = 87;
  36129. t[121] = 88;
  36130. t[122] = 89;
  36131. t[127] = 90;
  36132. t[258] = 97;
  36133. t[268] = 261;
  36134. t[271] = 98;
  36135. t[272] = 99;
  36136. t[273] = 263;
  36137. t[282] = 100;
  36138. t[286] = 101;
  36139. t[295] = 281;
  36140. t[296] = 102;
  36141. t[336] = 103;
  36142. t[346] = 104;
  36143. t[349] = 105;
  36144. t[361] = 106;
  36145. t[364] = 107;
  36146. t[367] = 108;
  36147. t[371] = 322;
  36148. t[373] = 109;
  36149. t[374] = 110;
  36150. t[381] = 111;
  36151. t[383] = 243;
  36152. t[393] = 112;
  36153. t[395] = 113;
  36154. t[396] = 114;
  36155. t[400] = 115;
  36156. t[401] = 347;
  36157. t[410] = 116;
  36158. t[437] = 117;
  36159. t[448] = 118;
  36160. t[449] = 119;
  36161. t[454] = 120;
  36162. t[455] = 121;
  36163. t[460] = 122;
  36164. t[463] = 380;
  36165. t[853] = 44;
  36166. t[855] = 58;
  36167. t[856] = 46;
  36168. t[876] = 47;
  36169. t[878] = 45;
  36170. t[882] = 45;
  36171. t[894] = 40;
  36172. t[895] = 41;
  36173. t[896] = 91;
  36174. t[897] = 93;
  36175. t[923] = 64;
  36176. t[1004] = 48;
  36177. t[1005] = 49;
  36178. t[1006] = 50;
  36179. t[1007] = 51;
  36180. t[1008] = 52;
  36181. t[1009] = 53;
  36182. t[1010] = 54;
  36183. t[1011] = 55;
  36184. t[1012] = 56;
  36185. t[1013] = 57;
  36186. t[1081] = 37;
  36187. t[1085] = 43;
  36188. t[1086] = 45;
  36189. });
  36190. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  36191. /***/ }),
  36192. /* 37 */
  36193. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  36194. __w_pdfjs_require__.r(__webpack_exports__);
  36195. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  36196. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  36197. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  36198. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  36199. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  36200. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  36201. /* harmony export */ });
  36202. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  36203. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  36204. t[63721] = 0x00a9;
  36205. t[63193] = 0x00a9;
  36206. t[63720] = 0x00ae;
  36207. t[63194] = 0x00ae;
  36208. t[63722] = 0x2122;
  36209. t[63195] = 0x2122;
  36210. t[63729] = 0x23a7;
  36211. t[63730] = 0x23a8;
  36212. t[63731] = 0x23a9;
  36213. t[63740] = 0x23ab;
  36214. t[63741] = 0x23ac;
  36215. t[63742] = 0x23ad;
  36216. t[63726] = 0x23a1;
  36217. t[63727] = 0x23a2;
  36218. t[63728] = 0x23a3;
  36219. t[63737] = 0x23a4;
  36220. t[63738] = 0x23a5;
  36221. t[63739] = 0x23a6;
  36222. t[63723] = 0x239b;
  36223. t[63724] = 0x239c;
  36224. t[63725] = 0x239d;
  36225. t[63734] = 0x239e;
  36226. t[63735] = 0x239f;
  36227. t[63736] = 0x23a0;
  36228. });
  36229. function mapSpecialUnicodeValues(code) {
  36230. if (code >= 0xfff0 && code <= 0xffff) {
  36231. return 0;
  36232. } else if (code >= 0xf600 && code <= 0xf8ff) {
  36233. return getSpecialPUASymbols()[code] || code;
  36234. } else if (code === 0x00ad) {
  36235. return 0x002d;
  36236. }
  36237. return code;
  36238. }
  36239. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  36240. let unicode = glyphsUnicodeMap[name];
  36241. if (unicode !== undefined) {
  36242. return unicode;
  36243. }
  36244. if (!name) {
  36245. return -1;
  36246. }
  36247. if (name[0] === "u") {
  36248. const nameLen = name.length;
  36249. let hexStr;
  36250. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  36251. hexStr = name.substring(3);
  36252. } else if (nameLen >= 5 && nameLen <= 7) {
  36253. hexStr = name.substring(1);
  36254. } else {
  36255. return -1;
  36256. }
  36257. if (hexStr === hexStr.toUpperCase()) {
  36258. unicode = parseInt(hexStr, 16);
  36259. if (unicode >= 0) {
  36260. return unicode;
  36261. }
  36262. }
  36263. }
  36264. return -1;
  36265. }
  36266. const UnicodeRanges = [
  36267. {
  36268. begin: 0x0000,
  36269. end: 0x007f
  36270. },
  36271. {
  36272. begin: 0x0080,
  36273. end: 0x00ff
  36274. },
  36275. {
  36276. begin: 0x0100,
  36277. end: 0x017f
  36278. },
  36279. {
  36280. begin: 0x0180,
  36281. end: 0x024f
  36282. },
  36283. {
  36284. begin: 0x0250,
  36285. end: 0x02af
  36286. },
  36287. {
  36288. begin: 0x02b0,
  36289. end: 0x02ff
  36290. },
  36291. {
  36292. begin: 0x0300,
  36293. end: 0x036f
  36294. },
  36295. {
  36296. begin: 0x0370,
  36297. end: 0x03ff
  36298. },
  36299. {
  36300. begin: 0x2c80,
  36301. end: 0x2cff
  36302. },
  36303. {
  36304. begin: 0x0400,
  36305. end: 0x04ff
  36306. },
  36307. {
  36308. begin: 0x0530,
  36309. end: 0x058f
  36310. },
  36311. {
  36312. begin: 0x0590,
  36313. end: 0x05ff
  36314. },
  36315. {
  36316. begin: 0xa500,
  36317. end: 0xa63f
  36318. },
  36319. {
  36320. begin: 0x0600,
  36321. end: 0x06ff
  36322. },
  36323. {
  36324. begin: 0x07c0,
  36325. end: 0x07ff
  36326. },
  36327. {
  36328. begin: 0x0900,
  36329. end: 0x097f
  36330. },
  36331. {
  36332. begin: 0x0980,
  36333. end: 0x09ff
  36334. },
  36335. {
  36336. begin: 0x0a00,
  36337. end: 0x0a7f
  36338. },
  36339. {
  36340. begin: 0x0a80,
  36341. end: 0x0aff
  36342. },
  36343. {
  36344. begin: 0x0b00,
  36345. end: 0x0b7f
  36346. },
  36347. {
  36348. begin: 0x0b80,
  36349. end: 0x0bff
  36350. },
  36351. {
  36352. begin: 0x0c00,
  36353. end: 0x0c7f
  36354. },
  36355. {
  36356. begin: 0x0c80,
  36357. end: 0x0cff
  36358. },
  36359. {
  36360. begin: 0x0d00,
  36361. end: 0x0d7f
  36362. },
  36363. {
  36364. begin: 0x0e00,
  36365. end: 0x0e7f
  36366. },
  36367. {
  36368. begin: 0x0e80,
  36369. end: 0x0eff
  36370. },
  36371. {
  36372. begin: 0x10a0,
  36373. end: 0x10ff
  36374. },
  36375. {
  36376. begin: 0x1b00,
  36377. end: 0x1b7f
  36378. },
  36379. {
  36380. begin: 0x1100,
  36381. end: 0x11ff
  36382. },
  36383. {
  36384. begin: 0x1e00,
  36385. end: 0x1eff
  36386. },
  36387. {
  36388. begin: 0x1f00,
  36389. end: 0x1fff
  36390. },
  36391. {
  36392. begin: 0x2000,
  36393. end: 0x206f
  36394. },
  36395. {
  36396. begin: 0x2070,
  36397. end: 0x209f
  36398. },
  36399. {
  36400. begin: 0x20a0,
  36401. end: 0x20cf
  36402. },
  36403. {
  36404. begin: 0x20d0,
  36405. end: 0x20ff
  36406. },
  36407. {
  36408. begin: 0x2100,
  36409. end: 0x214f
  36410. },
  36411. {
  36412. begin: 0x2150,
  36413. end: 0x218f
  36414. },
  36415. {
  36416. begin: 0x2190,
  36417. end: 0x21ff
  36418. },
  36419. {
  36420. begin: 0x2200,
  36421. end: 0x22ff
  36422. },
  36423. {
  36424. begin: 0x2300,
  36425. end: 0x23ff
  36426. },
  36427. {
  36428. begin: 0x2400,
  36429. end: 0x243f
  36430. },
  36431. {
  36432. begin: 0x2440,
  36433. end: 0x245f
  36434. },
  36435. {
  36436. begin: 0x2460,
  36437. end: 0x24ff
  36438. },
  36439. {
  36440. begin: 0x2500,
  36441. end: 0x257f
  36442. },
  36443. {
  36444. begin: 0x2580,
  36445. end: 0x259f
  36446. },
  36447. {
  36448. begin: 0x25a0,
  36449. end: 0x25ff
  36450. },
  36451. {
  36452. begin: 0x2600,
  36453. end: 0x26ff
  36454. },
  36455. {
  36456. begin: 0x2700,
  36457. end: 0x27bf
  36458. },
  36459. {
  36460. begin: 0x3000,
  36461. end: 0x303f
  36462. },
  36463. {
  36464. begin: 0x3040,
  36465. end: 0x309f
  36466. },
  36467. {
  36468. begin: 0x30a0,
  36469. end: 0x30ff
  36470. },
  36471. {
  36472. begin: 0x3100,
  36473. end: 0x312f
  36474. },
  36475. {
  36476. begin: 0x3130,
  36477. end: 0x318f
  36478. },
  36479. {
  36480. begin: 0xa840,
  36481. end: 0xa87f
  36482. },
  36483. {
  36484. begin: 0x3200,
  36485. end: 0x32ff
  36486. },
  36487. {
  36488. begin: 0x3300,
  36489. end: 0x33ff
  36490. },
  36491. {
  36492. begin: 0xac00,
  36493. end: 0xd7af
  36494. },
  36495. {
  36496. begin: 0xd800,
  36497. end: 0xdfff
  36498. },
  36499. {
  36500. begin: 0x10900,
  36501. end: 0x1091f
  36502. },
  36503. {
  36504. begin: 0x4e00,
  36505. end: 0x9fff
  36506. },
  36507. {
  36508. begin: 0xe000,
  36509. end: 0xf8ff
  36510. },
  36511. {
  36512. begin: 0x31c0,
  36513. end: 0x31ef
  36514. },
  36515. {
  36516. begin: 0xfb00,
  36517. end: 0xfb4f
  36518. },
  36519. {
  36520. begin: 0xfb50,
  36521. end: 0xfdff
  36522. },
  36523. {
  36524. begin: 0xfe20,
  36525. end: 0xfe2f
  36526. },
  36527. {
  36528. begin: 0xfe10,
  36529. end: 0xfe1f
  36530. },
  36531. {
  36532. begin: 0xfe50,
  36533. end: 0xfe6f
  36534. },
  36535. {
  36536. begin: 0xfe70,
  36537. end: 0xfeff
  36538. },
  36539. {
  36540. begin: 0xff00,
  36541. end: 0xffef
  36542. },
  36543. {
  36544. begin: 0xfff0,
  36545. end: 0xffff
  36546. },
  36547. {
  36548. begin: 0x0f00,
  36549. end: 0x0fff
  36550. },
  36551. {
  36552. begin: 0x0700,
  36553. end: 0x074f
  36554. },
  36555. {
  36556. begin: 0x0780,
  36557. end: 0x07bf
  36558. },
  36559. {
  36560. begin: 0x0d80,
  36561. end: 0x0dff
  36562. },
  36563. {
  36564. begin: 0x1000,
  36565. end: 0x109f
  36566. },
  36567. {
  36568. begin: 0x1200,
  36569. end: 0x137f
  36570. },
  36571. {
  36572. begin: 0x13a0,
  36573. end: 0x13ff
  36574. },
  36575. {
  36576. begin: 0x1400,
  36577. end: 0x167f
  36578. },
  36579. {
  36580. begin: 0x1680,
  36581. end: 0x169f
  36582. },
  36583. {
  36584. begin: 0x16a0,
  36585. end: 0x16ff
  36586. },
  36587. {
  36588. begin: 0x1780,
  36589. end: 0x17ff
  36590. },
  36591. {
  36592. begin: 0x1800,
  36593. end: 0x18af
  36594. },
  36595. {
  36596. begin: 0x2800,
  36597. end: 0x28ff
  36598. },
  36599. {
  36600. begin: 0xa000,
  36601. end: 0xa48f
  36602. },
  36603. {
  36604. begin: 0x1700,
  36605. end: 0x171f
  36606. },
  36607. {
  36608. begin: 0x10300,
  36609. end: 0x1032f
  36610. },
  36611. {
  36612. begin: 0x10330,
  36613. end: 0x1034f
  36614. },
  36615. {
  36616. begin: 0x10400,
  36617. end: 0x1044f
  36618. },
  36619. {
  36620. begin: 0x1d000,
  36621. end: 0x1d0ff
  36622. },
  36623. {
  36624. begin: 0x1d400,
  36625. end: 0x1d7ff
  36626. },
  36627. {
  36628. begin: 0xff000,
  36629. end: 0xffffd
  36630. },
  36631. {
  36632. begin: 0xfe00,
  36633. end: 0xfe0f
  36634. },
  36635. {
  36636. begin: 0xe0000,
  36637. end: 0xe007f
  36638. },
  36639. {
  36640. begin: 0x1900,
  36641. end: 0x194f
  36642. },
  36643. {
  36644. begin: 0x1950,
  36645. end: 0x197f
  36646. },
  36647. {
  36648. begin: 0x1980,
  36649. end: 0x19df
  36650. },
  36651. {
  36652. begin: 0x1a00,
  36653. end: 0x1a1f
  36654. },
  36655. {
  36656. begin: 0x2c00,
  36657. end: 0x2c5f
  36658. },
  36659. {
  36660. begin: 0x2d30,
  36661. end: 0x2d7f
  36662. },
  36663. {
  36664. begin: 0x4dc0,
  36665. end: 0x4dff
  36666. },
  36667. {
  36668. begin: 0xa800,
  36669. end: 0xa82f
  36670. },
  36671. {
  36672. begin: 0x10000,
  36673. end: 0x1007f
  36674. },
  36675. {
  36676. begin: 0x10140,
  36677. end: 0x1018f
  36678. },
  36679. {
  36680. begin: 0x10380,
  36681. end: 0x1039f
  36682. },
  36683. {
  36684. begin: 0x103a0,
  36685. end: 0x103df
  36686. },
  36687. {
  36688. begin: 0x10450,
  36689. end: 0x1047f
  36690. },
  36691. {
  36692. begin: 0x10480,
  36693. end: 0x104af
  36694. },
  36695. {
  36696. begin: 0x10800,
  36697. end: 0x1083f
  36698. },
  36699. {
  36700. begin: 0x10a00,
  36701. end: 0x10a5f
  36702. },
  36703. {
  36704. begin: 0x1d300,
  36705. end: 0x1d35f
  36706. },
  36707. {
  36708. begin: 0x12000,
  36709. end: 0x123ff
  36710. },
  36711. {
  36712. begin: 0x1d360,
  36713. end: 0x1d37f
  36714. },
  36715. {
  36716. begin: 0x1b80,
  36717. end: 0x1bbf
  36718. },
  36719. {
  36720. begin: 0x1c00,
  36721. end: 0x1c4f
  36722. },
  36723. {
  36724. begin: 0x1c50,
  36725. end: 0x1c7f
  36726. },
  36727. {
  36728. begin: 0xa880,
  36729. end: 0xa8df
  36730. },
  36731. {
  36732. begin: 0xa900,
  36733. end: 0xa92f
  36734. },
  36735. {
  36736. begin: 0xa930,
  36737. end: 0xa95f
  36738. },
  36739. {
  36740. begin: 0xaa00,
  36741. end: 0xaa5f
  36742. },
  36743. {
  36744. begin: 0x10190,
  36745. end: 0x101cf
  36746. },
  36747. {
  36748. begin: 0x101d0,
  36749. end: 0x101ff
  36750. },
  36751. {
  36752. begin: 0x102a0,
  36753. end: 0x102df
  36754. },
  36755. {
  36756. begin: 0x1f030,
  36757. end: 0x1f09f
  36758. }
  36759. ];
  36760. function getUnicodeRangeFor(value) {
  36761. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  36762. const range = UnicodeRanges[i];
  36763. if (value >= range.begin && value < range.end) {
  36764. return i;
  36765. }
  36766. }
  36767. return -1;
  36768. }
  36769. function isRTLRangeFor(value) {
  36770. let range = UnicodeRanges[13];
  36771. if (value >= range.begin && value < range.end) {
  36772. return true;
  36773. }
  36774. range = UnicodeRanges[11];
  36775. if (value >= range.begin && value < range.end) {
  36776. return true;
  36777. }
  36778. return false;
  36779. }
  36780. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  36781. return [
  36782. "\u00A8",
  36783. "\u0020\u0308",
  36784. "\u00AF",
  36785. "\u0020\u0304",
  36786. "\u00B4",
  36787. "\u0020\u0301",
  36788. "\u00B5",
  36789. "\u03BC",
  36790. "\u00B8",
  36791. "\u0020\u0327",
  36792. "\u0132",
  36793. "\u0049\u004A",
  36794. "\u0133",
  36795. "\u0069\u006A",
  36796. "\u013F",
  36797. "\u004C\u00B7",
  36798. "\u0140",
  36799. "\u006C\u00B7",
  36800. "\u0149",
  36801. "\u02BC\u006E",
  36802. "\u017F",
  36803. "\u0073",
  36804. "\u01C4",
  36805. "\u0044\u017D",
  36806. "\u01C5",
  36807. "\u0044\u017E",
  36808. "\u01C6",
  36809. "\u0064\u017E",
  36810. "\u01C7",
  36811. "\u004C\u004A",
  36812. "\u01C8",
  36813. "\u004C\u006A",
  36814. "\u01C9",
  36815. "\u006C\u006A",
  36816. "\u01CA",
  36817. "\u004E\u004A",
  36818. "\u01CB",
  36819. "\u004E\u006A",
  36820. "\u01CC",
  36821. "\u006E\u006A",
  36822. "\u01F1",
  36823. "\u0044\u005A",
  36824. "\u01F2",
  36825. "\u0044\u007A",
  36826. "\u01F3",
  36827. "\u0064\u007A",
  36828. "\u02D8",
  36829. "\u0020\u0306",
  36830. "\u02D9",
  36831. "\u0020\u0307",
  36832. "\u02DA",
  36833. "\u0020\u030A",
  36834. "\u02DB",
  36835. "\u0020\u0328",
  36836. "\u02DC",
  36837. "\u0020\u0303",
  36838. "\u02DD",
  36839. "\u0020\u030B",
  36840. "\u037A",
  36841. "\u0020\u0345",
  36842. "\u0384",
  36843. "\u0020\u0301",
  36844. "\u03D0",
  36845. "\u03B2",
  36846. "\u03D1",
  36847. "\u03B8",
  36848. "\u03D2",
  36849. "\u03A5",
  36850. "\u03D5",
  36851. "\u03C6",
  36852. "\u03D6",
  36853. "\u03C0",
  36854. "\u03F0",
  36855. "\u03BA",
  36856. "\u03F1",
  36857. "\u03C1",
  36858. "\u03F2",
  36859. "\u03C2",
  36860. "\u03F4",
  36861. "\u0398",
  36862. "\u03F5",
  36863. "\u03B5",
  36864. "\u03F9",
  36865. "\u03A3",
  36866. "\u0587",
  36867. "\u0565\u0582",
  36868. "\u0675",
  36869. "\u0627\u0674",
  36870. "\u0676",
  36871. "\u0648\u0674",
  36872. "\u0677",
  36873. "\u06C7\u0674",
  36874. "\u0678",
  36875. "\u064A\u0674",
  36876. "\u0E33",
  36877. "\u0E4D\u0E32",
  36878. "\u0EB3",
  36879. "\u0ECD\u0EB2",
  36880. "\u0EDC",
  36881. "\u0EAB\u0E99",
  36882. "\u0EDD",
  36883. "\u0EAB\u0EA1",
  36884. "\u0F77",
  36885. "\u0FB2\u0F81",
  36886. "\u0F79",
  36887. "\u0FB3\u0F81",
  36888. "\u1E9A",
  36889. "\u0061\u02BE",
  36890. "\u1FBD",
  36891. "\u0020\u0313",
  36892. "\u1FBF",
  36893. "\u0020\u0313",
  36894. "\u1FC0",
  36895. "\u0020\u0342",
  36896. "\u1FFE",
  36897. "\u0020\u0314",
  36898. "\u2002",
  36899. "\u0020",
  36900. "\u2003",
  36901. "\u0020",
  36902. "\u2004",
  36903. "\u0020",
  36904. "\u2005",
  36905. "\u0020",
  36906. "\u2006",
  36907. "\u0020",
  36908. "\u2008",
  36909. "\u0020",
  36910. "\u2009",
  36911. "\u0020",
  36912. "\u200A",
  36913. "\u0020",
  36914. "\u2017",
  36915. "\u0020\u0333",
  36916. "\u2024",
  36917. "\u002E",
  36918. "\u2025",
  36919. "\u002E\u002E",
  36920. "\u2026",
  36921. "\u002E\u002E\u002E",
  36922. "\u2033",
  36923. "\u2032\u2032",
  36924. "\u2034",
  36925. "\u2032\u2032\u2032",
  36926. "\u2036",
  36927. "\u2035\u2035",
  36928. "\u2037",
  36929. "\u2035\u2035\u2035",
  36930. "\u203C",
  36931. "\u0021\u0021",
  36932. "\u203E",
  36933. "\u0020\u0305",
  36934. "\u2047",
  36935. "\u003F\u003F",
  36936. "\u2048",
  36937. "\u003F\u0021",
  36938. "\u2049",
  36939. "\u0021\u003F",
  36940. "\u2057",
  36941. "\u2032\u2032\u2032\u2032",
  36942. "\u205F",
  36943. "\u0020",
  36944. "\u20A8",
  36945. "\u0052\u0073",
  36946. "\u2100",
  36947. "\u0061\u002F\u0063",
  36948. "\u2101",
  36949. "\u0061\u002F\u0073",
  36950. "\u2103",
  36951. "\u00B0\u0043",
  36952. "\u2105",
  36953. "\u0063\u002F\u006F",
  36954. "\u2106",
  36955. "\u0063\u002F\u0075",
  36956. "\u2107",
  36957. "\u0190",
  36958. "\u2109",
  36959. "\u00B0\u0046",
  36960. "\u2116",
  36961. "\u004E\u006F",
  36962. "\u2121",
  36963. "\u0054\u0045\u004C",
  36964. "\u2135",
  36965. "\u05D0",
  36966. "\u2136",
  36967. "\u05D1",
  36968. "\u2137",
  36969. "\u05D2",
  36970. "\u2138",
  36971. "\u05D3",
  36972. "\u213B",
  36973. "\u0046\u0041\u0058",
  36974. "\u2160",
  36975. "\u0049",
  36976. "\u2161",
  36977. "\u0049\u0049",
  36978. "\u2162",
  36979. "\u0049\u0049\u0049",
  36980. "\u2163",
  36981. "\u0049\u0056",
  36982. "\u2164",
  36983. "\u0056",
  36984. "\u2165",
  36985. "\u0056\u0049",
  36986. "\u2166",
  36987. "\u0056\u0049\u0049",
  36988. "\u2167",
  36989. "\u0056\u0049\u0049\u0049",
  36990. "\u2168",
  36991. "\u0049\u0058",
  36992. "\u2169",
  36993. "\u0058",
  36994. "\u216A",
  36995. "\u0058\u0049",
  36996. "\u216B",
  36997. "\u0058\u0049\u0049",
  36998. "\u216C",
  36999. "\u004C",
  37000. "\u216D",
  37001. "\u0043",
  37002. "\u216E",
  37003. "\u0044",
  37004. "\u216F",
  37005. "\u004D",
  37006. "\u2170",
  37007. "\u0069",
  37008. "\u2171",
  37009. "\u0069\u0069",
  37010. "\u2172",
  37011. "\u0069\u0069\u0069",
  37012. "\u2173",
  37013. "\u0069\u0076",
  37014. "\u2174",
  37015. "\u0076",
  37016. "\u2175",
  37017. "\u0076\u0069",
  37018. "\u2176",
  37019. "\u0076\u0069\u0069",
  37020. "\u2177",
  37021. "\u0076\u0069\u0069\u0069",
  37022. "\u2178",
  37023. "\u0069\u0078",
  37024. "\u2179",
  37025. "\u0078",
  37026. "\u217A",
  37027. "\u0078\u0069",
  37028. "\u217B",
  37029. "\u0078\u0069\u0069",
  37030. "\u217C",
  37031. "\u006C",
  37032. "\u217D",
  37033. "\u0063",
  37034. "\u217E",
  37035. "\u0064",
  37036. "\u217F",
  37037. "\u006D",
  37038. "\u222C",
  37039. "\u222B\u222B",
  37040. "\u222D",
  37041. "\u222B\u222B\u222B",
  37042. "\u222F",
  37043. "\u222E\u222E",
  37044. "\u2230",
  37045. "\u222E\u222E\u222E",
  37046. "\u2474",
  37047. "\u0028\u0031\u0029",
  37048. "\u2475",
  37049. "\u0028\u0032\u0029",
  37050. "\u2476",
  37051. "\u0028\u0033\u0029",
  37052. "\u2477",
  37053. "\u0028\u0034\u0029",
  37054. "\u2478",
  37055. "\u0028\u0035\u0029",
  37056. "\u2479",
  37057. "\u0028\u0036\u0029",
  37058. "\u247A",
  37059. "\u0028\u0037\u0029",
  37060. "\u247B",
  37061. "\u0028\u0038\u0029",
  37062. "\u247C",
  37063. "\u0028\u0039\u0029",
  37064. "\u247D",
  37065. "\u0028\u0031\u0030\u0029",
  37066. "\u247E",
  37067. "\u0028\u0031\u0031\u0029",
  37068. "\u247F",
  37069. "\u0028\u0031\u0032\u0029",
  37070. "\u2480",
  37071. "\u0028\u0031\u0033\u0029",
  37072. "\u2481",
  37073. "\u0028\u0031\u0034\u0029",
  37074. "\u2482",
  37075. "\u0028\u0031\u0035\u0029",
  37076. "\u2483",
  37077. "\u0028\u0031\u0036\u0029",
  37078. "\u2484",
  37079. "\u0028\u0031\u0037\u0029",
  37080. "\u2485",
  37081. "\u0028\u0031\u0038\u0029",
  37082. "\u2486",
  37083. "\u0028\u0031\u0039\u0029",
  37084. "\u2487",
  37085. "\u0028\u0032\u0030\u0029",
  37086. "\u2488",
  37087. "\u0031\u002E",
  37088. "\u2489",
  37089. "\u0032\u002E",
  37090. "\u248A",
  37091. "\u0033\u002E",
  37092. "\u248B",
  37093. "\u0034\u002E",
  37094. "\u248C",
  37095. "\u0035\u002E",
  37096. "\u248D",
  37097. "\u0036\u002E",
  37098. "\u248E",
  37099. "\u0037\u002E",
  37100. "\u248F",
  37101. "\u0038\u002E",
  37102. "\u2490",
  37103. "\u0039\u002E",
  37104. "\u2491",
  37105. "\u0031\u0030\u002E",
  37106. "\u2492",
  37107. "\u0031\u0031\u002E",
  37108. "\u2493",
  37109. "\u0031\u0032\u002E",
  37110. "\u2494",
  37111. "\u0031\u0033\u002E",
  37112. "\u2495",
  37113. "\u0031\u0034\u002E",
  37114. "\u2496",
  37115. "\u0031\u0035\u002E",
  37116. "\u2497",
  37117. "\u0031\u0036\u002E",
  37118. "\u2498",
  37119. "\u0031\u0037\u002E",
  37120. "\u2499",
  37121. "\u0031\u0038\u002E",
  37122. "\u249A",
  37123. "\u0031\u0039\u002E",
  37124. "\u249B",
  37125. "\u0032\u0030\u002E",
  37126. "\u249C",
  37127. "\u0028\u0061\u0029",
  37128. "\u249D",
  37129. "\u0028\u0062\u0029",
  37130. "\u249E",
  37131. "\u0028\u0063\u0029",
  37132. "\u249F",
  37133. "\u0028\u0064\u0029",
  37134. "\u24A0",
  37135. "\u0028\u0065\u0029",
  37136. "\u24A1",
  37137. "\u0028\u0066\u0029",
  37138. "\u24A2",
  37139. "\u0028\u0067\u0029",
  37140. "\u24A3",
  37141. "\u0028\u0068\u0029",
  37142. "\u24A4",
  37143. "\u0028\u0069\u0029",
  37144. "\u24A5",
  37145. "\u0028\u006A\u0029",
  37146. "\u24A6",
  37147. "\u0028\u006B\u0029",
  37148. "\u24A7",
  37149. "\u0028\u006C\u0029",
  37150. "\u24A8",
  37151. "\u0028\u006D\u0029",
  37152. "\u24A9",
  37153. "\u0028\u006E\u0029",
  37154. "\u24AA",
  37155. "\u0028\u006F\u0029",
  37156. "\u24AB",
  37157. "\u0028\u0070\u0029",
  37158. "\u24AC",
  37159. "\u0028\u0071\u0029",
  37160. "\u24AD",
  37161. "\u0028\u0072\u0029",
  37162. "\u24AE",
  37163. "\u0028\u0073\u0029",
  37164. "\u24AF",
  37165. "\u0028\u0074\u0029",
  37166. "\u24B0",
  37167. "\u0028\u0075\u0029",
  37168. "\u24B1",
  37169. "\u0028\u0076\u0029",
  37170. "\u24B2",
  37171. "\u0028\u0077\u0029",
  37172. "\u24B3",
  37173. "\u0028\u0078\u0029",
  37174. "\u24B4",
  37175. "\u0028\u0079\u0029",
  37176. "\u24B5",
  37177. "\u0028\u007A\u0029",
  37178. "\u2A0C",
  37179. "\u222B\u222B\u222B\u222B",
  37180. "\u2A74",
  37181. "\u003A\u003A\u003D",
  37182. "\u2A75",
  37183. "\u003D\u003D",
  37184. "\u2A76",
  37185. "\u003D\u003D\u003D",
  37186. "\u2E9F",
  37187. "\u6BCD",
  37188. "\u2EF3",
  37189. "\u9F9F",
  37190. "\u2F00",
  37191. "\u4E00",
  37192. "\u2F01",
  37193. "\u4E28",
  37194. "\u2F02",
  37195. "\u4E36",
  37196. "\u2F03",
  37197. "\u4E3F",
  37198. "\u2F04",
  37199. "\u4E59",
  37200. "\u2F05",
  37201. "\u4E85",
  37202. "\u2F06",
  37203. "\u4E8C",
  37204. "\u2F07",
  37205. "\u4EA0",
  37206. "\u2F08",
  37207. "\u4EBA",
  37208. "\u2F09",
  37209. "\u513F",
  37210. "\u2F0A",
  37211. "\u5165",
  37212. "\u2F0B",
  37213. "\u516B",
  37214. "\u2F0C",
  37215. "\u5182",
  37216. "\u2F0D",
  37217. "\u5196",
  37218. "\u2F0E",
  37219. "\u51AB",
  37220. "\u2F0F",
  37221. "\u51E0",
  37222. "\u2F10",
  37223. "\u51F5",
  37224. "\u2F11",
  37225. "\u5200",
  37226. "\u2F12",
  37227. "\u529B",
  37228. "\u2F13",
  37229. "\u52F9",
  37230. "\u2F14",
  37231. "\u5315",
  37232. "\u2F15",
  37233. "\u531A",
  37234. "\u2F16",
  37235. "\u5338",
  37236. "\u2F17",
  37237. "\u5341",
  37238. "\u2F18",
  37239. "\u535C",
  37240. "\u2F19",
  37241. "\u5369",
  37242. "\u2F1A",
  37243. "\u5382",
  37244. "\u2F1B",
  37245. "\u53B6",
  37246. "\u2F1C",
  37247. "\u53C8",
  37248. "\u2F1D",
  37249. "\u53E3",
  37250. "\u2F1E",
  37251. "\u56D7",
  37252. "\u2F1F",
  37253. "\u571F",
  37254. "\u2F20",
  37255. "\u58EB",
  37256. "\u2F21",
  37257. "\u5902",
  37258. "\u2F22",
  37259. "\u590A",
  37260. "\u2F23",
  37261. "\u5915",
  37262. "\u2F24",
  37263. "\u5927",
  37264. "\u2F25",
  37265. "\u5973",
  37266. "\u2F26",
  37267. "\u5B50",
  37268. "\u2F27",
  37269. "\u5B80",
  37270. "\u2F28",
  37271. "\u5BF8",
  37272. "\u2F29",
  37273. "\u5C0F",
  37274. "\u2F2A",
  37275. "\u5C22",
  37276. "\u2F2B",
  37277. "\u5C38",
  37278. "\u2F2C",
  37279. "\u5C6E",
  37280. "\u2F2D",
  37281. "\u5C71",
  37282. "\u2F2E",
  37283. "\u5DDB",
  37284. "\u2F2F",
  37285. "\u5DE5",
  37286. "\u2F30",
  37287. "\u5DF1",
  37288. "\u2F31",
  37289. "\u5DFE",
  37290. "\u2F32",
  37291. "\u5E72",
  37292. "\u2F33",
  37293. "\u5E7A",
  37294. "\u2F34",
  37295. "\u5E7F",
  37296. "\u2F35",
  37297. "\u5EF4",
  37298. "\u2F36",
  37299. "\u5EFE",
  37300. "\u2F37",
  37301. "\u5F0B",
  37302. "\u2F38",
  37303. "\u5F13",
  37304. "\u2F39",
  37305. "\u5F50",
  37306. "\u2F3A",
  37307. "\u5F61",
  37308. "\u2F3B",
  37309. "\u5F73",
  37310. "\u2F3C",
  37311. "\u5FC3",
  37312. "\u2F3D",
  37313. "\u6208",
  37314. "\u2F3E",
  37315. "\u6236",
  37316. "\u2F3F",
  37317. "\u624B",
  37318. "\u2F40",
  37319. "\u652F",
  37320. "\u2F41",
  37321. "\u6534",
  37322. "\u2F42",
  37323. "\u6587",
  37324. "\u2F43",
  37325. "\u6597",
  37326. "\u2F44",
  37327. "\u65A4",
  37328. "\u2F45",
  37329. "\u65B9",
  37330. "\u2F46",
  37331. "\u65E0",
  37332. "\u2F47",
  37333. "\u65E5",
  37334. "\u2F48",
  37335. "\u66F0",
  37336. "\u2F49",
  37337. "\u6708",
  37338. "\u2F4A",
  37339. "\u6728",
  37340. "\u2F4B",
  37341. "\u6B20",
  37342. "\u2F4C",
  37343. "\u6B62",
  37344. "\u2F4D",
  37345. "\u6B79",
  37346. "\u2F4E",
  37347. "\u6BB3",
  37348. "\u2F4F",
  37349. "\u6BCB",
  37350. "\u2F50",
  37351. "\u6BD4",
  37352. "\u2F51",
  37353. "\u6BDB",
  37354. "\u2F52",
  37355. "\u6C0F",
  37356. "\u2F53",
  37357. "\u6C14",
  37358. "\u2F54",
  37359. "\u6C34",
  37360. "\u2F55",
  37361. "\u706B",
  37362. "\u2F56",
  37363. "\u722A",
  37364. "\u2F57",
  37365. "\u7236",
  37366. "\u2F58",
  37367. "\u723B",
  37368. "\u2F59",
  37369. "\u723F",
  37370. "\u2F5A",
  37371. "\u7247",
  37372. "\u2F5B",
  37373. "\u7259",
  37374. "\u2F5C",
  37375. "\u725B",
  37376. "\u2F5D",
  37377. "\u72AC",
  37378. "\u2F5E",
  37379. "\u7384",
  37380. "\u2F5F",
  37381. "\u7389",
  37382. "\u2F60",
  37383. "\u74DC",
  37384. "\u2F61",
  37385. "\u74E6",
  37386. "\u2F62",
  37387. "\u7518",
  37388. "\u2F63",
  37389. "\u751F",
  37390. "\u2F64",
  37391. "\u7528",
  37392. "\u2F65",
  37393. "\u7530",
  37394. "\u2F66",
  37395. "\u758B",
  37396. "\u2F67",
  37397. "\u7592",
  37398. "\u2F68",
  37399. "\u7676",
  37400. "\u2F69",
  37401. "\u767D",
  37402. "\u2F6A",
  37403. "\u76AE",
  37404. "\u2F6B",
  37405. "\u76BF",
  37406. "\u2F6C",
  37407. "\u76EE",
  37408. "\u2F6D",
  37409. "\u77DB",
  37410. "\u2F6E",
  37411. "\u77E2",
  37412. "\u2F6F",
  37413. "\u77F3",
  37414. "\u2F70",
  37415. "\u793A",
  37416. "\u2F71",
  37417. "\u79B8",
  37418. "\u2F72",
  37419. "\u79BE",
  37420. "\u2F73",
  37421. "\u7A74",
  37422. "\u2F74",
  37423. "\u7ACB",
  37424. "\u2F75",
  37425. "\u7AF9",
  37426. "\u2F76",
  37427. "\u7C73",
  37428. "\u2F77",
  37429. "\u7CF8",
  37430. "\u2F78",
  37431. "\u7F36",
  37432. "\u2F79",
  37433. "\u7F51",
  37434. "\u2F7A",
  37435. "\u7F8A",
  37436. "\u2F7B",
  37437. "\u7FBD",
  37438. "\u2F7C",
  37439. "\u8001",
  37440. "\u2F7D",
  37441. "\u800C",
  37442. "\u2F7E",
  37443. "\u8012",
  37444. "\u2F7F",
  37445. "\u8033",
  37446. "\u2F80",
  37447. "\u807F",
  37448. "\u2F81",
  37449. "\u8089",
  37450. "\u2F82",
  37451. "\u81E3",
  37452. "\u2F83",
  37453. "\u81EA",
  37454. "\u2F84",
  37455. "\u81F3",
  37456. "\u2F85",
  37457. "\u81FC",
  37458. "\u2F86",
  37459. "\u820C",
  37460. "\u2F87",
  37461. "\u821B",
  37462. "\u2F88",
  37463. "\u821F",
  37464. "\u2F89",
  37465. "\u826E",
  37466. "\u2F8A",
  37467. "\u8272",
  37468. "\u2F8B",
  37469. "\u8278",
  37470. "\u2F8C",
  37471. "\u864D",
  37472. "\u2F8D",
  37473. "\u866B",
  37474. "\u2F8E",
  37475. "\u8840",
  37476. "\u2F8F",
  37477. "\u884C",
  37478. "\u2F90",
  37479. "\u8863",
  37480. "\u2F91",
  37481. "\u897E",
  37482. "\u2F92",
  37483. "\u898B",
  37484. "\u2F93",
  37485. "\u89D2",
  37486. "\u2F94",
  37487. "\u8A00",
  37488. "\u2F95",
  37489. "\u8C37",
  37490. "\u2F96",
  37491. "\u8C46",
  37492. "\u2F97",
  37493. "\u8C55",
  37494. "\u2F98",
  37495. "\u8C78",
  37496. "\u2F99",
  37497. "\u8C9D",
  37498. "\u2F9A",
  37499. "\u8D64",
  37500. "\u2F9B",
  37501. "\u8D70",
  37502. "\u2F9C",
  37503. "\u8DB3",
  37504. "\u2F9D",
  37505. "\u8EAB",
  37506. "\u2F9E",
  37507. "\u8ECA",
  37508. "\u2F9F",
  37509. "\u8F9B",
  37510. "\u2FA0",
  37511. "\u8FB0",
  37512. "\u2FA1",
  37513. "\u8FB5",
  37514. "\u2FA2",
  37515. "\u9091",
  37516. "\u2FA3",
  37517. "\u9149",
  37518. "\u2FA4",
  37519. "\u91C6",
  37520. "\u2FA5",
  37521. "\u91CC",
  37522. "\u2FA6",
  37523. "\u91D1",
  37524. "\u2FA7",
  37525. "\u9577",
  37526. "\u2FA8",
  37527. "\u9580",
  37528. "\u2FA9",
  37529. "\u961C",
  37530. "\u2FAA",
  37531. "\u96B6",
  37532. "\u2FAB",
  37533. "\u96B9",
  37534. "\u2FAC",
  37535. "\u96E8",
  37536. "\u2FAD",
  37537. "\u9751",
  37538. "\u2FAE",
  37539. "\u975E",
  37540. "\u2FAF",
  37541. "\u9762",
  37542. "\u2FB0",
  37543. "\u9769",
  37544. "\u2FB1",
  37545. "\u97CB",
  37546. "\u2FB2",
  37547. "\u97ED",
  37548. "\u2FB3",
  37549. "\u97F3",
  37550. "\u2FB4",
  37551. "\u9801",
  37552. "\u2FB5",
  37553. "\u98A8",
  37554. "\u2FB6",
  37555. "\u98DB",
  37556. "\u2FB7",
  37557. "\u98DF",
  37558. "\u2FB8",
  37559. "\u9996",
  37560. "\u2FB9",
  37561. "\u9999",
  37562. "\u2FBA",
  37563. "\u99AC",
  37564. "\u2FBB",
  37565. "\u9AA8",
  37566. "\u2FBC",
  37567. "\u9AD8",
  37568. "\u2FBD",
  37569. "\u9ADF",
  37570. "\u2FBE",
  37571. "\u9B25",
  37572. "\u2FBF",
  37573. "\u9B2F",
  37574. "\u2FC0",
  37575. "\u9B32",
  37576. "\u2FC1",
  37577. "\u9B3C",
  37578. "\u2FC2",
  37579. "\u9B5A",
  37580. "\u2FC3",
  37581. "\u9CE5",
  37582. "\u2FC4",
  37583. "\u9E75",
  37584. "\u2FC5",
  37585. "\u9E7F",
  37586. "\u2FC6",
  37587. "\u9EA5",
  37588. "\u2FC7",
  37589. "\u9EBB",
  37590. "\u2FC8",
  37591. "\u9EC3",
  37592. "\u2FC9",
  37593. "\u9ECD",
  37594. "\u2FCA",
  37595. "\u9ED1",
  37596. "\u2FCB",
  37597. "\u9EF9",
  37598. "\u2FCC",
  37599. "\u9EFD",
  37600. "\u2FCD",
  37601. "\u9F0E",
  37602. "\u2FCE",
  37603. "\u9F13",
  37604. "\u2FCF",
  37605. "\u9F20",
  37606. "\u2FD0",
  37607. "\u9F3B",
  37608. "\u2FD1",
  37609. "\u9F4A",
  37610. "\u2FD2",
  37611. "\u9F52",
  37612. "\u2FD3",
  37613. "\u9F8D",
  37614. "\u2FD4",
  37615. "\u9F9C",
  37616. "\u2FD5",
  37617. "\u9FA0",
  37618. "\u3036",
  37619. "\u3012",
  37620. "\u3038",
  37621. "\u5341",
  37622. "\u3039",
  37623. "\u5344",
  37624. "\u303A",
  37625. "\u5345",
  37626. "\u309B",
  37627. "\u0020\u3099",
  37628. "\u309C",
  37629. "\u0020\u309A",
  37630. "\u3131",
  37631. "\u1100",
  37632. "\u3132",
  37633. "\u1101",
  37634. "\u3133",
  37635. "\u11AA",
  37636. "\u3134",
  37637. "\u1102",
  37638. "\u3135",
  37639. "\u11AC",
  37640. "\u3136",
  37641. "\u11AD",
  37642. "\u3137",
  37643. "\u1103",
  37644. "\u3138",
  37645. "\u1104",
  37646. "\u3139",
  37647. "\u1105",
  37648. "\u313A",
  37649. "\u11B0",
  37650. "\u313B",
  37651. "\u11B1",
  37652. "\u313C",
  37653. "\u11B2",
  37654. "\u313D",
  37655. "\u11B3",
  37656. "\u313E",
  37657. "\u11B4",
  37658. "\u313F",
  37659. "\u11B5",
  37660. "\u3140",
  37661. "\u111A",
  37662. "\u3141",
  37663. "\u1106",
  37664. "\u3142",
  37665. "\u1107",
  37666. "\u3143",
  37667. "\u1108",
  37668. "\u3144",
  37669. "\u1121",
  37670. "\u3145",
  37671. "\u1109",
  37672. "\u3146",
  37673. "\u110A",
  37674. "\u3147",
  37675. "\u110B",
  37676. "\u3148",
  37677. "\u110C",
  37678. "\u3149",
  37679. "\u110D",
  37680. "\u314A",
  37681. "\u110E",
  37682. "\u314B",
  37683. "\u110F",
  37684. "\u314C",
  37685. "\u1110",
  37686. "\u314D",
  37687. "\u1111",
  37688. "\u314E",
  37689. "\u1112",
  37690. "\u314F",
  37691. "\u1161",
  37692. "\u3150",
  37693. "\u1162",
  37694. "\u3151",
  37695. "\u1163",
  37696. "\u3152",
  37697. "\u1164",
  37698. "\u3153",
  37699. "\u1165",
  37700. "\u3154",
  37701. "\u1166",
  37702. "\u3155",
  37703. "\u1167",
  37704. "\u3156",
  37705. "\u1168",
  37706. "\u3157",
  37707. "\u1169",
  37708. "\u3158",
  37709. "\u116A",
  37710. "\u3159",
  37711. "\u116B",
  37712. "\u315A",
  37713. "\u116C",
  37714. "\u315B",
  37715. "\u116D",
  37716. "\u315C",
  37717. "\u116E",
  37718. "\u315D",
  37719. "\u116F",
  37720. "\u315E",
  37721. "\u1170",
  37722. "\u315F",
  37723. "\u1171",
  37724. "\u3160",
  37725. "\u1172",
  37726. "\u3161",
  37727. "\u1173",
  37728. "\u3162",
  37729. "\u1174",
  37730. "\u3163",
  37731. "\u1175",
  37732. "\u3164",
  37733. "\u1160",
  37734. "\u3165",
  37735. "\u1114",
  37736. "\u3166",
  37737. "\u1115",
  37738. "\u3167",
  37739. "\u11C7",
  37740. "\u3168",
  37741. "\u11C8",
  37742. "\u3169",
  37743. "\u11CC",
  37744. "\u316A",
  37745. "\u11CE",
  37746. "\u316B",
  37747. "\u11D3",
  37748. "\u316C",
  37749. "\u11D7",
  37750. "\u316D",
  37751. "\u11D9",
  37752. "\u316E",
  37753. "\u111C",
  37754. "\u316F",
  37755. "\u11DD",
  37756. "\u3170",
  37757. "\u11DF",
  37758. "\u3171",
  37759. "\u111D",
  37760. "\u3172",
  37761. "\u111E",
  37762. "\u3173",
  37763. "\u1120",
  37764. "\u3174",
  37765. "\u1122",
  37766. "\u3175",
  37767. "\u1123",
  37768. "\u3176",
  37769. "\u1127",
  37770. "\u3177",
  37771. "\u1129",
  37772. "\u3178",
  37773. "\u112B",
  37774. "\u3179",
  37775. "\u112C",
  37776. "\u317A",
  37777. "\u112D",
  37778. "\u317B",
  37779. "\u112E",
  37780. "\u317C",
  37781. "\u112F",
  37782. "\u317D",
  37783. "\u1132",
  37784. "\u317E",
  37785. "\u1136",
  37786. "\u317F",
  37787. "\u1140",
  37788. "\u3180",
  37789. "\u1147",
  37790. "\u3181",
  37791. "\u114C",
  37792. "\u3182",
  37793. "\u11F1",
  37794. "\u3183",
  37795. "\u11F2",
  37796. "\u3184",
  37797. "\u1157",
  37798. "\u3185",
  37799. "\u1158",
  37800. "\u3186",
  37801. "\u1159",
  37802. "\u3187",
  37803. "\u1184",
  37804. "\u3188",
  37805. "\u1185",
  37806. "\u3189",
  37807. "\u1188",
  37808. "\u318A",
  37809. "\u1191",
  37810. "\u318B",
  37811. "\u1192",
  37812. "\u318C",
  37813. "\u1194",
  37814. "\u318D",
  37815. "\u119E",
  37816. "\u318E",
  37817. "\u11A1",
  37818. "\u3200",
  37819. "\u0028\u1100\u0029",
  37820. "\u3201",
  37821. "\u0028\u1102\u0029",
  37822. "\u3202",
  37823. "\u0028\u1103\u0029",
  37824. "\u3203",
  37825. "\u0028\u1105\u0029",
  37826. "\u3204",
  37827. "\u0028\u1106\u0029",
  37828. "\u3205",
  37829. "\u0028\u1107\u0029",
  37830. "\u3206",
  37831. "\u0028\u1109\u0029",
  37832. "\u3207",
  37833. "\u0028\u110B\u0029",
  37834. "\u3208",
  37835. "\u0028\u110C\u0029",
  37836. "\u3209",
  37837. "\u0028\u110E\u0029",
  37838. "\u320A",
  37839. "\u0028\u110F\u0029",
  37840. "\u320B",
  37841. "\u0028\u1110\u0029",
  37842. "\u320C",
  37843. "\u0028\u1111\u0029",
  37844. "\u320D",
  37845. "\u0028\u1112\u0029",
  37846. "\u320E",
  37847. "\u0028\u1100\u1161\u0029",
  37848. "\u320F",
  37849. "\u0028\u1102\u1161\u0029",
  37850. "\u3210",
  37851. "\u0028\u1103\u1161\u0029",
  37852. "\u3211",
  37853. "\u0028\u1105\u1161\u0029",
  37854. "\u3212",
  37855. "\u0028\u1106\u1161\u0029",
  37856. "\u3213",
  37857. "\u0028\u1107\u1161\u0029",
  37858. "\u3214",
  37859. "\u0028\u1109\u1161\u0029",
  37860. "\u3215",
  37861. "\u0028\u110B\u1161\u0029",
  37862. "\u3216",
  37863. "\u0028\u110C\u1161\u0029",
  37864. "\u3217",
  37865. "\u0028\u110E\u1161\u0029",
  37866. "\u3218",
  37867. "\u0028\u110F\u1161\u0029",
  37868. "\u3219",
  37869. "\u0028\u1110\u1161\u0029",
  37870. "\u321A",
  37871. "\u0028\u1111\u1161\u0029",
  37872. "\u321B",
  37873. "\u0028\u1112\u1161\u0029",
  37874. "\u321C",
  37875. "\u0028\u110C\u116E\u0029",
  37876. "\u321D",
  37877. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  37878. "\u321E",
  37879. "\u0028\u110B\u1169\u1112\u116E\u0029",
  37880. "\u3220",
  37881. "\u0028\u4E00\u0029",
  37882. "\u3221",
  37883. "\u0028\u4E8C\u0029",
  37884. "\u3222",
  37885. "\u0028\u4E09\u0029",
  37886. "\u3223",
  37887. "\u0028\u56DB\u0029",
  37888. "\u3224",
  37889. "\u0028\u4E94\u0029",
  37890. "\u3225",
  37891. "\u0028\u516D\u0029",
  37892. "\u3226",
  37893. "\u0028\u4E03\u0029",
  37894. "\u3227",
  37895. "\u0028\u516B\u0029",
  37896. "\u3228",
  37897. "\u0028\u4E5D\u0029",
  37898. "\u3229",
  37899. "\u0028\u5341\u0029",
  37900. "\u322A",
  37901. "\u0028\u6708\u0029",
  37902. "\u322B",
  37903. "\u0028\u706B\u0029",
  37904. "\u322C",
  37905. "\u0028\u6C34\u0029",
  37906. "\u322D",
  37907. "\u0028\u6728\u0029",
  37908. "\u322E",
  37909. "\u0028\u91D1\u0029",
  37910. "\u322F",
  37911. "\u0028\u571F\u0029",
  37912. "\u3230",
  37913. "\u0028\u65E5\u0029",
  37914. "\u3231",
  37915. "\u0028\u682A\u0029",
  37916. "\u3232",
  37917. "\u0028\u6709\u0029",
  37918. "\u3233",
  37919. "\u0028\u793E\u0029",
  37920. "\u3234",
  37921. "\u0028\u540D\u0029",
  37922. "\u3235",
  37923. "\u0028\u7279\u0029",
  37924. "\u3236",
  37925. "\u0028\u8CA1\u0029",
  37926. "\u3237",
  37927. "\u0028\u795D\u0029",
  37928. "\u3238",
  37929. "\u0028\u52B4\u0029",
  37930. "\u3239",
  37931. "\u0028\u4EE3\u0029",
  37932. "\u323A",
  37933. "\u0028\u547C\u0029",
  37934. "\u323B",
  37935. "\u0028\u5B66\u0029",
  37936. "\u323C",
  37937. "\u0028\u76E3\u0029",
  37938. "\u323D",
  37939. "\u0028\u4F01\u0029",
  37940. "\u323E",
  37941. "\u0028\u8CC7\u0029",
  37942. "\u323F",
  37943. "\u0028\u5354\u0029",
  37944. "\u3240",
  37945. "\u0028\u796D\u0029",
  37946. "\u3241",
  37947. "\u0028\u4F11\u0029",
  37948. "\u3242",
  37949. "\u0028\u81EA\u0029",
  37950. "\u3243",
  37951. "\u0028\u81F3\u0029",
  37952. "\u32C0",
  37953. "\u0031\u6708",
  37954. "\u32C1",
  37955. "\u0032\u6708",
  37956. "\u32C2",
  37957. "\u0033\u6708",
  37958. "\u32C3",
  37959. "\u0034\u6708",
  37960. "\u32C4",
  37961. "\u0035\u6708",
  37962. "\u32C5",
  37963. "\u0036\u6708",
  37964. "\u32C6",
  37965. "\u0037\u6708",
  37966. "\u32C7",
  37967. "\u0038\u6708",
  37968. "\u32C8",
  37969. "\u0039\u6708",
  37970. "\u32C9",
  37971. "\u0031\u0030\u6708",
  37972. "\u32CA",
  37973. "\u0031\u0031\u6708",
  37974. "\u32CB",
  37975. "\u0031\u0032\u6708",
  37976. "\u3358",
  37977. "\u0030\u70B9",
  37978. "\u3359",
  37979. "\u0031\u70B9",
  37980. "\u335A",
  37981. "\u0032\u70B9",
  37982. "\u335B",
  37983. "\u0033\u70B9",
  37984. "\u335C",
  37985. "\u0034\u70B9",
  37986. "\u335D",
  37987. "\u0035\u70B9",
  37988. "\u335E",
  37989. "\u0036\u70B9",
  37990. "\u335F",
  37991. "\u0037\u70B9",
  37992. "\u3360",
  37993. "\u0038\u70B9",
  37994. "\u3361",
  37995. "\u0039\u70B9",
  37996. "\u3362",
  37997. "\u0031\u0030\u70B9",
  37998. "\u3363",
  37999. "\u0031\u0031\u70B9",
  38000. "\u3364",
  38001. "\u0031\u0032\u70B9",
  38002. "\u3365",
  38003. "\u0031\u0033\u70B9",
  38004. "\u3366",
  38005. "\u0031\u0034\u70B9",
  38006. "\u3367",
  38007. "\u0031\u0035\u70B9",
  38008. "\u3368",
  38009. "\u0031\u0036\u70B9",
  38010. "\u3369",
  38011. "\u0031\u0037\u70B9",
  38012. "\u336A",
  38013. "\u0031\u0038\u70B9",
  38014. "\u336B",
  38015. "\u0031\u0039\u70B9",
  38016. "\u336C",
  38017. "\u0032\u0030\u70B9",
  38018. "\u336D",
  38019. "\u0032\u0031\u70B9",
  38020. "\u336E",
  38021. "\u0032\u0032\u70B9",
  38022. "\u336F",
  38023. "\u0032\u0033\u70B9",
  38024. "\u3370",
  38025. "\u0032\u0034\u70B9",
  38026. "\u33E0",
  38027. "\u0031\u65E5",
  38028. "\u33E1",
  38029. "\u0032\u65E5",
  38030. "\u33E2",
  38031. "\u0033\u65E5",
  38032. "\u33E3",
  38033. "\u0034\u65E5",
  38034. "\u33E4",
  38035. "\u0035\u65E5",
  38036. "\u33E5",
  38037. "\u0036\u65E5",
  38038. "\u33E6",
  38039. "\u0037\u65E5",
  38040. "\u33E7",
  38041. "\u0038\u65E5",
  38042. "\u33E8",
  38043. "\u0039\u65E5",
  38044. "\u33E9",
  38045. "\u0031\u0030\u65E5",
  38046. "\u33EA",
  38047. "\u0031\u0031\u65E5",
  38048. "\u33EB",
  38049. "\u0031\u0032\u65E5",
  38050. "\u33EC",
  38051. "\u0031\u0033\u65E5",
  38052. "\u33ED",
  38053. "\u0031\u0034\u65E5",
  38054. "\u33EE",
  38055. "\u0031\u0035\u65E5",
  38056. "\u33EF",
  38057. "\u0031\u0036\u65E5",
  38058. "\u33F0",
  38059. "\u0031\u0037\u65E5",
  38060. "\u33F1",
  38061. "\u0031\u0038\u65E5",
  38062. "\u33F2",
  38063. "\u0031\u0039\u65E5",
  38064. "\u33F3",
  38065. "\u0032\u0030\u65E5",
  38066. "\u33F4",
  38067. "\u0032\u0031\u65E5",
  38068. "\u33F5",
  38069. "\u0032\u0032\u65E5",
  38070. "\u33F6",
  38071. "\u0032\u0033\u65E5",
  38072. "\u33F7",
  38073. "\u0032\u0034\u65E5",
  38074. "\u33F8",
  38075. "\u0032\u0035\u65E5",
  38076. "\u33F9",
  38077. "\u0032\u0036\u65E5",
  38078. "\u33FA",
  38079. "\u0032\u0037\u65E5",
  38080. "\u33FB",
  38081. "\u0032\u0038\u65E5",
  38082. "\u33FC",
  38083. "\u0032\u0039\u65E5",
  38084. "\u33FD",
  38085. "\u0033\u0030\u65E5",
  38086. "\u33FE",
  38087. "\u0033\u0031\u65E5",
  38088. "\uFB00",
  38089. "\u0066\u0066",
  38090. "\uFB01",
  38091. "\u0066\u0069",
  38092. "\uFB02",
  38093. "\u0066\u006C",
  38094. "\uFB03",
  38095. "\u0066\u0066\u0069",
  38096. "\uFB04",
  38097. "\u0066\u0066\u006C",
  38098. "\uFB05",
  38099. "\u017F\u0074",
  38100. "\uFB06",
  38101. "\u0073\u0074",
  38102. "\uFB13",
  38103. "\u0574\u0576",
  38104. "\uFB14",
  38105. "\u0574\u0565",
  38106. "\uFB15",
  38107. "\u0574\u056B",
  38108. "\uFB16",
  38109. "\u057E\u0576",
  38110. "\uFB17",
  38111. "\u0574\u056D",
  38112. "\uFB4F",
  38113. "\u05D0\u05DC",
  38114. "\uFB50",
  38115. "\u0671",
  38116. "\uFB51",
  38117. "\u0671",
  38118. "\uFB52",
  38119. "\u067B",
  38120. "\uFB53",
  38121. "\u067B",
  38122. "\uFB54",
  38123. "\u067B",
  38124. "\uFB55",
  38125. "\u067B",
  38126. "\uFB56",
  38127. "\u067E",
  38128. "\uFB57",
  38129. "\u067E",
  38130. "\uFB58",
  38131. "\u067E",
  38132. "\uFB59",
  38133. "\u067E",
  38134. "\uFB5A",
  38135. "\u0680",
  38136. "\uFB5B",
  38137. "\u0680",
  38138. "\uFB5C",
  38139. "\u0680",
  38140. "\uFB5D",
  38141. "\u0680",
  38142. "\uFB5E",
  38143. "\u067A",
  38144. "\uFB5F",
  38145. "\u067A",
  38146. "\uFB60",
  38147. "\u067A",
  38148. "\uFB61",
  38149. "\u067A",
  38150. "\uFB62",
  38151. "\u067F",
  38152. "\uFB63",
  38153. "\u067F",
  38154. "\uFB64",
  38155. "\u067F",
  38156. "\uFB65",
  38157. "\u067F",
  38158. "\uFB66",
  38159. "\u0679",
  38160. "\uFB67",
  38161. "\u0679",
  38162. "\uFB68",
  38163. "\u0679",
  38164. "\uFB69",
  38165. "\u0679",
  38166. "\uFB6A",
  38167. "\u06A4",
  38168. "\uFB6B",
  38169. "\u06A4",
  38170. "\uFB6C",
  38171. "\u06A4",
  38172. "\uFB6D",
  38173. "\u06A4",
  38174. "\uFB6E",
  38175. "\u06A6",
  38176. "\uFB6F",
  38177. "\u06A6",
  38178. "\uFB70",
  38179. "\u06A6",
  38180. "\uFB71",
  38181. "\u06A6",
  38182. "\uFB72",
  38183. "\u0684",
  38184. "\uFB73",
  38185. "\u0684",
  38186. "\uFB74",
  38187. "\u0684",
  38188. "\uFB75",
  38189. "\u0684",
  38190. "\uFB76",
  38191. "\u0683",
  38192. "\uFB77",
  38193. "\u0683",
  38194. "\uFB78",
  38195. "\u0683",
  38196. "\uFB79",
  38197. "\u0683",
  38198. "\uFB7A",
  38199. "\u0686",
  38200. "\uFB7B",
  38201. "\u0686",
  38202. "\uFB7C",
  38203. "\u0686",
  38204. "\uFB7D",
  38205. "\u0686",
  38206. "\uFB7E",
  38207. "\u0687",
  38208. "\uFB7F",
  38209. "\u0687",
  38210. "\uFB80",
  38211. "\u0687",
  38212. "\uFB81",
  38213. "\u0687",
  38214. "\uFB82",
  38215. "\u068D",
  38216. "\uFB83",
  38217. "\u068D",
  38218. "\uFB84",
  38219. "\u068C",
  38220. "\uFB85",
  38221. "\u068C",
  38222. "\uFB86",
  38223. "\u068E",
  38224. "\uFB87",
  38225. "\u068E",
  38226. "\uFB88",
  38227. "\u0688",
  38228. "\uFB89",
  38229. "\u0688",
  38230. "\uFB8A",
  38231. "\u0698",
  38232. "\uFB8B",
  38233. "\u0698",
  38234. "\uFB8C",
  38235. "\u0691",
  38236. "\uFB8D",
  38237. "\u0691",
  38238. "\uFB8E",
  38239. "\u06A9",
  38240. "\uFB8F",
  38241. "\u06A9",
  38242. "\uFB90",
  38243. "\u06A9",
  38244. "\uFB91",
  38245. "\u06A9",
  38246. "\uFB92",
  38247. "\u06AF",
  38248. "\uFB93",
  38249. "\u06AF",
  38250. "\uFB94",
  38251. "\u06AF",
  38252. "\uFB95",
  38253. "\u06AF",
  38254. "\uFB96",
  38255. "\u06B3",
  38256. "\uFB97",
  38257. "\u06B3",
  38258. "\uFB98",
  38259. "\u06B3",
  38260. "\uFB99",
  38261. "\u06B3",
  38262. "\uFB9A",
  38263. "\u06B1",
  38264. "\uFB9B",
  38265. "\u06B1",
  38266. "\uFB9C",
  38267. "\u06B1",
  38268. "\uFB9D",
  38269. "\u06B1",
  38270. "\uFB9E",
  38271. "\u06BA",
  38272. "\uFB9F",
  38273. "\u06BA",
  38274. "\uFBA0",
  38275. "\u06BB",
  38276. "\uFBA1",
  38277. "\u06BB",
  38278. "\uFBA2",
  38279. "\u06BB",
  38280. "\uFBA3",
  38281. "\u06BB",
  38282. "\uFBA4",
  38283. "\u06C0",
  38284. "\uFBA5",
  38285. "\u06C0",
  38286. "\uFBA6",
  38287. "\u06C1",
  38288. "\uFBA7",
  38289. "\u06C1",
  38290. "\uFBA8",
  38291. "\u06C1",
  38292. "\uFBA9",
  38293. "\u06C1",
  38294. "\uFBAA",
  38295. "\u06BE",
  38296. "\uFBAB",
  38297. "\u06BE",
  38298. "\uFBAC",
  38299. "\u06BE",
  38300. "\uFBAD",
  38301. "\u06BE",
  38302. "\uFBAE",
  38303. "\u06D2",
  38304. "\uFBAF",
  38305. "\u06D2",
  38306. "\uFBB0",
  38307. "\u06D3",
  38308. "\uFBB1",
  38309. "\u06D3",
  38310. "\uFBD3",
  38311. "\u06AD",
  38312. "\uFBD4",
  38313. "\u06AD",
  38314. "\uFBD5",
  38315. "\u06AD",
  38316. "\uFBD6",
  38317. "\u06AD",
  38318. "\uFBD7",
  38319. "\u06C7",
  38320. "\uFBD8",
  38321. "\u06C7",
  38322. "\uFBD9",
  38323. "\u06C6",
  38324. "\uFBDA",
  38325. "\u06C6",
  38326. "\uFBDB",
  38327. "\u06C8",
  38328. "\uFBDC",
  38329. "\u06C8",
  38330. "\uFBDD",
  38331. "\u0677",
  38332. "\uFBDE",
  38333. "\u06CB",
  38334. "\uFBDF",
  38335. "\u06CB",
  38336. "\uFBE0",
  38337. "\u06C5",
  38338. "\uFBE1",
  38339. "\u06C5",
  38340. "\uFBE2",
  38341. "\u06C9",
  38342. "\uFBE3",
  38343. "\u06C9",
  38344. "\uFBE4",
  38345. "\u06D0",
  38346. "\uFBE5",
  38347. "\u06D0",
  38348. "\uFBE6",
  38349. "\u06D0",
  38350. "\uFBE7",
  38351. "\u06D0",
  38352. "\uFBE8",
  38353. "\u0649",
  38354. "\uFBE9",
  38355. "\u0649",
  38356. "\uFBEA",
  38357. "\u0626\u0627",
  38358. "\uFBEB",
  38359. "\u0626\u0627",
  38360. "\uFBEC",
  38361. "\u0626\u06D5",
  38362. "\uFBED",
  38363. "\u0626\u06D5",
  38364. "\uFBEE",
  38365. "\u0626\u0648",
  38366. "\uFBEF",
  38367. "\u0626\u0648",
  38368. "\uFBF0",
  38369. "\u0626\u06C7",
  38370. "\uFBF1",
  38371. "\u0626\u06C7",
  38372. "\uFBF2",
  38373. "\u0626\u06C6",
  38374. "\uFBF3",
  38375. "\u0626\u06C6",
  38376. "\uFBF4",
  38377. "\u0626\u06C8",
  38378. "\uFBF5",
  38379. "\u0626\u06C8",
  38380. "\uFBF6",
  38381. "\u0626\u06D0",
  38382. "\uFBF7",
  38383. "\u0626\u06D0",
  38384. "\uFBF8",
  38385. "\u0626\u06D0",
  38386. "\uFBF9",
  38387. "\u0626\u0649",
  38388. "\uFBFA",
  38389. "\u0626\u0649",
  38390. "\uFBFB",
  38391. "\u0626\u0649",
  38392. "\uFBFC",
  38393. "\u06CC",
  38394. "\uFBFD",
  38395. "\u06CC",
  38396. "\uFBFE",
  38397. "\u06CC",
  38398. "\uFBFF",
  38399. "\u06CC",
  38400. "\uFC00",
  38401. "\u0626\u062C",
  38402. "\uFC01",
  38403. "\u0626\u062D",
  38404. "\uFC02",
  38405. "\u0626\u0645",
  38406. "\uFC03",
  38407. "\u0626\u0649",
  38408. "\uFC04",
  38409. "\u0626\u064A",
  38410. "\uFC05",
  38411. "\u0628\u062C",
  38412. "\uFC06",
  38413. "\u0628\u062D",
  38414. "\uFC07",
  38415. "\u0628\u062E",
  38416. "\uFC08",
  38417. "\u0628\u0645",
  38418. "\uFC09",
  38419. "\u0628\u0649",
  38420. "\uFC0A",
  38421. "\u0628\u064A",
  38422. "\uFC0B",
  38423. "\u062A\u062C",
  38424. "\uFC0C",
  38425. "\u062A\u062D",
  38426. "\uFC0D",
  38427. "\u062A\u062E",
  38428. "\uFC0E",
  38429. "\u062A\u0645",
  38430. "\uFC0F",
  38431. "\u062A\u0649",
  38432. "\uFC10",
  38433. "\u062A\u064A",
  38434. "\uFC11",
  38435. "\u062B\u062C",
  38436. "\uFC12",
  38437. "\u062B\u0645",
  38438. "\uFC13",
  38439. "\u062B\u0649",
  38440. "\uFC14",
  38441. "\u062B\u064A",
  38442. "\uFC15",
  38443. "\u062C\u062D",
  38444. "\uFC16",
  38445. "\u062C\u0645",
  38446. "\uFC17",
  38447. "\u062D\u062C",
  38448. "\uFC18",
  38449. "\u062D\u0645",
  38450. "\uFC19",
  38451. "\u062E\u062C",
  38452. "\uFC1A",
  38453. "\u062E\u062D",
  38454. "\uFC1B",
  38455. "\u062E\u0645",
  38456. "\uFC1C",
  38457. "\u0633\u062C",
  38458. "\uFC1D",
  38459. "\u0633\u062D",
  38460. "\uFC1E",
  38461. "\u0633\u062E",
  38462. "\uFC1F",
  38463. "\u0633\u0645",
  38464. "\uFC20",
  38465. "\u0635\u062D",
  38466. "\uFC21",
  38467. "\u0635\u0645",
  38468. "\uFC22",
  38469. "\u0636\u062C",
  38470. "\uFC23",
  38471. "\u0636\u062D",
  38472. "\uFC24",
  38473. "\u0636\u062E",
  38474. "\uFC25",
  38475. "\u0636\u0645",
  38476. "\uFC26",
  38477. "\u0637\u062D",
  38478. "\uFC27",
  38479. "\u0637\u0645",
  38480. "\uFC28",
  38481. "\u0638\u0645",
  38482. "\uFC29",
  38483. "\u0639\u062C",
  38484. "\uFC2A",
  38485. "\u0639\u0645",
  38486. "\uFC2B",
  38487. "\u063A\u062C",
  38488. "\uFC2C",
  38489. "\u063A\u0645",
  38490. "\uFC2D",
  38491. "\u0641\u062C",
  38492. "\uFC2E",
  38493. "\u0641\u062D",
  38494. "\uFC2F",
  38495. "\u0641\u062E",
  38496. "\uFC30",
  38497. "\u0641\u0645",
  38498. "\uFC31",
  38499. "\u0641\u0649",
  38500. "\uFC32",
  38501. "\u0641\u064A",
  38502. "\uFC33",
  38503. "\u0642\u062D",
  38504. "\uFC34",
  38505. "\u0642\u0645",
  38506. "\uFC35",
  38507. "\u0642\u0649",
  38508. "\uFC36",
  38509. "\u0642\u064A",
  38510. "\uFC37",
  38511. "\u0643\u0627",
  38512. "\uFC38",
  38513. "\u0643\u062C",
  38514. "\uFC39",
  38515. "\u0643\u062D",
  38516. "\uFC3A",
  38517. "\u0643\u062E",
  38518. "\uFC3B",
  38519. "\u0643\u0644",
  38520. "\uFC3C",
  38521. "\u0643\u0645",
  38522. "\uFC3D",
  38523. "\u0643\u0649",
  38524. "\uFC3E",
  38525. "\u0643\u064A",
  38526. "\uFC3F",
  38527. "\u0644\u062C",
  38528. "\uFC40",
  38529. "\u0644\u062D",
  38530. "\uFC41",
  38531. "\u0644\u062E",
  38532. "\uFC42",
  38533. "\u0644\u0645",
  38534. "\uFC43",
  38535. "\u0644\u0649",
  38536. "\uFC44",
  38537. "\u0644\u064A",
  38538. "\uFC45",
  38539. "\u0645\u062C",
  38540. "\uFC46",
  38541. "\u0645\u062D",
  38542. "\uFC47",
  38543. "\u0645\u062E",
  38544. "\uFC48",
  38545. "\u0645\u0645",
  38546. "\uFC49",
  38547. "\u0645\u0649",
  38548. "\uFC4A",
  38549. "\u0645\u064A",
  38550. "\uFC4B",
  38551. "\u0646\u062C",
  38552. "\uFC4C",
  38553. "\u0646\u062D",
  38554. "\uFC4D",
  38555. "\u0646\u062E",
  38556. "\uFC4E",
  38557. "\u0646\u0645",
  38558. "\uFC4F",
  38559. "\u0646\u0649",
  38560. "\uFC50",
  38561. "\u0646\u064A",
  38562. "\uFC51",
  38563. "\u0647\u062C",
  38564. "\uFC52",
  38565. "\u0647\u0645",
  38566. "\uFC53",
  38567. "\u0647\u0649",
  38568. "\uFC54",
  38569. "\u0647\u064A",
  38570. "\uFC55",
  38571. "\u064A\u062C",
  38572. "\uFC56",
  38573. "\u064A\u062D",
  38574. "\uFC57",
  38575. "\u064A\u062E",
  38576. "\uFC58",
  38577. "\u064A\u0645",
  38578. "\uFC59",
  38579. "\u064A\u0649",
  38580. "\uFC5A",
  38581. "\u064A\u064A",
  38582. "\uFC5B",
  38583. "\u0630\u0670",
  38584. "\uFC5C",
  38585. "\u0631\u0670",
  38586. "\uFC5D",
  38587. "\u0649\u0670",
  38588. "\uFC5E",
  38589. "\u0020\u064C\u0651",
  38590. "\uFC5F",
  38591. "\u0020\u064D\u0651",
  38592. "\uFC60",
  38593. "\u0020\u064E\u0651",
  38594. "\uFC61",
  38595. "\u0020\u064F\u0651",
  38596. "\uFC62",
  38597. "\u0020\u0650\u0651",
  38598. "\uFC63",
  38599. "\u0020\u0651\u0670",
  38600. "\uFC64",
  38601. "\u0626\u0631",
  38602. "\uFC65",
  38603. "\u0626\u0632",
  38604. "\uFC66",
  38605. "\u0626\u0645",
  38606. "\uFC67",
  38607. "\u0626\u0646",
  38608. "\uFC68",
  38609. "\u0626\u0649",
  38610. "\uFC69",
  38611. "\u0626\u064A",
  38612. "\uFC6A",
  38613. "\u0628\u0631",
  38614. "\uFC6B",
  38615. "\u0628\u0632",
  38616. "\uFC6C",
  38617. "\u0628\u0645",
  38618. "\uFC6D",
  38619. "\u0628\u0646",
  38620. "\uFC6E",
  38621. "\u0628\u0649",
  38622. "\uFC6F",
  38623. "\u0628\u064A",
  38624. "\uFC70",
  38625. "\u062A\u0631",
  38626. "\uFC71",
  38627. "\u062A\u0632",
  38628. "\uFC72",
  38629. "\u062A\u0645",
  38630. "\uFC73",
  38631. "\u062A\u0646",
  38632. "\uFC74",
  38633. "\u062A\u0649",
  38634. "\uFC75",
  38635. "\u062A\u064A",
  38636. "\uFC76",
  38637. "\u062B\u0631",
  38638. "\uFC77",
  38639. "\u062B\u0632",
  38640. "\uFC78",
  38641. "\u062B\u0645",
  38642. "\uFC79",
  38643. "\u062B\u0646",
  38644. "\uFC7A",
  38645. "\u062B\u0649",
  38646. "\uFC7B",
  38647. "\u062B\u064A",
  38648. "\uFC7C",
  38649. "\u0641\u0649",
  38650. "\uFC7D",
  38651. "\u0641\u064A",
  38652. "\uFC7E",
  38653. "\u0642\u0649",
  38654. "\uFC7F",
  38655. "\u0642\u064A",
  38656. "\uFC80",
  38657. "\u0643\u0627",
  38658. "\uFC81",
  38659. "\u0643\u0644",
  38660. "\uFC82",
  38661. "\u0643\u0645",
  38662. "\uFC83",
  38663. "\u0643\u0649",
  38664. "\uFC84",
  38665. "\u0643\u064A",
  38666. "\uFC85",
  38667. "\u0644\u0645",
  38668. "\uFC86",
  38669. "\u0644\u0649",
  38670. "\uFC87",
  38671. "\u0644\u064A",
  38672. "\uFC88",
  38673. "\u0645\u0627",
  38674. "\uFC89",
  38675. "\u0645\u0645",
  38676. "\uFC8A",
  38677. "\u0646\u0631",
  38678. "\uFC8B",
  38679. "\u0646\u0632",
  38680. "\uFC8C",
  38681. "\u0646\u0645",
  38682. "\uFC8D",
  38683. "\u0646\u0646",
  38684. "\uFC8E",
  38685. "\u0646\u0649",
  38686. "\uFC8F",
  38687. "\u0646\u064A",
  38688. "\uFC90",
  38689. "\u0649\u0670",
  38690. "\uFC91",
  38691. "\u064A\u0631",
  38692. "\uFC92",
  38693. "\u064A\u0632",
  38694. "\uFC93",
  38695. "\u064A\u0645",
  38696. "\uFC94",
  38697. "\u064A\u0646",
  38698. "\uFC95",
  38699. "\u064A\u0649",
  38700. "\uFC96",
  38701. "\u064A\u064A",
  38702. "\uFC97",
  38703. "\u0626\u062C",
  38704. "\uFC98",
  38705. "\u0626\u062D",
  38706. "\uFC99",
  38707. "\u0626\u062E",
  38708. "\uFC9A",
  38709. "\u0626\u0645",
  38710. "\uFC9B",
  38711. "\u0626\u0647",
  38712. "\uFC9C",
  38713. "\u0628\u062C",
  38714. "\uFC9D",
  38715. "\u0628\u062D",
  38716. "\uFC9E",
  38717. "\u0628\u062E",
  38718. "\uFC9F",
  38719. "\u0628\u0645",
  38720. "\uFCA0",
  38721. "\u0628\u0647",
  38722. "\uFCA1",
  38723. "\u062A\u062C",
  38724. "\uFCA2",
  38725. "\u062A\u062D",
  38726. "\uFCA3",
  38727. "\u062A\u062E",
  38728. "\uFCA4",
  38729. "\u062A\u0645",
  38730. "\uFCA5",
  38731. "\u062A\u0647",
  38732. "\uFCA6",
  38733. "\u062B\u0645",
  38734. "\uFCA7",
  38735. "\u062C\u062D",
  38736. "\uFCA8",
  38737. "\u062C\u0645",
  38738. "\uFCA9",
  38739. "\u062D\u062C",
  38740. "\uFCAA",
  38741. "\u062D\u0645",
  38742. "\uFCAB",
  38743. "\u062E\u062C",
  38744. "\uFCAC",
  38745. "\u062E\u0645",
  38746. "\uFCAD",
  38747. "\u0633\u062C",
  38748. "\uFCAE",
  38749. "\u0633\u062D",
  38750. "\uFCAF",
  38751. "\u0633\u062E",
  38752. "\uFCB0",
  38753. "\u0633\u0645",
  38754. "\uFCB1",
  38755. "\u0635\u062D",
  38756. "\uFCB2",
  38757. "\u0635\u062E",
  38758. "\uFCB3",
  38759. "\u0635\u0645",
  38760. "\uFCB4",
  38761. "\u0636\u062C",
  38762. "\uFCB5",
  38763. "\u0636\u062D",
  38764. "\uFCB6",
  38765. "\u0636\u062E",
  38766. "\uFCB7",
  38767. "\u0636\u0645",
  38768. "\uFCB8",
  38769. "\u0637\u062D",
  38770. "\uFCB9",
  38771. "\u0638\u0645",
  38772. "\uFCBA",
  38773. "\u0639\u062C",
  38774. "\uFCBB",
  38775. "\u0639\u0645",
  38776. "\uFCBC",
  38777. "\u063A\u062C",
  38778. "\uFCBD",
  38779. "\u063A\u0645",
  38780. "\uFCBE",
  38781. "\u0641\u062C",
  38782. "\uFCBF",
  38783. "\u0641\u062D",
  38784. "\uFCC0",
  38785. "\u0641\u062E",
  38786. "\uFCC1",
  38787. "\u0641\u0645",
  38788. "\uFCC2",
  38789. "\u0642\u062D",
  38790. "\uFCC3",
  38791. "\u0642\u0645",
  38792. "\uFCC4",
  38793. "\u0643\u062C",
  38794. "\uFCC5",
  38795. "\u0643\u062D",
  38796. "\uFCC6",
  38797. "\u0643\u062E",
  38798. "\uFCC7",
  38799. "\u0643\u0644",
  38800. "\uFCC8",
  38801. "\u0643\u0645",
  38802. "\uFCC9",
  38803. "\u0644\u062C",
  38804. "\uFCCA",
  38805. "\u0644\u062D",
  38806. "\uFCCB",
  38807. "\u0644\u062E",
  38808. "\uFCCC",
  38809. "\u0644\u0645",
  38810. "\uFCCD",
  38811. "\u0644\u0647",
  38812. "\uFCCE",
  38813. "\u0645\u062C",
  38814. "\uFCCF",
  38815. "\u0645\u062D",
  38816. "\uFCD0",
  38817. "\u0645\u062E",
  38818. "\uFCD1",
  38819. "\u0645\u0645",
  38820. "\uFCD2",
  38821. "\u0646\u062C",
  38822. "\uFCD3",
  38823. "\u0646\u062D",
  38824. "\uFCD4",
  38825. "\u0646\u062E",
  38826. "\uFCD5",
  38827. "\u0646\u0645",
  38828. "\uFCD6",
  38829. "\u0646\u0647",
  38830. "\uFCD7",
  38831. "\u0647\u062C",
  38832. "\uFCD8",
  38833. "\u0647\u0645",
  38834. "\uFCD9",
  38835. "\u0647\u0670",
  38836. "\uFCDA",
  38837. "\u064A\u062C",
  38838. "\uFCDB",
  38839. "\u064A\u062D",
  38840. "\uFCDC",
  38841. "\u064A\u062E",
  38842. "\uFCDD",
  38843. "\u064A\u0645",
  38844. "\uFCDE",
  38845. "\u064A\u0647",
  38846. "\uFCDF",
  38847. "\u0626\u0645",
  38848. "\uFCE0",
  38849. "\u0626\u0647",
  38850. "\uFCE1",
  38851. "\u0628\u0645",
  38852. "\uFCE2",
  38853. "\u0628\u0647",
  38854. "\uFCE3",
  38855. "\u062A\u0645",
  38856. "\uFCE4",
  38857. "\u062A\u0647",
  38858. "\uFCE5",
  38859. "\u062B\u0645",
  38860. "\uFCE6",
  38861. "\u062B\u0647",
  38862. "\uFCE7",
  38863. "\u0633\u0645",
  38864. "\uFCE8",
  38865. "\u0633\u0647",
  38866. "\uFCE9",
  38867. "\u0634\u0645",
  38868. "\uFCEA",
  38869. "\u0634\u0647",
  38870. "\uFCEB",
  38871. "\u0643\u0644",
  38872. "\uFCEC",
  38873. "\u0643\u0645",
  38874. "\uFCED",
  38875. "\u0644\u0645",
  38876. "\uFCEE",
  38877. "\u0646\u0645",
  38878. "\uFCEF",
  38879. "\u0646\u0647",
  38880. "\uFCF0",
  38881. "\u064A\u0645",
  38882. "\uFCF1",
  38883. "\u064A\u0647",
  38884. "\uFCF2",
  38885. "\u0640\u064E\u0651",
  38886. "\uFCF3",
  38887. "\u0640\u064F\u0651",
  38888. "\uFCF4",
  38889. "\u0640\u0650\u0651",
  38890. "\uFCF5",
  38891. "\u0637\u0649",
  38892. "\uFCF6",
  38893. "\u0637\u064A",
  38894. "\uFCF7",
  38895. "\u0639\u0649",
  38896. "\uFCF8",
  38897. "\u0639\u064A",
  38898. "\uFCF9",
  38899. "\u063A\u0649",
  38900. "\uFCFA",
  38901. "\u063A\u064A",
  38902. "\uFCFB",
  38903. "\u0633\u0649",
  38904. "\uFCFC",
  38905. "\u0633\u064A",
  38906. "\uFCFD",
  38907. "\u0634\u0649",
  38908. "\uFCFE",
  38909. "\u0634\u064A",
  38910. "\uFCFF",
  38911. "\u062D\u0649",
  38912. "\uFD00",
  38913. "\u062D\u064A",
  38914. "\uFD01",
  38915. "\u062C\u0649",
  38916. "\uFD02",
  38917. "\u062C\u064A",
  38918. "\uFD03",
  38919. "\u062E\u0649",
  38920. "\uFD04",
  38921. "\u062E\u064A",
  38922. "\uFD05",
  38923. "\u0635\u0649",
  38924. "\uFD06",
  38925. "\u0635\u064A",
  38926. "\uFD07",
  38927. "\u0636\u0649",
  38928. "\uFD08",
  38929. "\u0636\u064A",
  38930. "\uFD09",
  38931. "\u0634\u062C",
  38932. "\uFD0A",
  38933. "\u0634\u062D",
  38934. "\uFD0B",
  38935. "\u0634\u062E",
  38936. "\uFD0C",
  38937. "\u0634\u0645",
  38938. "\uFD0D",
  38939. "\u0634\u0631",
  38940. "\uFD0E",
  38941. "\u0633\u0631",
  38942. "\uFD0F",
  38943. "\u0635\u0631",
  38944. "\uFD10",
  38945. "\u0636\u0631",
  38946. "\uFD11",
  38947. "\u0637\u0649",
  38948. "\uFD12",
  38949. "\u0637\u064A",
  38950. "\uFD13",
  38951. "\u0639\u0649",
  38952. "\uFD14",
  38953. "\u0639\u064A",
  38954. "\uFD15",
  38955. "\u063A\u0649",
  38956. "\uFD16",
  38957. "\u063A\u064A",
  38958. "\uFD17",
  38959. "\u0633\u0649",
  38960. "\uFD18",
  38961. "\u0633\u064A",
  38962. "\uFD19",
  38963. "\u0634\u0649",
  38964. "\uFD1A",
  38965. "\u0634\u064A",
  38966. "\uFD1B",
  38967. "\u062D\u0649",
  38968. "\uFD1C",
  38969. "\u062D\u064A",
  38970. "\uFD1D",
  38971. "\u062C\u0649",
  38972. "\uFD1E",
  38973. "\u062C\u064A",
  38974. "\uFD1F",
  38975. "\u062E\u0649",
  38976. "\uFD20",
  38977. "\u062E\u064A",
  38978. "\uFD21",
  38979. "\u0635\u0649",
  38980. "\uFD22",
  38981. "\u0635\u064A",
  38982. "\uFD23",
  38983. "\u0636\u0649",
  38984. "\uFD24",
  38985. "\u0636\u064A",
  38986. "\uFD25",
  38987. "\u0634\u062C",
  38988. "\uFD26",
  38989. "\u0634\u062D",
  38990. "\uFD27",
  38991. "\u0634\u062E",
  38992. "\uFD28",
  38993. "\u0634\u0645",
  38994. "\uFD29",
  38995. "\u0634\u0631",
  38996. "\uFD2A",
  38997. "\u0633\u0631",
  38998. "\uFD2B",
  38999. "\u0635\u0631",
  39000. "\uFD2C",
  39001. "\u0636\u0631",
  39002. "\uFD2D",
  39003. "\u0634\u062C",
  39004. "\uFD2E",
  39005. "\u0634\u062D",
  39006. "\uFD2F",
  39007. "\u0634\u062E",
  39008. "\uFD30",
  39009. "\u0634\u0645",
  39010. "\uFD31",
  39011. "\u0633\u0647",
  39012. "\uFD32",
  39013. "\u0634\u0647",
  39014. "\uFD33",
  39015. "\u0637\u0645",
  39016. "\uFD34",
  39017. "\u0633\u062C",
  39018. "\uFD35",
  39019. "\u0633\u062D",
  39020. "\uFD36",
  39021. "\u0633\u062E",
  39022. "\uFD37",
  39023. "\u0634\u062C",
  39024. "\uFD38",
  39025. "\u0634\u062D",
  39026. "\uFD39",
  39027. "\u0634\u062E",
  39028. "\uFD3A",
  39029. "\u0637\u0645",
  39030. "\uFD3B",
  39031. "\u0638\u0645",
  39032. "\uFD3C",
  39033. "\u0627\u064B",
  39034. "\uFD3D",
  39035. "\u0627\u064B",
  39036. "\uFD50",
  39037. "\u062A\u062C\u0645",
  39038. "\uFD51",
  39039. "\u062A\u062D\u062C",
  39040. "\uFD52",
  39041. "\u062A\u062D\u062C",
  39042. "\uFD53",
  39043. "\u062A\u062D\u0645",
  39044. "\uFD54",
  39045. "\u062A\u062E\u0645",
  39046. "\uFD55",
  39047. "\u062A\u0645\u062C",
  39048. "\uFD56",
  39049. "\u062A\u0645\u062D",
  39050. "\uFD57",
  39051. "\u062A\u0645\u062E",
  39052. "\uFD58",
  39053. "\u062C\u0645\u062D",
  39054. "\uFD59",
  39055. "\u062C\u0645\u062D",
  39056. "\uFD5A",
  39057. "\u062D\u0645\u064A",
  39058. "\uFD5B",
  39059. "\u062D\u0645\u0649",
  39060. "\uFD5C",
  39061. "\u0633\u062D\u062C",
  39062. "\uFD5D",
  39063. "\u0633\u062C\u062D",
  39064. "\uFD5E",
  39065. "\u0633\u062C\u0649",
  39066. "\uFD5F",
  39067. "\u0633\u0645\u062D",
  39068. "\uFD60",
  39069. "\u0633\u0645\u062D",
  39070. "\uFD61",
  39071. "\u0633\u0645\u062C",
  39072. "\uFD62",
  39073. "\u0633\u0645\u0645",
  39074. "\uFD63",
  39075. "\u0633\u0645\u0645",
  39076. "\uFD64",
  39077. "\u0635\u062D\u062D",
  39078. "\uFD65",
  39079. "\u0635\u062D\u062D",
  39080. "\uFD66",
  39081. "\u0635\u0645\u0645",
  39082. "\uFD67",
  39083. "\u0634\u062D\u0645",
  39084. "\uFD68",
  39085. "\u0634\u062D\u0645",
  39086. "\uFD69",
  39087. "\u0634\u062C\u064A",
  39088. "\uFD6A",
  39089. "\u0634\u0645\u062E",
  39090. "\uFD6B",
  39091. "\u0634\u0645\u062E",
  39092. "\uFD6C",
  39093. "\u0634\u0645\u0645",
  39094. "\uFD6D",
  39095. "\u0634\u0645\u0645",
  39096. "\uFD6E",
  39097. "\u0636\u062D\u0649",
  39098. "\uFD6F",
  39099. "\u0636\u062E\u0645",
  39100. "\uFD70",
  39101. "\u0636\u062E\u0645",
  39102. "\uFD71",
  39103. "\u0637\u0645\u062D",
  39104. "\uFD72",
  39105. "\u0637\u0645\u062D",
  39106. "\uFD73",
  39107. "\u0637\u0645\u0645",
  39108. "\uFD74",
  39109. "\u0637\u0645\u064A",
  39110. "\uFD75",
  39111. "\u0639\u062C\u0645",
  39112. "\uFD76",
  39113. "\u0639\u0645\u0645",
  39114. "\uFD77",
  39115. "\u0639\u0645\u0645",
  39116. "\uFD78",
  39117. "\u0639\u0645\u0649",
  39118. "\uFD79",
  39119. "\u063A\u0645\u0645",
  39120. "\uFD7A",
  39121. "\u063A\u0645\u064A",
  39122. "\uFD7B",
  39123. "\u063A\u0645\u0649",
  39124. "\uFD7C",
  39125. "\u0641\u062E\u0645",
  39126. "\uFD7D",
  39127. "\u0641\u062E\u0645",
  39128. "\uFD7E",
  39129. "\u0642\u0645\u062D",
  39130. "\uFD7F",
  39131. "\u0642\u0645\u0645",
  39132. "\uFD80",
  39133. "\u0644\u062D\u0645",
  39134. "\uFD81",
  39135. "\u0644\u062D\u064A",
  39136. "\uFD82",
  39137. "\u0644\u062D\u0649",
  39138. "\uFD83",
  39139. "\u0644\u062C\u062C",
  39140. "\uFD84",
  39141. "\u0644\u062C\u062C",
  39142. "\uFD85",
  39143. "\u0644\u062E\u0645",
  39144. "\uFD86",
  39145. "\u0644\u062E\u0645",
  39146. "\uFD87",
  39147. "\u0644\u0645\u062D",
  39148. "\uFD88",
  39149. "\u0644\u0645\u062D",
  39150. "\uFD89",
  39151. "\u0645\u062D\u062C",
  39152. "\uFD8A",
  39153. "\u0645\u062D\u0645",
  39154. "\uFD8B",
  39155. "\u0645\u062D\u064A",
  39156. "\uFD8C",
  39157. "\u0645\u062C\u062D",
  39158. "\uFD8D",
  39159. "\u0645\u062C\u0645",
  39160. "\uFD8E",
  39161. "\u0645\u062E\u062C",
  39162. "\uFD8F",
  39163. "\u0645\u062E\u0645",
  39164. "\uFD92",
  39165. "\u0645\u062C\u062E",
  39166. "\uFD93",
  39167. "\u0647\u0645\u062C",
  39168. "\uFD94",
  39169. "\u0647\u0645\u0645",
  39170. "\uFD95",
  39171. "\u0646\u062D\u0645",
  39172. "\uFD96",
  39173. "\u0646\u062D\u0649",
  39174. "\uFD97",
  39175. "\u0646\u062C\u0645",
  39176. "\uFD98",
  39177. "\u0646\u062C\u0645",
  39178. "\uFD99",
  39179. "\u0646\u062C\u0649",
  39180. "\uFD9A",
  39181. "\u0646\u0645\u064A",
  39182. "\uFD9B",
  39183. "\u0646\u0645\u0649",
  39184. "\uFD9C",
  39185. "\u064A\u0645\u0645",
  39186. "\uFD9D",
  39187. "\u064A\u0645\u0645",
  39188. "\uFD9E",
  39189. "\u0628\u062E\u064A",
  39190. "\uFD9F",
  39191. "\u062A\u062C\u064A",
  39192. "\uFDA0",
  39193. "\u062A\u062C\u0649",
  39194. "\uFDA1",
  39195. "\u062A\u062E\u064A",
  39196. "\uFDA2",
  39197. "\u062A\u062E\u0649",
  39198. "\uFDA3",
  39199. "\u062A\u0645\u064A",
  39200. "\uFDA4",
  39201. "\u062A\u0645\u0649",
  39202. "\uFDA5",
  39203. "\u062C\u0645\u064A",
  39204. "\uFDA6",
  39205. "\u062C\u062D\u0649",
  39206. "\uFDA7",
  39207. "\u062C\u0645\u0649",
  39208. "\uFDA8",
  39209. "\u0633\u062E\u0649",
  39210. "\uFDA9",
  39211. "\u0635\u062D\u064A",
  39212. "\uFDAA",
  39213. "\u0634\u062D\u064A",
  39214. "\uFDAB",
  39215. "\u0636\u062D\u064A",
  39216. "\uFDAC",
  39217. "\u0644\u062C\u064A",
  39218. "\uFDAD",
  39219. "\u0644\u0645\u064A",
  39220. "\uFDAE",
  39221. "\u064A\u062D\u064A",
  39222. "\uFDAF",
  39223. "\u064A\u062C\u064A",
  39224. "\uFDB0",
  39225. "\u064A\u0645\u064A",
  39226. "\uFDB1",
  39227. "\u0645\u0645\u064A",
  39228. "\uFDB2",
  39229. "\u0642\u0645\u064A",
  39230. "\uFDB3",
  39231. "\u0646\u062D\u064A",
  39232. "\uFDB4",
  39233. "\u0642\u0645\u062D",
  39234. "\uFDB5",
  39235. "\u0644\u062D\u0645",
  39236. "\uFDB6",
  39237. "\u0639\u0645\u064A",
  39238. "\uFDB7",
  39239. "\u0643\u0645\u064A",
  39240. "\uFDB8",
  39241. "\u0646\u062C\u062D",
  39242. "\uFDB9",
  39243. "\u0645\u062E\u064A",
  39244. "\uFDBA",
  39245. "\u0644\u062C\u0645",
  39246. "\uFDBB",
  39247. "\u0643\u0645\u0645",
  39248. "\uFDBC",
  39249. "\u0644\u062C\u0645",
  39250. "\uFDBD",
  39251. "\u0646\u062C\u062D",
  39252. "\uFDBE",
  39253. "\u062C\u062D\u064A",
  39254. "\uFDBF",
  39255. "\u062D\u062C\u064A",
  39256. "\uFDC0",
  39257. "\u0645\u062C\u064A",
  39258. "\uFDC1",
  39259. "\u0641\u0645\u064A",
  39260. "\uFDC2",
  39261. "\u0628\u062D\u064A",
  39262. "\uFDC3",
  39263. "\u0643\u0645\u0645",
  39264. "\uFDC4",
  39265. "\u0639\u062C\u0645",
  39266. "\uFDC5",
  39267. "\u0635\u0645\u0645",
  39268. "\uFDC6",
  39269. "\u0633\u062E\u064A",
  39270. "\uFDC7",
  39271. "\u0646\u062C\u064A",
  39272. "\uFE49",
  39273. "\u203E",
  39274. "\uFE4A",
  39275. "\u203E",
  39276. "\uFE4B",
  39277. "\u203E",
  39278. "\uFE4C",
  39279. "\u203E",
  39280. "\uFE4D",
  39281. "\u005F",
  39282. "\uFE4E",
  39283. "\u005F",
  39284. "\uFE4F",
  39285. "\u005F",
  39286. "\uFE80",
  39287. "\u0621",
  39288. "\uFE81",
  39289. "\u0622",
  39290. "\uFE82",
  39291. "\u0622",
  39292. "\uFE83",
  39293. "\u0623",
  39294. "\uFE84",
  39295. "\u0623",
  39296. "\uFE85",
  39297. "\u0624",
  39298. "\uFE86",
  39299. "\u0624",
  39300. "\uFE87",
  39301. "\u0625",
  39302. "\uFE88",
  39303. "\u0625",
  39304. "\uFE89",
  39305. "\u0626",
  39306. "\uFE8A",
  39307. "\u0626",
  39308. "\uFE8B",
  39309. "\u0626",
  39310. "\uFE8C",
  39311. "\u0626",
  39312. "\uFE8D",
  39313. "\u0627",
  39314. "\uFE8E",
  39315. "\u0627",
  39316. "\uFE8F",
  39317. "\u0628",
  39318. "\uFE90",
  39319. "\u0628",
  39320. "\uFE91",
  39321. "\u0628",
  39322. "\uFE92",
  39323. "\u0628",
  39324. "\uFE93",
  39325. "\u0629",
  39326. "\uFE94",
  39327. "\u0629",
  39328. "\uFE95",
  39329. "\u062A",
  39330. "\uFE96",
  39331. "\u062A",
  39332. "\uFE97",
  39333. "\u062A",
  39334. "\uFE98",
  39335. "\u062A",
  39336. "\uFE99",
  39337. "\u062B",
  39338. "\uFE9A",
  39339. "\u062B",
  39340. "\uFE9B",
  39341. "\u062B",
  39342. "\uFE9C",
  39343. "\u062B",
  39344. "\uFE9D",
  39345. "\u062C",
  39346. "\uFE9E",
  39347. "\u062C",
  39348. "\uFE9F",
  39349. "\u062C",
  39350. "\uFEA0",
  39351. "\u062C",
  39352. "\uFEA1",
  39353. "\u062D",
  39354. "\uFEA2",
  39355. "\u062D",
  39356. "\uFEA3",
  39357. "\u062D",
  39358. "\uFEA4",
  39359. "\u062D",
  39360. "\uFEA5",
  39361. "\u062E",
  39362. "\uFEA6",
  39363. "\u062E",
  39364. "\uFEA7",
  39365. "\u062E",
  39366. "\uFEA8",
  39367. "\u062E",
  39368. "\uFEA9",
  39369. "\u062F",
  39370. "\uFEAA",
  39371. "\u062F",
  39372. "\uFEAB",
  39373. "\u0630",
  39374. "\uFEAC",
  39375. "\u0630",
  39376. "\uFEAD",
  39377. "\u0631",
  39378. "\uFEAE",
  39379. "\u0631",
  39380. "\uFEAF",
  39381. "\u0632",
  39382. "\uFEB0",
  39383. "\u0632",
  39384. "\uFEB1",
  39385. "\u0633",
  39386. "\uFEB2",
  39387. "\u0633",
  39388. "\uFEB3",
  39389. "\u0633",
  39390. "\uFEB4",
  39391. "\u0633",
  39392. "\uFEB5",
  39393. "\u0634",
  39394. "\uFEB6",
  39395. "\u0634",
  39396. "\uFEB7",
  39397. "\u0634",
  39398. "\uFEB8",
  39399. "\u0634",
  39400. "\uFEB9",
  39401. "\u0635",
  39402. "\uFEBA",
  39403. "\u0635",
  39404. "\uFEBB",
  39405. "\u0635",
  39406. "\uFEBC",
  39407. "\u0635",
  39408. "\uFEBD",
  39409. "\u0636",
  39410. "\uFEBE",
  39411. "\u0636",
  39412. "\uFEBF",
  39413. "\u0636",
  39414. "\uFEC0",
  39415. "\u0636",
  39416. "\uFEC1",
  39417. "\u0637",
  39418. "\uFEC2",
  39419. "\u0637",
  39420. "\uFEC3",
  39421. "\u0637",
  39422. "\uFEC4",
  39423. "\u0637",
  39424. "\uFEC5",
  39425. "\u0638",
  39426. "\uFEC6",
  39427. "\u0638",
  39428. "\uFEC7",
  39429. "\u0638",
  39430. "\uFEC8",
  39431. "\u0638",
  39432. "\uFEC9",
  39433. "\u0639",
  39434. "\uFECA",
  39435. "\u0639",
  39436. "\uFECB",
  39437. "\u0639",
  39438. "\uFECC",
  39439. "\u0639",
  39440. "\uFECD",
  39441. "\u063A",
  39442. "\uFECE",
  39443. "\u063A",
  39444. "\uFECF",
  39445. "\u063A",
  39446. "\uFED0",
  39447. "\u063A",
  39448. "\uFED1",
  39449. "\u0641",
  39450. "\uFED2",
  39451. "\u0641",
  39452. "\uFED3",
  39453. "\u0641",
  39454. "\uFED4",
  39455. "\u0641",
  39456. "\uFED5",
  39457. "\u0642",
  39458. "\uFED6",
  39459. "\u0642",
  39460. "\uFED7",
  39461. "\u0642",
  39462. "\uFED8",
  39463. "\u0642",
  39464. "\uFED9",
  39465. "\u0643",
  39466. "\uFEDA",
  39467. "\u0643",
  39468. "\uFEDB",
  39469. "\u0643",
  39470. "\uFEDC",
  39471. "\u0643",
  39472. "\uFEDD",
  39473. "\u0644",
  39474. "\uFEDE",
  39475. "\u0644",
  39476. "\uFEDF",
  39477. "\u0644",
  39478. "\uFEE0",
  39479. "\u0644",
  39480. "\uFEE1",
  39481. "\u0645",
  39482. "\uFEE2",
  39483. "\u0645",
  39484. "\uFEE3",
  39485. "\u0645",
  39486. "\uFEE4",
  39487. "\u0645",
  39488. "\uFEE5",
  39489. "\u0646",
  39490. "\uFEE6",
  39491. "\u0646",
  39492. "\uFEE7",
  39493. "\u0646",
  39494. "\uFEE8",
  39495. "\u0646",
  39496. "\uFEE9",
  39497. "\u0647",
  39498. "\uFEEA",
  39499. "\u0647",
  39500. "\uFEEB",
  39501. "\u0647",
  39502. "\uFEEC",
  39503. "\u0647",
  39504. "\uFEED",
  39505. "\u0648",
  39506. "\uFEEE",
  39507. "\u0648",
  39508. "\uFEEF",
  39509. "\u0649",
  39510. "\uFEF0",
  39511. "\u0649",
  39512. "\uFEF1",
  39513. "\u064A",
  39514. "\uFEF2",
  39515. "\u064A",
  39516. "\uFEF3",
  39517. "\u064A",
  39518. "\uFEF4",
  39519. "\u064A",
  39520. "\uFEF5",
  39521. "\u0644\u0622",
  39522. "\uFEF6",
  39523. "\u0644\u0622",
  39524. "\uFEF7",
  39525. "\u0644\u0623",
  39526. "\uFEF8",
  39527. "\u0644\u0623",
  39528. "\uFEF9",
  39529. "\u0644\u0625",
  39530. "\uFEFA",
  39531. "\u0644\u0625",
  39532. "\uFEFB",
  39533. "\u0644\u0627",
  39534. "\uFEFC",
  39535. "\u0644\u0627"
  39536. ];
  39537. });
  39538. function reverseIfRtl(chars) {
  39539. const charsLength = chars.length;
  39540. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  39541. return chars;
  39542. }
  39543. const buf = [];
  39544. for (let ii = charsLength - 1; ii >= 0; ii--) {
  39545. buf.push(chars[ii]);
  39546. }
  39547. return buf.join("");
  39548. }
  39549. /***/ }),
  39550. /* 38 */
  39551. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39552. Object.defineProperty(exports, "__esModule", ({
  39553. value: true
  39554. }));
  39555. exports.FontRendererFactory = void 0;
  39556. var _util = __w_pdfjs_require__(2);
  39557. var _cff_parser = __w_pdfjs_require__(32);
  39558. var _glyphlist = __w_pdfjs_require__(35);
  39559. var _encodings = __w_pdfjs_require__(34);
  39560. var _stream = __w_pdfjs_require__(12);
  39561. const FontRendererFactory = function FontRendererFactoryClosure() {
  39562. function getLong(data, offset) {
  39563. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39564. }
  39565. function getUshort(data, offset) {
  39566. return data[offset] << 8 | data[offset + 1];
  39567. }
  39568. function getSubroutineBias(subrs) {
  39569. const numSubrs = subrs.length;
  39570. let bias = 32768;
  39571. if (numSubrs < 1240) {
  39572. bias = 107;
  39573. } else if (numSubrs < 33900) {
  39574. bias = 1131;
  39575. }
  39576. return bias;
  39577. }
  39578. function parseCmap(data, start, end) {
  39579. const offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  39580. const format = getUshort(data, start + offset);
  39581. let ranges, p, i;
  39582. if (format === 4) {
  39583. getUshort(data, start + offset + 2);
  39584. const segCount = getUshort(data, start + offset + 6) >> 1;
  39585. p = start + offset + 14;
  39586. ranges = [];
  39587. for (i = 0; i < segCount; i++, p += 2) {
  39588. ranges[i] = {
  39589. end: getUshort(data, p)
  39590. };
  39591. }
  39592. p += 2;
  39593. for (i = 0; i < segCount; i++, p += 2) {
  39594. ranges[i].start = getUshort(data, p);
  39595. }
  39596. for (i = 0; i < segCount; i++, p += 2) {
  39597. ranges[i].idDelta = getUshort(data, p);
  39598. }
  39599. for (i = 0; i < segCount; i++, p += 2) {
  39600. let idOffset = getUshort(data, p);
  39601. if (idOffset === 0) {
  39602. continue;
  39603. }
  39604. ranges[i].ids = [];
  39605. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  39606. ranges[i].ids[j] = getUshort(data, p + idOffset);
  39607. idOffset += 2;
  39608. }
  39609. }
  39610. return ranges;
  39611. } else if (format === 12) {
  39612. getLong(data, start + offset + 4);
  39613. const groups = getLong(data, start + offset + 12);
  39614. p = start + offset + 16;
  39615. ranges = [];
  39616. for (i = 0; i < groups; i++) {
  39617. ranges.push({
  39618. start: getLong(data, p),
  39619. end: getLong(data, p + 4),
  39620. idDelta: getLong(data, p + 8) - getLong(data, p)
  39621. });
  39622. p += 12;
  39623. }
  39624. return ranges;
  39625. }
  39626. throw new _util.FormatError(`unsupported cmap: ${format}`);
  39627. }
  39628. function parseCff(data, start, end, seacAnalysisEnabled) {
  39629. const properties = {};
  39630. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  39631. const cff = parser.parse();
  39632. return {
  39633. glyphs: cff.charStrings.objects,
  39634. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  39635. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  39636. isCFFCIDFont: cff.isCIDFont,
  39637. fdSelect: cff.fdSelect,
  39638. fdArray: cff.fdArray
  39639. };
  39640. }
  39641. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  39642. let itemSize, itemDecode;
  39643. if (isGlyphLocationsLong) {
  39644. itemSize = 4;
  39645. itemDecode = function fontItemDecodeLong(data, offset) {
  39646. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  39647. };
  39648. } else {
  39649. itemSize = 2;
  39650. itemDecode = function fontItemDecode(data, offset) {
  39651. return data[offset] << 9 | data[offset + 1] << 1;
  39652. };
  39653. }
  39654. const glyphs = [];
  39655. let startOffset = itemDecode(loca, 0);
  39656. for (let j = itemSize; j < loca.length; j += itemSize) {
  39657. const endOffset = itemDecode(loca, j);
  39658. glyphs.push(glyf.subarray(startOffset, endOffset));
  39659. startOffset = endOffset;
  39660. }
  39661. return glyphs;
  39662. }
  39663. function lookupCmap(ranges, unicode) {
  39664. const code = unicode.codePointAt(0);
  39665. let gid = 0,
  39666. l = 0,
  39667. r = ranges.length - 1;
  39668. while (l < r) {
  39669. const c = l + r + 1 >> 1;
  39670. if (code < ranges[c].start) {
  39671. r = c - 1;
  39672. } else {
  39673. l = c;
  39674. }
  39675. }
  39676. if (ranges[l].start <= code && code <= ranges[l].end) {
  39677. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  39678. }
  39679. return {
  39680. charCode: code,
  39681. glyphId: gid
  39682. };
  39683. }
  39684. function compileGlyf(code, cmds, font) {
  39685. function moveTo(x, y) {
  39686. cmds.push({
  39687. cmd: "moveTo",
  39688. args: [x, y]
  39689. });
  39690. }
  39691. function lineTo(x, y) {
  39692. cmds.push({
  39693. cmd: "lineTo",
  39694. args: [x, y]
  39695. });
  39696. }
  39697. function quadraticCurveTo(xa, ya, x, y) {
  39698. cmds.push({
  39699. cmd: "quadraticCurveTo",
  39700. args: [xa, ya, x, y]
  39701. });
  39702. }
  39703. let i = 0;
  39704. const numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39705. let flags;
  39706. let x = 0,
  39707. y = 0;
  39708. i += 10;
  39709. if (numberOfContours < 0) {
  39710. do {
  39711. flags = code[i] << 8 | code[i + 1];
  39712. const glyphIndex = code[i + 2] << 8 | code[i + 3];
  39713. i += 4;
  39714. let arg1, arg2;
  39715. if (flags & 0x01) {
  39716. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  39717. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  39718. i += 4;
  39719. } else {
  39720. arg1 = code[i++];
  39721. arg2 = code[i++];
  39722. }
  39723. if (flags & 0x02) {
  39724. x = arg1;
  39725. y = arg2;
  39726. } else {
  39727. x = 0;
  39728. y = 0;
  39729. }
  39730. let scaleX = 1,
  39731. scaleY = 1,
  39732. scale01 = 0,
  39733. scale10 = 0;
  39734. if (flags & 0x08) {
  39735. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39736. i += 2;
  39737. } else if (flags & 0x40) {
  39738. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39739. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39740. i += 4;
  39741. } else if (flags & 0x80) {
  39742. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  39743. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  39744. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  39745. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  39746. i += 8;
  39747. }
  39748. const subglyph = font.glyphs[glyphIndex];
  39749. if (subglyph) {
  39750. cmds.push({
  39751. cmd: "save"
  39752. });
  39753. cmds.push({
  39754. cmd: "transform",
  39755. args: [scaleX, scale01, scale10, scaleY, x, y]
  39756. });
  39757. compileGlyf(subglyph, cmds, font);
  39758. cmds.push({
  39759. cmd: "restore"
  39760. });
  39761. }
  39762. } while (flags & 0x20);
  39763. } else {
  39764. const endPtsOfContours = [];
  39765. let j, jj;
  39766. for (j = 0; j < numberOfContours; j++) {
  39767. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  39768. i += 2;
  39769. }
  39770. const instructionLength = code[i] << 8 | code[i + 1];
  39771. i += 2 + instructionLength;
  39772. const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  39773. const points = [];
  39774. while (points.length < numberOfPoints) {
  39775. flags = code[i++];
  39776. let repeat = 1;
  39777. if (flags & 0x08) {
  39778. repeat += code[i++];
  39779. }
  39780. while (repeat-- > 0) {
  39781. points.push({
  39782. flags
  39783. });
  39784. }
  39785. }
  39786. for (j = 0; j < numberOfPoints; j++) {
  39787. switch (points[j].flags & 0x12) {
  39788. case 0x00:
  39789. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39790. i += 2;
  39791. break;
  39792. case 0x02:
  39793. x -= code[i++];
  39794. break;
  39795. case 0x12:
  39796. x += code[i++];
  39797. break;
  39798. }
  39799. points[j].x = x;
  39800. }
  39801. for (j = 0; j < numberOfPoints; j++) {
  39802. switch (points[j].flags & 0x24) {
  39803. case 0x00:
  39804. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  39805. i += 2;
  39806. break;
  39807. case 0x04:
  39808. y -= code[i++];
  39809. break;
  39810. case 0x24:
  39811. y += code[i++];
  39812. break;
  39813. }
  39814. points[j].y = y;
  39815. }
  39816. let startPoint = 0;
  39817. for (i = 0; i < numberOfContours; i++) {
  39818. const endPoint = endPtsOfContours[i];
  39819. const contour = points.slice(startPoint, endPoint + 1);
  39820. if (contour[0].flags & 1) {
  39821. contour.push(contour[0]);
  39822. } else if (contour[contour.length - 1].flags & 1) {
  39823. contour.unshift(contour[contour.length - 1]);
  39824. } else {
  39825. const p = {
  39826. flags: 1,
  39827. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  39828. y: (contour[0].y + contour[contour.length - 1].y) / 2
  39829. };
  39830. contour.unshift(p);
  39831. contour.push(p);
  39832. }
  39833. moveTo(contour[0].x, contour[0].y);
  39834. for (j = 1, jj = contour.length; j < jj; j++) {
  39835. if (contour[j].flags & 1) {
  39836. lineTo(contour[j].x, contour[j].y);
  39837. } else if (contour[j + 1].flags & 1) {
  39838. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  39839. j++;
  39840. } else {
  39841. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  39842. }
  39843. }
  39844. startPoint = endPoint + 1;
  39845. }
  39846. }
  39847. }
  39848. function compileCharString(charStringCode, cmds, font, glyphId) {
  39849. function moveTo(x, y) {
  39850. cmds.push({
  39851. cmd: "moveTo",
  39852. args: [x, y]
  39853. });
  39854. }
  39855. function lineTo(x, y) {
  39856. cmds.push({
  39857. cmd: "lineTo",
  39858. args: [x, y]
  39859. });
  39860. }
  39861. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  39862. cmds.push({
  39863. cmd: "bezierCurveTo",
  39864. args: [x1, y1, x2, y2, x, y]
  39865. });
  39866. }
  39867. const stack = [];
  39868. let x = 0,
  39869. y = 0;
  39870. let stems = 0;
  39871. function parse(code) {
  39872. let i = 0;
  39873. while (i < code.length) {
  39874. let stackClean = false;
  39875. let v = code[i++];
  39876. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  39877. switch (v) {
  39878. case 1:
  39879. stems += stack.length >> 1;
  39880. stackClean = true;
  39881. break;
  39882. case 3:
  39883. stems += stack.length >> 1;
  39884. stackClean = true;
  39885. break;
  39886. case 4:
  39887. y += stack.pop();
  39888. moveTo(x, y);
  39889. stackClean = true;
  39890. break;
  39891. case 5:
  39892. while (stack.length > 0) {
  39893. x += stack.shift();
  39894. y += stack.shift();
  39895. lineTo(x, y);
  39896. }
  39897. break;
  39898. case 6:
  39899. while (stack.length > 0) {
  39900. x += stack.shift();
  39901. lineTo(x, y);
  39902. if (stack.length === 0) {
  39903. break;
  39904. }
  39905. y += stack.shift();
  39906. lineTo(x, y);
  39907. }
  39908. break;
  39909. case 7:
  39910. while (stack.length > 0) {
  39911. y += stack.shift();
  39912. lineTo(x, y);
  39913. if (stack.length === 0) {
  39914. break;
  39915. }
  39916. x += stack.shift();
  39917. lineTo(x, y);
  39918. }
  39919. break;
  39920. case 8:
  39921. while (stack.length > 0) {
  39922. xa = x + stack.shift();
  39923. ya = y + stack.shift();
  39924. xb = xa + stack.shift();
  39925. yb = ya + stack.shift();
  39926. x = xb + stack.shift();
  39927. y = yb + stack.shift();
  39928. bezierCurveTo(xa, ya, xb, yb, x, y);
  39929. }
  39930. break;
  39931. case 10:
  39932. n = stack.pop();
  39933. subrCode = null;
  39934. if (font.isCFFCIDFont) {
  39935. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  39936. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  39937. const fontDict = font.fdArray[fdIndex];
  39938. let subrs;
  39939. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  39940. subrs = fontDict.privateDict.subrsIndex.objects;
  39941. }
  39942. if (subrs) {
  39943. n += getSubroutineBias(subrs);
  39944. subrCode = subrs[n];
  39945. }
  39946. } else {
  39947. (0, _util.warn)("Invalid fd index for glyph index.");
  39948. }
  39949. } else {
  39950. subrCode = font.subrs[n + font.subrsBias];
  39951. }
  39952. if (subrCode) {
  39953. parse(subrCode);
  39954. }
  39955. break;
  39956. case 11:
  39957. return;
  39958. case 12:
  39959. v = code[i++];
  39960. switch (v) {
  39961. case 34:
  39962. xa = x + stack.shift();
  39963. xb = xa + stack.shift();
  39964. y1 = y + stack.shift();
  39965. x = xb + stack.shift();
  39966. bezierCurveTo(xa, y, xb, y1, x, y1);
  39967. xa = x + stack.shift();
  39968. xb = xa + stack.shift();
  39969. x = xb + stack.shift();
  39970. bezierCurveTo(xa, y1, xb, y, x, y);
  39971. break;
  39972. case 35:
  39973. xa = x + stack.shift();
  39974. ya = y + stack.shift();
  39975. xb = xa + stack.shift();
  39976. yb = ya + stack.shift();
  39977. x = xb + stack.shift();
  39978. y = yb + stack.shift();
  39979. bezierCurveTo(xa, ya, xb, yb, x, y);
  39980. xa = x + stack.shift();
  39981. ya = y + stack.shift();
  39982. xb = xa + stack.shift();
  39983. yb = ya + stack.shift();
  39984. x = xb + stack.shift();
  39985. y = yb + stack.shift();
  39986. bezierCurveTo(xa, ya, xb, yb, x, y);
  39987. stack.pop();
  39988. break;
  39989. case 36:
  39990. xa = x + stack.shift();
  39991. y1 = y + stack.shift();
  39992. xb = xa + stack.shift();
  39993. y2 = y1 + stack.shift();
  39994. x = xb + stack.shift();
  39995. bezierCurveTo(xa, y1, xb, y2, x, y2);
  39996. xa = x + stack.shift();
  39997. xb = xa + stack.shift();
  39998. y3 = y2 + stack.shift();
  39999. x = xb + stack.shift();
  40000. bezierCurveTo(xa, y2, xb, y3, x, y);
  40001. break;
  40002. case 37:
  40003. const x0 = x,
  40004. y0 = y;
  40005. xa = x + stack.shift();
  40006. ya = y + stack.shift();
  40007. xb = xa + stack.shift();
  40008. yb = ya + stack.shift();
  40009. x = xb + stack.shift();
  40010. y = yb + stack.shift();
  40011. bezierCurveTo(xa, ya, xb, yb, x, y);
  40012. xa = x + stack.shift();
  40013. ya = y + stack.shift();
  40014. xb = xa + stack.shift();
  40015. yb = ya + stack.shift();
  40016. x = xb;
  40017. y = yb;
  40018. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  40019. x += stack.shift();
  40020. } else {
  40021. y += stack.shift();
  40022. }
  40023. bezierCurveTo(xa, ya, xb, yb, x, y);
  40024. break;
  40025. default:
  40026. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  40027. }
  40028. break;
  40029. case 14:
  40030. if (stack.length >= 4) {
  40031. const achar = stack.pop();
  40032. const bchar = stack.pop();
  40033. y = stack.pop();
  40034. x = stack.pop();
  40035. cmds.push({
  40036. cmd: "save"
  40037. });
  40038. cmds.push({
  40039. cmd: "translate",
  40040. args: [x, y]
  40041. });
  40042. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  40043. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  40044. cmds.push({
  40045. cmd: "restore"
  40046. });
  40047. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  40048. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  40049. }
  40050. return;
  40051. case 18:
  40052. stems += stack.length >> 1;
  40053. stackClean = true;
  40054. break;
  40055. case 19:
  40056. stems += stack.length >> 1;
  40057. i += stems + 7 >> 3;
  40058. stackClean = true;
  40059. break;
  40060. case 20:
  40061. stems += stack.length >> 1;
  40062. i += stems + 7 >> 3;
  40063. stackClean = true;
  40064. break;
  40065. case 21:
  40066. y += stack.pop();
  40067. x += stack.pop();
  40068. moveTo(x, y);
  40069. stackClean = true;
  40070. break;
  40071. case 22:
  40072. x += stack.pop();
  40073. moveTo(x, y);
  40074. stackClean = true;
  40075. break;
  40076. case 23:
  40077. stems += stack.length >> 1;
  40078. stackClean = true;
  40079. break;
  40080. case 24:
  40081. while (stack.length > 2) {
  40082. xa = x + stack.shift();
  40083. ya = y + stack.shift();
  40084. xb = xa + stack.shift();
  40085. yb = ya + stack.shift();
  40086. x = xb + stack.shift();
  40087. y = yb + stack.shift();
  40088. bezierCurveTo(xa, ya, xb, yb, x, y);
  40089. }
  40090. x += stack.shift();
  40091. y += stack.shift();
  40092. lineTo(x, y);
  40093. break;
  40094. case 25:
  40095. while (stack.length > 6) {
  40096. x += stack.shift();
  40097. y += stack.shift();
  40098. lineTo(x, y);
  40099. }
  40100. xa = x + stack.shift();
  40101. ya = y + stack.shift();
  40102. xb = xa + stack.shift();
  40103. yb = ya + stack.shift();
  40104. x = xb + stack.shift();
  40105. y = yb + stack.shift();
  40106. bezierCurveTo(xa, ya, xb, yb, x, y);
  40107. break;
  40108. case 26:
  40109. if (stack.length % 2) {
  40110. x += stack.shift();
  40111. }
  40112. while (stack.length > 0) {
  40113. xa = x;
  40114. ya = y + stack.shift();
  40115. xb = xa + stack.shift();
  40116. yb = ya + stack.shift();
  40117. x = xb;
  40118. y = yb + stack.shift();
  40119. bezierCurveTo(xa, ya, xb, yb, x, y);
  40120. }
  40121. break;
  40122. case 27:
  40123. if (stack.length % 2) {
  40124. y += stack.shift();
  40125. }
  40126. while (stack.length > 0) {
  40127. xa = x + stack.shift();
  40128. ya = y;
  40129. xb = xa + stack.shift();
  40130. yb = ya + stack.shift();
  40131. x = xb + stack.shift();
  40132. y = yb;
  40133. bezierCurveTo(xa, ya, xb, yb, x, y);
  40134. }
  40135. break;
  40136. case 28:
  40137. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  40138. i += 2;
  40139. break;
  40140. case 29:
  40141. n = stack.pop() + font.gsubrsBias;
  40142. subrCode = font.gsubrs[n];
  40143. if (subrCode) {
  40144. parse(subrCode);
  40145. }
  40146. break;
  40147. case 30:
  40148. while (stack.length > 0) {
  40149. xa = x;
  40150. ya = y + stack.shift();
  40151. xb = xa + stack.shift();
  40152. yb = ya + stack.shift();
  40153. x = xb + stack.shift();
  40154. y = yb + (stack.length === 1 ? stack.shift() : 0);
  40155. bezierCurveTo(xa, ya, xb, yb, x, y);
  40156. if (stack.length === 0) {
  40157. break;
  40158. }
  40159. xa = x + stack.shift();
  40160. ya = y;
  40161. xb = xa + stack.shift();
  40162. yb = ya + stack.shift();
  40163. y = yb + stack.shift();
  40164. x = xb + (stack.length === 1 ? stack.shift() : 0);
  40165. bezierCurveTo(xa, ya, xb, yb, x, y);
  40166. }
  40167. break;
  40168. case 31:
  40169. while (stack.length > 0) {
  40170. xa = x + stack.shift();
  40171. ya = y;
  40172. xb = xa + stack.shift();
  40173. yb = ya + stack.shift();
  40174. y = yb + stack.shift();
  40175. x = xb + (stack.length === 1 ? stack.shift() : 0);
  40176. bezierCurveTo(xa, ya, xb, yb, x, y);
  40177. if (stack.length === 0) {
  40178. break;
  40179. }
  40180. xa = x;
  40181. ya = y + stack.shift();
  40182. xb = xa + stack.shift();
  40183. yb = ya + stack.shift();
  40184. x = xb + stack.shift();
  40185. y = yb + (stack.length === 1 ? stack.shift() : 0);
  40186. bezierCurveTo(xa, ya, xb, yb, x, y);
  40187. }
  40188. break;
  40189. default:
  40190. if (v < 32) {
  40191. throw new _util.FormatError(`unknown operator: ${v}`);
  40192. }
  40193. if (v < 247) {
  40194. stack.push(v - 139);
  40195. } else if (v < 251) {
  40196. stack.push((v - 247) * 256 + code[i++] + 108);
  40197. } else if (v < 255) {
  40198. stack.push(-(v - 251) * 256 - code[i++] - 108);
  40199. } else {
  40200. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  40201. i += 4;
  40202. }
  40203. break;
  40204. }
  40205. if (stackClean) {
  40206. stack.length = 0;
  40207. }
  40208. }
  40209. }
  40210. parse(charStringCode);
  40211. }
  40212. const NOOP = [];
  40213. class CompiledFont {
  40214. constructor(fontMatrix) {
  40215. if (this.constructor === CompiledFont) {
  40216. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  40217. }
  40218. this.fontMatrix = fontMatrix;
  40219. this.compiledGlyphs = Object.create(null);
  40220. this.compiledCharCodeToGlyphId = Object.create(null);
  40221. }
  40222. getPathJs(unicode) {
  40223. const cmap = lookupCmap(this.cmap, unicode);
  40224. let fn = this.compiledGlyphs[cmap.glyphId];
  40225. if (!fn) {
  40226. fn = this.compileGlyph(this.glyphs[cmap.glyphId], cmap.glyphId);
  40227. this.compiledGlyphs[cmap.glyphId] = fn;
  40228. }
  40229. if (this.compiledCharCodeToGlyphId[cmap.charCode] === undefined) {
  40230. this.compiledCharCodeToGlyphId[cmap.charCode] = cmap.glyphId;
  40231. }
  40232. return fn;
  40233. }
  40234. compileGlyph(code, glyphId) {
  40235. if (!code || code.length === 0 || code[0] === 14) {
  40236. return NOOP;
  40237. }
  40238. let fontMatrix = this.fontMatrix;
  40239. if (this.isCFFCIDFont) {
  40240. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  40241. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  40242. const fontDict = this.fdArray[fdIndex];
  40243. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  40244. } else {
  40245. (0, _util.warn)("Invalid fd index for glyph index.");
  40246. }
  40247. }
  40248. const cmds = [];
  40249. cmds.push({
  40250. cmd: "save"
  40251. });
  40252. cmds.push({
  40253. cmd: "transform",
  40254. args: fontMatrix.slice()
  40255. });
  40256. cmds.push({
  40257. cmd: "scale",
  40258. args: ["size", "-size"]
  40259. });
  40260. this.compileGlyphImpl(code, cmds, glyphId);
  40261. cmds.push({
  40262. cmd: "restore"
  40263. });
  40264. return cmds;
  40265. }
  40266. compileGlyphImpl() {
  40267. (0, _util.unreachable)("Children classes should implement this.");
  40268. }
  40269. hasBuiltPath(unicode) {
  40270. const cmap = lookupCmap(this.cmap, unicode);
  40271. return this.compiledGlyphs[cmap.glyphId] !== undefined && this.compiledCharCodeToGlyphId[cmap.charCode] !== undefined;
  40272. }
  40273. }
  40274. class TrueTypeCompiled extends CompiledFont {
  40275. constructor(glyphs, cmap, fontMatrix) {
  40276. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  40277. this.glyphs = glyphs;
  40278. this.cmap = cmap;
  40279. }
  40280. compileGlyphImpl(code, cmds) {
  40281. compileGlyf(code, cmds, this);
  40282. }
  40283. }
  40284. class Type2Compiled extends CompiledFont {
  40285. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  40286. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  40287. this.glyphs = cffInfo.glyphs;
  40288. this.gsubrs = cffInfo.gsubrs || [];
  40289. this.subrs = cffInfo.subrs || [];
  40290. this.cmap = cmap;
  40291. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  40292. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  40293. this.subrsBias = getSubroutineBias(this.subrs);
  40294. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  40295. this.fdSelect = cffInfo.fdSelect;
  40296. this.fdArray = cffInfo.fdArray;
  40297. }
  40298. compileGlyphImpl(code, cmds, glyphId) {
  40299. compileCharString(code, cmds, this, glyphId);
  40300. }
  40301. }
  40302. return {
  40303. create: function FontRendererFactory_create(font, seacAnalysisEnabled) {
  40304. const data = new Uint8Array(font.data);
  40305. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  40306. const numTables = getUshort(data, 4);
  40307. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  40308. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  40309. const offset = getLong(data, p + 8);
  40310. const length = getLong(data, p + 12);
  40311. switch (tag) {
  40312. case "cmap":
  40313. cmap = parseCmap(data, offset, offset + length);
  40314. break;
  40315. case "glyf":
  40316. glyf = data.subarray(offset, offset + length);
  40317. break;
  40318. case "loca":
  40319. loca = data.subarray(offset, offset + length);
  40320. break;
  40321. case "head":
  40322. unitsPerEm = getUshort(data, offset + 18);
  40323. indexToLocFormat = getUshort(data, offset + 50);
  40324. break;
  40325. case "CFF ":
  40326. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  40327. break;
  40328. }
  40329. }
  40330. if (glyf) {
  40331. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  40332. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  40333. }
  40334. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  40335. }
  40336. };
  40337. }();
  40338. exports.FontRendererFactory = FontRendererFactory;
  40339. /***/ }),
  40340. /* 39 */
  40341. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40342. Object.defineProperty(exports, "__esModule", ({
  40343. value: true
  40344. }));
  40345. exports.Type1Parser = void 0;
  40346. var _encodings = __w_pdfjs_require__(34);
  40347. var _core_utils = __w_pdfjs_require__(8);
  40348. var _stream = __w_pdfjs_require__(12);
  40349. var _util = __w_pdfjs_require__(2);
  40350. const HINTING_ENABLED = false;
  40351. const Type1CharString = function Type1CharStringClosure() {
  40352. const COMMAND_MAP = {
  40353. hstem: [1],
  40354. vstem: [3],
  40355. vmoveto: [4],
  40356. rlineto: [5],
  40357. hlineto: [6],
  40358. vlineto: [7],
  40359. rrcurveto: [8],
  40360. callsubr: [10],
  40361. flex: [12, 35],
  40362. drop: [12, 18],
  40363. endchar: [14],
  40364. rmoveto: [21],
  40365. hmoveto: [22],
  40366. vhcurveto: [30],
  40367. hvcurveto: [31]
  40368. };
  40369. class Type1CharString {
  40370. constructor() {
  40371. this.width = 0;
  40372. this.lsb = 0;
  40373. this.flexing = false;
  40374. this.output = [];
  40375. this.stack = [];
  40376. }
  40377. convert(encoded, subrs, seacAnalysisEnabled) {
  40378. const count = encoded.length;
  40379. let error = false;
  40380. let wx, sbx, subrNumber;
  40381. for (let i = 0; i < count; i++) {
  40382. let value = encoded[i];
  40383. if (value < 32) {
  40384. if (value === 12) {
  40385. value = (value << 8) + encoded[++i];
  40386. }
  40387. switch (value) {
  40388. case 1:
  40389. if (!HINTING_ENABLED) {
  40390. this.stack = [];
  40391. break;
  40392. }
  40393. error = this.executeCommand(2, COMMAND_MAP.hstem);
  40394. break;
  40395. case 3:
  40396. if (!HINTING_ENABLED) {
  40397. this.stack = [];
  40398. break;
  40399. }
  40400. error = this.executeCommand(2, COMMAND_MAP.vstem);
  40401. break;
  40402. case 4:
  40403. if (this.flexing) {
  40404. if (this.stack.length < 1) {
  40405. error = true;
  40406. break;
  40407. }
  40408. const dy = this.stack.pop();
  40409. this.stack.push(0, dy);
  40410. break;
  40411. }
  40412. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  40413. break;
  40414. case 5:
  40415. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  40416. break;
  40417. case 6:
  40418. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  40419. break;
  40420. case 7:
  40421. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  40422. break;
  40423. case 8:
  40424. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  40425. break;
  40426. case 9:
  40427. this.stack = [];
  40428. break;
  40429. case 10:
  40430. if (this.stack.length < 1) {
  40431. error = true;
  40432. break;
  40433. }
  40434. subrNumber = this.stack.pop();
  40435. if (!subrs[subrNumber]) {
  40436. error = true;
  40437. break;
  40438. }
  40439. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  40440. break;
  40441. case 11:
  40442. return error;
  40443. case 13:
  40444. if (this.stack.length < 2) {
  40445. error = true;
  40446. break;
  40447. }
  40448. wx = this.stack.pop();
  40449. sbx = this.stack.pop();
  40450. this.lsb = sbx;
  40451. this.width = wx;
  40452. this.stack.push(wx, sbx);
  40453. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  40454. break;
  40455. case 14:
  40456. this.output.push(COMMAND_MAP.endchar[0]);
  40457. break;
  40458. case 21:
  40459. if (this.flexing) {
  40460. break;
  40461. }
  40462. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  40463. break;
  40464. case 22:
  40465. if (this.flexing) {
  40466. this.stack.push(0);
  40467. break;
  40468. }
  40469. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  40470. break;
  40471. case 30:
  40472. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  40473. break;
  40474. case 31:
  40475. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  40476. break;
  40477. case (12 << 8) + 0:
  40478. this.stack = [];
  40479. break;
  40480. case (12 << 8) + 1:
  40481. if (!HINTING_ENABLED) {
  40482. this.stack = [];
  40483. break;
  40484. }
  40485. error = this.executeCommand(2, COMMAND_MAP.vstem);
  40486. break;
  40487. case (12 << 8) + 2:
  40488. if (!HINTING_ENABLED) {
  40489. this.stack = [];
  40490. break;
  40491. }
  40492. error = this.executeCommand(2, COMMAND_MAP.hstem);
  40493. break;
  40494. case (12 << 8) + 6:
  40495. if (seacAnalysisEnabled) {
  40496. const asb = this.stack[this.stack.length - 5];
  40497. this.seac = this.stack.splice(-4, 4);
  40498. this.seac[0] += this.lsb - asb;
  40499. error = this.executeCommand(0, COMMAND_MAP.endchar);
  40500. } else {
  40501. error = this.executeCommand(4, COMMAND_MAP.endchar);
  40502. }
  40503. break;
  40504. case (12 << 8) + 7:
  40505. if (this.stack.length < 4) {
  40506. error = true;
  40507. break;
  40508. }
  40509. this.stack.pop();
  40510. wx = this.stack.pop();
  40511. const sby = this.stack.pop();
  40512. sbx = this.stack.pop();
  40513. this.lsb = sbx;
  40514. this.width = wx;
  40515. this.stack.push(wx, sbx, sby);
  40516. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  40517. break;
  40518. case (12 << 8) + 12:
  40519. if (this.stack.length < 2) {
  40520. error = true;
  40521. break;
  40522. }
  40523. const num2 = this.stack.pop();
  40524. const num1 = this.stack.pop();
  40525. this.stack.push(num1 / num2);
  40526. break;
  40527. case (12 << 8) + 16:
  40528. if (this.stack.length < 2) {
  40529. error = true;
  40530. break;
  40531. }
  40532. subrNumber = this.stack.pop();
  40533. const numArgs = this.stack.pop();
  40534. if (subrNumber === 0 && numArgs === 3) {
  40535. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  40536. 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]);
  40537. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  40538. this.flexing = false;
  40539. this.stack.push(flexArgs[15], flexArgs[16]);
  40540. } else if (subrNumber === 1 && numArgs === 0) {
  40541. this.flexing = true;
  40542. }
  40543. break;
  40544. case (12 << 8) + 17:
  40545. break;
  40546. case (12 << 8) + 33:
  40547. this.stack = [];
  40548. break;
  40549. default:
  40550. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  40551. break;
  40552. }
  40553. if (error) {
  40554. break;
  40555. }
  40556. continue;
  40557. } else if (value <= 246) {
  40558. value = value - 139;
  40559. } else if (value <= 250) {
  40560. value = (value - 247) * 256 + encoded[++i] + 108;
  40561. } else if (value <= 254) {
  40562. value = -((value - 251) * 256) - encoded[++i] - 108;
  40563. } else {
  40564. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  40565. }
  40566. this.stack.push(value);
  40567. }
  40568. return error;
  40569. }
  40570. executeCommand(howManyArgs, command, keepStack) {
  40571. const stackLength = this.stack.length;
  40572. if (howManyArgs > stackLength) {
  40573. return true;
  40574. }
  40575. const start = stackLength - howManyArgs;
  40576. for (let i = start; i < stackLength; i++) {
  40577. let value = this.stack[i];
  40578. if (Number.isInteger(value)) {
  40579. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  40580. } else {
  40581. value = 65536 * value | 0;
  40582. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  40583. }
  40584. }
  40585. this.output.push.apply(this.output, command);
  40586. if (keepStack) {
  40587. this.stack.splice(start, howManyArgs);
  40588. } else {
  40589. this.stack.length = 0;
  40590. }
  40591. return false;
  40592. }
  40593. }
  40594. return Type1CharString;
  40595. }();
  40596. const Type1Parser = function Type1ParserClosure() {
  40597. const EEXEC_ENCRYPT_KEY = 55665;
  40598. const CHAR_STRS_ENCRYPT_KEY = 4330;
  40599. function isHexDigit(code) {
  40600. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  40601. }
  40602. function decrypt(data, key, discardNumber) {
  40603. if (discardNumber >= data.length) {
  40604. return new Uint8Array(0);
  40605. }
  40606. const c1 = 52845,
  40607. c2 = 22719;
  40608. let r = key | 0,
  40609. i,
  40610. j;
  40611. for (i = 0; i < discardNumber; i++) {
  40612. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  40613. }
  40614. const count = data.length - discardNumber;
  40615. const decrypted = new Uint8Array(count);
  40616. for (i = discardNumber, j = 0; j < count; i++, j++) {
  40617. const value = data[i];
  40618. decrypted[j] = value ^ r >> 8;
  40619. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  40620. }
  40621. return decrypted;
  40622. }
  40623. function decryptAscii(data, key, discardNumber) {
  40624. const c1 = 52845,
  40625. c2 = 22719;
  40626. let r = key | 0;
  40627. const count = data.length,
  40628. maybeLength = count >>> 1;
  40629. const decrypted = new Uint8Array(maybeLength);
  40630. let i, j;
  40631. for (i = 0, j = 0; i < count; i++) {
  40632. const digit1 = data[i];
  40633. if (!isHexDigit(digit1)) {
  40634. continue;
  40635. }
  40636. i++;
  40637. let digit2;
  40638. while (i < count && !isHexDigit(digit2 = data[i])) {
  40639. i++;
  40640. }
  40641. if (i < count) {
  40642. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  40643. decrypted[j++] = value ^ r >> 8;
  40644. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  40645. }
  40646. }
  40647. return decrypted.slice(discardNumber, j);
  40648. }
  40649. function isSpecial(c) {
  40650. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  40651. }
  40652. class Type1Parser {
  40653. constructor(stream, encrypted, seacAnalysisEnabled) {
  40654. if (encrypted) {
  40655. const data = stream.getBytes();
  40656. const 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]));
  40657. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  40658. }
  40659. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  40660. this.stream = stream;
  40661. this.nextChar();
  40662. }
  40663. readNumberArray() {
  40664. this.getToken();
  40665. const array = [];
  40666. while (true) {
  40667. const token = this.getToken();
  40668. if (token === null || token === "]" || token === "}") {
  40669. break;
  40670. }
  40671. array.push(parseFloat(token || 0));
  40672. }
  40673. return array;
  40674. }
  40675. readNumber() {
  40676. const token = this.getToken();
  40677. return parseFloat(token || 0);
  40678. }
  40679. readInt() {
  40680. const token = this.getToken();
  40681. return parseInt(token || 0, 10) | 0;
  40682. }
  40683. readBoolean() {
  40684. const token = this.getToken();
  40685. return token === "true" ? 1 : 0;
  40686. }
  40687. nextChar() {
  40688. return this.currentChar = this.stream.getByte();
  40689. }
  40690. getToken() {
  40691. let comment = false;
  40692. let ch = this.currentChar;
  40693. while (true) {
  40694. if (ch === -1) {
  40695. return null;
  40696. }
  40697. if (comment) {
  40698. if (ch === 0x0a || ch === 0x0d) {
  40699. comment = false;
  40700. }
  40701. } else if (ch === 0x25) {
  40702. comment = true;
  40703. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  40704. break;
  40705. }
  40706. ch = this.nextChar();
  40707. }
  40708. if (isSpecial(ch)) {
  40709. this.nextChar();
  40710. return String.fromCharCode(ch);
  40711. }
  40712. let token = "";
  40713. do {
  40714. token += String.fromCharCode(ch);
  40715. ch = this.nextChar();
  40716. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  40717. return token;
  40718. }
  40719. readCharStrings(bytes, lenIV) {
  40720. if (lenIV === -1) {
  40721. return bytes;
  40722. }
  40723. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  40724. }
  40725. extractFontProgram(properties) {
  40726. const stream = this.stream;
  40727. const subrs = [],
  40728. charstrings = [];
  40729. const privateData = Object.create(null);
  40730. privateData.lenIV = 4;
  40731. const program = {
  40732. subrs: [],
  40733. charstrings: [],
  40734. properties: {
  40735. privateData
  40736. }
  40737. };
  40738. let token, length, data, lenIV, encoded;
  40739. while ((token = this.getToken()) !== null) {
  40740. if (token !== "/") {
  40741. continue;
  40742. }
  40743. token = this.getToken();
  40744. switch (token) {
  40745. case "CharStrings":
  40746. this.getToken();
  40747. this.getToken();
  40748. this.getToken();
  40749. this.getToken();
  40750. while (true) {
  40751. token = this.getToken();
  40752. if (token === null || token === "end") {
  40753. break;
  40754. }
  40755. if (token !== "/") {
  40756. continue;
  40757. }
  40758. const glyph = this.getToken();
  40759. length = this.readInt();
  40760. this.getToken();
  40761. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  40762. lenIV = program.properties.privateData.lenIV;
  40763. encoded = this.readCharStrings(data, lenIV);
  40764. this.nextChar();
  40765. token = this.getToken();
  40766. if (token === "noaccess") {
  40767. this.getToken();
  40768. }
  40769. charstrings.push({
  40770. glyph,
  40771. encoded
  40772. });
  40773. }
  40774. break;
  40775. case "Subrs":
  40776. this.readInt();
  40777. this.getToken();
  40778. while (this.getToken() === "dup") {
  40779. const index = this.readInt();
  40780. length = this.readInt();
  40781. this.getToken();
  40782. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  40783. lenIV = program.properties.privateData.lenIV;
  40784. encoded = this.readCharStrings(data, lenIV);
  40785. this.nextChar();
  40786. token = this.getToken();
  40787. if (token === "noaccess") {
  40788. this.getToken();
  40789. }
  40790. subrs[index] = encoded;
  40791. }
  40792. break;
  40793. case "BlueValues":
  40794. case "OtherBlues":
  40795. case "FamilyBlues":
  40796. case "FamilyOtherBlues":
  40797. const blueArray = this.readNumberArray();
  40798. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  40799. program.properties.privateData[token] = blueArray;
  40800. }
  40801. break;
  40802. case "StemSnapH":
  40803. case "StemSnapV":
  40804. program.properties.privateData[token] = this.readNumberArray();
  40805. break;
  40806. case "StdHW":
  40807. case "StdVW":
  40808. program.properties.privateData[token] = this.readNumberArray()[0];
  40809. break;
  40810. case "BlueShift":
  40811. case "lenIV":
  40812. case "BlueFuzz":
  40813. case "BlueScale":
  40814. case "LanguageGroup":
  40815. case "ExpansionFactor":
  40816. program.properties.privateData[token] = this.readNumber();
  40817. break;
  40818. case "ForceBold":
  40819. program.properties.privateData[token] = this.readBoolean();
  40820. break;
  40821. }
  40822. }
  40823. for (let i = 0; i < charstrings.length; i++) {
  40824. const glyph = charstrings[i].glyph;
  40825. encoded = charstrings[i].encoded;
  40826. const charString = new Type1CharString();
  40827. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  40828. let output = charString.output;
  40829. if (error) {
  40830. output = [14];
  40831. }
  40832. const charStringObject = {
  40833. glyphName: glyph,
  40834. charstring: output,
  40835. width: charString.width,
  40836. lsb: charString.lsb,
  40837. seac: charString.seac
  40838. };
  40839. if (glyph === ".notdef") {
  40840. program.charstrings.unshift(charStringObject);
  40841. } else {
  40842. program.charstrings.push(charStringObject);
  40843. }
  40844. if (properties.builtInEncoding) {
  40845. const index = properties.builtInEncoding.indexOf(glyph);
  40846. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  40847. properties.widths[index] = charString.width;
  40848. }
  40849. }
  40850. }
  40851. return program;
  40852. }
  40853. extractFontHeader(properties) {
  40854. let token;
  40855. while ((token = this.getToken()) !== null) {
  40856. if (token !== "/") {
  40857. continue;
  40858. }
  40859. token = this.getToken();
  40860. switch (token) {
  40861. case "FontMatrix":
  40862. const matrix = this.readNumberArray();
  40863. properties.fontMatrix = matrix;
  40864. break;
  40865. case "Encoding":
  40866. const encodingArg = this.getToken();
  40867. let encoding;
  40868. if (!/^\d+$/.test(encodingArg)) {
  40869. encoding = (0, _encodings.getEncoding)(encodingArg);
  40870. } else {
  40871. encoding = [];
  40872. const size = parseInt(encodingArg, 10) | 0;
  40873. this.getToken();
  40874. for (let j = 0; j < size; j++) {
  40875. token = this.getToken();
  40876. while (token !== "dup" && token !== "def") {
  40877. token = this.getToken();
  40878. if (token === null) {
  40879. return;
  40880. }
  40881. }
  40882. if (token === "def") {
  40883. break;
  40884. }
  40885. const index = this.readInt();
  40886. this.getToken();
  40887. const glyph = this.getToken();
  40888. encoding[index] = glyph;
  40889. this.getToken();
  40890. }
  40891. }
  40892. properties.builtInEncoding = encoding;
  40893. break;
  40894. case "FontBBox":
  40895. const fontBBox = this.readNumberArray();
  40896. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  40897. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  40898. properties.ascentScaled = true;
  40899. break;
  40900. }
  40901. }
  40902. }
  40903. }
  40904. return Type1Parser;
  40905. }();
  40906. exports.Type1Parser = Type1Parser;
  40907. /***/ }),
  40908. /* 40 */
  40909. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40910. Object.defineProperty(exports, "__esModule", ({
  40911. value: true
  40912. }));
  40913. exports.getTilingPatternIR = getTilingPatternIR;
  40914. exports.Pattern = void 0;
  40915. var _util = __w_pdfjs_require__(2);
  40916. var _colorspace = __w_pdfjs_require__(23);
  40917. var _primitives = __w_pdfjs_require__(5);
  40918. var _core_utils = __w_pdfjs_require__(8);
  40919. const ShadingType = {
  40920. FUNCTION_BASED: 1,
  40921. AXIAL: 2,
  40922. RADIAL: 3,
  40923. FREE_FORM_MESH: 4,
  40924. LATTICE_FORM_MESH: 5,
  40925. COONS_PATCH_MESH: 6,
  40926. TENSOR_PATCH_MESH: 7
  40927. };
  40928. const Pattern = function PatternClosure() {
  40929. function Pattern() {
  40930. (0, _util.unreachable)("should not call Pattern constructor");
  40931. }
  40932. Pattern.prototype = {
  40933. getPattern: function Pattern_getPattern(ctx) {
  40934. (0, _util.unreachable)(`Should not call Pattern.getStyle: ${ctx}`);
  40935. }
  40936. };
  40937. Pattern.parseShading = function (shading, matrix, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  40938. const dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
  40939. const type = dict.get("ShadingType");
  40940. try {
  40941. switch (type) {
  40942. case ShadingType.AXIAL:
  40943. case ShadingType.RADIAL:
  40944. return new Shadings.RadialAxial(dict, matrix, xref, res, pdfFunctionFactory, localColorSpaceCache);
  40945. case ShadingType.FREE_FORM_MESH:
  40946. case ShadingType.LATTICE_FORM_MESH:
  40947. case ShadingType.COONS_PATCH_MESH:
  40948. case ShadingType.TENSOR_PATCH_MESH:
  40949. return new Shadings.Mesh(shading, matrix, xref, res, pdfFunctionFactory, localColorSpaceCache);
  40950. default:
  40951. throw new _util.FormatError("Unsupported ShadingType: " + type);
  40952. }
  40953. } catch (ex) {
  40954. if (ex instanceof _core_utils.MissingDataException) {
  40955. throw ex;
  40956. }
  40957. handler.send("UnsupportedFeature", {
  40958. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  40959. });
  40960. (0, _util.warn)(ex);
  40961. return new Shadings.Dummy();
  40962. }
  40963. };
  40964. return Pattern;
  40965. }();
  40966. exports.Pattern = Pattern;
  40967. const Shadings = {};
  40968. Shadings.SMALL_NUMBER = 1e-6;
  40969. Shadings.RadialAxial = function RadialAxialClosure() {
  40970. function RadialAxial(dict, matrix, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  40971. this.matrix = matrix;
  40972. this.coordsArr = dict.getArray("Coords");
  40973. this.shadingType = dict.get("ShadingType");
  40974. this.type = "Pattern";
  40975. const cs = _colorspace.ColorSpace.parse({
  40976. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  40977. xref,
  40978. resources,
  40979. pdfFunctionFactory,
  40980. localColorSpaceCache
  40981. });
  40982. this.cs = cs;
  40983. const bbox = dict.getArray("BBox");
  40984. if (Array.isArray(bbox) && bbox.length === 4) {
  40985. this.bbox = _util.Util.normalizeRect(bbox);
  40986. } else {
  40987. this.bbox = null;
  40988. }
  40989. let t0 = 0.0,
  40990. t1 = 1.0;
  40991. if (dict.has("Domain")) {
  40992. const domainArr = dict.getArray("Domain");
  40993. t0 = domainArr[0];
  40994. t1 = domainArr[1];
  40995. }
  40996. let extendStart = false,
  40997. extendEnd = false;
  40998. if (dict.has("Extend")) {
  40999. const extendArr = dict.getArray("Extend");
  41000. extendStart = extendArr[0];
  41001. extendEnd = extendArr[1];
  41002. }
  41003. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  41004. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  41005. const distance = Math.hypot(x1 - x2, y1 - y2);
  41006. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  41007. (0, _util.warn)("Unsupported radial gradient.");
  41008. }
  41009. }
  41010. this.extendStart = extendStart;
  41011. this.extendEnd = extendEnd;
  41012. const fnObj = dict.getRaw("Function");
  41013. const fn = pdfFunctionFactory.createFromArray(fnObj);
  41014. const NUMBER_OF_SAMPLES = 10;
  41015. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  41016. const colorStops = this.colorStops = [];
  41017. if (t0 >= t1 || step <= 0) {
  41018. (0, _util.info)("Bad shading domain.");
  41019. return;
  41020. }
  41021. const color = new Float32Array(cs.numComps),
  41022. ratio = new Float32Array(1);
  41023. let rgbColor;
  41024. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  41025. ratio[0] = t0 + i * step;
  41026. fn(ratio, 0, color, 0);
  41027. rgbColor = cs.getRgb(color, 0);
  41028. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  41029. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  41030. }
  41031. let background = "transparent";
  41032. if (dict.has("Background")) {
  41033. rgbColor = cs.getRgb(dict.get("Background"), 0);
  41034. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  41035. }
  41036. if (!extendStart) {
  41037. colorStops.unshift([0, background]);
  41038. colorStops[1][0] += Shadings.SMALL_NUMBER;
  41039. }
  41040. if (!extendEnd) {
  41041. colorStops[colorStops.length - 1][0] -= Shadings.SMALL_NUMBER;
  41042. colorStops.push([1, background]);
  41043. }
  41044. this.colorStops = colorStops;
  41045. }
  41046. RadialAxial.prototype = {
  41047. getIR: function RadialAxial_getIR() {
  41048. const coordsArr = this.coordsArr;
  41049. const shadingType = this.shadingType;
  41050. let type, p0, p1, r0, r1;
  41051. if (shadingType === ShadingType.AXIAL) {
  41052. p0 = [coordsArr[0], coordsArr[1]];
  41053. p1 = [coordsArr[2], coordsArr[3]];
  41054. r0 = null;
  41055. r1 = null;
  41056. type = "axial";
  41057. } else if (shadingType === ShadingType.RADIAL) {
  41058. p0 = [coordsArr[0], coordsArr[1]];
  41059. p1 = [coordsArr[3], coordsArr[4]];
  41060. r0 = coordsArr[2];
  41061. r1 = coordsArr[5];
  41062. type = "radial";
  41063. } else {
  41064. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  41065. }
  41066. const matrix = this.matrix;
  41067. if (matrix) {
  41068. p0 = _util.Util.applyTransform(p0, matrix);
  41069. p1 = _util.Util.applyTransform(p1, matrix);
  41070. if (shadingType === ShadingType.RADIAL) {
  41071. const scale = _util.Util.singularValueDecompose2dScale(matrix);
  41072. r0 *= scale[0];
  41073. r1 *= scale[1];
  41074. }
  41075. }
  41076. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  41077. }
  41078. };
  41079. return RadialAxial;
  41080. }();
  41081. Shadings.Mesh = function MeshClosure() {
  41082. function MeshStreamReader(stream, context) {
  41083. this.stream = stream;
  41084. this.context = context;
  41085. this.buffer = 0;
  41086. this.bufferLength = 0;
  41087. const numComps = context.numComps;
  41088. this.tmpCompsBuf = new Float32Array(numComps);
  41089. const csNumComps = context.colorSpace.numComps;
  41090. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  41091. }
  41092. MeshStreamReader.prototype = {
  41093. get hasData() {
  41094. if (this.stream.end) {
  41095. return this.stream.pos < this.stream.end;
  41096. }
  41097. if (this.bufferLength > 0) {
  41098. return true;
  41099. }
  41100. const nextByte = this.stream.getByte();
  41101. if (nextByte < 0) {
  41102. return false;
  41103. }
  41104. this.buffer = nextByte;
  41105. this.bufferLength = 8;
  41106. return true;
  41107. },
  41108. readBits: function MeshStreamReader_readBits(n) {
  41109. let buffer = this.buffer;
  41110. let bufferLength = this.bufferLength;
  41111. if (n === 32) {
  41112. if (bufferLength === 0) {
  41113. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  41114. }
  41115. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  41116. const nextByte = this.stream.getByte();
  41117. this.buffer = nextByte & (1 << bufferLength) - 1;
  41118. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  41119. }
  41120. if (n === 8 && bufferLength === 0) {
  41121. return this.stream.getByte();
  41122. }
  41123. while (bufferLength < n) {
  41124. buffer = buffer << 8 | this.stream.getByte();
  41125. bufferLength += 8;
  41126. }
  41127. bufferLength -= n;
  41128. this.bufferLength = bufferLength;
  41129. this.buffer = buffer & (1 << bufferLength) - 1;
  41130. return buffer >> bufferLength;
  41131. },
  41132. align: function MeshStreamReader_align() {
  41133. this.buffer = 0;
  41134. this.bufferLength = 0;
  41135. },
  41136. readFlag: function MeshStreamReader_readFlag() {
  41137. return this.readBits(this.context.bitsPerFlag);
  41138. },
  41139. readCoordinate: function MeshStreamReader_readCoordinate() {
  41140. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  41141. const xi = this.readBits(bitsPerCoordinate);
  41142. const yi = this.readBits(bitsPerCoordinate);
  41143. const decode = this.context.decode;
  41144. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  41145. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  41146. },
  41147. readComponents: function MeshStreamReader_readComponents() {
  41148. const numComps = this.context.numComps;
  41149. const bitsPerComponent = this.context.bitsPerComponent;
  41150. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  41151. const decode = this.context.decode;
  41152. const components = this.tmpCompsBuf;
  41153. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  41154. const ci = this.readBits(bitsPerComponent);
  41155. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  41156. }
  41157. const color = this.tmpCsCompsBuf;
  41158. if (this.context.colorFn) {
  41159. this.context.colorFn(components, 0, color, 0);
  41160. }
  41161. return this.context.colorSpace.getRgb(color, 0);
  41162. }
  41163. };
  41164. function decodeType4Shading(mesh, reader) {
  41165. const coords = mesh.coords;
  41166. const colors = mesh.colors;
  41167. const operators = [];
  41168. const ps = [];
  41169. let verticesLeft = 0;
  41170. while (reader.hasData) {
  41171. const f = reader.readFlag();
  41172. const coord = reader.readCoordinate();
  41173. const color = reader.readComponents();
  41174. if (verticesLeft === 0) {
  41175. if (!(0 <= f && f <= 2)) {
  41176. throw new _util.FormatError("Unknown type4 flag");
  41177. }
  41178. switch (f) {
  41179. case 0:
  41180. verticesLeft = 3;
  41181. break;
  41182. case 1:
  41183. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  41184. verticesLeft = 1;
  41185. break;
  41186. case 2:
  41187. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  41188. verticesLeft = 1;
  41189. break;
  41190. }
  41191. operators.push(f);
  41192. }
  41193. ps.push(coords.length);
  41194. coords.push(coord);
  41195. colors.push(color);
  41196. verticesLeft--;
  41197. reader.align();
  41198. }
  41199. mesh.figures.push({
  41200. type: "triangles",
  41201. coords: new Int32Array(ps),
  41202. colors: new Int32Array(ps)
  41203. });
  41204. }
  41205. function decodeType5Shading(mesh, reader, verticesPerRow) {
  41206. const coords = mesh.coords;
  41207. const colors = mesh.colors;
  41208. const ps = [];
  41209. while (reader.hasData) {
  41210. const coord = reader.readCoordinate();
  41211. const color = reader.readComponents();
  41212. ps.push(coords.length);
  41213. coords.push(coord);
  41214. colors.push(color);
  41215. }
  41216. mesh.figures.push({
  41217. type: "lattice",
  41218. coords: new Int32Array(ps),
  41219. colors: new Int32Array(ps),
  41220. verticesPerRow
  41221. });
  41222. }
  41223. const MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  41224. const MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  41225. const TRIANGLE_DENSITY = 20;
  41226. const getB = function getBClosure() {
  41227. function buildB(count) {
  41228. const lut = [];
  41229. for (let i = 0; i <= count; i++) {
  41230. const t = i / count,
  41231. t_ = 1 - t;
  41232. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  41233. }
  41234. return lut;
  41235. }
  41236. const cache = [];
  41237. return function getB(count) {
  41238. if (!cache[count]) {
  41239. cache[count] = buildB(count);
  41240. }
  41241. return cache[count];
  41242. };
  41243. }();
  41244. function buildFigureFromPatch(mesh, index) {
  41245. const figure = mesh.figures[index];
  41246. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  41247. const coords = mesh.coords,
  41248. colors = mesh.colors;
  41249. const pi = figure.coords;
  41250. const ci = figure.colors;
  41251. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  41252. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  41253. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  41254. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  41255. let splitXBy = Math.ceil((figureMaxX - figureMinX) * TRIANGLE_DENSITY / (mesh.bounds[2] - mesh.bounds[0]));
  41256. splitXBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  41257. let splitYBy = Math.ceil((figureMaxY - figureMinY) * TRIANGLE_DENSITY / (mesh.bounds[3] - mesh.bounds[1]));
  41258. splitYBy = Math.max(MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  41259. const verticesPerRow = splitXBy + 1;
  41260. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  41261. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  41262. let k = 0;
  41263. const cl = new Uint8Array(3),
  41264. cr = new Uint8Array(3);
  41265. const c0 = colors[ci[0]],
  41266. c1 = colors[ci[1]],
  41267. c2 = colors[ci[2]],
  41268. c3 = colors[ci[3]];
  41269. const bRow = getB(splitYBy),
  41270. bCol = getB(splitXBy);
  41271. for (let row = 0; row <= splitYBy; row++) {
  41272. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  41273. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  41274. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  41275. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  41276. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  41277. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  41278. for (let col = 0; col <= splitXBy; col++, k++) {
  41279. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  41280. continue;
  41281. }
  41282. let x = 0,
  41283. y = 0;
  41284. let q = 0;
  41285. for (let i = 0; i <= 3; i++) {
  41286. for (let j = 0; j <= 3; j++, q++) {
  41287. const m = bRow[row][i] * bCol[col][j];
  41288. x += coords[pi[q]][0] * m;
  41289. y += coords[pi[q]][1] * m;
  41290. }
  41291. }
  41292. figureCoords[k] = coords.length;
  41293. coords.push([x, y]);
  41294. figureColors[k] = colors.length;
  41295. const newColor = new Uint8Array(3);
  41296. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  41297. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  41298. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  41299. colors.push(newColor);
  41300. }
  41301. }
  41302. figureCoords[0] = pi[0];
  41303. figureColors[0] = ci[0];
  41304. figureCoords[splitXBy] = pi[3];
  41305. figureColors[splitXBy] = ci[1];
  41306. figureCoords[verticesPerRow * splitYBy] = pi[12];
  41307. figureColors[verticesPerRow * splitYBy] = ci[2];
  41308. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  41309. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  41310. mesh.figures[index] = {
  41311. type: "lattice",
  41312. coords: figureCoords,
  41313. colors: figureColors,
  41314. verticesPerRow
  41315. };
  41316. }
  41317. function decodeType6Shading(mesh, reader) {
  41318. const coords = mesh.coords;
  41319. const colors = mesh.colors;
  41320. const ps = new Int32Array(16);
  41321. const cs = new Int32Array(4);
  41322. while (reader.hasData) {
  41323. const f = reader.readFlag();
  41324. if (!(0 <= f && f <= 3)) {
  41325. throw new _util.FormatError("Unknown type6 flag");
  41326. }
  41327. const pi = coords.length;
  41328. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  41329. coords.push(reader.readCoordinate());
  41330. }
  41331. const ci = colors.length;
  41332. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  41333. colors.push(reader.readComponents());
  41334. }
  41335. let tmp1, tmp2, tmp3, tmp4;
  41336. switch (f) {
  41337. case 0:
  41338. ps[12] = pi + 3;
  41339. ps[13] = pi + 4;
  41340. ps[14] = pi + 5;
  41341. ps[15] = pi + 6;
  41342. ps[8] = pi + 2;
  41343. ps[11] = pi + 7;
  41344. ps[4] = pi + 1;
  41345. ps[7] = pi + 8;
  41346. ps[0] = pi;
  41347. ps[1] = pi + 11;
  41348. ps[2] = pi + 10;
  41349. ps[3] = pi + 9;
  41350. cs[2] = ci + 1;
  41351. cs[3] = ci + 2;
  41352. cs[0] = ci;
  41353. cs[1] = ci + 3;
  41354. break;
  41355. case 1:
  41356. tmp1 = ps[12];
  41357. tmp2 = ps[13];
  41358. tmp3 = ps[14];
  41359. tmp4 = ps[15];
  41360. ps[12] = tmp4;
  41361. ps[13] = pi + 0;
  41362. ps[14] = pi + 1;
  41363. ps[15] = pi + 2;
  41364. ps[8] = tmp3;
  41365. ps[11] = pi + 3;
  41366. ps[4] = tmp2;
  41367. ps[7] = pi + 4;
  41368. ps[0] = tmp1;
  41369. ps[1] = pi + 7;
  41370. ps[2] = pi + 6;
  41371. ps[3] = pi + 5;
  41372. tmp1 = cs[2];
  41373. tmp2 = cs[3];
  41374. cs[2] = tmp2;
  41375. cs[3] = ci;
  41376. cs[0] = tmp1;
  41377. cs[1] = ci + 1;
  41378. break;
  41379. case 2:
  41380. tmp1 = ps[15];
  41381. tmp2 = ps[11];
  41382. ps[12] = ps[3];
  41383. ps[13] = pi + 0;
  41384. ps[14] = pi + 1;
  41385. ps[15] = pi + 2;
  41386. ps[8] = ps[7];
  41387. ps[11] = pi + 3;
  41388. ps[4] = tmp2;
  41389. ps[7] = pi + 4;
  41390. ps[0] = tmp1;
  41391. ps[1] = pi + 7;
  41392. ps[2] = pi + 6;
  41393. ps[3] = pi + 5;
  41394. tmp1 = cs[3];
  41395. cs[2] = cs[1];
  41396. cs[3] = ci;
  41397. cs[0] = tmp1;
  41398. cs[1] = ci + 1;
  41399. break;
  41400. case 3:
  41401. ps[12] = ps[0];
  41402. ps[13] = pi + 0;
  41403. ps[14] = pi + 1;
  41404. ps[15] = pi + 2;
  41405. ps[8] = ps[1];
  41406. ps[11] = pi + 3;
  41407. ps[4] = ps[2];
  41408. ps[7] = pi + 4;
  41409. ps[0] = ps[3];
  41410. ps[1] = pi + 7;
  41411. ps[2] = pi + 6;
  41412. ps[3] = pi + 5;
  41413. cs[2] = cs[0];
  41414. cs[3] = ci;
  41415. cs[0] = cs[1];
  41416. cs[1] = ci + 1;
  41417. break;
  41418. }
  41419. ps[5] = coords.length;
  41420. 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]);
  41421. ps[6] = coords.length;
  41422. 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]);
  41423. ps[9] = coords.length;
  41424. 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]);
  41425. ps[10] = coords.length;
  41426. 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]);
  41427. mesh.figures.push({
  41428. type: "patch",
  41429. coords: new Int32Array(ps),
  41430. colors: new Int32Array(cs)
  41431. });
  41432. }
  41433. }
  41434. function decodeType7Shading(mesh, reader) {
  41435. const coords = mesh.coords;
  41436. const colors = mesh.colors;
  41437. const ps = new Int32Array(16);
  41438. const cs = new Int32Array(4);
  41439. while (reader.hasData) {
  41440. const f = reader.readFlag();
  41441. if (!(0 <= f && f <= 3)) {
  41442. throw new _util.FormatError("Unknown type7 flag");
  41443. }
  41444. const pi = coords.length;
  41445. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  41446. coords.push(reader.readCoordinate());
  41447. }
  41448. const ci = colors.length;
  41449. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  41450. colors.push(reader.readComponents());
  41451. }
  41452. let tmp1, tmp2, tmp3, tmp4;
  41453. switch (f) {
  41454. case 0:
  41455. ps[12] = pi + 3;
  41456. ps[13] = pi + 4;
  41457. ps[14] = pi + 5;
  41458. ps[15] = pi + 6;
  41459. ps[8] = pi + 2;
  41460. ps[9] = pi + 13;
  41461. ps[10] = pi + 14;
  41462. ps[11] = pi + 7;
  41463. ps[4] = pi + 1;
  41464. ps[5] = pi + 12;
  41465. ps[6] = pi + 15;
  41466. ps[7] = pi + 8;
  41467. ps[0] = pi;
  41468. ps[1] = pi + 11;
  41469. ps[2] = pi + 10;
  41470. ps[3] = pi + 9;
  41471. cs[2] = ci + 1;
  41472. cs[3] = ci + 2;
  41473. cs[0] = ci;
  41474. cs[1] = ci + 3;
  41475. break;
  41476. case 1:
  41477. tmp1 = ps[12];
  41478. tmp2 = ps[13];
  41479. tmp3 = ps[14];
  41480. tmp4 = ps[15];
  41481. ps[12] = tmp4;
  41482. ps[13] = pi + 0;
  41483. ps[14] = pi + 1;
  41484. ps[15] = pi + 2;
  41485. ps[8] = tmp3;
  41486. ps[9] = pi + 9;
  41487. ps[10] = pi + 10;
  41488. ps[11] = pi + 3;
  41489. ps[4] = tmp2;
  41490. ps[5] = pi + 8;
  41491. ps[6] = pi + 11;
  41492. ps[7] = pi + 4;
  41493. ps[0] = tmp1;
  41494. ps[1] = pi + 7;
  41495. ps[2] = pi + 6;
  41496. ps[3] = pi + 5;
  41497. tmp1 = cs[2];
  41498. tmp2 = cs[3];
  41499. cs[2] = tmp2;
  41500. cs[3] = ci;
  41501. cs[0] = tmp1;
  41502. cs[1] = ci + 1;
  41503. break;
  41504. case 2:
  41505. tmp1 = ps[15];
  41506. tmp2 = ps[11];
  41507. ps[12] = ps[3];
  41508. ps[13] = pi + 0;
  41509. ps[14] = pi + 1;
  41510. ps[15] = pi + 2;
  41511. ps[8] = ps[7];
  41512. ps[9] = pi + 9;
  41513. ps[10] = pi + 10;
  41514. ps[11] = pi + 3;
  41515. ps[4] = tmp2;
  41516. ps[5] = pi + 8;
  41517. ps[6] = pi + 11;
  41518. ps[7] = pi + 4;
  41519. ps[0] = tmp1;
  41520. ps[1] = pi + 7;
  41521. ps[2] = pi + 6;
  41522. ps[3] = pi + 5;
  41523. tmp1 = cs[3];
  41524. cs[2] = cs[1];
  41525. cs[3] = ci;
  41526. cs[0] = tmp1;
  41527. cs[1] = ci + 1;
  41528. break;
  41529. case 3:
  41530. ps[12] = ps[0];
  41531. ps[13] = pi + 0;
  41532. ps[14] = pi + 1;
  41533. ps[15] = pi + 2;
  41534. ps[8] = ps[1];
  41535. ps[9] = pi + 9;
  41536. ps[10] = pi + 10;
  41537. ps[11] = pi + 3;
  41538. ps[4] = ps[2];
  41539. ps[5] = pi + 8;
  41540. ps[6] = pi + 11;
  41541. ps[7] = pi + 4;
  41542. ps[0] = ps[3];
  41543. ps[1] = pi + 7;
  41544. ps[2] = pi + 6;
  41545. ps[3] = pi + 5;
  41546. cs[2] = cs[0];
  41547. cs[3] = ci;
  41548. cs[0] = cs[1];
  41549. cs[1] = ci + 1;
  41550. break;
  41551. }
  41552. mesh.figures.push({
  41553. type: "patch",
  41554. coords: new Int32Array(ps),
  41555. colors: new Int32Array(cs)
  41556. });
  41557. }
  41558. }
  41559. function updateBounds(mesh) {
  41560. let minX = mesh.coords[0][0],
  41561. minY = mesh.coords[0][1],
  41562. maxX = minX,
  41563. maxY = minY;
  41564. for (let i = 1, ii = mesh.coords.length; i < ii; i++) {
  41565. const x = mesh.coords[i][0],
  41566. y = mesh.coords[i][1];
  41567. minX = minX > x ? x : minX;
  41568. minY = minY > y ? y : minY;
  41569. maxX = maxX < x ? x : maxX;
  41570. maxY = maxY < y ? y : maxY;
  41571. }
  41572. mesh.bounds = [minX, minY, maxX, maxY];
  41573. }
  41574. function packData(mesh) {
  41575. let i, ii, j, jj;
  41576. const coords = mesh.coords;
  41577. const coordsPacked = new Float32Array(coords.length * 2);
  41578. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  41579. const xy = coords[i];
  41580. coordsPacked[j++] = xy[0];
  41581. coordsPacked[j++] = xy[1];
  41582. }
  41583. mesh.coords = coordsPacked;
  41584. const colors = mesh.colors;
  41585. const colorsPacked = new Uint8Array(colors.length * 3);
  41586. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  41587. const c = colors[i];
  41588. colorsPacked[j++] = c[0];
  41589. colorsPacked[j++] = c[1];
  41590. colorsPacked[j++] = c[2];
  41591. }
  41592. mesh.colors = colorsPacked;
  41593. const figures = mesh.figures;
  41594. for (i = 0, ii = figures.length; i < ii; i++) {
  41595. const figure = figures[i],
  41596. ps = figure.coords,
  41597. cs = figure.colors;
  41598. for (j = 0, jj = ps.length; j < jj; j++) {
  41599. ps[j] *= 2;
  41600. cs[j] *= 3;
  41601. }
  41602. }
  41603. }
  41604. function Mesh(stream, matrix, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  41605. if (!(0, _primitives.isStream)(stream)) {
  41606. throw new _util.FormatError("Mesh data is not a stream");
  41607. }
  41608. const dict = stream.dict;
  41609. this.matrix = matrix;
  41610. this.shadingType = dict.get("ShadingType");
  41611. this.type = "Pattern";
  41612. const bbox = dict.getArray("BBox");
  41613. if (Array.isArray(bbox) && bbox.length === 4) {
  41614. this.bbox = _util.Util.normalizeRect(bbox);
  41615. } else {
  41616. this.bbox = null;
  41617. }
  41618. const cs = _colorspace.ColorSpace.parse({
  41619. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  41620. xref,
  41621. resources,
  41622. pdfFunctionFactory,
  41623. localColorSpaceCache
  41624. });
  41625. this.cs = cs;
  41626. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  41627. const fnObj = dict.getRaw("Function");
  41628. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  41629. this.coords = [];
  41630. this.colors = [];
  41631. this.figures = [];
  41632. const decodeContext = {
  41633. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  41634. bitsPerComponent: dict.get("BitsPerComponent"),
  41635. bitsPerFlag: dict.get("BitsPerFlag"),
  41636. decode: dict.getArray("Decode"),
  41637. colorFn: fn,
  41638. colorSpace: cs,
  41639. numComps: fn ? 1 : cs.numComps
  41640. };
  41641. const reader = new MeshStreamReader(stream, decodeContext);
  41642. let patchMesh = false;
  41643. switch (this.shadingType) {
  41644. case ShadingType.FREE_FORM_MESH:
  41645. decodeType4Shading(this, reader);
  41646. break;
  41647. case ShadingType.LATTICE_FORM_MESH:
  41648. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  41649. if (verticesPerRow < 2) {
  41650. throw new _util.FormatError("Invalid VerticesPerRow");
  41651. }
  41652. decodeType5Shading(this, reader, verticesPerRow);
  41653. break;
  41654. case ShadingType.COONS_PATCH_MESH:
  41655. decodeType6Shading(this, reader);
  41656. patchMesh = true;
  41657. break;
  41658. case ShadingType.TENSOR_PATCH_MESH:
  41659. decodeType7Shading(this, reader);
  41660. patchMesh = true;
  41661. break;
  41662. default:
  41663. (0, _util.unreachable)("Unsupported mesh type.");
  41664. break;
  41665. }
  41666. if (patchMesh) {
  41667. updateBounds(this);
  41668. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  41669. buildFigureFromPatch(this, i);
  41670. }
  41671. }
  41672. updateBounds(this);
  41673. packData(this);
  41674. }
  41675. Mesh.prototype = {
  41676. getIR: function Mesh_getIR() {
  41677. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.matrix, this.bbox, this.background];
  41678. }
  41679. };
  41680. return Mesh;
  41681. }();
  41682. Shadings.Dummy = function DummyClosure() {
  41683. function Dummy() {
  41684. this.type = "Pattern";
  41685. }
  41686. Dummy.prototype = {
  41687. getIR: function Dummy_getIR() {
  41688. return ["Dummy"];
  41689. }
  41690. };
  41691. return Dummy;
  41692. }();
  41693. function getTilingPatternIR(operatorList, dict, color) {
  41694. const matrix = dict.getArray("Matrix");
  41695. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  41696. const xstep = dict.get("XStep");
  41697. const ystep = dict.get("YStep");
  41698. const paintType = dict.get("PaintType");
  41699. const tilingType = dict.get("TilingType");
  41700. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  41701. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  41702. }
  41703. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  41704. }
  41705. /***/ }),
  41706. /* 41 */
  41707. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41708. Object.defineProperty(exports, "__esModule", ({
  41709. value: true
  41710. }));
  41711. exports.isPDFFunction = isPDFFunction;
  41712. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  41713. var _primitives = __w_pdfjs_require__(5);
  41714. var _util = __w_pdfjs_require__(2);
  41715. var _ps_parser = __w_pdfjs_require__(42);
  41716. var _image_utils = __w_pdfjs_require__(24);
  41717. class PDFFunctionFactory {
  41718. constructor({
  41719. xref,
  41720. isEvalSupported = true
  41721. }) {
  41722. this.xref = xref;
  41723. this.isEvalSupported = isEvalSupported !== false;
  41724. }
  41725. create(fn) {
  41726. const cachedFunction = this.getCached(fn);
  41727. if (cachedFunction) {
  41728. return cachedFunction;
  41729. }
  41730. const parsedFunction = PDFFunction.parse({
  41731. xref: this.xref,
  41732. isEvalSupported: this.isEvalSupported,
  41733. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  41734. });
  41735. this._cache(fn, parsedFunction);
  41736. return parsedFunction;
  41737. }
  41738. createFromArray(fnObj) {
  41739. const cachedFunction = this.getCached(fnObj);
  41740. if (cachedFunction) {
  41741. return cachedFunction;
  41742. }
  41743. const parsedFunction = PDFFunction.parseArray({
  41744. xref: this.xref,
  41745. isEvalSupported: this.isEvalSupported,
  41746. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  41747. });
  41748. this._cache(fnObj, parsedFunction);
  41749. return parsedFunction;
  41750. }
  41751. getCached(cacheKey) {
  41752. let fnRef;
  41753. if (cacheKey instanceof _primitives.Ref) {
  41754. fnRef = cacheKey;
  41755. } else if (cacheKey instanceof _primitives.Dict) {
  41756. fnRef = cacheKey.objId;
  41757. } else if ((0, _primitives.isStream)(cacheKey)) {
  41758. fnRef = cacheKey.dict && cacheKey.dict.objId;
  41759. }
  41760. if (fnRef) {
  41761. const localFunction = this._localFunctionCache.getByRef(fnRef);
  41762. if (localFunction) {
  41763. return localFunction;
  41764. }
  41765. }
  41766. return null;
  41767. }
  41768. _cache(cacheKey, parsedFunction) {
  41769. if (!parsedFunction) {
  41770. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  41771. }
  41772. let fnRef;
  41773. if (cacheKey instanceof _primitives.Ref) {
  41774. fnRef = cacheKey;
  41775. } else if (cacheKey instanceof _primitives.Dict) {
  41776. fnRef = cacheKey.objId;
  41777. } else if ((0, _primitives.isStream)(cacheKey)) {
  41778. fnRef = cacheKey.dict && cacheKey.dict.objId;
  41779. }
  41780. if (fnRef) {
  41781. this._localFunctionCache.set(null, fnRef, parsedFunction);
  41782. }
  41783. }
  41784. get _localFunctionCache() {
  41785. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  41786. }
  41787. }
  41788. exports.PDFFunctionFactory = PDFFunctionFactory;
  41789. function toNumberArray(arr) {
  41790. if (!Array.isArray(arr)) {
  41791. return null;
  41792. }
  41793. const length = arr.length;
  41794. for (let i = 0; i < length; i++) {
  41795. if (typeof arr[i] !== "number") {
  41796. const result = new Array(length);
  41797. for (let j = 0; j < length; j++) {
  41798. result[j] = +arr[j];
  41799. }
  41800. return result;
  41801. }
  41802. }
  41803. return arr;
  41804. }
  41805. var PDFFunction = function PDFFunctionClosure() {
  41806. const CONSTRUCT_SAMPLED = 0;
  41807. const CONSTRUCT_INTERPOLATED = 2;
  41808. const CONSTRUCT_STICHED = 3;
  41809. const CONSTRUCT_POSTSCRIPT = 4;
  41810. return {
  41811. getSampleArray(size, outputSize, bps, stream) {
  41812. var i, ii;
  41813. var length = 1;
  41814. for (i = 0, ii = size.length; i < ii; i++) {
  41815. length *= size[i];
  41816. }
  41817. length *= outputSize;
  41818. var array = new Array(length);
  41819. var codeSize = 0;
  41820. var codeBuf = 0;
  41821. var sampleMul = 1.0 / (2.0 ** bps - 1);
  41822. var strBytes = stream.getBytes((length * bps + 7) / 8);
  41823. var strIdx = 0;
  41824. for (i = 0; i < length; i++) {
  41825. while (codeSize < bps) {
  41826. codeBuf <<= 8;
  41827. codeBuf |= strBytes[strIdx++];
  41828. codeSize += 8;
  41829. }
  41830. codeSize -= bps;
  41831. array[i] = (codeBuf >> codeSize) * sampleMul;
  41832. codeBuf &= (1 << codeSize) - 1;
  41833. }
  41834. return array;
  41835. },
  41836. getIR({
  41837. xref,
  41838. isEvalSupported,
  41839. fn
  41840. }) {
  41841. var dict = fn.dict;
  41842. if (!dict) {
  41843. dict = fn;
  41844. }
  41845. var types = [this.constructSampled, null, this.constructInterpolated, this.constructStiched, this.constructPostScript];
  41846. var typeNum = dict.get("FunctionType");
  41847. var typeFn = types[typeNum];
  41848. if (!typeFn) {
  41849. throw new _util.FormatError("Unknown type of function");
  41850. }
  41851. return typeFn.call(this, {
  41852. xref,
  41853. isEvalSupported,
  41854. fn,
  41855. dict
  41856. });
  41857. },
  41858. fromIR({
  41859. xref,
  41860. isEvalSupported,
  41861. IR
  41862. }) {
  41863. var type = IR[0];
  41864. switch (type) {
  41865. case CONSTRUCT_SAMPLED:
  41866. return this.constructSampledFromIR({
  41867. xref,
  41868. isEvalSupported,
  41869. IR
  41870. });
  41871. case CONSTRUCT_INTERPOLATED:
  41872. return this.constructInterpolatedFromIR({
  41873. xref,
  41874. isEvalSupported,
  41875. IR
  41876. });
  41877. case CONSTRUCT_STICHED:
  41878. return this.constructStichedFromIR({
  41879. xref,
  41880. isEvalSupported,
  41881. IR
  41882. });
  41883. default:
  41884. return this.constructPostScriptFromIR({
  41885. xref,
  41886. isEvalSupported,
  41887. IR
  41888. });
  41889. }
  41890. },
  41891. parse({
  41892. xref,
  41893. isEvalSupported,
  41894. fn
  41895. }) {
  41896. const IR = this.getIR({
  41897. xref,
  41898. isEvalSupported,
  41899. fn
  41900. });
  41901. return this.fromIR({
  41902. xref,
  41903. isEvalSupported,
  41904. IR
  41905. });
  41906. },
  41907. parseArray({
  41908. xref,
  41909. isEvalSupported,
  41910. fnObj
  41911. }) {
  41912. if (!Array.isArray(fnObj)) {
  41913. return this.parse({
  41914. xref,
  41915. isEvalSupported,
  41916. fn: fnObj
  41917. });
  41918. }
  41919. var fnArray = [];
  41920. for (var j = 0, jj = fnObj.length; j < jj; j++) {
  41921. fnArray.push(this.parse({
  41922. xref,
  41923. isEvalSupported,
  41924. fn: xref.fetchIfRef(fnObj[j])
  41925. }));
  41926. }
  41927. return function (src, srcOffset, dest, destOffset) {
  41928. for (var i = 0, ii = fnArray.length; i < ii; i++) {
  41929. fnArray[i](src, srcOffset, dest, destOffset + i);
  41930. }
  41931. };
  41932. },
  41933. constructSampled({
  41934. xref,
  41935. isEvalSupported,
  41936. fn,
  41937. dict
  41938. }) {
  41939. function toMultiArray(arr) {
  41940. var inputLength = arr.length;
  41941. var out = [];
  41942. var index = 0;
  41943. for (var i = 0; i < inputLength; i += 2) {
  41944. out[index] = [arr[i], arr[i + 1]];
  41945. ++index;
  41946. }
  41947. return out;
  41948. }
  41949. var domain = toNumberArray(dict.getArray("Domain"));
  41950. var range = toNumberArray(dict.getArray("Range"));
  41951. if (!domain || !range) {
  41952. throw new _util.FormatError("No domain or range");
  41953. }
  41954. var inputSize = domain.length / 2;
  41955. var outputSize = range.length / 2;
  41956. domain = toMultiArray(domain);
  41957. range = toMultiArray(range);
  41958. var size = toNumberArray(dict.getArray("Size"));
  41959. var bps = dict.get("BitsPerSample");
  41960. var order = dict.get("Order") || 1;
  41961. if (order !== 1) {
  41962. (0, _util.info)("No support for cubic spline interpolation: " + order);
  41963. }
  41964. var encode = toNumberArray(dict.getArray("Encode"));
  41965. if (!encode) {
  41966. encode = [];
  41967. for (var i = 0; i < inputSize; ++i) {
  41968. encode.push([0, size[i] - 1]);
  41969. }
  41970. } else {
  41971. encode = toMultiArray(encode);
  41972. }
  41973. var decode = toNumberArray(dict.getArray("Decode"));
  41974. if (!decode) {
  41975. decode = range;
  41976. } else {
  41977. decode = toMultiArray(decode);
  41978. }
  41979. var samples = this.getSampleArray(size, outputSize, bps, fn);
  41980. return [CONSTRUCT_SAMPLED, inputSize, domain, encode, decode, samples, size, outputSize, 2 ** bps - 1, range];
  41981. },
  41982. constructSampledFromIR({
  41983. xref,
  41984. isEvalSupported,
  41985. IR
  41986. }) {
  41987. function interpolate(x, xmin, xmax, ymin, ymax) {
  41988. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  41989. }
  41990. return function constructSampledFromIRResult(src, srcOffset, dest, destOffset) {
  41991. var m = IR[1];
  41992. var domain = IR[2];
  41993. var encode = IR[3];
  41994. var decode = IR[4];
  41995. var samples = IR[5];
  41996. var size = IR[6];
  41997. var n = IR[7];
  41998. var range = IR[9];
  41999. var cubeVertices = 1 << m;
  42000. var cubeN = new Float64Array(cubeVertices);
  42001. var cubeVertex = new Uint32Array(cubeVertices);
  42002. var i, j;
  42003. for (j = 0; j < cubeVertices; j++) {
  42004. cubeN[j] = 1;
  42005. }
  42006. var k = n,
  42007. pos = 1;
  42008. for (i = 0; i < m; ++i) {
  42009. var domain_2i = domain[i][0];
  42010. var domain_2i_1 = domain[i][1];
  42011. var xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  42012. var e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  42013. var size_i = size[i];
  42014. e = Math.min(Math.max(e, 0), size_i - 1);
  42015. var e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  42016. var n0 = e0 + 1 - e;
  42017. var n1 = e - e0;
  42018. var offset0 = e0 * k;
  42019. var offset1 = offset0 + k;
  42020. for (j = 0; j < cubeVertices; j++) {
  42021. if (j & pos) {
  42022. cubeN[j] *= n1;
  42023. cubeVertex[j] += offset1;
  42024. } else {
  42025. cubeN[j] *= n0;
  42026. cubeVertex[j] += offset0;
  42027. }
  42028. }
  42029. k *= size_i;
  42030. pos <<= 1;
  42031. }
  42032. for (j = 0; j < n; ++j) {
  42033. var rj = 0;
  42034. for (i = 0; i < cubeVertices; i++) {
  42035. rj += samples[cubeVertex[i] + j] * cubeN[i];
  42036. }
  42037. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  42038. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  42039. }
  42040. };
  42041. },
  42042. constructInterpolated({
  42043. xref,
  42044. isEvalSupported,
  42045. fn,
  42046. dict
  42047. }) {
  42048. var c0 = toNumberArray(dict.getArray("C0")) || [0];
  42049. var c1 = toNumberArray(dict.getArray("C1")) || [1];
  42050. var n = dict.get("N");
  42051. var length = c0.length;
  42052. var diff = [];
  42053. for (var i = 0; i < length; ++i) {
  42054. diff.push(c1[i] - c0[i]);
  42055. }
  42056. return [CONSTRUCT_INTERPOLATED, c0, diff, n];
  42057. },
  42058. constructInterpolatedFromIR({
  42059. xref,
  42060. isEvalSupported,
  42061. IR
  42062. }) {
  42063. var c0 = IR[1];
  42064. var diff = IR[2];
  42065. var n = IR[3];
  42066. var length = diff.length;
  42067. return function constructInterpolatedFromIRResult(src, srcOffset, dest, destOffset) {
  42068. var x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  42069. for (var j = 0; j < length; ++j) {
  42070. dest[destOffset + j] = c0[j] + x * diff[j];
  42071. }
  42072. };
  42073. },
  42074. constructStiched({
  42075. xref,
  42076. isEvalSupported,
  42077. fn,
  42078. dict
  42079. }) {
  42080. var domain = toNumberArray(dict.getArray("Domain"));
  42081. if (!domain) {
  42082. throw new _util.FormatError("No domain");
  42083. }
  42084. var inputSize = domain.length / 2;
  42085. if (inputSize !== 1) {
  42086. throw new _util.FormatError("Bad domain for stiched function");
  42087. }
  42088. var fnRefs = dict.get("Functions");
  42089. var fns = [];
  42090. for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
  42091. fns.push(this.parse({
  42092. xref,
  42093. isEvalSupported,
  42094. fn: xref.fetchIfRef(fnRefs[i])
  42095. }));
  42096. }
  42097. var bounds = toNumberArray(dict.getArray("Bounds"));
  42098. var encode = toNumberArray(dict.getArray("Encode"));
  42099. return [CONSTRUCT_STICHED, domain, bounds, encode, fns];
  42100. },
  42101. constructStichedFromIR({
  42102. xref,
  42103. isEvalSupported,
  42104. IR
  42105. }) {
  42106. var domain = IR[1];
  42107. var bounds = IR[2];
  42108. var encode = IR[3];
  42109. var fns = IR[4];
  42110. var tmpBuf = new Float32Array(1);
  42111. return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
  42112. var clip = function constructStichedFromIRClip(v, min, max) {
  42113. if (v > max) {
  42114. v = max;
  42115. } else if (v < min) {
  42116. v = min;
  42117. }
  42118. return v;
  42119. };
  42120. var v = clip(src[srcOffset], domain[0], domain[1]);
  42121. for (var i = 0, ii = bounds.length; i < ii; ++i) {
  42122. if (v < bounds[i]) {
  42123. break;
  42124. }
  42125. }
  42126. var dmin = domain[0];
  42127. if (i > 0) {
  42128. dmin = bounds[i - 1];
  42129. }
  42130. var dmax = domain[1];
  42131. if (i < bounds.length) {
  42132. dmax = bounds[i];
  42133. }
  42134. var rmin = encode[2 * i];
  42135. var rmax = encode[2 * i + 1];
  42136. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  42137. fns[i](tmpBuf, 0, dest, destOffset);
  42138. };
  42139. },
  42140. constructPostScript({
  42141. xref,
  42142. isEvalSupported,
  42143. fn,
  42144. dict
  42145. }) {
  42146. var domain = toNumberArray(dict.getArray("Domain"));
  42147. var range = toNumberArray(dict.getArray("Range"));
  42148. if (!domain) {
  42149. throw new _util.FormatError("No domain.");
  42150. }
  42151. if (!range) {
  42152. throw new _util.FormatError("No range.");
  42153. }
  42154. var lexer = new _ps_parser.PostScriptLexer(fn);
  42155. var parser = new _ps_parser.PostScriptParser(lexer);
  42156. var code = parser.parse();
  42157. return [CONSTRUCT_POSTSCRIPT, domain, range, code];
  42158. },
  42159. constructPostScriptFromIR({
  42160. xref,
  42161. isEvalSupported,
  42162. IR
  42163. }) {
  42164. var domain = IR[1];
  42165. var range = IR[2];
  42166. var code = IR[3];
  42167. if (isEvalSupported && _util.IsEvalSupportedCached.value) {
  42168. const compiled = new PostScriptCompiler().compile(code, domain, range);
  42169. if (compiled) {
  42170. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  42171. }
  42172. }
  42173. (0, _util.info)("Unable to compile PS function");
  42174. var numOutputs = range.length >> 1;
  42175. var numInputs = domain.length >> 1;
  42176. var evaluator = new PostScriptEvaluator(code);
  42177. var cache = Object.create(null);
  42178. var MAX_CACHE_SIZE = 2048 * 4;
  42179. var cache_available = MAX_CACHE_SIZE;
  42180. var tmpBuf = new Float32Array(numInputs);
  42181. return function constructPostScriptFromIRResult(src, srcOffset, dest, destOffset) {
  42182. var i, value;
  42183. var key = "";
  42184. var input = tmpBuf;
  42185. for (i = 0; i < numInputs; i++) {
  42186. value = src[srcOffset + i];
  42187. input[i] = value;
  42188. key += value + "_";
  42189. }
  42190. var cachedValue = cache[key];
  42191. if (cachedValue !== undefined) {
  42192. dest.set(cachedValue, destOffset);
  42193. return;
  42194. }
  42195. var output = new Float32Array(numOutputs);
  42196. var stack = evaluator.execute(input);
  42197. var stackIndex = stack.length - numOutputs;
  42198. for (i = 0; i < numOutputs; i++) {
  42199. value = stack[stackIndex + i];
  42200. var bound = range[i * 2];
  42201. if (value < bound) {
  42202. value = bound;
  42203. } else {
  42204. bound = range[i * 2 + 1];
  42205. if (value > bound) {
  42206. value = bound;
  42207. }
  42208. }
  42209. output[i] = value;
  42210. }
  42211. if (cache_available > 0) {
  42212. cache_available--;
  42213. cache[key] = output;
  42214. }
  42215. dest.set(output, destOffset);
  42216. };
  42217. }
  42218. };
  42219. }();
  42220. function isPDFFunction(v) {
  42221. var fnDict;
  42222. if (typeof v !== "object") {
  42223. return false;
  42224. } else if ((0, _primitives.isDict)(v)) {
  42225. fnDict = v;
  42226. } else if ((0, _primitives.isStream)(v)) {
  42227. fnDict = v.dict;
  42228. } else {
  42229. return false;
  42230. }
  42231. return fnDict.has("FunctionType");
  42232. }
  42233. var PostScriptStack = function PostScriptStackClosure() {
  42234. var MAX_STACK_SIZE = 100;
  42235. class PostScriptStack {
  42236. constructor(initialStack) {
  42237. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  42238. }
  42239. push(value) {
  42240. if (this.stack.length >= MAX_STACK_SIZE) {
  42241. throw new Error("PostScript function stack overflow.");
  42242. }
  42243. this.stack.push(value);
  42244. }
  42245. pop() {
  42246. if (this.stack.length <= 0) {
  42247. throw new Error("PostScript function stack underflow.");
  42248. }
  42249. return this.stack.pop();
  42250. }
  42251. copy(n) {
  42252. if (this.stack.length + n >= MAX_STACK_SIZE) {
  42253. throw new Error("PostScript function stack overflow.");
  42254. }
  42255. var stack = this.stack;
  42256. for (var i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  42257. stack.push(stack[i]);
  42258. }
  42259. }
  42260. index(n) {
  42261. this.push(this.stack[this.stack.length - n - 1]);
  42262. }
  42263. roll(n, p) {
  42264. var stack = this.stack;
  42265. var l = stack.length - n;
  42266. var r = stack.length - 1,
  42267. c = l + (p - Math.floor(p / n) * n),
  42268. i,
  42269. j,
  42270. t;
  42271. for (i = l, j = r; i < j; i++, j--) {
  42272. t = stack[i];
  42273. stack[i] = stack[j];
  42274. stack[j] = t;
  42275. }
  42276. for (i = l, j = c - 1; i < j; i++, j--) {
  42277. t = stack[i];
  42278. stack[i] = stack[j];
  42279. stack[j] = t;
  42280. }
  42281. for (i = c, j = r; i < j; i++, j--) {
  42282. t = stack[i];
  42283. stack[i] = stack[j];
  42284. stack[j] = t;
  42285. }
  42286. }
  42287. }
  42288. return PostScriptStack;
  42289. }();
  42290. class PostScriptEvaluator {
  42291. constructor(operators) {
  42292. this.operators = operators;
  42293. }
  42294. execute(initialStack) {
  42295. var stack = new PostScriptStack(initialStack);
  42296. var counter = 0;
  42297. var operators = this.operators;
  42298. var length = operators.length;
  42299. var operator, a, b;
  42300. while (counter < length) {
  42301. operator = operators[counter++];
  42302. if (typeof operator === "number") {
  42303. stack.push(operator);
  42304. continue;
  42305. }
  42306. switch (operator) {
  42307. case "jz":
  42308. b = stack.pop();
  42309. a = stack.pop();
  42310. if (!a) {
  42311. counter = b;
  42312. }
  42313. break;
  42314. case "j":
  42315. a = stack.pop();
  42316. counter = a;
  42317. break;
  42318. case "abs":
  42319. a = stack.pop();
  42320. stack.push(Math.abs(a));
  42321. break;
  42322. case "add":
  42323. b = stack.pop();
  42324. a = stack.pop();
  42325. stack.push(a + b);
  42326. break;
  42327. case "and":
  42328. b = stack.pop();
  42329. a = stack.pop();
  42330. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  42331. stack.push(a && b);
  42332. } else {
  42333. stack.push(a & b);
  42334. }
  42335. break;
  42336. case "atan":
  42337. a = stack.pop();
  42338. stack.push(Math.atan(a));
  42339. break;
  42340. case "bitshift":
  42341. b = stack.pop();
  42342. a = stack.pop();
  42343. if (a > 0) {
  42344. stack.push(a << b);
  42345. } else {
  42346. stack.push(a >> b);
  42347. }
  42348. break;
  42349. case "ceiling":
  42350. a = stack.pop();
  42351. stack.push(Math.ceil(a));
  42352. break;
  42353. case "copy":
  42354. a = stack.pop();
  42355. stack.copy(a);
  42356. break;
  42357. case "cos":
  42358. a = stack.pop();
  42359. stack.push(Math.cos(a));
  42360. break;
  42361. case "cvi":
  42362. a = stack.pop() | 0;
  42363. stack.push(a);
  42364. break;
  42365. case "cvr":
  42366. break;
  42367. case "div":
  42368. b = stack.pop();
  42369. a = stack.pop();
  42370. stack.push(a / b);
  42371. break;
  42372. case "dup":
  42373. stack.copy(1);
  42374. break;
  42375. case "eq":
  42376. b = stack.pop();
  42377. a = stack.pop();
  42378. stack.push(a === b);
  42379. break;
  42380. case "exch":
  42381. stack.roll(2, 1);
  42382. break;
  42383. case "exp":
  42384. b = stack.pop();
  42385. a = stack.pop();
  42386. stack.push(a ** b);
  42387. break;
  42388. case "false":
  42389. stack.push(false);
  42390. break;
  42391. case "floor":
  42392. a = stack.pop();
  42393. stack.push(Math.floor(a));
  42394. break;
  42395. case "ge":
  42396. b = stack.pop();
  42397. a = stack.pop();
  42398. stack.push(a >= b);
  42399. break;
  42400. case "gt":
  42401. b = stack.pop();
  42402. a = stack.pop();
  42403. stack.push(a > b);
  42404. break;
  42405. case "idiv":
  42406. b = stack.pop();
  42407. a = stack.pop();
  42408. stack.push(a / b | 0);
  42409. break;
  42410. case "index":
  42411. a = stack.pop();
  42412. stack.index(a);
  42413. break;
  42414. case "le":
  42415. b = stack.pop();
  42416. a = stack.pop();
  42417. stack.push(a <= b);
  42418. break;
  42419. case "ln":
  42420. a = stack.pop();
  42421. stack.push(Math.log(a));
  42422. break;
  42423. case "log":
  42424. a = stack.pop();
  42425. stack.push(Math.log(a) / Math.LN10);
  42426. break;
  42427. case "lt":
  42428. b = stack.pop();
  42429. a = stack.pop();
  42430. stack.push(a < b);
  42431. break;
  42432. case "mod":
  42433. b = stack.pop();
  42434. a = stack.pop();
  42435. stack.push(a % b);
  42436. break;
  42437. case "mul":
  42438. b = stack.pop();
  42439. a = stack.pop();
  42440. stack.push(a * b);
  42441. break;
  42442. case "ne":
  42443. b = stack.pop();
  42444. a = stack.pop();
  42445. stack.push(a !== b);
  42446. break;
  42447. case "neg":
  42448. a = stack.pop();
  42449. stack.push(-a);
  42450. break;
  42451. case "not":
  42452. a = stack.pop();
  42453. if ((0, _util.isBool)(a)) {
  42454. stack.push(!a);
  42455. } else {
  42456. stack.push(~a);
  42457. }
  42458. break;
  42459. case "or":
  42460. b = stack.pop();
  42461. a = stack.pop();
  42462. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  42463. stack.push(a || b);
  42464. } else {
  42465. stack.push(a | b);
  42466. }
  42467. break;
  42468. case "pop":
  42469. stack.pop();
  42470. break;
  42471. case "roll":
  42472. b = stack.pop();
  42473. a = stack.pop();
  42474. stack.roll(a, b);
  42475. break;
  42476. case "round":
  42477. a = stack.pop();
  42478. stack.push(Math.round(a));
  42479. break;
  42480. case "sin":
  42481. a = stack.pop();
  42482. stack.push(Math.sin(a));
  42483. break;
  42484. case "sqrt":
  42485. a = stack.pop();
  42486. stack.push(Math.sqrt(a));
  42487. break;
  42488. case "sub":
  42489. b = stack.pop();
  42490. a = stack.pop();
  42491. stack.push(a - b);
  42492. break;
  42493. case "true":
  42494. stack.push(true);
  42495. break;
  42496. case "truncate":
  42497. a = stack.pop();
  42498. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  42499. stack.push(a);
  42500. break;
  42501. case "xor":
  42502. b = stack.pop();
  42503. a = stack.pop();
  42504. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  42505. stack.push(a !== b);
  42506. } else {
  42507. stack.push(a ^ b);
  42508. }
  42509. break;
  42510. default:
  42511. throw new _util.FormatError(`Unknown operator ${operator}`);
  42512. }
  42513. }
  42514. return stack.stack;
  42515. }
  42516. }
  42517. exports.PostScriptEvaluator = PostScriptEvaluator;
  42518. var PostScriptCompiler = function PostScriptCompilerClosure() {
  42519. class AstNode {
  42520. constructor(type) {
  42521. this.type = type;
  42522. }
  42523. visit(visitor) {
  42524. (0, _util.unreachable)("abstract method");
  42525. }
  42526. }
  42527. class AstArgument extends AstNode {
  42528. constructor(index, min, max) {
  42529. super("args");
  42530. this.index = index;
  42531. this.min = min;
  42532. this.max = max;
  42533. }
  42534. visit(visitor) {
  42535. visitor.visitArgument(this);
  42536. }
  42537. }
  42538. class AstLiteral extends AstNode {
  42539. constructor(number) {
  42540. super("literal");
  42541. this.number = number;
  42542. this.min = number;
  42543. this.max = number;
  42544. }
  42545. visit(visitor) {
  42546. visitor.visitLiteral(this);
  42547. }
  42548. }
  42549. class AstBinaryOperation extends AstNode {
  42550. constructor(op, arg1, arg2, min, max) {
  42551. super("binary");
  42552. this.op = op;
  42553. this.arg1 = arg1;
  42554. this.arg2 = arg2;
  42555. this.min = min;
  42556. this.max = max;
  42557. }
  42558. visit(visitor) {
  42559. visitor.visitBinaryOperation(this);
  42560. }
  42561. }
  42562. class AstMin extends AstNode {
  42563. constructor(arg, max) {
  42564. super("max");
  42565. this.arg = arg;
  42566. this.min = arg.min;
  42567. this.max = max;
  42568. }
  42569. visit(visitor) {
  42570. visitor.visitMin(this);
  42571. }
  42572. }
  42573. class AstVariable extends AstNode {
  42574. constructor(index, min, max) {
  42575. super("var");
  42576. this.index = index;
  42577. this.min = min;
  42578. this.max = max;
  42579. }
  42580. visit(visitor) {
  42581. visitor.visitVariable(this);
  42582. }
  42583. }
  42584. class AstVariableDefinition extends AstNode {
  42585. constructor(variable, arg) {
  42586. super("definition");
  42587. this.variable = variable;
  42588. this.arg = arg;
  42589. }
  42590. visit(visitor) {
  42591. visitor.visitVariableDefinition(this);
  42592. }
  42593. }
  42594. class ExpressionBuilderVisitor {
  42595. constructor() {
  42596. this.parts = [];
  42597. }
  42598. visitArgument(arg) {
  42599. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  42600. }
  42601. visitVariable(variable) {
  42602. this.parts.push("v", variable.index);
  42603. }
  42604. visitLiteral(literal) {
  42605. this.parts.push(literal.number);
  42606. }
  42607. visitBinaryOperation(operation) {
  42608. this.parts.push("(");
  42609. operation.arg1.visit(this);
  42610. this.parts.push(" ", operation.op, " ");
  42611. operation.arg2.visit(this);
  42612. this.parts.push(")");
  42613. }
  42614. visitVariableDefinition(definition) {
  42615. this.parts.push("var ");
  42616. definition.variable.visit(this);
  42617. this.parts.push(" = ");
  42618. definition.arg.visit(this);
  42619. this.parts.push(";");
  42620. }
  42621. visitMin(max) {
  42622. this.parts.push("Math.min(");
  42623. max.arg.visit(this);
  42624. this.parts.push(", ", max.max, ")");
  42625. }
  42626. toString() {
  42627. return this.parts.join("");
  42628. }
  42629. }
  42630. function buildAddOperation(num1, num2) {
  42631. if (num2.type === "literal" && num2.number === 0) {
  42632. return num1;
  42633. }
  42634. if (num1.type === "literal" && num1.number === 0) {
  42635. return num2;
  42636. }
  42637. if (num2.type === "literal" && num1.type === "literal") {
  42638. return new AstLiteral(num1.number + num2.number);
  42639. }
  42640. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  42641. }
  42642. function buildMulOperation(num1, num2) {
  42643. if (num2.type === "literal") {
  42644. if (num2.number === 0) {
  42645. return new AstLiteral(0);
  42646. } else if (num2.number === 1) {
  42647. return num1;
  42648. } else if (num1.type === "literal") {
  42649. return new AstLiteral(num1.number * num2.number);
  42650. }
  42651. }
  42652. if (num1.type === "literal") {
  42653. if (num1.number === 0) {
  42654. return new AstLiteral(0);
  42655. } else if (num1.number === 1) {
  42656. return num2;
  42657. }
  42658. }
  42659. var min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  42660. var max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  42661. return new AstBinaryOperation("*", num1, num2, min, max);
  42662. }
  42663. function buildSubOperation(num1, num2) {
  42664. if (num2.type === "literal") {
  42665. if (num2.number === 0) {
  42666. return num1;
  42667. } else if (num1.type === "literal") {
  42668. return new AstLiteral(num1.number - num2.number);
  42669. }
  42670. }
  42671. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  42672. return num2.arg2;
  42673. }
  42674. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  42675. }
  42676. function buildMinOperation(num1, max) {
  42677. if (num1.min >= max) {
  42678. return new AstLiteral(max);
  42679. } else if (num1.max <= max) {
  42680. return num1;
  42681. }
  42682. return new AstMin(num1, max);
  42683. }
  42684. class PostScriptCompiler {
  42685. compile(code, domain, range) {
  42686. var stack = [];
  42687. var instructions = [];
  42688. var inputSize = domain.length >> 1,
  42689. outputSize = range.length >> 1;
  42690. var lastRegister = 0;
  42691. var n, j;
  42692. var num1, num2, ast1, ast2, tmpVar, item;
  42693. for (let i = 0; i < inputSize; i++) {
  42694. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  42695. }
  42696. for (let i = 0, ii = code.length; i < ii; i++) {
  42697. item = code[i];
  42698. if (typeof item === "number") {
  42699. stack.push(new AstLiteral(item));
  42700. continue;
  42701. }
  42702. switch (item) {
  42703. case "add":
  42704. if (stack.length < 2) {
  42705. return null;
  42706. }
  42707. num2 = stack.pop();
  42708. num1 = stack.pop();
  42709. stack.push(buildAddOperation(num1, num2));
  42710. break;
  42711. case "cvr":
  42712. if (stack.length < 1) {
  42713. return null;
  42714. }
  42715. break;
  42716. case "mul":
  42717. if (stack.length < 2) {
  42718. return null;
  42719. }
  42720. num2 = stack.pop();
  42721. num1 = stack.pop();
  42722. stack.push(buildMulOperation(num1, num2));
  42723. break;
  42724. case "sub":
  42725. if (stack.length < 2) {
  42726. return null;
  42727. }
  42728. num2 = stack.pop();
  42729. num1 = stack.pop();
  42730. stack.push(buildSubOperation(num1, num2));
  42731. break;
  42732. case "exch":
  42733. if (stack.length < 2) {
  42734. return null;
  42735. }
  42736. ast1 = stack.pop();
  42737. ast2 = stack.pop();
  42738. stack.push(ast1, ast2);
  42739. break;
  42740. case "pop":
  42741. if (stack.length < 1) {
  42742. return null;
  42743. }
  42744. stack.pop();
  42745. break;
  42746. case "index":
  42747. if (stack.length < 1) {
  42748. return null;
  42749. }
  42750. num1 = stack.pop();
  42751. if (num1.type !== "literal") {
  42752. return null;
  42753. }
  42754. n = num1.number;
  42755. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  42756. return null;
  42757. }
  42758. ast1 = stack[stack.length - n - 1];
  42759. if (ast1.type === "literal" || ast1.type === "var") {
  42760. stack.push(ast1);
  42761. break;
  42762. }
  42763. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  42764. stack[stack.length - n - 1] = tmpVar;
  42765. stack.push(tmpVar);
  42766. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  42767. break;
  42768. case "dup":
  42769. if (stack.length < 1) {
  42770. return null;
  42771. }
  42772. 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]) {
  42773. num1 = stack.pop();
  42774. stack.push(buildMinOperation(num1, code[i + 1]));
  42775. i += 6;
  42776. break;
  42777. }
  42778. ast1 = stack[stack.length - 1];
  42779. if (ast1.type === "literal" || ast1.type === "var") {
  42780. stack.push(ast1);
  42781. break;
  42782. }
  42783. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  42784. stack[stack.length - 1] = tmpVar;
  42785. stack.push(tmpVar);
  42786. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  42787. break;
  42788. case "roll":
  42789. if (stack.length < 2) {
  42790. return null;
  42791. }
  42792. num2 = stack.pop();
  42793. num1 = stack.pop();
  42794. if (num2.type !== "literal" || num1.type !== "literal") {
  42795. return null;
  42796. }
  42797. j = num2.number;
  42798. n = num1.number;
  42799. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  42800. return null;
  42801. }
  42802. j = (j % n + n) % n;
  42803. if (j === 0) {
  42804. break;
  42805. }
  42806. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  42807. break;
  42808. default:
  42809. return null;
  42810. }
  42811. }
  42812. if (stack.length !== outputSize) {
  42813. return null;
  42814. }
  42815. var result = [];
  42816. instructions.forEach(function (instruction) {
  42817. var statementBuilder = new ExpressionBuilderVisitor();
  42818. instruction.visit(statementBuilder);
  42819. result.push(statementBuilder.toString());
  42820. });
  42821. stack.forEach(function (expr, i) {
  42822. var statementBuilder = new ExpressionBuilderVisitor();
  42823. expr.visit(statementBuilder);
  42824. var min = range[i * 2],
  42825. max = range[i * 2 + 1];
  42826. var out = [statementBuilder.toString()];
  42827. if (min > expr.min) {
  42828. out.unshift("Math.max(", min, ", ");
  42829. out.push(")");
  42830. }
  42831. if (max < expr.max) {
  42832. out.unshift("Math.min(", max, ", ");
  42833. out.push(")");
  42834. }
  42835. out.unshift("dest[destOffset + ", i, "] = ");
  42836. out.push(";");
  42837. result.push(out.join(""));
  42838. });
  42839. return result.join("\n");
  42840. }
  42841. }
  42842. return PostScriptCompiler;
  42843. }();
  42844. exports.PostScriptCompiler = PostScriptCompiler;
  42845. /***/ }),
  42846. /* 42 */
  42847. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42848. Object.defineProperty(exports, "__esModule", ({
  42849. value: true
  42850. }));
  42851. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  42852. var _util = __w_pdfjs_require__(2);
  42853. var _primitives = __w_pdfjs_require__(5);
  42854. var _core_utils = __w_pdfjs_require__(8);
  42855. class PostScriptParser {
  42856. constructor(lexer) {
  42857. this.lexer = lexer;
  42858. this.operators = [];
  42859. this.token = null;
  42860. this.prev = null;
  42861. }
  42862. nextToken() {
  42863. this.prev = this.token;
  42864. this.token = this.lexer.getToken();
  42865. }
  42866. accept(type) {
  42867. if (this.token.type === type) {
  42868. this.nextToken();
  42869. return true;
  42870. }
  42871. return false;
  42872. }
  42873. expect(type) {
  42874. if (this.accept(type)) {
  42875. return true;
  42876. }
  42877. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  42878. }
  42879. parse() {
  42880. this.nextToken();
  42881. this.expect(PostScriptTokenTypes.LBRACE);
  42882. this.parseBlock();
  42883. this.expect(PostScriptTokenTypes.RBRACE);
  42884. return this.operators;
  42885. }
  42886. parseBlock() {
  42887. while (true) {
  42888. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  42889. this.operators.push(this.prev.value);
  42890. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  42891. this.operators.push(this.prev.value);
  42892. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  42893. this.parseCondition();
  42894. } else {
  42895. return;
  42896. }
  42897. }
  42898. }
  42899. parseCondition() {
  42900. const conditionLocation = this.operators.length;
  42901. this.operators.push(null, null);
  42902. this.parseBlock();
  42903. this.expect(PostScriptTokenTypes.RBRACE);
  42904. if (this.accept(PostScriptTokenTypes.IF)) {
  42905. this.operators[conditionLocation] = this.operators.length;
  42906. this.operators[conditionLocation + 1] = "jz";
  42907. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  42908. const jumpLocation = this.operators.length;
  42909. this.operators.push(null, null);
  42910. const endOfTrue = this.operators.length;
  42911. this.parseBlock();
  42912. this.expect(PostScriptTokenTypes.RBRACE);
  42913. this.expect(PostScriptTokenTypes.IFELSE);
  42914. this.operators[jumpLocation] = this.operators.length;
  42915. this.operators[jumpLocation + 1] = "j";
  42916. this.operators[conditionLocation] = endOfTrue;
  42917. this.operators[conditionLocation + 1] = "jz";
  42918. } else {
  42919. throw new _util.FormatError("PS Function: error parsing conditional.");
  42920. }
  42921. }
  42922. }
  42923. exports.PostScriptParser = PostScriptParser;
  42924. const PostScriptTokenTypes = {
  42925. LBRACE: 0,
  42926. RBRACE: 1,
  42927. NUMBER: 2,
  42928. OPERATOR: 3,
  42929. IF: 4,
  42930. IFELSE: 5
  42931. };
  42932. const PostScriptToken = function PostScriptTokenClosure() {
  42933. const opCache = Object.create(null);
  42934. class PostScriptToken {
  42935. constructor(type, value) {
  42936. this.type = type;
  42937. this.value = value;
  42938. }
  42939. static getOperator(op) {
  42940. const opValue = opCache[op];
  42941. if (opValue) {
  42942. return opValue;
  42943. }
  42944. return opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  42945. }
  42946. static get LBRACE() {
  42947. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  42948. }
  42949. static get RBRACE() {
  42950. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  42951. }
  42952. static get IF() {
  42953. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  42954. }
  42955. static get IFELSE() {
  42956. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  42957. }
  42958. }
  42959. return PostScriptToken;
  42960. }();
  42961. class PostScriptLexer {
  42962. constructor(stream) {
  42963. this.stream = stream;
  42964. this.nextChar();
  42965. this.strBuf = [];
  42966. }
  42967. nextChar() {
  42968. return this.currentChar = this.stream.getByte();
  42969. }
  42970. getToken() {
  42971. let comment = false;
  42972. let ch = this.currentChar;
  42973. while (true) {
  42974. if (ch < 0) {
  42975. return _primitives.EOF;
  42976. }
  42977. if (comment) {
  42978. if (ch === 0x0a || ch === 0x0d) {
  42979. comment = false;
  42980. }
  42981. } else if (ch === 0x25) {
  42982. comment = true;
  42983. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  42984. break;
  42985. }
  42986. ch = this.nextChar();
  42987. }
  42988. switch (ch | 0) {
  42989. case 0x30:
  42990. case 0x31:
  42991. case 0x32:
  42992. case 0x33:
  42993. case 0x34:
  42994. case 0x35:
  42995. case 0x36:
  42996. case 0x37:
  42997. case 0x38:
  42998. case 0x39:
  42999. case 0x2b:
  43000. case 0x2d:
  43001. case 0x2e:
  43002. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  43003. case 0x7b:
  43004. this.nextChar();
  43005. return PostScriptToken.LBRACE;
  43006. case 0x7d:
  43007. this.nextChar();
  43008. return PostScriptToken.RBRACE;
  43009. }
  43010. const strBuf = this.strBuf;
  43011. strBuf.length = 0;
  43012. strBuf[0] = String.fromCharCode(ch);
  43013. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  43014. strBuf.push(String.fromCharCode(ch));
  43015. }
  43016. const str = strBuf.join("");
  43017. switch (str.toLowerCase()) {
  43018. case "if":
  43019. return PostScriptToken.IF;
  43020. case "ifelse":
  43021. return PostScriptToken.IFELSE;
  43022. default:
  43023. return PostScriptToken.getOperator(str);
  43024. }
  43025. }
  43026. getNumber() {
  43027. let ch = this.currentChar;
  43028. const strBuf = this.strBuf;
  43029. strBuf.length = 0;
  43030. strBuf[0] = String.fromCharCode(ch);
  43031. while ((ch = this.nextChar()) >= 0) {
  43032. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  43033. strBuf.push(String.fromCharCode(ch));
  43034. } else {
  43035. break;
  43036. }
  43037. }
  43038. const value = parseFloat(strBuf.join(""));
  43039. if (isNaN(value)) {
  43040. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  43041. }
  43042. return value;
  43043. }
  43044. }
  43045. exports.PostScriptLexer = PostScriptLexer;
  43046. /***/ }),
  43047. /* 43 */
  43048. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43049. Object.defineProperty(exports, "__esModule", ({
  43050. value: true
  43051. }));
  43052. exports.bidi = bidi;
  43053. var _util = __w_pdfjs_require__(2);
  43054. 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"];
  43055. 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"];
  43056. function isOdd(i) {
  43057. return (i & 1) !== 0;
  43058. }
  43059. function isEven(i) {
  43060. return (i & 1) === 0;
  43061. }
  43062. function findUnequal(arr, start, value) {
  43063. for (var j = start, jj = arr.length; j < jj; ++j) {
  43064. if (arr[j] !== value) {
  43065. return j;
  43066. }
  43067. }
  43068. return j;
  43069. }
  43070. function setValues(arr, start, end, value) {
  43071. for (var j = start; j < end; ++j) {
  43072. arr[j] = value;
  43073. }
  43074. }
  43075. function reverseValues(arr, start, end) {
  43076. for (var i = start, j = end - 1; i < j; ++i, --j) {
  43077. var temp = arr[i];
  43078. arr[i] = arr[j];
  43079. arr[j] = temp;
  43080. }
  43081. }
  43082. function createBidiText(str, isLTR, vertical = false) {
  43083. let dir = "ltr";
  43084. if (vertical) {
  43085. dir = "ttb";
  43086. } else if (!isLTR) {
  43087. dir = "rtl";
  43088. }
  43089. return {
  43090. str,
  43091. dir
  43092. };
  43093. }
  43094. var chars = [];
  43095. var types = [];
  43096. function bidi(str, startLevel, vertical) {
  43097. var isLTR = true;
  43098. var strLength = str.length;
  43099. if (strLength === 0 || vertical) {
  43100. return createBidiText(str, isLTR, vertical);
  43101. }
  43102. chars.length = strLength;
  43103. types.length = strLength;
  43104. var numBidi = 0;
  43105. var i, ii;
  43106. for (i = 0; i < strLength; ++i) {
  43107. chars[i] = str.charAt(i);
  43108. var charCode = str.charCodeAt(i);
  43109. var charType = "L";
  43110. if (charCode <= 0x00ff) {
  43111. charType = baseTypes[charCode];
  43112. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  43113. charType = "R";
  43114. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  43115. charType = arabicTypes[charCode & 0xff];
  43116. if (!charType) {
  43117. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  43118. }
  43119. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  43120. charType = "AL";
  43121. }
  43122. if (charType === "R" || charType === "AL" || charType === "AN") {
  43123. numBidi++;
  43124. }
  43125. types[i] = charType;
  43126. }
  43127. if (numBidi === 0) {
  43128. isLTR = true;
  43129. return createBidiText(str, isLTR);
  43130. }
  43131. if (startLevel === -1) {
  43132. if (numBidi / strLength < 0.3) {
  43133. isLTR = true;
  43134. startLevel = 0;
  43135. } else {
  43136. isLTR = false;
  43137. startLevel = 1;
  43138. }
  43139. }
  43140. var levels = [];
  43141. for (i = 0; i < strLength; ++i) {
  43142. levels[i] = startLevel;
  43143. }
  43144. var e = isOdd(startLevel) ? "R" : "L";
  43145. var sor = e;
  43146. var eor = sor;
  43147. var lastType = sor;
  43148. for (i = 0; i < strLength; ++i) {
  43149. if (types[i] === "NSM") {
  43150. types[i] = lastType;
  43151. } else {
  43152. lastType = types[i];
  43153. }
  43154. }
  43155. lastType = sor;
  43156. var t;
  43157. for (i = 0; i < strLength; ++i) {
  43158. t = types[i];
  43159. if (t === "EN") {
  43160. types[i] = lastType === "AL" ? "AN" : "EN";
  43161. } else if (t === "R" || t === "L" || t === "AL") {
  43162. lastType = t;
  43163. }
  43164. }
  43165. for (i = 0; i < strLength; ++i) {
  43166. t = types[i];
  43167. if (t === "AL") {
  43168. types[i] = "R";
  43169. }
  43170. }
  43171. for (i = 1; i < strLength - 1; ++i) {
  43172. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  43173. types[i] = "EN";
  43174. }
  43175. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  43176. types[i] = types[i - 1];
  43177. }
  43178. }
  43179. for (i = 0; i < strLength; ++i) {
  43180. if (types[i] === "EN") {
  43181. var j;
  43182. for (j = i - 1; j >= 0; --j) {
  43183. if (types[j] !== "ET") {
  43184. break;
  43185. }
  43186. types[j] = "EN";
  43187. }
  43188. for (j = i + 1; j < strLength; ++j) {
  43189. if (types[j] !== "ET") {
  43190. break;
  43191. }
  43192. types[j] = "EN";
  43193. }
  43194. }
  43195. }
  43196. for (i = 0; i < strLength; ++i) {
  43197. t = types[i];
  43198. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  43199. types[i] = "ON";
  43200. }
  43201. }
  43202. lastType = sor;
  43203. for (i = 0; i < strLength; ++i) {
  43204. t = types[i];
  43205. if (t === "EN") {
  43206. types[i] = lastType === "L" ? "L" : "EN";
  43207. } else if (t === "R" || t === "L") {
  43208. lastType = t;
  43209. }
  43210. }
  43211. for (i = 0; i < strLength; ++i) {
  43212. if (types[i] === "ON") {
  43213. var end = findUnequal(types, i + 1, "ON");
  43214. var before = sor;
  43215. if (i > 0) {
  43216. before = types[i - 1];
  43217. }
  43218. var after = eor;
  43219. if (end + 1 < strLength) {
  43220. after = types[end + 1];
  43221. }
  43222. if (before !== "L") {
  43223. before = "R";
  43224. }
  43225. if (after !== "L") {
  43226. after = "R";
  43227. }
  43228. if (before === after) {
  43229. setValues(types, i, end, before);
  43230. }
  43231. i = end - 1;
  43232. }
  43233. }
  43234. for (i = 0; i < strLength; ++i) {
  43235. if (types[i] === "ON") {
  43236. types[i] = e;
  43237. }
  43238. }
  43239. for (i = 0; i < strLength; ++i) {
  43240. t = types[i];
  43241. if (isEven(levels[i])) {
  43242. if (t === "R") {
  43243. levels[i] += 1;
  43244. } else if (t === "AN" || t === "EN") {
  43245. levels[i] += 2;
  43246. }
  43247. } else {
  43248. if (t === "L" || t === "AN" || t === "EN") {
  43249. levels[i] += 1;
  43250. }
  43251. }
  43252. }
  43253. var highestLevel = -1;
  43254. var lowestOddLevel = 99;
  43255. var level;
  43256. for (i = 0, ii = levels.length; i < ii; ++i) {
  43257. level = levels[i];
  43258. if (highestLevel < level) {
  43259. highestLevel = level;
  43260. }
  43261. if (lowestOddLevel > level && isOdd(level)) {
  43262. lowestOddLevel = level;
  43263. }
  43264. }
  43265. for (level = highestLevel; level >= lowestOddLevel; --level) {
  43266. var start = -1;
  43267. for (i = 0, ii = levels.length; i < ii; ++i) {
  43268. if (levels[i] < level) {
  43269. if (start >= 0) {
  43270. reverseValues(chars, start, i);
  43271. start = -1;
  43272. }
  43273. } else if (start < 0) {
  43274. start = i;
  43275. }
  43276. }
  43277. if (start >= 0) {
  43278. reverseValues(chars, start, levels.length);
  43279. }
  43280. }
  43281. for (i = 0, ii = chars.length; i < ii; ++i) {
  43282. var ch = chars[i];
  43283. if (ch === "<" || ch === ">") {
  43284. chars[i] = "";
  43285. }
  43286. }
  43287. return createBidiText(chars.join(""), isLTR);
  43288. }
  43289. /***/ }),
  43290. /* 44 */
  43291. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43292. Object.defineProperty(exports, "__esModule", ({
  43293. value: true
  43294. }));
  43295. exports.getMetrics = void 0;
  43296. var _core_utils = __w_pdfjs_require__(8);
  43297. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  43298. t.Courier = 600;
  43299. t["Courier-Bold"] = 600;
  43300. t["Courier-BoldOblique"] = 600;
  43301. t["Courier-Oblique"] = 600;
  43302. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  43303. t.space = 278;
  43304. t.exclam = 278;
  43305. t.quotedbl = 355;
  43306. t.numbersign = 556;
  43307. t.dollar = 556;
  43308. t.percent = 889;
  43309. t.ampersand = 667;
  43310. t.quoteright = 222;
  43311. t.parenleft = 333;
  43312. t.parenright = 333;
  43313. t.asterisk = 389;
  43314. t.plus = 584;
  43315. t.comma = 278;
  43316. t.hyphen = 333;
  43317. t.period = 278;
  43318. t.slash = 278;
  43319. t.zero = 556;
  43320. t.one = 556;
  43321. t.two = 556;
  43322. t.three = 556;
  43323. t.four = 556;
  43324. t.five = 556;
  43325. t.six = 556;
  43326. t.seven = 556;
  43327. t.eight = 556;
  43328. t.nine = 556;
  43329. t.colon = 278;
  43330. t.semicolon = 278;
  43331. t.less = 584;
  43332. t.equal = 584;
  43333. t.greater = 584;
  43334. t.question = 556;
  43335. t.at = 1015;
  43336. t.A = 667;
  43337. t.B = 667;
  43338. t.C = 722;
  43339. t.D = 722;
  43340. t.E = 667;
  43341. t.F = 611;
  43342. t.G = 778;
  43343. t.H = 722;
  43344. t.I = 278;
  43345. t.J = 500;
  43346. t.K = 667;
  43347. t.L = 556;
  43348. t.M = 833;
  43349. t.N = 722;
  43350. t.O = 778;
  43351. t.P = 667;
  43352. t.Q = 778;
  43353. t.R = 722;
  43354. t.S = 667;
  43355. t.T = 611;
  43356. t.U = 722;
  43357. t.V = 667;
  43358. t.W = 944;
  43359. t.X = 667;
  43360. t.Y = 667;
  43361. t.Z = 611;
  43362. t.bracketleft = 278;
  43363. t.backslash = 278;
  43364. t.bracketright = 278;
  43365. t.asciicircum = 469;
  43366. t.underscore = 556;
  43367. t.quoteleft = 222;
  43368. t.a = 556;
  43369. t.b = 556;
  43370. t.c = 500;
  43371. t.d = 556;
  43372. t.e = 556;
  43373. t.f = 278;
  43374. t.g = 556;
  43375. t.h = 556;
  43376. t.i = 222;
  43377. t.j = 222;
  43378. t.k = 500;
  43379. t.l = 222;
  43380. t.m = 833;
  43381. t.n = 556;
  43382. t.o = 556;
  43383. t.p = 556;
  43384. t.q = 556;
  43385. t.r = 333;
  43386. t.s = 500;
  43387. t.t = 278;
  43388. t.u = 556;
  43389. t.v = 500;
  43390. t.w = 722;
  43391. t.x = 500;
  43392. t.y = 500;
  43393. t.z = 500;
  43394. t.braceleft = 334;
  43395. t.bar = 260;
  43396. t.braceright = 334;
  43397. t.asciitilde = 584;
  43398. t.exclamdown = 333;
  43399. t.cent = 556;
  43400. t.sterling = 556;
  43401. t.fraction = 167;
  43402. t.yen = 556;
  43403. t.florin = 556;
  43404. t.section = 556;
  43405. t.currency = 556;
  43406. t.quotesingle = 191;
  43407. t.quotedblleft = 333;
  43408. t.guillemotleft = 556;
  43409. t.guilsinglleft = 333;
  43410. t.guilsinglright = 333;
  43411. t.fi = 500;
  43412. t.fl = 500;
  43413. t.endash = 556;
  43414. t.dagger = 556;
  43415. t.daggerdbl = 556;
  43416. t.periodcentered = 278;
  43417. t.paragraph = 537;
  43418. t.bullet = 350;
  43419. t.quotesinglbase = 222;
  43420. t.quotedblbase = 333;
  43421. t.quotedblright = 333;
  43422. t.guillemotright = 556;
  43423. t.ellipsis = 1000;
  43424. t.perthousand = 1000;
  43425. t.questiondown = 611;
  43426. t.grave = 333;
  43427. t.acute = 333;
  43428. t.circumflex = 333;
  43429. t.tilde = 333;
  43430. t.macron = 333;
  43431. t.breve = 333;
  43432. t.dotaccent = 333;
  43433. t.dieresis = 333;
  43434. t.ring = 333;
  43435. t.cedilla = 333;
  43436. t.hungarumlaut = 333;
  43437. t.ogonek = 333;
  43438. t.caron = 333;
  43439. t.emdash = 1000;
  43440. t.AE = 1000;
  43441. t.ordfeminine = 370;
  43442. t.Lslash = 556;
  43443. t.Oslash = 778;
  43444. t.OE = 1000;
  43445. t.ordmasculine = 365;
  43446. t.ae = 889;
  43447. t.dotlessi = 278;
  43448. t.lslash = 222;
  43449. t.oslash = 611;
  43450. t.oe = 944;
  43451. t.germandbls = 611;
  43452. t.Idieresis = 278;
  43453. t.eacute = 556;
  43454. t.abreve = 556;
  43455. t.uhungarumlaut = 556;
  43456. t.ecaron = 556;
  43457. t.Ydieresis = 667;
  43458. t.divide = 584;
  43459. t.Yacute = 667;
  43460. t.Acircumflex = 667;
  43461. t.aacute = 556;
  43462. t.Ucircumflex = 722;
  43463. t.yacute = 500;
  43464. t.scommaaccent = 500;
  43465. t.ecircumflex = 556;
  43466. t.Uring = 722;
  43467. t.Udieresis = 722;
  43468. t.aogonek = 556;
  43469. t.Uacute = 722;
  43470. t.uogonek = 556;
  43471. t.Edieresis = 667;
  43472. t.Dcroat = 722;
  43473. t.commaaccent = 250;
  43474. t.copyright = 737;
  43475. t.Emacron = 667;
  43476. t.ccaron = 500;
  43477. t.aring = 556;
  43478. t.Ncommaaccent = 722;
  43479. t.lacute = 222;
  43480. t.agrave = 556;
  43481. t.Tcommaaccent = 611;
  43482. t.Cacute = 722;
  43483. t.atilde = 556;
  43484. t.Edotaccent = 667;
  43485. t.scaron = 500;
  43486. t.scedilla = 500;
  43487. t.iacute = 278;
  43488. t.lozenge = 471;
  43489. t.Rcaron = 722;
  43490. t.Gcommaaccent = 778;
  43491. t.ucircumflex = 556;
  43492. t.acircumflex = 556;
  43493. t.Amacron = 667;
  43494. t.rcaron = 333;
  43495. t.ccedilla = 500;
  43496. t.Zdotaccent = 611;
  43497. t.Thorn = 667;
  43498. t.Omacron = 778;
  43499. t.Racute = 722;
  43500. t.Sacute = 667;
  43501. t.dcaron = 643;
  43502. t.Umacron = 722;
  43503. t.uring = 556;
  43504. t.threesuperior = 333;
  43505. t.Ograve = 778;
  43506. t.Agrave = 667;
  43507. t.Abreve = 667;
  43508. t.multiply = 584;
  43509. t.uacute = 556;
  43510. t.Tcaron = 611;
  43511. t.partialdiff = 476;
  43512. t.ydieresis = 500;
  43513. t.Nacute = 722;
  43514. t.icircumflex = 278;
  43515. t.Ecircumflex = 667;
  43516. t.adieresis = 556;
  43517. t.edieresis = 556;
  43518. t.cacute = 500;
  43519. t.nacute = 556;
  43520. t.umacron = 556;
  43521. t.Ncaron = 722;
  43522. t.Iacute = 278;
  43523. t.plusminus = 584;
  43524. t.brokenbar = 260;
  43525. t.registered = 737;
  43526. t.Gbreve = 778;
  43527. t.Idotaccent = 278;
  43528. t.summation = 600;
  43529. t.Egrave = 667;
  43530. t.racute = 333;
  43531. t.omacron = 556;
  43532. t.Zacute = 611;
  43533. t.Zcaron = 611;
  43534. t.greaterequal = 549;
  43535. t.Eth = 722;
  43536. t.Ccedilla = 722;
  43537. t.lcommaaccent = 222;
  43538. t.tcaron = 317;
  43539. t.eogonek = 556;
  43540. t.Uogonek = 722;
  43541. t.Aacute = 667;
  43542. t.Adieresis = 667;
  43543. t.egrave = 556;
  43544. t.zacute = 500;
  43545. t.iogonek = 222;
  43546. t.Oacute = 778;
  43547. t.oacute = 556;
  43548. t.amacron = 556;
  43549. t.sacute = 500;
  43550. t.idieresis = 278;
  43551. t.Ocircumflex = 778;
  43552. t.Ugrave = 722;
  43553. t.Delta = 612;
  43554. t.thorn = 556;
  43555. t.twosuperior = 333;
  43556. t.Odieresis = 778;
  43557. t.mu = 556;
  43558. t.igrave = 278;
  43559. t.ohungarumlaut = 556;
  43560. t.Eogonek = 667;
  43561. t.dcroat = 556;
  43562. t.threequarters = 834;
  43563. t.Scedilla = 667;
  43564. t.lcaron = 299;
  43565. t.Kcommaaccent = 667;
  43566. t.Lacute = 556;
  43567. t.trademark = 1000;
  43568. t.edotaccent = 556;
  43569. t.Igrave = 278;
  43570. t.Imacron = 278;
  43571. t.Lcaron = 556;
  43572. t.onehalf = 834;
  43573. t.lessequal = 549;
  43574. t.ocircumflex = 556;
  43575. t.ntilde = 556;
  43576. t.Uhungarumlaut = 722;
  43577. t.Eacute = 667;
  43578. t.emacron = 556;
  43579. t.gbreve = 556;
  43580. t.onequarter = 834;
  43581. t.Scaron = 667;
  43582. t.Scommaaccent = 667;
  43583. t.Ohungarumlaut = 778;
  43584. t.degree = 400;
  43585. t.ograve = 556;
  43586. t.Ccaron = 722;
  43587. t.ugrave = 556;
  43588. t.radical = 453;
  43589. t.Dcaron = 722;
  43590. t.rcommaaccent = 333;
  43591. t.Ntilde = 722;
  43592. t.otilde = 556;
  43593. t.Rcommaaccent = 722;
  43594. t.Lcommaaccent = 556;
  43595. t.Atilde = 667;
  43596. t.Aogonek = 667;
  43597. t.Aring = 667;
  43598. t.Otilde = 778;
  43599. t.zdotaccent = 500;
  43600. t.Ecaron = 667;
  43601. t.Iogonek = 278;
  43602. t.kcommaaccent = 500;
  43603. t.minus = 584;
  43604. t.Icircumflex = 278;
  43605. t.ncaron = 556;
  43606. t.tcommaaccent = 278;
  43607. t.logicalnot = 584;
  43608. t.odieresis = 556;
  43609. t.udieresis = 556;
  43610. t.notequal = 549;
  43611. t.gcommaaccent = 556;
  43612. t.eth = 556;
  43613. t.zcaron = 500;
  43614. t.ncommaaccent = 556;
  43615. t.onesuperior = 333;
  43616. t.imacron = 278;
  43617. t.Euro = 556;
  43618. });
  43619. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43620. t.space = 278;
  43621. t.exclam = 333;
  43622. t.quotedbl = 474;
  43623. t.numbersign = 556;
  43624. t.dollar = 556;
  43625. t.percent = 889;
  43626. t.ampersand = 722;
  43627. t.quoteright = 278;
  43628. t.parenleft = 333;
  43629. t.parenright = 333;
  43630. t.asterisk = 389;
  43631. t.plus = 584;
  43632. t.comma = 278;
  43633. t.hyphen = 333;
  43634. t.period = 278;
  43635. t.slash = 278;
  43636. t.zero = 556;
  43637. t.one = 556;
  43638. t.two = 556;
  43639. t.three = 556;
  43640. t.four = 556;
  43641. t.five = 556;
  43642. t.six = 556;
  43643. t.seven = 556;
  43644. t.eight = 556;
  43645. t.nine = 556;
  43646. t.colon = 333;
  43647. t.semicolon = 333;
  43648. t.less = 584;
  43649. t.equal = 584;
  43650. t.greater = 584;
  43651. t.question = 611;
  43652. t.at = 975;
  43653. t.A = 722;
  43654. t.B = 722;
  43655. t.C = 722;
  43656. t.D = 722;
  43657. t.E = 667;
  43658. t.F = 611;
  43659. t.G = 778;
  43660. t.H = 722;
  43661. t.I = 278;
  43662. t.J = 556;
  43663. t.K = 722;
  43664. t.L = 611;
  43665. t.M = 833;
  43666. t.N = 722;
  43667. t.O = 778;
  43668. t.P = 667;
  43669. t.Q = 778;
  43670. t.R = 722;
  43671. t.S = 667;
  43672. t.T = 611;
  43673. t.U = 722;
  43674. t.V = 667;
  43675. t.W = 944;
  43676. t.X = 667;
  43677. t.Y = 667;
  43678. t.Z = 611;
  43679. t.bracketleft = 333;
  43680. t.backslash = 278;
  43681. t.bracketright = 333;
  43682. t.asciicircum = 584;
  43683. t.underscore = 556;
  43684. t.quoteleft = 278;
  43685. t.a = 556;
  43686. t.b = 611;
  43687. t.c = 556;
  43688. t.d = 611;
  43689. t.e = 556;
  43690. t.f = 333;
  43691. t.g = 611;
  43692. t.h = 611;
  43693. t.i = 278;
  43694. t.j = 278;
  43695. t.k = 556;
  43696. t.l = 278;
  43697. t.m = 889;
  43698. t.n = 611;
  43699. t.o = 611;
  43700. t.p = 611;
  43701. t.q = 611;
  43702. t.r = 389;
  43703. t.s = 556;
  43704. t.t = 333;
  43705. t.u = 611;
  43706. t.v = 556;
  43707. t.w = 778;
  43708. t.x = 556;
  43709. t.y = 556;
  43710. t.z = 500;
  43711. t.braceleft = 389;
  43712. t.bar = 280;
  43713. t.braceright = 389;
  43714. t.asciitilde = 584;
  43715. t.exclamdown = 333;
  43716. t.cent = 556;
  43717. t.sterling = 556;
  43718. t.fraction = 167;
  43719. t.yen = 556;
  43720. t.florin = 556;
  43721. t.section = 556;
  43722. t.currency = 556;
  43723. t.quotesingle = 238;
  43724. t.quotedblleft = 500;
  43725. t.guillemotleft = 556;
  43726. t.guilsinglleft = 333;
  43727. t.guilsinglright = 333;
  43728. t.fi = 611;
  43729. t.fl = 611;
  43730. t.endash = 556;
  43731. t.dagger = 556;
  43732. t.daggerdbl = 556;
  43733. t.periodcentered = 278;
  43734. t.paragraph = 556;
  43735. t.bullet = 350;
  43736. t.quotesinglbase = 278;
  43737. t.quotedblbase = 500;
  43738. t.quotedblright = 500;
  43739. t.guillemotright = 556;
  43740. t.ellipsis = 1000;
  43741. t.perthousand = 1000;
  43742. t.questiondown = 611;
  43743. t.grave = 333;
  43744. t.acute = 333;
  43745. t.circumflex = 333;
  43746. t.tilde = 333;
  43747. t.macron = 333;
  43748. t.breve = 333;
  43749. t.dotaccent = 333;
  43750. t.dieresis = 333;
  43751. t.ring = 333;
  43752. t.cedilla = 333;
  43753. t.hungarumlaut = 333;
  43754. t.ogonek = 333;
  43755. t.caron = 333;
  43756. t.emdash = 1000;
  43757. t.AE = 1000;
  43758. t.ordfeminine = 370;
  43759. t.Lslash = 611;
  43760. t.Oslash = 778;
  43761. t.OE = 1000;
  43762. t.ordmasculine = 365;
  43763. t.ae = 889;
  43764. t.dotlessi = 278;
  43765. t.lslash = 278;
  43766. t.oslash = 611;
  43767. t.oe = 944;
  43768. t.germandbls = 611;
  43769. t.Idieresis = 278;
  43770. t.eacute = 556;
  43771. t.abreve = 556;
  43772. t.uhungarumlaut = 611;
  43773. t.ecaron = 556;
  43774. t.Ydieresis = 667;
  43775. t.divide = 584;
  43776. t.Yacute = 667;
  43777. t.Acircumflex = 722;
  43778. t.aacute = 556;
  43779. t.Ucircumflex = 722;
  43780. t.yacute = 556;
  43781. t.scommaaccent = 556;
  43782. t.ecircumflex = 556;
  43783. t.Uring = 722;
  43784. t.Udieresis = 722;
  43785. t.aogonek = 556;
  43786. t.Uacute = 722;
  43787. t.uogonek = 611;
  43788. t.Edieresis = 667;
  43789. t.Dcroat = 722;
  43790. t.commaaccent = 250;
  43791. t.copyright = 737;
  43792. t.Emacron = 667;
  43793. t.ccaron = 556;
  43794. t.aring = 556;
  43795. t.Ncommaaccent = 722;
  43796. t.lacute = 278;
  43797. t.agrave = 556;
  43798. t.Tcommaaccent = 611;
  43799. t.Cacute = 722;
  43800. t.atilde = 556;
  43801. t.Edotaccent = 667;
  43802. t.scaron = 556;
  43803. t.scedilla = 556;
  43804. t.iacute = 278;
  43805. t.lozenge = 494;
  43806. t.Rcaron = 722;
  43807. t.Gcommaaccent = 778;
  43808. t.ucircumflex = 611;
  43809. t.acircumflex = 556;
  43810. t.Amacron = 722;
  43811. t.rcaron = 389;
  43812. t.ccedilla = 556;
  43813. t.Zdotaccent = 611;
  43814. t.Thorn = 667;
  43815. t.Omacron = 778;
  43816. t.Racute = 722;
  43817. t.Sacute = 667;
  43818. t.dcaron = 743;
  43819. t.Umacron = 722;
  43820. t.uring = 611;
  43821. t.threesuperior = 333;
  43822. t.Ograve = 778;
  43823. t.Agrave = 722;
  43824. t.Abreve = 722;
  43825. t.multiply = 584;
  43826. t.uacute = 611;
  43827. t.Tcaron = 611;
  43828. t.partialdiff = 494;
  43829. t.ydieresis = 556;
  43830. t.Nacute = 722;
  43831. t.icircumflex = 278;
  43832. t.Ecircumflex = 667;
  43833. t.adieresis = 556;
  43834. t.edieresis = 556;
  43835. t.cacute = 556;
  43836. t.nacute = 611;
  43837. t.umacron = 611;
  43838. t.Ncaron = 722;
  43839. t.Iacute = 278;
  43840. t.plusminus = 584;
  43841. t.brokenbar = 280;
  43842. t.registered = 737;
  43843. t.Gbreve = 778;
  43844. t.Idotaccent = 278;
  43845. t.summation = 600;
  43846. t.Egrave = 667;
  43847. t.racute = 389;
  43848. t.omacron = 611;
  43849. t.Zacute = 611;
  43850. t.Zcaron = 611;
  43851. t.greaterequal = 549;
  43852. t.Eth = 722;
  43853. t.Ccedilla = 722;
  43854. t.lcommaaccent = 278;
  43855. t.tcaron = 389;
  43856. t.eogonek = 556;
  43857. t.Uogonek = 722;
  43858. t.Aacute = 722;
  43859. t.Adieresis = 722;
  43860. t.egrave = 556;
  43861. t.zacute = 500;
  43862. t.iogonek = 278;
  43863. t.Oacute = 778;
  43864. t.oacute = 611;
  43865. t.amacron = 556;
  43866. t.sacute = 556;
  43867. t.idieresis = 278;
  43868. t.Ocircumflex = 778;
  43869. t.Ugrave = 722;
  43870. t.Delta = 612;
  43871. t.thorn = 611;
  43872. t.twosuperior = 333;
  43873. t.Odieresis = 778;
  43874. t.mu = 611;
  43875. t.igrave = 278;
  43876. t.ohungarumlaut = 611;
  43877. t.Eogonek = 667;
  43878. t.dcroat = 611;
  43879. t.threequarters = 834;
  43880. t.Scedilla = 667;
  43881. t.lcaron = 400;
  43882. t.Kcommaaccent = 722;
  43883. t.Lacute = 611;
  43884. t.trademark = 1000;
  43885. t.edotaccent = 556;
  43886. t.Igrave = 278;
  43887. t.Imacron = 278;
  43888. t.Lcaron = 611;
  43889. t.onehalf = 834;
  43890. t.lessequal = 549;
  43891. t.ocircumflex = 611;
  43892. t.ntilde = 611;
  43893. t.Uhungarumlaut = 722;
  43894. t.Eacute = 667;
  43895. t.emacron = 556;
  43896. t.gbreve = 611;
  43897. t.onequarter = 834;
  43898. t.Scaron = 667;
  43899. t.Scommaaccent = 667;
  43900. t.Ohungarumlaut = 778;
  43901. t.degree = 400;
  43902. t.ograve = 611;
  43903. t.Ccaron = 722;
  43904. t.ugrave = 611;
  43905. t.radical = 549;
  43906. t.Dcaron = 722;
  43907. t.rcommaaccent = 389;
  43908. t.Ntilde = 722;
  43909. t.otilde = 611;
  43910. t.Rcommaaccent = 722;
  43911. t.Lcommaaccent = 611;
  43912. t.Atilde = 722;
  43913. t.Aogonek = 722;
  43914. t.Aring = 722;
  43915. t.Otilde = 778;
  43916. t.zdotaccent = 500;
  43917. t.Ecaron = 667;
  43918. t.Iogonek = 278;
  43919. t.kcommaaccent = 556;
  43920. t.minus = 584;
  43921. t.Icircumflex = 278;
  43922. t.ncaron = 611;
  43923. t.tcommaaccent = 333;
  43924. t.logicalnot = 584;
  43925. t.odieresis = 611;
  43926. t.udieresis = 611;
  43927. t.notequal = 549;
  43928. t.gcommaaccent = 611;
  43929. t.eth = 611;
  43930. t.zcaron = 500;
  43931. t.ncommaaccent = 611;
  43932. t.onesuperior = 333;
  43933. t.imacron = 278;
  43934. t.Euro = 556;
  43935. });
  43936. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43937. t.space = 278;
  43938. t.exclam = 333;
  43939. t.quotedbl = 474;
  43940. t.numbersign = 556;
  43941. t.dollar = 556;
  43942. t.percent = 889;
  43943. t.ampersand = 722;
  43944. t.quoteright = 278;
  43945. t.parenleft = 333;
  43946. t.parenright = 333;
  43947. t.asterisk = 389;
  43948. t.plus = 584;
  43949. t.comma = 278;
  43950. t.hyphen = 333;
  43951. t.period = 278;
  43952. t.slash = 278;
  43953. t.zero = 556;
  43954. t.one = 556;
  43955. t.two = 556;
  43956. t.three = 556;
  43957. t.four = 556;
  43958. t.five = 556;
  43959. t.six = 556;
  43960. t.seven = 556;
  43961. t.eight = 556;
  43962. t.nine = 556;
  43963. t.colon = 333;
  43964. t.semicolon = 333;
  43965. t.less = 584;
  43966. t.equal = 584;
  43967. t.greater = 584;
  43968. t.question = 611;
  43969. t.at = 975;
  43970. t.A = 722;
  43971. t.B = 722;
  43972. t.C = 722;
  43973. t.D = 722;
  43974. t.E = 667;
  43975. t.F = 611;
  43976. t.G = 778;
  43977. t.H = 722;
  43978. t.I = 278;
  43979. t.J = 556;
  43980. t.K = 722;
  43981. t.L = 611;
  43982. t.M = 833;
  43983. t.N = 722;
  43984. t.O = 778;
  43985. t.P = 667;
  43986. t.Q = 778;
  43987. t.R = 722;
  43988. t.S = 667;
  43989. t.T = 611;
  43990. t.U = 722;
  43991. t.V = 667;
  43992. t.W = 944;
  43993. t.X = 667;
  43994. t.Y = 667;
  43995. t.Z = 611;
  43996. t.bracketleft = 333;
  43997. t.backslash = 278;
  43998. t.bracketright = 333;
  43999. t.asciicircum = 584;
  44000. t.underscore = 556;
  44001. t.quoteleft = 278;
  44002. t.a = 556;
  44003. t.b = 611;
  44004. t.c = 556;
  44005. t.d = 611;
  44006. t.e = 556;
  44007. t.f = 333;
  44008. t.g = 611;
  44009. t.h = 611;
  44010. t.i = 278;
  44011. t.j = 278;
  44012. t.k = 556;
  44013. t.l = 278;
  44014. t.m = 889;
  44015. t.n = 611;
  44016. t.o = 611;
  44017. t.p = 611;
  44018. t.q = 611;
  44019. t.r = 389;
  44020. t.s = 556;
  44021. t.t = 333;
  44022. t.u = 611;
  44023. t.v = 556;
  44024. t.w = 778;
  44025. t.x = 556;
  44026. t.y = 556;
  44027. t.z = 500;
  44028. t.braceleft = 389;
  44029. t.bar = 280;
  44030. t.braceright = 389;
  44031. t.asciitilde = 584;
  44032. t.exclamdown = 333;
  44033. t.cent = 556;
  44034. t.sterling = 556;
  44035. t.fraction = 167;
  44036. t.yen = 556;
  44037. t.florin = 556;
  44038. t.section = 556;
  44039. t.currency = 556;
  44040. t.quotesingle = 238;
  44041. t.quotedblleft = 500;
  44042. t.guillemotleft = 556;
  44043. t.guilsinglleft = 333;
  44044. t.guilsinglright = 333;
  44045. t.fi = 611;
  44046. t.fl = 611;
  44047. t.endash = 556;
  44048. t.dagger = 556;
  44049. t.daggerdbl = 556;
  44050. t.periodcentered = 278;
  44051. t.paragraph = 556;
  44052. t.bullet = 350;
  44053. t.quotesinglbase = 278;
  44054. t.quotedblbase = 500;
  44055. t.quotedblright = 500;
  44056. t.guillemotright = 556;
  44057. t.ellipsis = 1000;
  44058. t.perthousand = 1000;
  44059. t.questiondown = 611;
  44060. t.grave = 333;
  44061. t.acute = 333;
  44062. t.circumflex = 333;
  44063. t.tilde = 333;
  44064. t.macron = 333;
  44065. t.breve = 333;
  44066. t.dotaccent = 333;
  44067. t.dieresis = 333;
  44068. t.ring = 333;
  44069. t.cedilla = 333;
  44070. t.hungarumlaut = 333;
  44071. t.ogonek = 333;
  44072. t.caron = 333;
  44073. t.emdash = 1000;
  44074. t.AE = 1000;
  44075. t.ordfeminine = 370;
  44076. t.Lslash = 611;
  44077. t.Oslash = 778;
  44078. t.OE = 1000;
  44079. t.ordmasculine = 365;
  44080. t.ae = 889;
  44081. t.dotlessi = 278;
  44082. t.lslash = 278;
  44083. t.oslash = 611;
  44084. t.oe = 944;
  44085. t.germandbls = 611;
  44086. t.Idieresis = 278;
  44087. t.eacute = 556;
  44088. t.abreve = 556;
  44089. t.uhungarumlaut = 611;
  44090. t.ecaron = 556;
  44091. t.Ydieresis = 667;
  44092. t.divide = 584;
  44093. t.Yacute = 667;
  44094. t.Acircumflex = 722;
  44095. t.aacute = 556;
  44096. t.Ucircumflex = 722;
  44097. t.yacute = 556;
  44098. t.scommaaccent = 556;
  44099. t.ecircumflex = 556;
  44100. t.Uring = 722;
  44101. t.Udieresis = 722;
  44102. t.aogonek = 556;
  44103. t.Uacute = 722;
  44104. t.uogonek = 611;
  44105. t.Edieresis = 667;
  44106. t.Dcroat = 722;
  44107. t.commaaccent = 250;
  44108. t.copyright = 737;
  44109. t.Emacron = 667;
  44110. t.ccaron = 556;
  44111. t.aring = 556;
  44112. t.Ncommaaccent = 722;
  44113. t.lacute = 278;
  44114. t.agrave = 556;
  44115. t.Tcommaaccent = 611;
  44116. t.Cacute = 722;
  44117. t.atilde = 556;
  44118. t.Edotaccent = 667;
  44119. t.scaron = 556;
  44120. t.scedilla = 556;
  44121. t.iacute = 278;
  44122. t.lozenge = 494;
  44123. t.Rcaron = 722;
  44124. t.Gcommaaccent = 778;
  44125. t.ucircumflex = 611;
  44126. t.acircumflex = 556;
  44127. t.Amacron = 722;
  44128. t.rcaron = 389;
  44129. t.ccedilla = 556;
  44130. t.Zdotaccent = 611;
  44131. t.Thorn = 667;
  44132. t.Omacron = 778;
  44133. t.Racute = 722;
  44134. t.Sacute = 667;
  44135. t.dcaron = 743;
  44136. t.Umacron = 722;
  44137. t.uring = 611;
  44138. t.threesuperior = 333;
  44139. t.Ograve = 778;
  44140. t.Agrave = 722;
  44141. t.Abreve = 722;
  44142. t.multiply = 584;
  44143. t.uacute = 611;
  44144. t.Tcaron = 611;
  44145. t.partialdiff = 494;
  44146. t.ydieresis = 556;
  44147. t.Nacute = 722;
  44148. t.icircumflex = 278;
  44149. t.Ecircumflex = 667;
  44150. t.adieresis = 556;
  44151. t.edieresis = 556;
  44152. t.cacute = 556;
  44153. t.nacute = 611;
  44154. t.umacron = 611;
  44155. t.Ncaron = 722;
  44156. t.Iacute = 278;
  44157. t.plusminus = 584;
  44158. t.brokenbar = 280;
  44159. t.registered = 737;
  44160. t.Gbreve = 778;
  44161. t.Idotaccent = 278;
  44162. t.summation = 600;
  44163. t.Egrave = 667;
  44164. t.racute = 389;
  44165. t.omacron = 611;
  44166. t.Zacute = 611;
  44167. t.Zcaron = 611;
  44168. t.greaterequal = 549;
  44169. t.Eth = 722;
  44170. t.Ccedilla = 722;
  44171. t.lcommaaccent = 278;
  44172. t.tcaron = 389;
  44173. t.eogonek = 556;
  44174. t.Uogonek = 722;
  44175. t.Aacute = 722;
  44176. t.Adieresis = 722;
  44177. t.egrave = 556;
  44178. t.zacute = 500;
  44179. t.iogonek = 278;
  44180. t.Oacute = 778;
  44181. t.oacute = 611;
  44182. t.amacron = 556;
  44183. t.sacute = 556;
  44184. t.idieresis = 278;
  44185. t.Ocircumflex = 778;
  44186. t.Ugrave = 722;
  44187. t.Delta = 612;
  44188. t.thorn = 611;
  44189. t.twosuperior = 333;
  44190. t.Odieresis = 778;
  44191. t.mu = 611;
  44192. t.igrave = 278;
  44193. t.ohungarumlaut = 611;
  44194. t.Eogonek = 667;
  44195. t.dcroat = 611;
  44196. t.threequarters = 834;
  44197. t.Scedilla = 667;
  44198. t.lcaron = 400;
  44199. t.Kcommaaccent = 722;
  44200. t.Lacute = 611;
  44201. t.trademark = 1000;
  44202. t.edotaccent = 556;
  44203. t.Igrave = 278;
  44204. t.Imacron = 278;
  44205. t.Lcaron = 611;
  44206. t.onehalf = 834;
  44207. t.lessequal = 549;
  44208. t.ocircumflex = 611;
  44209. t.ntilde = 611;
  44210. t.Uhungarumlaut = 722;
  44211. t.Eacute = 667;
  44212. t.emacron = 556;
  44213. t.gbreve = 611;
  44214. t.onequarter = 834;
  44215. t.Scaron = 667;
  44216. t.Scommaaccent = 667;
  44217. t.Ohungarumlaut = 778;
  44218. t.degree = 400;
  44219. t.ograve = 611;
  44220. t.Ccaron = 722;
  44221. t.ugrave = 611;
  44222. t.radical = 549;
  44223. t.Dcaron = 722;
  44224. t.rcommaaccent = 389;
  44225. t.Ntilde = 722;
  44226. t.otilde = 611;
  44227. t.Rcommaaccent = 722;
  44228. t.Lcommaaccent = 611;
  44229. t.Atilde = 722;
  44230. t.Aogonek = 722;
  44231. t.Aring = 722;
  44232. t.Otilde = 778;
  44233. t.zdotaccent = 500;
  44234. t.Ecaron = 667;
  44235. t.Iogonek = 278;
  44236. t.kcommaaccent = 556;
  44237. t.minus = 584;
  44238. t.Icircumflex = 278;
  44239. t.ncaron = 611;
  44240. t.tcommaaccent = 333;
  44241. t.logicalnot = 584;
  44242. t.odieresis = 611;
  44243. t.udieresis = 611;
  44244. t.notequal = 549;
  44245. t.gcommaaccent = 611;
  44246. t.eth = 611;
  44247. t.zcaron = 500;
  44248. t.ncommaaccent = 611;
  44249. t.onesuperior = 333;
  44250. t.imacron = 278;
  44251. t.Euro = 556;
  44252. });
  44253. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44254. t.space = 278;
  44255. t.exclam = 278;
  44256. t.quotedbl = 355;
  44257. t.numbersign = 556;
  44258. t.dollar = 556;
  44259. t.percent = 889;
  44260. t.ampersand = 667;
  44261. t.quoteright = 222;
  44262. t.parenleft = 333;
  44263. t.parenright = 333;
  44264. t.asterisk = 389;
  44265. t.plus = 584;
  44266. t.comma = 278;
  44267. t.hyphen = 333;
  44268. t.period = 278;
  44269. t.slash = 278;
  44270. t.zero = 556;
  44271. t.one = 556;
  44272. t.two = 556;
  44273. t.three = 556;
  44274. t.four = 556;
  44275. t.five = 556;
  44276. t.six = 556;
  44277. t.seven = 556;
  44278. t.eight = 556;
  44279. t.nine = 556;
  44280. t.colon = 278;
  44281. t.semicolon = 278;
  44282. t.less = 584;
  44283. t.equal = 584;
  44284. t.greater = 584;
  44285. t.question = 556;
  44286. t.at = 1015;
  44287. t.A = 667;
  44288. t.B = 667;
  44289. t.C = 722;
  44290. t.D = 722;
  44291. t.E = 667;
  44292. t.F = 611;
  44293. t.G = 778;
  44294. t.H = 722;
  44295. t.I = 278;
  44296. t.J = 500;
  44297. t.K = 667;
  44298. t.L = 556;
  44299. t.M = 833;
  44300. t.N = 722;
  44301. t.O = 778;
  44302. t.P = 667;
  44303. t.Q = 778;
  44304. t.R = 722;
  44305. t.S = 667;
  44306. t.T = 611;
  44307. t.U = 722;
  44308. t.V = 667;
  44309. t.W = 944;
  44310. t.X = 667;
  44311. t.Y = 667;
  44312. t.Z = 611;
  44313. t.bracketleft = 278;
  44314. t.backslash = 278;
  44315. t.bracketright = 278;
  44316. t.asciicircum = 469;
  44317. t.underscore = 556;
  44318. t.quoteleft = 222;
  44319. t.a = 556;
  44320. t.b = 556;
  44321. t.c = 500;
  44322. t.d = 556;
  44323. t.e = 556;
  44324. t.f = 278;
  44325. t.g = 556;
  44326. t.h = 556;
  44327. t.i = 222;
  44328. t.j = 222;
  44329. t.k = 500;
  44330. t.l = 222;
  44331. t.m = 833;
  44332. t.n = 556;
  44333. t.o = 556;
  44334. t.p = 556;
  44335. t.q = 556;
  44336. t.r = 333;
  44337. t.s = 500;
  44338. t.t = 278;
  44339. t.u = 556;
  44340. t.v = 500;
  44341. t.w = 722;
  44342. t.x = 500;
  44343. t.y = 500;
  44344. t.z = 500;
  44345. t.braceleft = 334;
  44346. t.bar = 260;
  44347. t.braceright = 334;
  44348. t.asciitilde = 584;
  44349. t.exclamdown = 333;
  44350. t.cent = 556;
  44351. t.sterling = 556;
  44352. t.fraction = 167;
  44353. t.yen = 556;
  44354. t.florin = 556;
  44355. t.section = 556;
  44356. t.currency = 556;
  44357. t.quotesingle = 191;
  44358. t.quotedblleft = 333;
  44359. t.guillemotleft = 556;
  44360. t.guilsinglleft = 333;
  44361. t.guilsinglright = 333;
  44362. t.fi = 500;
  44363. t.fl = 500;
  44364. t.endash = 556;
  44365. t.dagger = 556;
  44366. t.daggerdbl = 556;
  44367. t.periodcentered = 278;
  44368. t.paragraph = 537;
  44369. t.bullet = 350;
  44370. t.quotesinglbase = 222;
  44371. t.quotedblbase = 333;
  44372. t.quotedblright = 333;
  44373. t.guillemotright = 556;
  44374. t.ellipsis = 1000;
  44375. t.perthousand = 1000;
  44376. t.questiondown = 611;
  44377. t.grave = 333;
  44378. t.acute = 333;
  44379. t.circumflex = 333;
  44380. t.tilde = 333;
  44381. t.macron = 333;
  44382. t.breve = 333;
  44383. t.dotaccent = 333;
  44384. t.dieresis = 333;
  44385. t.ring = 333;
  44386. t.cedilla = 333;
  44387. t.hungarumlaut = 333;
  44388. t.ogonek = 333;
  44389. t.caron = 333;
  44390. t.emdash = 1000;
  44391. t.AE = 1000;
  44392. t.ordfeminine = 370;
  44393. t.Lslash = 556;
  44394. t.Oslash = 778;
  44395. t.OE = 1000;
  44396. t.ordmasculine = 365;
  44397. t.ae = 889;
  44398. t.dotlessi = 278;
  44399. t.lslash = 222;
  44400. t.oslash = 611;
  44401. t.oe = 944;
  44402. t.germandbls = 611;
  44403. t.Idieresis = 278;
  44404. t.eacute = 556;
  44405. t.abreve = 556;
  44406. t.uhungarumlaut = 556;
  44407. t.ecaron = 556;
  44408. t.Ydieresis = 667;
  44409. t.divide = 584;
  44410. t.Yacute = 667;
  44411. t.Acircumflex = 667;
  44412. t.aacute = 556;
  44413. t.Ucircumflex = 722;
  44414. t.yacute = 500;
  44415. t.scommaaccent = 500;
  44416. t.ecircumflex = 556;
  44417. t.Uring = 722;
  44418. t.Udieresis = 722;
  44419. t.aogonek = 556;
  44420. t.Uacute = 722;
  44421. t.uogonek = 556;
  44422. t.Edieresis = 667;
  44423. t.Dcroat = 722;
  44424. t.commaaccent = 250;
  44425. t.copyright = 737;
  44426. t.Emacron = 667;
  44427. t.ccaron = 500;
  44428. t.aring = 556;
  44429. t.Ncommaaccent = 722;
  44430. t.lacute = 222;
  44431. t.agrave = 556;
  44432. t.Tcommaaccent = 611;
  44433. t.Cacute = 722;
  44434. t.atilde = 556;
  44435. t.Edotaccent = 667;
  44436. t.scaron = 500;
  44437. t.scedilla = 500;
  44438. t.iacute = 278;
  44439. t.lozenge = 471;
  44440. t.Rcaron = 722;
  44441. t.Gcommaaccent = 778;
  44442. t.ucircumflex = 556;
  44443. t.acircumflex = 556;
  44444. t.Amacron = 667;
  44445. t.rcaron = 333;
  44446. t.ccedilla = 500;
  44447. t.Zdotaccent = 611;
  44448. t.Thorn = 667;
  44449. t.Omacron = 778;
  44450. t.Racute = 722;
  44451. t.Sacute = 667;
  44452. t.dcaron = 643;
  44453. t.Umacron = 722;
  44454. t.uring = 556;
  44455. t.threesuperior = 333;
  44456. t.Ograve = 778;
  44457. t.Agrave = 667;
  44458. t.Abreve = 667;
  44459. t.multiply = 584;
  44460. t.uacute = 556;
  44461. t.Tcaron = 611;
  44462. t.partialdiff = 476;
  44463. t.ydieresis = 500;
  44464. t.Nacute = 722;
  44465. t.icircumflex = 278;
  44466. t.Ecircumflex = 667;
  44467. t.adieresis = 556;
  44468. t.edieresis = 556;
  44469. t.cacute = 500;
  44470. t.nacute = 556;
  44471. t.umacron = 556;
  44472. t.Ncaron = 722;
  44473. t.Iacute = 278;
  44474. t.plusminus = 584;
  44475. t.brokenbar = 260;
  44476. t.registered = 737;
  44477. t.Gbreve = 778;
  44478. t.Idotaccent = 278;
  44479. t.summation = 600;
  44480. t.Egrave = 667;
  44481. t.racute = 333;
  44482. t.omacron = 556;
  44483. t.Zacute = 611;
  44484. t.Zcaron = 611;
  44485. t.greaterequal = 549;
  44486. t.Eth = 722;
  44487. t.Ccedilla = 722;
  44488. t.lcommaaccent = 222;
  44489. t.tcaron = 317;
  44490. t.eogonek = 556;
  44491. t.Uogonek = 722;
  44492. t.Aacute = 667;
  44493. t.Adieresis = 667;
  44494. t.egrave = 556;
  44495. t.zacute = 500;
  44496. t.iogonek = 222;
  44497. t.Oacute = 778;
  44498. t.oacute = 556;
  44499. t.amacron = 556;
  44500. t.sacute = 500;
  44501. t.idieresis = 278;
  44502. t.Ocircumflex = 778;
  44503. t.Ugrave = 722;
  44504. t.Delta = 612;
  44505. t.thorn = 556;
  44506. t.twosuperior = 333;
  44507. t.Odieresis = 778;
  44508. t.mu = 556;
  44509. t.igrave = 278;
  44510. t.ohungarumlaut = 556;
  44511. t.Eogonek = 667;
  44512. t.dcroat = 556;
  44513. t.threequarters = 834;
  44514. t.Scedilla = 667;
  44515. t.lcaron = 299;
  44516. t.Kcommaaccent = 667;
  44517. t.Lacute = 556;
  44518. t.trademark = 1000;
  44519. t.edotaccent = 556;
  44520. t.Igrave = 278;
  44521. t.Imacron = 278;
  44522. t.Lcaron = 556;
  44523. t.onehalf = 834;
  44524. t.lessequal = 549;
  44525. t.ocircumflex = 556;
  44526. t.ntilde = 556;
  44527. t.Uhungarumlaut = 722;
  44528. t.Eacute = 667;
  44529. t.emacron = 556;
  44530. t.gbreve = 556;
  44531. t.onequarter = 834;
  44532. t.Scaron = 667;
  44533. t.Scommaaccent = 667;
  44534. t.Ohungarumlaut = 778;
  44535. t.degree = 400;
  44536. t.ograve = 556;
  44537. t.Ccaron = 722;
  44538. t.ugrave = 556;
  44539. t.radical = 453;
  44540. t.Dcaron = 722;
  44541. t.rcommaaccent = 333;
  44542. t.Ntilde = 722;
  44543. t.otilde = 556;
  44544. t.Rcommaaccent = 722;
  44545. t.Lcommaaccent = 556;
  44546. t.Atilde = 667;
  44547. t.Aogonek = 667;
  44548. t.Aring = 667;
  44549. t.Otilde = 778;
  44550. t.zdotaccent = 500;
  44551. t.Ecaron = 667;
  44552. t.Iogonek = 278;
  44553. t.kcommaaccent = 500;
  44554. t.minus = 584;
  44555. t.Icircumflex = 278;
  44556. t.ncaron = 556;
  44557. t.tcommaaccent = 278;
  44558. t.logicalnot = 584;
  44559. t.odieresis = 556;
  44560. t.udieresis = 556;
  44561. t.notequal = 549;
  44562. t.gcommaaccent = 556;
  44563. t.eth = 556;
  44564. t.zcaron = 500;
  44565. t.ncommaaccent = 556;
  44566. t.onesuperior = 333;
  44567. t.imacron = 278;
  44568. t.Euro = 556;
  44569. });
  44570. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  44571. t.space = 250;
  44572. t.exclam = 333;
  44573. t.universal = 713;
  44574. t.numbersign = 500;
  44575. t.existential = 549;
  44576. t.percent = 833;
  44577. t.ampersand = 778;
  44578. t.suchthat = 439;
  44579. t.parenleft = 333;
  44580. t.parenright = 333;
  44581. t.asteriskmath = 500;
  44582. t.plus = 549;
  44583. t.comma = 250;
  44584. t.minus = 549;
  44585. t.period = 250;
  44586. t.slash = 278;
  44587. t.zero = 500;
  44588. t.one = 500;
  44589. t.two = 500;
  44590. t.three = 500;
  44591. t.four = 500;
  44592. t.five = 500;
  44593. t.six = 500;
  44594. t.seven = 500;
  44595. t.eight = 500;
  44596. t.nine = 500;
  44597. t.colon = 278;
  44598. t.semicolon = 278;
  44599. t.less = 549;
  44600. t.equal = 549;
  44601. t.greater = 549;
  44602. t.question = 444;
  44603. t.congruent = 549;
  44604. t.Alpha = 722;
  44605. t.Beta = 667;
  44606. t.Chi = 722;
  44607. t.Delta = 612;
  44608. t.Epsilon = 611;
  44609. t.Phi = 763;
  44610. t.Gamma = 603;
  44611. t.Eta = 722;
  44612. t.Iota = 333;
  44613. t.theta1 = 631;
  44614. t.Kappa = 722;
  44615. t.Lambda = 686;
  44616. t.Mu = 889;
  44617. t.Nu = 722;
  44618. t.Omicron = 722;
  44619. t.Pi = 768;
  44620. t.Theta = 741;
  44621. t.Rho = 556;
  44622. t.Sigma = 592;
  44623. t.Tau = 611;
  44624. t.Upsilon = 690;
  44625. t.sigma1 = 439;
  44626. t.Omega = 768;
  44627. t.Xi = 645;
  44628. t.Psi = 795;
  44629. t.Zeta = 611;
  44630. t.bracketleft = 333;
  44631. t.therefore = 863;
  44632. t.bracketright = 333;
  44633. t.perpendicular = 658;
  44634. t.underscore = 500;
  44635. t.radicalex = 500;
  44636. t.alpha = 631;
  44637. t.beta = 549;
  44638. t.chi = 549;
  44639. t.delta = 494;
  44640. t.epsilon = 439;
  44641. t.phi = 521;
  44642. t.gamma = 411;
  44643. t.eta = 603;
  44644. t.iota = 329;
  44645. t.phi1 = 603;
  44646. t.kappa = 549;
  44647. t.lambda = 549;
  44648. t.mu = 576;
  44649. t.nu = 521;
  44650. t.omicron = 549;
  44651. t.pi = 549;
  44652. t.theta = 521;
  44653. t.rho = 549;
  44654. t.sigma = 603;
  44655. t.tau = 439;
  44656. t.upsilon = 576;
  44657. t.omega1 = 713;
  44658. t.omega = 686;
  44659. t.xi = 493;
  44660. t.psi = 686;
  44661. t.zeta = 494;
  44662. t.braceleft = 480;
  44663. t.bar = 200;
  44664. t.braceright = 480;
  44665. t.similar = 549;
  44666. t.Euro = 750;
  44667. t.Upsilon1 = 620;
  44668. t.minute = 247;
  44669. t.lessequal = 549;
  44670. t.fraction = 167;
  44671. t.infinity = 713;
  44672. t.florin = 500;
  44673. t.club = 753;
  44674. t.diamond = 753;
  44675. t.heart = 753;
  44676. t.spade = 753;
  44677. t.arrowboth = 1042;
  44678. t.arrowleft = 987;
  44679. t.arrowup = 603;
  44680. t.arrowright = 987;
  44681. t.arrowdown = 603;
  44682. t.degree = 400;
  44683. t.plusminus = 549;
  44684. t.second = 411;
  44685. t.greaterequal = 549;
  44686. t.multiply = 549;
  44687. t.proportional = 713;
  44688. t.partialdiff = 494;
  44689. t.bullet = 460;
  44690. t.divide = 549;
  44691. t.notequal = 549;
  44692. t.equivalence = 549;
  44693. t.approxequal = 549;
  44694. t.ellipsis = 1000;
  44695. t.arrowvertex = 603;
  44696. t.arrowhorizex = 1000;
  44697. t.carriagereturn = 658;
  44698. t.aleph = 823;
  44699. t.Ifraktur = 686;
  44700. t.Rfraktur = 795;
  44701. t.weierstrass = 987;
  44702. t.circlemultiply = 768;
  44703. t.circleplus = 768;
  44704. t.emptyset = 823;
  44705. t.intersection = 768;
  44706. t.union = 768;
  44707. t.propersuperset = 713;
  44708. t.reflexsuperset = 713;
  44709. t.notsubset = 713;
  44710. t.propersubset = 713;
  44711. t.reflexsubset = 713;
  44712. t.element = 713;
  44713. t.notelement = 713;
  44714. t.angle = 768;
  44715. t.gradient = 713;
  44716. t.registerserif = 790;
  44717. t.copyrightserif = 790;
  44718. t.trademarkserif = 890;
  44719. t.product = 823;
  44720. t.radical = 549;
  44721. t.dotmath = 250;
  44722. t.logicalnot = 713;
  44723. t.logicaland = 603;
  44724. t.logicalor = 603;
  44725. t.arrowdblboth = 1042;
  44726. t.arrowdblleft = 987;
  44727. t.arrowdblup = 603;
  44728. t.arrowdblright = 987;
  44729. t.arrowdbldown = 603;
  44730. t.lozenge = 494;
  44731. t.angleleft = 329;
  44732. t.registersans = 790;
  44733. t.copyrightsans = 790;
  44734. t.trademarksans = 786;
  44735. t.summation = 713;
  44736. t.parenlefttp = 384;
  44737. t.parenleftex = 384;
  44738. t.parenleftbt = 384;
  44739. t.bracketlefttp = 384;
  44740. t.bracketleftex = 384;
  44741. t.bracketleftbt = 384;
  44742. t.bracelefttp = 494;
  44743. t.braceleftmid = 494;
  44744. t.braceleftbt = 494;
  44745. t.braceex = 494;
  44746. t.angleright = 329;
  44747. t.integral = 274;
  44748. t.integraltp = 686;
  44749. t.integralex = 686;
  44750. t.integralbt = 686;
  44751. t.parenrighttp = 384;
  44752. t.parenrightex = 384;
  44753. t.parenrightbt = 384;
  44754. t.bracketrighttp = 384;
  44755. t.bracketrightex = 384;
  44756. t.bracketrightbt = 384;
  44757. t.bracerighttp = 494;
  44758. t.bracerightmid = 494;
  44759. t.bracerightbt = 494;
  44760. t.apple = 790;
  44761. });
  44762. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  44763. t.space = 250;
  44764. t.exclam = 333;
  44765. t.quotedbl = 408;
  44766. t.numbersign = 500;
  44767. t.dollar = 500;
  44768. t.percent = 833;
  44769. t.ampersand = 778;
  44770. t.quoteright = 333;
  44771. t.parenleft = 333;
  44772. t.parenright = 333;
  44773. t.asterisk = 500;
  44774. t.plus = 564;
  44775. t.comma = 250;
  44776. t.hyphen = 333;
  44777. t.period = 250;
  44778. t.slash = 278;
  44779. t.zero = 500;
  44780. t.one = 500;
  44781. t.two = 500;
  44782. t.three = 500;
  44783. t.four = 500;
  44784. t.five = 500;
  44785. t.six = 500;
  44786. t.seven = 500;
  44787. t.eight = 500;
  44788. t.nine = 500;
  44789. t.colon = 278;
  44790. t.semicolon = 278;
  44791. t.less = 564;
  44792. t.equal = 564;
  44793. t.greater = 564;
  44794. t.question = 444;
  44795. t.at = 921;
  44796. t.A = 722;
  44797. t.B = 667;
  44798. t.C = 667;
  44799. t.D = 722;
  44800. t.E = 611;
  44801. t.F = 556;
  44802. t.G = 722;
  44803. t.H = 722;
  44804. t.I = 333;
  44805. t.J = 389;
  44806. t.K = 722;
  44807. t.L = 611;
  44808. t.M = 889;
  44809. t.N = 722;
  44810. t.O = 722;
  44811. t.P = 556;
  44812. t.Q = 722;
  44813. t.R = 667;
  44814. t.S = 556;
  44815. t.T = 611;
  44816. t.U = 722;
  44817. t.V = 722;
  44818. t.W = 944;
  44819. t.X = 722;
  44820. t.Y = 722;
  44821. t.Z = 611;
  44822. t.bracketleft = 333;
  44823. t.backslash = 278;
  44824. t.bracketright = 333;
  44825. t.asciicircum = 469;
  44826. t.underscore = 500;
  44827. t.quoteleft = 333;
  44828. t.a = 444;
  44829. t.b = 500;
  44830. t.c = 444;
  44831. t.d = 500;
  44832. t.e = 444;
  44833. t.f = 333;
  44834. t.g = 500;
  44835. t.h = 500;
  44836. t.i = 278;
  44837. t.j = 278;
  44838. t.k = 500;
  44839. t.l = 278;
  44840. t.m = 778;
  44841. t.n = 500;
  44842. t.o = 500;
  44843. t.p = 500;
  44844. t.q = 500;
  44845. t.r = 333;
  44846. t.s = 389;
  44847. t.t = 278;
  44848. t.u = 500;
  44849. t.v = 500;
  44850. t.w = 722;
  44851. t.x = 500;
  44852. t.y = 500;
  44853. t.z = 444;
  44854. t.braceleft = 480;
  44855. t.bar = 200;
  44856. t.braceright = 480;
  44857. t.asciitilde = 541;
  44858. t.exclamdown = 333;
  44859. t.cent = 500;
  44860. t.sterling = 500;
  44861. t.fraction = 167;
  44862. t.yen = 500;
  44863. t.florin = 500;
  44864. t.section = 500;
  44865. t.currency = 500;
  44866. t.quotesingle = 180;
  44867. t.quotedblleft = 444;
  44868. t.guillemotleft = 500;
  44869. t.guilsinglleft = 333;
  44870. t.guilsinglright = 333;
  44871. t.fi = 556;
  44872. t.fl = 556;
  44873. t.endash = 500;
  44874. t.dagger = 500;
  44875. t.daggerdbl = 500;
  44876. t.periodcentered = 250;
  44877. t.paragraph = 453;
  44878. t.bullet = 350;
  44879. t.quotesinglbase = 333;
  44880. t.quotedblbase = 444;
  44881. t.quotedblright = 444;
  44882. t.guillemotright = 500;
  44883. t.ellipsis = 1000;
  44884. t.perthousand = 1000;
  44885. t.questiondown = 444;
  44886. t.grave = 333;
  44887. t.acute = 333;
  44888. t.circumflex = 333;
  44889. t.tilde = 333;
  44890. t.macron = 333;
  44891. t.breve = 333;
  44892. t.dotaccent = 333;
  44893. t.dieresis = 333;
  44894. t.ring = 333;
  44895. t.cedilla = 333;
  44896. t.hungarumlaut = 333;
  44897. t.ogonek = 333;
  44898. t.caron = 333;
  44899. t.emdash = 1000;
  44900. t.AE = 889;
  44901. t.ordfeminine = 276;
  44902. t.Lslash = 611;
  44903. t.Oslash = 722;
  44904. t.OE = 889;
  44905. t.ordmasculine = 310;
  44906. t.ae = 667;
  44907. t.dotlessi = 278;
  44908. t.lslash = 278;
  44909. t.oslash = 500;
  44910. t.oe = 722;
  44911. t.germandbls = 500;
  44912. t.Idieresis = 333;
  44913. t.eacute = 444;
  44914. t.abreve = 444;
  44915. t.uhungarumlaut = 500;
  44916. t.ecaron = 444;
  44917. t.Ydieresis = 722;
  44918. t.divide = 564;
  44919. t.Yacute = 722;
  44920. t.Acircumflex = 722;
  44921. t.aacute = 444;
  44922. t.Ucircumflex = 722;
  44923. t.yacute = 500;
  44924. t.scommaaccent = 389;
  44925. t.ecircumflex = 444;
  44926. t.Uring = 722;
  44927. t.Udieresis = 722;
  44928. t.aogonek = 444;
  44929. t.Uacute = 722;
  44930. t.uogonek = 500;
  44931. t.Edieresis = 611;
  44932. t.Dcroat = 722;
  44933. t.commaaccent = 250;
  44934. t.copyright = 760;
  44935. t.Emacron = 611;
  44936. t.ccaron = 444;
  44937. t.aring = 444;
  44938. t.Ncommaaccent = 722;
  44939. t.lacute = 278;
  44940. t.agrave = 444;
  44941. t.Tcommaaccent = 611;
  44942. t.Cacute = 667;
  44943. t.atilde = 444;
  44944. t.Edotaccent = 611;
  44945. t.scaron = 389;
  44946. t.scedilla = 389;
  44947. t.iacute = 278;
  44948. t.lozenge = 471;
  44949. t.Rcaron = 667;
  44950. t.Gcommaaccent = 722;
  44951. t.ucircumflex = 500;
  44952. t.acircumflex = 444;
  44953. t.Amacron = 722;
  44954. t.rcaron = 333;
  44955. t.ccedilla = 444;
  44956. t.Zdotaccent = 611;
  44957. t.Thorn = 556;
  44958. t.Omacron = 722;
  44959. t.Racute = 667;
  44960. t.Sacute = 556;
  44961. t.dcaron = 588;
  44962. t.Umacron = 722;
  44963. t.uring = 500;
  44964. t.threesuperior = 300;
  44965. t.Ograve = 722;
  44966. t.Agrave = 722;
  44967. t.Abreve = 722;
  44968. t.multiply = 564;
  44969. t.uacute = 500;
  44970. t.Tcaron = 611;
  44971. t.partialdiff = 476;
  44972. t.ydieresis = 500;
  44973. t.Nacute = 722;
  44974. t.icircumflex = 278;
  44975. t.Ecircumflex = 611;
  44976. t.adieresis = 444;
  44977. t.edieresis = 444;
  44978. t.cacute = 444;
  44979. t.nacute = 500;
  44980. t.umacron = 500;
  44981. t.Ncaron = 722;
  44982. t.Iacute = 333;
  44983. t.plusminus = 564;
  44984. t.brokenbar = 200;
  44985. t.registered = 760;
  44986. t.Gbreve = 722;
  44987. t.Idotaccent = 333;
  44988. t.summation = 600;
  44989. t.Egrave = 611;
  44990. t.racute = 333;
  44991. t.omacron = 500;
  44992. t.Zacute = 611;
  44993. t.Zcaron = 611;
  44994. t.greaterequal = 549;
  44995. t.Eth = 722;
  44996. t.Ccedilla = 667;
  44997. t.lcommaaccent = 278;
  44998. t.tcaron = 326;
  44999. t.eogonek = 444;
  45000. t.Uogonek = 722;
  45001. t.Aacute = 722;
  45002. t.Adieresis = 722;
  45003. t.egrave = 444;
  45004. t.zacute = 444;
  45005. t.iogonek = 278;
  45006. t.Oacute = 722;
  45007. t.oacute = 500;
  45008. t.amacron = 444;
  45009. t.sacute = 389;
  45010. t.idieresis = 278;
  45011. t.Ocircumflex = 722;
  45012. t.Ugrave = 722;
  45013. t.Delta = 612;
  45014. t.thorn = 500;
  45015. t.twosuperior = 300;
  45016. t.Odieresis = 722;
  45017. t.mu = 500;
  45018. t.igrave = 278;
  45019. t.ohungarumlaut = 500;
  45020. t.Eogonek = 611;
  45021. t.dcroat = 500;
  45022. t.threequarters = 750;
  45023. t.Scedilla = 556;
  45024. t.lcaron = 344;
  45025. t.Kcommaaccent = 722;
  45026. t.Lacute = 611;
  45027. t.trademark = 980;
  45028. t.edotaccent = 444;
  45029. t.Igrave = 333;
  45030. t.Imacron = 333;
  45031. t.Lcaron = 611;
  45032. t.onehalf = 750;
  45033. t.lessequal = 549;
  45034. t.ocircumflex = 500;
  45035. t.ntilde = 500;
  45036. t.Uhungarumlaut = 722;
  45037. t.Eacute = 611;
  45038. t.emacron = 444;
  45039. t.gbreve = 500;
  45040. t.onequarter = 750;
  45041. t.Scaron = 556;
  45042. t.Scommaaccent = 556;
  45043. t.Ohungarumlaut = 722;
  45044. t.degree = 400;
  45045. t.ograve = 500;
  45046. t.Ccaron = 667;
  45047. t.ugrave = 500;
  45048. t.radical = 453;
  45049. t.Dcaron = 722;
  45050. t.rcommaaccent = 333;
  45051. t.Ntilde = 722;
  45052. t.otilde = 500;
  45053. t.Rcommaaccent = 667;
  45054. t.Lcommaaccent = 611;
  45055. t.Atilde = 722;
  45056. t.Aogonek = 722;
  45057. t.Aring = 722;
  45058. t.Otilde = 722;
  45059. t.zdotaccent = 444;
  45060. t.Ecaron = 611;
  45061. t.Iogonek = 333;
  45062. t.kcommaaccent = 500;
  45063. t.minus = 564;
  45064. t.Icircumflex = 333;
  45065. t.ncaron = 500;
  45066. t.tcommaaccent = 278;
  45067. t.logicalnot = 564;
  45068. t.odieresis = 500;
  45069. t.udieresis = 500;
  45070. t.notequal = 549;
  45071. t.gcommaaccent = 500;
  45072. t.eth = 500;
  45073. t.zcaron = 444;
  45074. t.ncommaaccent = 500;
  45075. t.onesuperior = 300;
  45076. t.imacron = 278;
  45077. t.Euro = 500;
  45078. });
  45079. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  45080. t.space = 250;
  45081. t.exclam = 333;
  45082. t.quotedbl = 555;
  45083. t.numbersign = 500;
  45084. t.dollar = 500;
  45085. t.percent = 1000;
  45086. t.ampersand = 833;
  45087. t.quoteright = 333;
  45088. t.parenleft = 333;
  45089. t.parenright = 333;
  45090. t.asterisk = 500;
  45091. t.plus = 570;
  45092. t.comma = 250;
  45093. t.hyphen = 333;
  45094. t.period = 250;
  45095. t.slash = 278;
  45096. t.zero = 500;
  45097. t.one = 500;
  45098. t.two = 500;
  45099. t.three = 500;
  45100. t.four = 500;
  45101. t.five = 500;
  45102. t.six = 500;
  45103. t.seven = 500;
  45104. t.eight = 500;
  45105. t.nine = 500;
  45106. t.colon = 333;
  45107. t.semicolon = 333;
  45108. t.less = 570;
  45109. t.equal = 570;
  45110. t.greater = 570;
  45111. t.question = 500;
  45112. t.at = 930;
  45113. t.A = 722;
  45114. t.B = 667;
  45115. t.C = 722;
  45116. t.D = 722;
  45117. t.E = 667;
  45118. t.F = 611;
  45119. t.G = 778;
  45120. t.H = 778;
  45121. t.I = 389;
  45122. t.J = 500;
  45123. t.K = 778;
  45124. t.L = 667;
  45125. t.M = 944;
  45126. t.N = 722;
  45127. t.O = 778;
  45128. t.P = 611;
  45129. t.Q = 778;
  45130. t.R = 722;
  45131. t.S = 556;
  45132. t.T = 667;
  45133. t.U = 722;
  45134. t.V = 722;
  45135. t.W = 1000;
  45136. t.X = 722;
  45137. t.Y = 722;
  45138. t.Z = 667;
  45139. t.bracketleft = 333;
  45140. t.backslash = 278;
  45141. t.bracketright = 333;
  45142. t.asciicircum = 581;
  45143. t.underscore = 500;
  45144. t.quoteleft = 333;
  45145. t.a = 500;
  45146. t.b = 556;
  45147. t.c = 444;
  45148. t.d = 556;
  45149. t.e = 444;
  45150. t.f = 333;
  45151. t.g = 500;
  45152. t.h = 556;
  45153. t.i = 278;
  45154. t.j = 333;
  45155. t.k = 556;
  45156. t.l = 278;
  45157. t.m = 833;
  45158. t.n = 556;
  45159. t.o = 500;
  45160. t.p = 556;
  45161. t.q = 556;
  45162. t.r = 444;
  45163. t.s = 389;
  45164. t.t = 333;
  45165. t.u = 556;
  45166. t.v = 500;
  45167. t.w = 722;
  45168. t.x = 500;
  45169. t.y = 500;
  45170. t.z = 444;
  45171. t.braceleft = 394;
  45172. t.bar = 220;
  45173. t.braceright = 394;
  45174. t.asciitilde = 520;
  45175. t.exclamdown = 333;
  45176. t.cent = 500;
  45177. t.sterling = 500;
  45178. t.fraction = 167;
  45179. t.yen = 500;
  45180. t.florin = 500;
  45181. t.section = 500;
  45182. t.currency = 500;
  45183. t.quotesingle = 278;
  45184. t.quotedblleft = 500;
  45185. t.guillemotleft = 500;
  45186. t.guilsinglleft = 333;
  45187. t.guilsinglright = 333;
  45188. t.fi = 556;
  45189. t.fl = 556;
  45190. t.endash = 500;
  45191. t.dagger = 500;
  45192. t.daggerdbl = 500;
  45193. t.periodcentered = 250;
  45194. t.paragraph = 540;
  45195. t.bullet = 350;
  45196. t.quotesinglbase = 333;
  45197. t.quotedblbase = 500;
  45198. t.quotedblright = 500;
  45199. t.guillemotright = 500;
  45200. t.ellipsis = 1000;
  45201. t.perthousand = 1000;
  45202. t.questiondown = 500;
  45203. t.grave = 333;
  45204. t.acute = 333;
  45205. t.circumflex = 333;
  45206. t.tilde = 333;
  45207. t.macron = 333;
  45208. t.breve = 333;
  45209. t.dotaccent = 333;
  45210. t.dieresis = 333;
  45211. t.ring = 333;
  45212. t.cedilla = 333;
  45213. t.hungarumlaut = 333;
  45214. t.ogonek = 333;
  45215. t.caron = 333;
  45216. t.emdash = 1000;
  45217. t.AE = 1000;
  45218. t.ordfeminine = 300;
  45219. t.Lslash = 667;
  45220. t.Oslash = 778;
  45221. t.OE = 1000;
  45222. t.ordmasculine = 330;
  45223. t.ae = 722;
  45224. t.dotlessi = 278;
  45225. t.lslash = 278;
  45226. t.oslash = 500;
  45227. t.oe = 722;
  45228. t.germandbls = 556;
  45229. t.Idieresis = 389;
  45230. t.eacute = 444;
  45231. t.abreve = 500;
  45232. t.uhungarumlaut = 556;
  45233. t.ecaron = 444;
  45234. t.Ydieresis = 722;
  45235. t.divide = 570;
  45236. t.Yacute = 722;
  45237. t.Acircumflex = 722;
  45238. t.aacute = 500;
  45239. t.Ucircumflex = 722;
  45240. t.yacute = 500;
  45241. t.scommaaccent = 389;
  45242. t.ecircumflex = 444;
  45243. t.Uring = 722;
  45244. t.Udieresis = 722;
  45245. t.aogonek = 500;
  45246. t.Uacute = 722;
  45247. t.uogonek = 556;
  45248. t.Edieresis = 667;
  45249. t.Dcroat = 722;
  45250. t.commaaccent = 250;
  45251. t.copyright = 747;
  45252. t.Emacron = 667;
  45253. t.ccaron = 444;
  45254. t.aring = 500;
  45255. t.Ncommaaccent = 722;
  45256. t.lacute = 278;
  45257. t.agrave = 500;
  45258. t.Tcommaaccent = 667;
  45259. t.Cacute = 722;
  45260. t.atilde = 500;
  45261. t.Edotaccent = 667;
  45262. t.scaron = 389;
  45263. t.scedilla = 389;
  45264. t.iacute = 278;
  45265. t.lozenge = 494;
  45266. t.Rcaron = 722;
  45267. t.Gcommaaccent = 778;
  45268. t.ucircumflex = 556;
  45269. t.acircumflex = 500;
  45270. t.Amacron = 722;
  45271. t.rcaron = 444;
  45272. t.ccedilla = 444;
  45273. t.Zdotaccent = 667;
  45274. t.Thorn = 611;
  45275. t.Omacron = 778;
  45276. t.Racute = 722;
  45277. t.Sacute = 556;
  45278. t.dcaron = 672;
  45279. t.Umacron = 722;
  45280. t.uring = 556;
  45281. t.threesuperior = 300;
  45282. t.Ograve = 778;
  45283. t.Agrave = 722;
  45284. t.Abreve = 722;
  45285. t.multiply = 570;
  45286. t.uacute = 556;
  45287. t.Tcaron = 667;
  45288. t.partialdiff = 494;
  45289. t.ydieresis = 500;
  45290. t.Nacute = 722;
  45291. t.icircumflex = 278;
  45292. t.Ecircumflex = 667;
  45293. t.adieresis = 500;
  45294. t.edieresis = 444;
  45295. t.cacute = 444;
  45296. t.nacute = 556;
  45297. t.umacron = 556;
  45298. t.Ncaron = 722;
  45299. t.Iacute = 389;
  45300. t.plusminus = 570;
  45301. t.brokenbar = 220;
  45302. t.registered = 747;
  45303. t.Gbreve = 778;
  45304. t.Idotaccent = 389;
  45305. t.summation = 600;
  45306. t.Egrave = 667;
  45307. t.racute = 444;
  45308. t.omacron = 500;
  45309. t.Zacute = 667;
  45310. t.Zcaron = 667;
  45311. t.greaterequal = 549;
  45312. t.Eth = 722;
  45313. t.Ccedilla = 722;
  45314. t.lcommaaccent = 278;
  45315. t.tcaron = 416;
  45316. t.eogonek = 444;
  45317. t.Uogonek = 722;
  45318. t.Aacute = 722;
  45319. t.Adieresis = 722;
  45320. t.egrave = 444;
  45321. t.zacute = 444;
  45322. t.iogonek = 278;
  45323. t.Oacute = 778;
  45324. t.oacute = 500;
  45325. t.amacron = 500;
  45326. t.sacute = 389;
  45327. t.idieresis = 278;
  45328. t.Ocircumflex = 778;
  45329. t.Ugrave = 722;
  45330. t.Delta = 612;
  45331. t.thorn = 556;
  45332. t.twosuperior = 300;
  45333. t.Odieresis = 778;
  45334. t.mu = 556;
  45335. t.igrave = 278;
  45336. t.ohungarumlaut = 500;
  45337. t.Eogonek = 667;
  45338. t.dcroat = 556;
  45339. t.threequarters = 750;
  45340. t.Scedilla = 556;
  45341. t.lcaron = 394;
  45342. t.Kcommaaccent = 778;
  45343. t.Lacute = 667;
  45344. t.trademark = 1000;
  45345. t.edotaccent = 444;
  45346. t.Igrave = 389;
  45347. t.Imacron = 389;
  45348. t.Lcaron = 667;
  45349. t.onehalf = 750;
  45350. t.lessequal = 549;
  45351. t.ocircumflex = 500;
  45352. t.ntilde = 556;
  45353. t.Uhungarumlaut = 722;
  45354. t.Eacute = 667;
  45355. t.emacron = 444;
  45356. t.gbreve = 500;
  45357. t.onequarter = 750;
  45358. t.Scaron = 556;
  45359. t.Scommaaccent = 556;
  45360. t.Ohungarumlaut = 778;
  45361. t.degree = 400;
  45362. t.ograve = 500;
  45363. t.Ccaron = 722;
  45364. t.ugrave = 556;
  45365. t.radical = 549;
  45366. t.Dcaron = 722;
  45367. t.rcommaaccent = 444;
  45368. t.Ntilde = 722;
  45369. t.otilde = 500;
  45370. t.Rcommaaccent = 722;
  45371. t.Lcommaaccent = 667;
  45372. t.Atilde = 722;
  45373. t.Aogonek = 722;
  45374. t.Aring = 722;
  45375. t.Otilde = 778;
  45376. t.zdotaccent = 444;
  45377. t.Ecaron = 667;
  45378. t.Iogonek = 389;
  45379. t.kcommaaccent = 556;
  45380. t.minus = 570;
  45381. t.Icircumflex = 389;
  45382. t.ncaron = 556;
  45383. t.tcommaaccent = 333;
  45384. t.logicalnot = 570;
  45385. t.odieresis = 500;
  45386. t.udieresis = 556;
  45387. t.notequal = 549;
  45388. t.gcommaaccent = 500;
  45389. t.eth = 500;
  45390. t.zcaron = 444;
  45391. t.ncommaaccent = 556;
  45392. t.onesuperior = 300;
  45393. t.imacron = 278;
  45394. t.Euro = 500;
  45395. });
  45396. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  45397. t.space = 250;
  45398. t.exclam = 389;
  45399. t.quotedbl = 555;
  45400. t.numbersign = 500;
  45401. t.dollar = 500;
  45402. t.percent = 833;
  45403. t.ampersand = 778;
  45404. t.quoteright = 333;
  45405. t.parenleft = 333;
  45406. t.parenright = 333;
  45407. t.asterisk = 500;
  45408. t.plus = 570;
  45409. t.comma = 250;
  45410. t.hyphen = 333;
  45411. t.period = 250;
  45412. t.slash = 278;
  45413. t.zero = 500;
  45414. t.one = 500;
  45415. t.two = 500;
  45416. t.three = 500;
  45417. t.four = 500;
  45418. t.five = 500;
  45419. t.six = 500;
  45420. t.seven = 500;
  45421. t.eight = 500;
  45422. t.nine = 500;
  45423. t.colon = 333;
  45424. t.semicolon = 333;
  45425. t.less = 570;
  45426. t.equal = 570;
  45427. t.greater = 570;
  45428. t.question = 500;
  45429. t.at = 832;
  45430. t.A = 667;
  45431. t.B = 667;
  45432. t.C = 667;
  45433. t.D = 722;
  45434. t.E = 667;
  45435. t.F = 667;
  45436. t.G = 722;
  45437. t.H = 778;
  45438. t.I = 389;
  45439. t.J = 500;
  45440. t.K = 667;
  45441. t.L = 611;
  45442. t.M = 889;
  45443. t.N = 722;
  45444. t.O = 722;
  45445. t.P = 611;
  45446. t.Q = 722;
  45447. t.R = 667;
  45448. t.S = 556;
  45449. t.T = 611;
  45450. t.U = 722;
  45451. t.V = 667;
  45452. t.W = 889;
  45453. t.X = 667;
  45454. t.Y = 611;
  45455. t.Z = 611;
  45456. t.bracketleft = 333;
  45457. t.backslash = 278;
  45458. t.bracketright = 333;
  45459. t.asciicircum = 570;
  45460. t.underscore = 500;
  45461. t.quoteleft = 333;
  45462. t.a = 500;
  45463. t.b = 500;
  45464. t.c = 444;
  45465. t.d = 500;
  45466. t.e = 444;
  45467. t.f = 333;
  45468. t.g = 500;
  45469. t.h = 556;
  45470. t.i = 278;
  45471. t.j = 278;
  45472. t.k = 500;
  45473. t.l = 278;
  45474. t.m = 778;
  45475. t.n = 556;
  45476. t.o = 500;
  45477. t.p = 500;
  45478. t.q = 500;
  45479. t.r = 389;
  45480. t.s = 389;
  45481. t.t = 278;
  45482. t.u = 556;
  45483. t.v = 444;
  45484. t.w = 667;
  45485. t.x = 500;
  45486. t.y = 444;
  45487. t.z = 389;
  45488. t.braceleft = 348;
  45489. t.bar = 220;
  45490. t.braceright = 348;
  45491. t.asciitilde = 570;
  45492. t.exclamdown = 389;
  45493. t.cent = 500;
  45494. t.sterling = 500;
  45495. t.fraction = 167;
  45496. t.yen = 500;
  45497. t.florin = 500;
  45498. t.section = 500;
  45499. t.currency = 500;
  45500. t.quotesingle = 278;
  45501. t.quotedblleft = 500;
  45502. t.guillemotleft = 500;
  45503. t.guilsinglleft = 333;
  45504. t.guilsinglright = 333;
  45505. t.fi = 556;
  45506. t.fl = 556;
  45507. t.endash = 500;
  45508. t.dagger = 500;
  45509. t.daggerdbl = 500;
  45510. t.periodcentered = 250;
  45511. t.paragraph = 500;
  45512. t.bullet = 350;
  45513. t.quotesinglbase = 333;
  45514. t.quotedblbase = 500;
  45515. t.quotedblright = 500;
  45516. t.guillemotright = 500;
  45517. t.ellipsis = 1000;
  45518. t.perthousand = 1000;
  45519. t.questiondown = 500;
  45520. t.grave = 333;
  45521. t.acute = 333;
  45522. t.circumflex = 333;
  45523. t.tilde = 333;
  45524. t.macron = 333;
  45525. t.breve = 333;
  45526. t.dotaccent = 333;
  45527. t.dieresis = 333;
  45528. t.ring = 333;
  45529. t.cedilla = 333;
  45530. t.hungarumlaut = 333;
  45531. t.ogonek = 333;
  45532. t.caron = 333;
  45533. t.emdash = 1000;
  45534. t.AE = 944;
  45535. t.ordfeminine = 266;
  45536. t.Lslash = 611;
  45537. t.Oslash = 722;
  45538. t.OE = 944;
  45539. t.ordmasculine = 300;
  45540. t.ae = 722;
  45541. t.dotlessi = 278;
  45542. t.lslash = 278;
  45543. t.oslash = 500;
  45544. t.oe = 722;
  45545. t.germandbls = 500;
  45546. t.Idieresis = 389;
  45547. t.eacute = 444;
  45548. t.abreve = 500;
  45549. t.uhungarumlaut = 556;
  45550. t.ecaron = 444;
  45551. t.Ydieresis = 611;
  45552. t.divide = 570;
  45553. t.Yacute = 611;
  45554. t.Acircumflex = 667;
  45555. t.aacute = 500;
  45556. t.Ucircumflex = 722;
  45557. t.yacute = 444;
  45558. t.scommaaccent = 389;
  45559. t.ecircumflex = 444;
  45560. t.Uring = 722;
  45561. t.Udieresis = 722;
  45562. t.aogonek = 500;
  45563. t.Uacute = 722;
  45564. t.uogonek = 556;
  45565. t.Edieresis = 667;
  45566. t.Dcroat = 722;
  45567. t.commaaccent = 250;
  45568. t.copyright = 747;
  45569. t.Emacron = 667;
  45570. t.ccaron = 444;
  45571. t.aring = 500;
  45572. t.Ncommaaccent = 722;
  45573. t.lacute = 278;
  45574. t.agrave = 500;
  45575. t.Tcommaaccent = 611;
  45576. t.Cacute = 667;
  45577. t.atilde = 500;
  45578. t.Edotaccent = 667;
  45579. t.scaron = 389;
  45580. t.scedilla = 389;
  45581. t.iacute = 278;
  45582. t.lozenge = 494;
  45583. t.Rcaron = 667;
  45584. t.Gcommaaccent = 722;
  45585. t.ucircumflex = 556;
  45586. t.acircumflex = 500;
  45587. t.Amacron = 667;
  45588. t.rcaron = 389;
  45589. t.ccedilla = 444;
  45590. t.Zdotaccent = 611;
  45591. t.Thorn = 611;
  45592. t.Omacron = 722;
  45593. t.Racute = 667;
  45594. t.Sacute = 556;
  45595. t.dcaron = 608;
  45596. t.Umacron = 722;
  45597. t.uring = 556;
  45598. t.threesuperior = 300;
  45599. t.Ograve = 722;
  45600. t.Agrave = 667;
  45601. t.Abreve = 667;
  45602. t.multiply = 570;
  45603. t.uacute = 556;
  45604. t.Tcaron = 611;
  45605. t.partialdiff = 494;
  45606. t.ydieresis = 444;
  45607. t.Nacute = 722;
  45608. t.icircumflex = 278;
  45609. t.Ecircumflex = 667;
  45610. t.adieresis = 500;
  45611. t.edieresis = 444;
  45612. t.cacute = 444;
  45613. t.nacute = 556;
  45614. t.umacron = 556;
  45615. t.Ncaron = 722;
  45616. t.Iacute = 389;
  45617. t.plusminus = 570;
  45618. t.brokenbar = 220;
  45619. t.registered = 747;
  45620. t.Gbreve = 722;
  45621. t.Idotaccent = 389;
  45622. t.summation = 600;
  45623. t.Egrave = 667;
  45624. t.racute = 389;
  45625. t.omacron = 500;
  45626. t.Zacute = 611;
  45627. t.Zcaron = 611;
  45628. t.greaterequal = 549;
  45629. t.Eth = 722;
  45630. t.Ccedilla = 667;
  45631. t.lcommaaccent = 278;
  45632. t.tcaron = 366;
  45633. t.eogonek = 444;
  45634. t.Uogonek = 722;
  45635. t.Aacute = 667;
  45636. t.Adieresis = 667;
  45637. t.egrave = 444;
  45638. t.zacute = 389;
  45639. t.iogonek = 278;
  45640. t.Oacute = 722;
  45641. t.oacute = 500;
  45642. t.amacron = 500;
  45643. t.sacute = 389;
  45644. t.idieresis = 278;
  45645. t.Ocircumflex = 722;
  45646. t.Ugrave = 722;
  45647. t.Delta = 612;
  45648. t.thorn = 500;
  45649. t.twosuperior = 300;
  45650. t.Odieresis = 722;
  45651. t.mu = 576;
  45652. t.igrave = 278;
  45653. t.ohungarumlaut = 500;
  45654. t.Eogonek = 667;
  45655. t.dcroat = 500;
  45656. t.threequarters = 750;
  45657. t.Scedilla = 556;
  45658. t.lcaron = 382;
  45659. t.Kcommaaccent = 667;
  45660. t.Lacute = 611;
  45661. t.trademark = 1000;
  45662. t.edotaccent = 444;
  45663. t.Igrave = 389;
  45664. t.Imacron = 389;
  45665. t.Lcaron = 611;
  45666. t.onehalf = 750;
  45667. t.lessequal = 549;
  45668. t.ocircumflex = 500;
  45669. t.ntilde = 556;
  45670. t.Uhungarumlaut = 722;
  45671. t.Eacute = 667;
  45672. t.emacron = 444;
  45673. t.gbreve = 500;
  45674. t.onequarter = 750;
  45675. t.Scaron = 556;
  45676. t.Scommaaccent = 556;
  45677. t.Ohungarumlaut = 722;
  45678. t.degree = 400;
  45679. t.ograve = 500;
  45680. t.Ccaron = 667;
  45681. t.ugrave = 556;
  45682. t.radical = 549;
  45683. t.Dcaron = 722;
  45684. t.rcommaaccent = 389;
  45685. t.Ntilde = 722;
  45686. t.otilde = 500;
  45687. t.Rcommaaccent = 667;
  45688. t.Lcommaaccent = 611;
  45689. t.Atilde = 667;
  45690. t.Aogonek = 667;
  45691. t.Aring = 667;
  45692. t.Otilde = 722;
  45693. t.zdotaccent = 389;
  45694. t.Ecaron = 667;
  45695. t.Iogonek = 389;
  45696. t.kcommaaccent = 500;
  45697. t.minus = 606;
  45698. t.Icircumflex = 389;
  45699. t.ncaron = 556;
  45700. t.tcommaaccent = 278;
  45701. t.logicalnot = 606;
  45702. t.odieresis = 500;
  45703. t.udieresis = 556;
  45704. t.notequal = 549;
  45705. t.gcommaaccent = 500;
  45706. t.eth = 500;
  45707. t.zcaron = 389;
  45708. t.ncommaaccent = 556;
  45709. t.onesuperior = 300;
  45710. t.imacron = 278;
  45711. t.Euro = 500;
  45712. });
  45713. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  45714. t.space = 250;
  45715. t.exclam = 333;
  45716. t.quotedbl = 420;
  45717. t.numbersign = 500;
  45718. t.dollar = 500;
  45719. t.percent = 833;
  45720. t.ampersand = 778;
  45721. t.quoteright = 333;
  45722. t.parenleft = 333;
  45723. t.parenright = 333;
  45724. t.asterisk = 500;
  45725. t.plus = 675;
  45726. t.comma = 250;
  45727. t.hyphen = 333;
  45728. t.period = 250;
  45729. t.slash = 278;
  45730. t.zero = 500;
  45731. t.one = 500;
  45732. t.two = 500;
  45733. t.three = 500;
  45734. t.four = 500;
  45735. t.five = 500;
  45736. t.six = 500;
  45737. t.seven = 500;
  45738. t.eight = 500;
  45739. t.nine = 500;
  45740. t.colon = 333;
  45741. t.semicolon = 333;
  45742. t.less = 675;
  45743. t.equal = 675;
  45744. t.greater = 675;
  45745. t.question = 500;
  45746. t.at = 920;
  45747. t.A = 611;
  45748. t.B = 611;
  45749. t.C = 667;
  45750. t.D = 722;
  45751. t.E = 611;
  45752. t.F = 611;
  45753. t.G = 722;
  45754. t.H = 722;
  45755. t.I = 333;
  45756. t.J = 444;
  45757. t.K = 667;
  45758. t.L = 556;
  45759. t.M = 833;
  45760. t.N = 667;
  45761. t.O = 722;
  45762. t.P = 611;
  45763. t.Q = 722;
  45764. t.R = 611;
  45765. t.S = 500;
  45766. t.T = 556;
  45767. t.U = 722;
  45768. t.V = 611;
  45769. t.W = 833;
  45770. t.X = 611;
  45771. t.Y = 556;
  45772. t.Z = 556;
  45773. t.bracketleft = 389;
  45774. t.backslash = 278;
  45775. t.bracketright = 389;
  45776. t.asciicircum = 422;
  45777. t.underscore = 500;
  45778. t.quoteleft = 333;
  45779. t.a = 500;
  45780. t.b = 500;
  45781. t.c = 444;
  45782. t.d = 500;
  45783. t.e = 444;
  45784. t.f = 278;
  45785. t.g = 500;
  45786. t.h = 500;
  45787. t.i = 278;
  45788. t.j = 278;
  45789. t.k = 444;
  45790. t.l = 278;
  45791. t.m = 722;
  45792. t.n = 500;
  45793. t.o = 500;
  45794. t.p = 500;
  45795. t.q = 500;
  45796. t.r = 389;
  45797. t.s = 389;
  45798. t.t = 278;
  45799. t.u = 500;
  45800. t.v = 444;
  45801. t.w = 667;
  45802. t.x = 444;
  45803. t.y = 444;
  45804. t.z = 389;
  45805. t.braceleft = 400;
  45806. t.bar = 275;
  45807. t.braceright = 400;
  45808. t.asciitilde = 541;
  45809. t.exclamdown = 389;
  45810. t.cent = 500;
  45811. t.sterling = 500;
  45812. t.fraction = 167;
  45813. t.yen = 500;
  45814. t.florin = 500;
  45815. t.section = 500;
  45816. t.currency = 500;
  45817. t.quotesingle = 214;
  45818. t.quotedblleft = 556;
  45819. t.guillemotleft = 500;
  45820. t.guilsinglleft = 333;
  45821. t.guilsinglright = 333;
  45822. t.fi = 500;
  45823. t.fl = 500;
  45824. t.endash = 500;
  45825. t.dagger = 500;
  45826. t.daggerdbl = 500;
  45827. t.periodcentered = 250;
  45828. t.paragraph = 523;
  45829. t.bullet = 350;
  45830. t.quotesinglbase = 333;
  45831. t.quotedblbase = 556;
  45832. t.quotedblright = 556;
  45833. t.guillemotright = 500;
  45834. t.ellipsis = 889;
  45835. t.perthousand = 1000;
  45836. t.questiondown = 500;
  45837. t.grave = 333;
  45838. t.acute = 333;
  45839. t.circumflex = 333;
  45840. t.tilde = 333;
  45841. t.macron = 333;
  45842. t.breve = 333;
  45843. t.dotaccent = 333;
  45844. t.dieresis = 333;
  45845. t.ring = 333;
  45846. t.cedilla = 333;
  45847. t.hungarumlaut = 333;
  45848. t.ogonek = 333;
  45849. t.caron = 333;
  45850. t.emdash = 889;
  45851. t.AE = 889;
  45852. t.ordfeminine = 276;
  45853. t.Lslash = 556;
  45854. t.Oslash = 722;
  45855. t.OE = 944;
  45856. t.ordmasculine = 310;
  45857. t.ae = 667;
  45858. t.dotlessi = 278;
  45859. t.lslash = 278;
  45860. t.oslash = 500;
  45861. t.oe = 667;
  45862. t.germandbls = 500;
  45863. t.Idieresis = 333;
  45864. t.eacute = 444;
  45865. t.abreve = 500;
  45866. t.uhungarumlaut = 500;
  45867. t.ecaron = 444;
  45868. t.Ydieresis = 556;
  45869. t.divide = 675;
  45870. t.Yacute = 556;
  45871. t.Acircumflex = 611;
  45872. t.aacute = 500;
  45873. t.Ucircumflex = 722;
  45874. t.yacute = 444;
  45875. t.scommaaccent = 389;
  45876. t.ecircumflex = 444;
  45877. t.Uring = 722;
  45878. t.Udieresis = 722;
  45879. t.aogonek = 500;
  45880. t.Uacute = 722;
  45881. t.uogonek = 500;
  45882. t.Edieresis = 611;
  45883. t.Dcroat = 722;
  45884. t.commaaccent = 250;
  45885. t.copyright = 760;
  45886. t.Emacron = 611;
  45887. t.ccaron = 444;
  45888. t.aring = 500;
  45889. t.Ncommaaccent = 667;
  45890. t.lacute = 278;
  45891. t.agrave = 500;
  45892. t.Tcommaaccent = 556;
  45893. t.Cacute = 667;
  45894. t.atilde = 500;
  45895. t.Edotaccent = 611;
  45896. t.scaron = 389;
  45897. t.scedilla = 389;
  45898. t.iacute = 278;
  45899. t.lozenge = 471;
  45900. t.Rcaron = 611;
  45901. t.Gcommaaccent = 722;
  45902. t.ucircumflex = 500;
  45903. t.acircumflex = 500;
  45904. t.Amacron = 611;
  45905. t.rcaron = 389;
  45906. t.ccedilla = 444;
  45907. t.Zdotaccent = 556;
  45908. t.Thorn = 611;
  45909. t.Omacron = 722;
  45910. t.Racute = 611;
  45911. t.Sacute = 500;
  45912. t.dcaron = 544;
  45913. t.Umacron = 722;
  45914. t.uring = 500;
  45915. t.threesuperior = 300;
  45916. t.Ograve = 722;
  45917. t.Agrave = 611;
  45918. t.Abreve = 611;
  45919. t.multiply = 675;
  45920. t.uacute = 500;
  45921. t.Tcaron = 556;
  45922. t.partialdiff = 476;
  45923. t.ydieresis = 444;
  45924. t.Nacute = 667;
  45925. t.icircumflex = 278;
  45926. t.Ecircumflex = 611;
  45927. t.adieresis = 500;
  45928. t.edieresis = 444;
  45929. t.cacute = 444;
  45930. t.nacute = 500;
  45931. t.umacron = 500;
  45932. t.Ncaron = 667;
  45933. t.Iacute = 333;
  45934. t.plusminus = 675;
  45935. t.brokenbar = 275;
  45936. t.registered = 760;
  45937. t.Gbreve = 722;
  45938. t.Idotaccent = 333;
  45939. t.summation = 600;
  45940. t.Egrave = 611;
  45941. t.racute = 389;
  45942. t.omacron = 500;
  45943. t.Zacute = 556;
  45944. t.Zcaron = 556;
  45945. t.greaterequal = 549;
  45946. t.Eth = 722;
  45947. t.Ccedilla = 667;
  45948. t.lcommaaccent = 278;
  45949. t.tcaron = 300;
  45950. t.eogonek = 444;
  45951. t.Uogonek = 722;
  45952. t.Aacute = 611;
  45953. t.Adieresis = 611;
  45954. t.egrave = 444;
  45955. t.zacute = 389;
  45956. t.iogonek = 278;
  45957. t.Oacute = 722;
  45958. t.oacute = 500;
  45959. t.amacron = 500;
  45960. t.sacute = 389;
  45961. t.idieresis = 278;
  45962. t.Ocircumflex = 722;
  45963. t.Ugrave = 722;
  45964. t.Delta = 612;
  45965. t.thorn = 500;
  45966. t.twosuperior = 300;
  45967. t.Odieresis = 722;
  45968. t.mu = 500;
  45969. t.igrave = 278;
  45970. t.ohungarumlaut = 500;
  45971. t.Eogonek = 611;
  45972. t.dcroat = 500;
  45973. t.threequarters = 750;
  45974. t.Scedilla = 500;
  45975. t.lcaron = 300;
  45976. t.Kcommaaccent = 667;
  45977. t.Lacute = 556;
  45978. t.trademark = 980;
  45979. t.edotaccent = 444;
  45980. t.Igrave = 333;
  45981. t.Imacron = 333;
  45982. t.Lcaron = 611;
  45983. t.onehalf = 750;
  45984. t.lessequal = 549;
  45985. t.ocircumflex = 500;
  45986. t.ntilde = 500;
  45987. t.Uhungarumlaut = 722;
  45988. t.Eacute = 611;
  45989. t.emacron = 444;
  45990. t.gbreve = 500;
  45991. t.onequarter = 750;
  45992. t.Scaron = 500;
  45993. t.Scommaaccent = 500;
  45994. t.Ohungarumlaut = 722;
  45995. t.degree = 400;
  45996. t.ograve = 500;
  45997. t.Ccaron = 667;
  45998. t.ugrave = 500;
  45999. t.radical = 453;
  46000. t.Dcaron = 722;
  46001. t.rcommaaccent = 389;
  46002. t.Ntilde = 667;
  46003. t.otilde = 500;
  46004. t.Rcommaaccent = 611;
  46005. t.Lcommaaccent = 556;
  46006. t.Atilde = 611;
  46007. t.Aogonek = 611;
  46008. t.Aring = 611;
  46009. t.Otilde = 722;
  46010. t.zdotaccent = 389;
  46011. t.Ecaron = 611;
  46012. t.Iogonek = 333;
  46013. t.kcommaaccent = 444;
  46014. t.minus = 675;
  46015. t.Icircumflex = 333;
  46016. t.ncaron = 500;
  46017. t.tcommaaccent = 278;
  46018. t.logicalnot = 675;
  46019. t.odieresis = 500;
  46020. t.udieresis = 500;
  46021. t.notequal = 549;
  46022. t.gcommaaccent = 500;
  46023. t.eth = 500;
  46024. t.zcaron = 389;
  46025. t.ncommaaccent = 500;
  46026. t.onesuperior = 300;
  46027. t.imacron = 278;
  46028. t.Euro = 500;
  46029. });
  46030. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  46031. t.space = 278;
  46032. t.a1 = 974;
  46033. t.a2 = 961;
  46034. t.a202 = 974;
  46035. t.a3 = 980;
  46036. t.a4 = 719;
  46037. t.a5 = 789;
  46038. t.a119 = 790;
  46039. t.a118 = 791;
  46040. t.a117 = 690;
  46041. t.a11 = 960;
  46042. t.a12 = 939;
  46043. t.a13 = 549;
  46044. t.a14 = 855;
  46045. t.a15 = 911;
  46046. t.a16 = 933;
  46047. t.a105 = 911;
  46048. t.a17 = 945;
  46049. t.a18 = 974;
  46050. t.a19 = 755;
  46051. t.a20 = 846;
  46052. t.a21 = 762;
  46053. t.a22 = 761;
  46054. t.a23 = 571;
  46055. t.a24 = 677;
  46056. t.a25 = 763;
  46057. t.a26 = 760;
  46058. t.a27 = 759;
  46059. t.a28 = 754;
  46060. t.a6 = 494;
  46061. t.a7 = 552;
  46062. t.a8 = 537;
  46063. t.a9 = 577;
  46064. t.a10 = 692;
  46065. t.a29 = 786;
  46066. t.a30 = 788;
  46067. t.a31 = 788;
  46068. t.a32 = 790;
  46069. t.a33 = 793;
  46070. t.a34 = 794;
  46071. t.a35 = 816;
  46072. t.a36 = 823;
  46073. t.a37 = 789;
  46074. t.a38 = 841;
  46075. t.a39 = 823;
  46076. t.a40 = 833;
  46077. t.a41 = 816;
  46078. t.a42 = 831;
  46079. t.a43 = 923;
  46080. t.a44 = 744;
  46081. t.a45 = 723;
  46082. t.a46 = 749;
  46083. t.a47 = 790;
  46084. t.a48 = 792;
  46085. t.a49 = 695;
  46086. t.a50 = 776;
  46087. t.a51 = 768;
  46088. t.a52 = 792;
  46089. t.a53 = 759;
  46090. t.a54 = 707;
  46091. t.a55 = 708;
  46092. t.a56 = 682;
  46093. t.a57 = 701;
  46094. t.a58 = 826;
  46095. t.a59 = 815;
  46096. t.a60 = 789;
  46097. t.a61 = 789;
  46098. t.a62 = 707;
  46099. t.a63 = 687;
  46100. t.a64 = 696;
  46101. t.a65 = 689;
  46102. t.a66 = 786;
  46103. t.a67 = 787;
  46104. t.a68 = 713;
  46105. t.a69 = 791;
  46106. t.a70 = 785;
  46107. t.a71 = 791;
  46108. t.a72 = 873;
  46109. t.a73 = 761;
  46110. t.a74 = 762;
  46111. t.a203 = 762;
  46112. t.a75 = 759;
  46113. t.a204 = 759;
  46114. t.a76 = 892;
  46115. t.a77 = 892;
  46116. t.a78 = 788;
  46117. t.a79 = 784;
  46118. t.a81 = 438;
  46119. t.a82 = 138;
  46120. t.a83 = 277;
  46121. t.a84 = 415;
  46122. t.a97 = 392;
  46123. t.a98 = 392;
  46124. t.a99 = 668;
  46125. t.a100 = 668;
  46126. t.a89 = 390;
  46127. t.a90 = 390;
  46128. t.a93 = 317;
  46129. t.a94 = 317;
  46130. t.a91 = 276;
  46131. t.a92 = 276;
  46132. t.a205 = 509;
  46133. t.a85 = 509;
  46134. t.a206 = 410;
  46135. t.a86 = 410;
  46136. t.a87 = 234;
  46137. t.a88 = 234;
  46138. t.a95 = 334;
  46139. t.a96 = 334;
  46140. t.a101 = 732;
  46141. t.a102 = 544;
  46142. t.a103 = 544;
  46143. t.a104 = 910;
  46144. t.a106 = 667;
  46145. t.a107 = 760;
  46146. t.a108 = 760;
  46147. t.a112 = 776;
  46148. t.a111 = 595;
  46149. t.a110 = 694;
  46150. t.a109 = 626;
  46151. t.a120 = 788;
  46152. t.a121 = 788;
  46153. t.a122 = 788;
  46154. t.a123 = 788;
  46155. t.a124 = 788;
  46156. t.a125 = 788;
  46157. t.a126 = 788;
  46158. t.a127 = 788;
  46159. t.a128 = 788;
  46160. t.a129 = 788;
  46161. t.a130 = 788;
  46162. t.a131 = 788;
  46163. t.a132 = 788;
  46164. t.a133 = 788;
  46165. t.a134 = 788;
  46166. t.a135 = 788;
  46167. t.a136 = 788;
  46168. t.a137 = 788;
  46169. t.a138 = 788;
  46170. t.a139 = 788;
  46171. t.a140 = 788;
  46172. t.a141 = 788;
  46173. t.a142 = 788;
  46174. t.a143 = 788;
  46175. t.a144 = 788;
  46176. t.a145 = 788;
  46177. t.a146 = 788;
  46178. t.a147 = 788;
  46179. t.a148 = 788;
  46180. t.a149 = 788;
  46181. t.a150 = 788;
  46182. t.a151 = 788;
  46183. t.a152 = 788;
  46184. t.a153 = 788;
  46185. t.a154 = 788;
  46186. t.a155 = 788;
  46187. t.a156 = 788;
  46188. t.a157 = 788;
  46189. t.a158 = 788;
  46190. t.a159 = 788;
  46191. t.a160 = 894;
  46192. t.a161 = 838;
  46193. t.a163 = 1016;
  46194. t.a164 = 458;
  46195. t.a196 = 748;
  46196. t.a165 = 924;
  46197. t.a192 = 748;
  46198. t.a166 = 918;
  46199. t.a167 = 927;
  46200. t.a168 = 928;
  46201. t.a169 = 928;
  46202. t.a170 = 834;
  46203. t.a171 = 873;
  46204. t.a172 = 828;
  46205. t.a173 = 924;
  46206. t.a162 = 924;
  46207. t.a174 = 917;
  46208. t.a175 = 930;
  46209. t.a176 = 931;
  46210. t.a177 = 463;
  46211. t.a178 = 883;
  46212. t.a179 = 836;
  46213. t.a193 = 836;
  46214. t.a180 = 867;
  46215. t.a199 = 867;
  46216. t.a181 = 696;
  46217. t.a200 = 696;
  46218. t.a182 = 874;
  46219. t.a201 = 874;
  46220. t.a183 = 760;
  46221. t.a184 = 946;
  46222. t.a197 = 771;
  46223. t.a185 = 865;
  46224. t.a194 = 771;
  46225. t.a198 = 888;
  46226. t.a186 = 967;
  46227. t.a195 = 888;
  46228. t.a187 = 831;
  46229. t.a188 = 873;
  46230. t.a189 = 927;
  46231. t.a190 = 970;
  46232. t.a191 = 918;
  46233. });
  46234. });
  46235. exports.getMetrics = getMetrics;
  46236. /***/ }),
  46237. /* 45 */
  46238. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46239. Object.defineProperty(exports, "__esModule", ({
  46240. value: true
  46241. }));
  46242. exports.MurmurHash3_64 = void 0;
  46243. var _util = __w_pdfjs_require__(2);
  46244. const SEED = 0xc3d2e1f0;
  46245. const MASK_HIGH = 0xffff0000;
  46246. const MASK_LOW = 0xffff;
  46247. class MurmurHash3_64 {
  46248. constructor(seed) {
  46249. this.h1 = seed ? seed & 0xffffffff : SEED;
  46250. this.h2 = seed ? seed & 0xffffffff : SEED;
  46251. }
  46252. update(input) {
  46253. let data, length;
  46254. if ((0, _util.isString)(input)) {
  46255. data = new Uint8Array(input.length * 2);
  46256. length = 0;
  46257. for (let i = 0, ii = input.length; i < ii; i++) {
  46258. const code = input.charCodeAt(i);
  46259. if (code <= 0xff) {
  46260. data[length++] = code;
  46261. } else {
  46262. data[length++] = code >>> 8;
  46263. data[length++] = code & 0xff;
  46264. }
  46265. }
  46266. } else if ((0, _util.isArrayBuffer)(input)) {
  46267. data = input.slice();
  46268. length = data.byteLength;
  46269. } else {
  46270. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  46271. }
  46272. const blockCounts = length >> 2;
  46273. const tailLength = length - blockCounts * 4;
  46274. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  46275. let k1 = 0,
  46276. k2 = 0;
  46277. let h1 = this.h1,
  46278. h2 = this.h2;
  46279. const C1 = 0xcc9e2d51,
  46280. C2 = 0x1b873593;
  46281. const C1_LOW = C1 & MASK_LOW,
  46282. C2_LOW = C2 & MASK_LOW;
  46283. for (let i = 0; i < blockCounts; i++) {
  46284. if (i & 1) {
  46285. k1 = dataUint32[i];
  46286. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  46287. k1 = k1 << 15 | k1 >>> 17;
  46288. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  46289. h1 ^= k1;
  46290. h1 = h1 << 13 | h1 >>> 19;
  46291. h1 = h1 * 5 + 0xe6546b64;
  46292. } else {
  46293. k2 = dataUint32[i];
  46294. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  46295. k2 = k2 << 15 | k2 >>> 17;
  46296. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  46297. h2 ^= k2;
  46298. h2 = h2 << 13 | h2 >>> 19;
  46299. h2 = h2 * 5 + 0xe6546b64;
  46300. }
  46301. }
  46302. k1 = 0;
  46303. switch (tailLength) {
  46304. case 3:
  46305. k1 ^= data[blockCounts * 4 + 2] << 16;
  46306. case 2:
  46307. k1 ^= data[blockCounts * 4 + 1] << 8;
  46308. case 1:
  46309. k1 ^= data[blockCounts * 4];
  46310. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  46311. k1 = k1 << 15 | k1 >>> 17;
  46312. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  46313. if (blockCounts & 1) {
  46314. h1 ^= k1;
  46315. } else {
  46316. h2 ^= k1;
  46317. }
  46318. }
  46319. this.h1 = h1;
  46320. this.h2 = h2;
  46321. }
  46322. hexdigest() {
  46323. let h1 = this.h1,
  46324. h2 = this.h2;
  46325. h1 ^= h2 >>> 1;
  46326. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  46327. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  46328. h1 ^= h2 >>> 1;
  46329. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  46330. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  46331. h1 ^= h2 >>> 1;
  46332. const hex1 = (h1 >>> 0).toString(16),
  46333. hex2 = (h2 >>> 0).toString(16);
  46334. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  46335. }
  46336. }
  46337. exports.MurmurHash3_64 = MurmurHash3_64;
  46338. /***/ }),
  46339. /* 46 */
  46340. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46341. Object.defineProperty(exports, "__esModule", ({
  46342. value: true
  46343. }));
  46344. exports.OperatorList = void 0;
  46345. var _util = __w_pdfjs_require__(2);
  46346. const QueueOptimizer = function QueueOptimizerClosure() {
  46347. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  46348. let state = parentState;
  46349. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  46350. const item = pattern[i];
  46351. state = state[item] || (state[item] = []);
  46352. }
  46353. state[pattern[pattern.length - 1]] = {
  46354. checkFn,
  46355. iterateFn,
  46356. processFn
  46357. };
  46358. }
  46359. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  46360. const iFirstPIMXO = iFirstSave + 2;
  46361. let i;
  46362. for (i = 0; i < count; i++) {
  46363. const arg = argsArray[iFirstPIMXO + 4 * i];
  46364. const imageMask = arg.length === 1 && arg[0];
  46365. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  46366. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  46367. continue;
  46368. }
  46369. break;
  46370. }
  46371. return count - i;
  46372. }
  46373. const InitialState = [];
  46374. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  46375. const fnArray = context.fnArray;
  46376. const iFirstSave = context.iCurr - 3;
  46377. const pos = (i - iFirstSave) % 4;
  46378. switch (pos) {
  46379. case 0:
  46380. return fnArray[i] === _util.OPS.save;
  46381. case 1:
  46382. return fnArray[i] === _util.OPS.transform;
  46383. case 2:
  46384. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  46385. case 3:
  46386. return fnArray[i] === _util.OPS.restore;
  46387. }
  46388. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  46389. }, function foundInlineImageGroup(context, i) {
  46390. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  46391. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  46392. const MAX_WIDTH = 1000;
  46393. const IMAGE_PADDING = 1;
  46394. const fnArray = context.fnArray,
  46395. argsArray = context.argsArray;
  46396. const curr = context.iCurr;
  46397. const iFirstSave = curr - 3;
  46398. const iFirstTransform = curr - 2;
  46399. const iFirstPIIXO = curr - 1;
  46400. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  46401. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  46402. return i - (i - iFirstSave) % 4;
  46403. }
  46404. let maxX = 0;
  46405. const map = [];
  46406. let maxLineHeight = 0;
  46407. let currentX = IMAGE_PADDING,
  46408. currentY = IMAGE_PADDING;
  46409. for (let q = 0; q < count; q++) {
  46410. const transform = argsArray[iFirstTransform + (q << 2)];
  46411. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  46412. if (currentX + img.width > MAX_WIDTH) {
  46413. maxX = Math.max(maxX, currentX);
  46414. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  46415. currentX = 0;
  46416. maxLineHeight = 0;
  46417. }
  46418. map.push({
  46419. transform,
  46420. x: currentX,
  46421. y: currentY,
  46422. w: img.width,
  46423. h: img.height
  46424. });
  46425. currentX += img.width + 2 * IMAGE_PADDING;
  46426. maxLineHeight = Math.max(maxLineHeight, img.height);
  46427. }
  46428. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  46429. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  46430. const imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
  46431. const imgRowSize = imgWidth << 2;
  46432. for (let q = 0; q < count; q++) {
  46433. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  46434. const rowSize = map[q].w << 2;
  46435. let dataOffset = 0;
  46436. let offset = map[q].x + map[q].y * imgWidth << 2;
  46437. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  46438. for (let k = 0, kk = map[q].h; k < kk; k++) {
  46439. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  46440. dataOffset += rowSize;
  46441. offset += imgRowSize;
  46442. }
  46443. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  46444. while (offset >= 0) {
  46445. data[offset - 4] = data[offset];
  46446. data[offset - 3] = data[offset + 1];
  46447. data[offset - 2] = data[offset + 2];
  46448. data[offset - 1] = data[offset + 3];
  46449. data[offset + rowSize] = data[offset + rowSize - 4];
  46450. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  46451. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  46452. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  46453. offset -= imgRowSize;
  46454. }
  46455. }
  46456. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  46457. argsArray.splice(iFirstSave, count * 4, [{
  46458. width: imgWidth,
  46459. height: imgHeight,
  46460. kind: _util.ImageKind.RGBA_32BPP,
  46461. data: imgData
  46462. }, map]);
  46463. return iFirstSave + 1;
  46464. });
  46465. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  46466. const fnArray = context.fnArray;
  46467. const iFirstSave = context.iCurr - 3;
  46468. const pos = (i - iFirstSave) % 4;
  46469. switch (pos) {
  46470. case 0:
  46471. return fnArray[i] === _util.OPS.save;
  46472. case 1:
  46473. return fnArray[i] === _util.OPS.transform;
  46474. case 2:
  46475. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  46476. case 3:
  46477. return fnArray[i] === _util.OPS.restore;
  46478. }
  46479. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  46480. }, function foundImageMaskGroup(context, i) {
  46481. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  46482. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  46483. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  46484. const fnArray = context.fnArray,
  46485. argsArray = context.argsArray;
  46486. const curr = context.iCurr;
  46487. const iFirstSave = curr - 3;
  46488. const iFirstTransform = curr - 2;
  46489. const iFirstPIMXO = curr - 1;
  46490. let count = Math.floor((i - iFirstSave) / 4);
  46491. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  46492. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  46493. return i - (i - iFirstSave) % 4;
  46494. }
  46495. let isSameImage = false;
  46496. let iTransform, transformArgs;
  46497. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  46498. const firstTransformArg0 = argsArray[iFirstTransform][0],
  46499. firstTransformArg1 = argsArray[iFirstTransform][1],
  46500. firstTransformArg2 = argsArray[iFirstTransform][2],
  46501. firstTransformArg3 = argsArray[iFirstTransform][3];
  46502. if (firstTransformArg1 === firstTransformArg2) {
  46503. isSameImage = true;
  46504. iTransform = iFirstTransform + 4;
  46505. let iPIMXO = iFirstPIMXO + 4;
  46506. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  46507. transformArgs = argsArray[iTransform];
  46508. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  46509. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  46510. isSameImage = false;
  46511. } else {
  46512. count = q;
  46513. }
  46514. break;
  46515. }
  46516. }
  46517. }
  46518. if (isSameImage) {
  46519. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  46520. const positions = new Float32Array(count * 2);
  46521. iTransform = iFirstTransform;
  46522. for (let q = 0; q < count; q++, iTransform += 4) {
  46523. transformArgs = argsArray[iTransform];
  46524. positions[q << 1] = transformArgs[4];
  46525. positions[(q << 1) + 1] = transformArgs[5];
  46526. }
  46527. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  46528. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  46529. } else {
  46530. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  46531. const images = [];
  46532. for (let q = 0; q < count; q++) {
  46533. transformArgs = argsArray[iFirstTransform + (q << 2)];
  46534. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  46535. images.push({
  46536. data: maskParams.data,
  46537. width: maskParams.width,
  46538. height: maskParams.height,
  46539. transform: transformArgs
  46540. });
  46541. }
  46542. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  46543. argsArray.splice(iFirstSave, count * 4, [images]);
  46544. }
  46545. return iFirstSave + 1;
  46546. });
  46547. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  46548. const argsArray = context.argsArray;
  46549. const iFirstTransform = context.iCurr - 2;
  46550. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  46551. }, function iterateImageGroup(context, i) {
  46552. const fnArray = context.fnArray,
  46553. argsArray = context.argsArray;
  46554. const iFirstSave = context.iCurr - 3;
  46555. const pos = (i - iFirstSave) % 4;
  46556. switch (pos) {
  46557. case 0:
  46558. return fnArray[i] === _util.OPS.save;
  46559. case 1:
  46560. if (fnArray[i] !== _util.OPS.transform) {
  46561. return false;
  46562. }
  46563. const iFirstTransform = context.iCurr - 2;
  46564. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46565. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46566. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  46567. return false;
  46568. }
  46569. return true;
  46570. case 2:
  46571. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  46572. return false;
  46573. }
  46574. const iFirstPIXO = context.iCurr - 1;
  46575. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46576. if (argsArray[i][0] !== firstPIXOArg0) {
  46577. return false;
  46578. }
  46579. return true;
  46580. case 3:
  46581. return fnArray[i] === _util.OPS.restore;
  46582. }
  46583. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  46584. }, function (context, i) {
  46585. const MIN_IMAGES_IN_BLOCK = 3;
  46586. const MAX_IMAGES_IN_BLOCK = 1000;
  46587. const fnArray = context.fnArray,
  46588. argsArray = context.argsArray;
  46589. const curr = context.iCurr;
  46590. const iFirstSave = curr - 3;
  46591. const iFirstTransform = curr - 2;
  46592. const iFirstPIXO = curr - 1;
  46593. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  46594. const firstTransformArg0 = argsArray[iFirstTransform][0];
  46595. const firstTransformArg3 = argsArray[iFirstTransform][3];
  46596. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  46597. if (count < MIN_IMAGES_IN_BLOCK) {
  46598. return i - (i - iFirstSave) % 4;
  46599. }
  46600. const positions = new Float32Array(count * 2);
  46601. let iTransform = iFirstTransform;
  46602. for (let q = 0; q < count; q++, iTransform += 4) {
  46603. const transformArgs = argsArray[iTransform];
  46604. positions[q << 1] = transformArgs[4];
  46605. positions[(q << 1) + 1] = transformArgs[5];
  46606. }
  46607. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  46608. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  46609. argsArray.splice(iFirstSave, count * 4, args);
  46610. return iFirstSave + 1;
  46611. });
  46612. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  46613. const fnArray = context.fnArray,
  46614. argsArray = context.argsArray;
  46615. const iFirstSave = context.iCurr - 4;
  46616. const pos = (i - iFirstSave) % 5;
  46617. switch (pos) {
  46618. case 0:
  46619. return fnArray[i] === _util.OPS.beginText;
  46620. case 1:
  46621. return fnArray[i] === _util.OPS.setFont;
  46622. case 2:
  46623. return fnArray[i] === _util.OPS.setTextMatrix;
  46624. case 3:
  46625. if (fnArray[i] !== _util.OPS.showText) {
  46626. return false;
  46627. }
  46628. const iFirstSetFont = context.iCurr - 3;
  46629. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46630. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46631. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  46632. return false;
  46633. }
  46634. return true;
  46635. case 4:
  46636. return fnArray[i] === _util.OPS.endText;
  46637. }
  46638. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  46639. }, function (context, i) {
  46640. const MIN_CHARS_IN_BLOCK = 3;
  46641. const MAX_CHARS_IN_BLOCK = 1000;
  46642. const fnArray = context.fnArray,
  46643. argsArray = context.argsArray;
  46644. const curr = context.iCurr;
  46645. const iFirstBeginText = curr - 4;
  46646. const iFirstSetFont = curr - 3;
  46647. const iFirstSetTextMatrix = curr - 2;
  46648. const iFirstShowText = curr - 1;
  46649. const iFirstEndText = curr;
  46650. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  46651. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  46652. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  46653. if (count < MIN_CHARS_IN_BLOCK) {
  46654. return i - (i - iFirstBeginText) % 5;
  46655. }
  46656. let iFirst = iFirstBeginText;
  46657. 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) {
  46658. count++;
  46659. iFirst -= 5;
  46660. }
  46661. let iEndText = iFirst + 4;
  46662. for (let q = 1; q < count; q++) {
  46663. fnArray.splice(iEndText, 3);
  46664. argsArray.splice(iEndText, 3);
  46665. iEndText += 2;
  46666. }
  46667. return iEndText + 1;
  46668. });
  46669. function QueueOptimizer(queue) {
  46670. this.queue = queue;
  46671. this.state = null;
  46672. this.context = {
  46673. iCurr: 0,
  46674. fnArray: queue.fnArray,
  46675. argsArray: queue.argsArray
  46676. };
  46677. this.match = null;
  46678. this.lastProcessed = 0;
  46679. }
  46680. QueueOptimizer.prototype = {
  46681. _optimize() {
  46682. const fnArray = this.queue.fnArray;
  46683. let i = this.lastProcessed,
  46684. ii = fnArray.length;
  46685. let state = this.state;
  46686. let match = this.match;
  46687. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  46688. this.lastProcessed = ii;
  46689. return;
  46690. }
  46691. const context = this.context;
  46692. while (i < ii) {
  46693. if (match) {
  46694. const iterate = (0, match.iterateFn)(context, i);
  46695. if (iterate) {
  46696. i++;
  46697. continue;
  46698. }
  46699. i = (0, match.processFn)(context, i + 1);
  46700. ii = fnArray.length;
  46701. match = null;
  46702. state = null;
  46703. if (i >= ii) {
  46704. break;
  46705. }
  46706. }
  46707. state = (state || InitialState)[fnArray[i]];
  46708. if (!state || Array.isArray(state)) {
  46709. i++;
  46710. continue;
  46711. }
  46712. context.iCurr = i;
  46713. i++;
  46714. if (state.checkFn && !(0, state.checkFn)(context)) {
  46715. state = null;
  46716. continue;
  46717. }
  46718. match = state;
  46719. state = null;
  46720. }
  46721. this.state = state;
  46722. this.match = match;
  46723. this.lastProcessed = i;
  46724. },
  46725. push(fn, args) {
  46726. this.queue.fnArray.push(fn);
  46727. this.queue.argsArray.push(args);
  46728. this._optimize();
  46729. },
  46730. flush() {
  46731. while (this.match) {
  46732. const length = this.queue.fnArray.length;
  46733. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  46734. this.match = null;
  46735. this.state = null;
  46736. this._optimize();
  46737. }
  46738. },
  46739. reset() {
  46740. this.state = null;
  46741. this.match = null;
  46742. this.lastProcessed = 0;
  46743. }
  46744. };
  46745. return QueueOptimizer;
  46746. }();
  46747. const NullOptimizer = function NullOptimizerClosure() {
  46748. function NullOptimizer(queue) {
  46749. this.queue = queue;
  46750. }
  46751. NullOptimizer.prototype = {
  46752. push(fn, args) {
  46753. this.queue.fnArray.push(fn);
  46754. this.queue.argsArray.push(args);
  46755. },
  46756. flush() {},
  46757. reset() {}
  46758. };
  46759. return NullOptimizer;
  46760. }();
  46761. const OperatorList = function OperatorListClosure() {
  46762. const CHUNK_SIZE = 1000;
  46763. const CHUNK_SIZE_ABOUT = CHUNK_SIZE - 5;
  46764. function OperatorList(intent, streamSink) {
  46765. this._streamSink = streamSink;
  46766. this.fnArray = [];
  46767. this.argsArray = [];
  46768. if (streamSink && intent !== "oplist") {
  46769. this.optimizer = new QueueOptimizer(this);
  46770. } else {
  46771. this.optimizer = new NullOptimizer(this);
  46772. }
  46773. this.dependencies = new Set();
  46774. this._totalLength = 0;
  46775. this.weight = 0;
  46776. this._resolved = streamSink ? null : Promise.resolve();
  46777. }
  46778. OperatorList.prototype = {
  46779. get length() {
  46780. return this.argsArray.length;
  46781. },
  46782. get ready() {
  46783. return this._resolved || this._streamSink.ready;
  46784. },
  46785. get totalLength() {
  46786. return this._totalLength + this.length;
  46787. },
  46788. addOp(fn, args) {
  46789. this.optimizer.push(fn, args);
  46790. this.weight++;
  46791. if (this._streamSink) {
  46792. if (this.weight >= CHUNK_SIZE) {
  46793. this.flush();
  46794. } else if (this.weight >= CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  46795. this.flush();
  46796. }
  46797. }
  46798. },
  46799. addDependency(dependency) {
  46800. if (this.dependencies.has(dependency)) {
  46801. return;
  46802. }
  46803. this.dependencies.add(dependency);
  46804. this.addOp(_util.OPS.dependency, [dependency]);
  46805. },
  46806. addDependencies(dependencies) {
  46807. for (const dependency of dependencies) {
  46808. this.addDependency(dependency);
  46809. }
  46810. },
  46811. addOpList(opList) {
  46812. if (!(opList instanceof OperatorList)) {
  46813. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  46814. return;
  46815. }
  46816. for (const dependency of opList.dependencies) {
  46817. this.dependencies.add(dependency);
  46818. }
  46819. for (let i = 0, ii = opList.length; i < ii; i++) {
  46820. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  46821. }
  46822. },
  46823. getIR() {
  46824. return {
  46825. fnArray: this.fnArray,
  46826. argsArray: this.argsArray,
  46827. length: this.length
  46828. };
  46829. },
  46830. get _transfers() {
  46831. const transfers = [];
  46832. const {
  46833. fnArray,
  46834. argsArray,
  46835. length
  46836. } = this;
  46837. for (let i = 0; i < length; i++) {
  46838. switch (fnArray[i]) {
  46839. case _util.OPS.paintInlineImageXObject:
  46840. case _util.OPS.paintInlineImageXObjectGroup:
  46841. case _util.OPS.paintImageMaskXObject:
  46842. const arg = argsArray[i][0];
  46843. ;
  46844. if (!arg.cached) {
  46845. transfers.push(arg.data.buffer);
  46846. }
  46847. break;
  46848. }
  46849. }
  46850. return transfers;
  46851. },
  46852. flush(lastChunk = false) {
  46853. this.optimizer.flush();
  46854. const length = this.length;
  46855. this._totalLength += length;
  46856. this._streamSink.enqueue({
  46857. fnArray: this.fnArray,
  46858. argsArray: this.argsArray,
  46859. lastChunk,
  46860. length
  46861. }, 1, this._transfers);
  46862. this.dependencies.clear();
  46863. this.fnArray.length = 0;
  46864. this.argsArray.length = 0;
  46865. this.weight = 0;
  46866. this.optimizer.reset();
  46867. }
  46868. };
  46869. return OperatorList;
  46870. }();
  46871. exports.OperatorList = OperatorList;
  46872. /***/ }),
  46873. /* 47 */
  46874. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46875. Object.defineProperty(exports, "__esModule", ({
  46876. value: true
  46877. }));
  46878. exports.PDFImage = void 0;
  46879. var _util = __w_pdfjs_require__(2);
  46880. var _primitives = __w_pdfjs_require__(5);
  46881. var _colorspace = __w_pdfjs_require__(23);
  46882. var _stream = __w_pdfjs_require__(12);
  46883. var _jpeg_stream = __w_pdfjs_require__(18);
  46884. var _jpx = __w_pdfjs_require__(21);
  46885. function decodeAndClamp(value, addend, coefficient, max) {
  46886. value = addend + value * coefficient;
  46887. if (value < 0) {
  46888. value = 0;
  46889. } else if (value > max) {
  46890. value = max;
  46891. }
  46892. return value;
  46893. }
  46894. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  46895. var length = w2 * h2;
  46896. let dest;
  46897. if (bpc <= 8) {
  46898. dest = new Uint8Array(length);
  46899. } else if (bpc <= 16) {
  46900. dest = new Uint16Array(length);
  46901. } else {
  46902. dest = new Uint32Array(length);
  46903. }
  46904. var xRatio = w1 / w2;
  46905. var yRatio = h1 / h2;
  46906. var i,
  46907. j,
  46908. py,
  46909. newIndex = 0,
  46910. oldIndex;
  46911. var xScaled = new Uint16Array(w2);
  46912. var w1Scanline = w1;
  46913. for (i = 0; i < w2; i++) {
  46914. xScaled[i] = Math.floor(i * xRatio);
  46915. }
  46916. for (i = 0; i < h2; i++) {
  46917. py = Math.floor(i * yRatio) * w1Scanline;
  46918. for (j = 0; j < w2; j++) {
  46919. oldIndex = py + xScaled[j];
  46920. dest[newIndex++] = src[oldIndex];
  46921. }
  46922. }
  46923. return dest;
  46924. }
  46925. class PDFImage {
  46926. constructor({
  46927. xref,
  46928. res,
  46929. image,
  46930. isInline = false,
  46931. smask = null,
  46932. mask = null,
  46933. isMask = false,
  46934. pdfFunctionFactory,
  46935. localColorSpaceCache
  46936. }) {
  46937. this.image = image;
  46938. var dict = image.dict;
  46939. const filter = dict.get("Filter");
  46940. if ((0, _primitives.isName)(filter)) {
  46941. switch (filter.name) {
  46942. case "JPXDecode":
  46943. var jpxImage = new _jpx.JpxImage();
  46944. jpxImage.parseImageProperties(image.stream);
  46945. image.stream.reset();
  46946. image.width = jpxImage.width;
  46947. image.height = jpxImage.height;
  46948. image.bitsPerComponent = jpxImage.bitsPerComponent;
  46949. image.numComps = jpxImage.componentsCount;
  46950. break;
  46951. case "JBIG2Decode":
  46952. image.bitsPerComponent = 1;
  46953. image.numComps = 1;
  46954. break;
  46955. }
  46956. }
  46957. let width = dict.get("Width", "W");
  46958. let height = dict.get("Height", "H");
  46959. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  46960. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  46961. width = image.width;
  46962. height = image.height;
  46963. }
  46964. if (width < 1 || height < 1) {
  46965. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  46966. }
  46967. this.width = width;
  46968. this.height = height;
  46969. this.interpolate = dict.get("Interpolate", "I") || false;
  46970. this.imageMask = dict.get("ImageMask", "IM") || false;
  46971. this.matte = dict.get("Matte") || false;
  46972. var bitsPerComponent = image.bitsPerComponent;
  46973. if (!bitsPerComponent) {
  46974. bitsPerComponent = dict.get("BitsPerComponent", "BPC");
  46975. if (!bitsPerComponent) {
  46976. if (this.imageMask) {
  46977. bitsPerComponent = 1;
  46978. } else {
  46979. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  46980. }
  46981. }
  46982. }
  46983. this.bpc = bitsPerComponent;
  46984. if (!this.imageMask) {
  46985. let colorSpace = dict.getRaw("ColorSpace") || dict.getRaw("CS");
  46986. if (!colorSpace) {
  46987. (0, _util.info)("JPX images (which do not require color spaces)");
  46988. switch (image.numComps) {
  46989. case 1:
  46990. colorSpace = _primitives.Name.get("DeviceGray");
  46991. break;
  46992. case 3:
  46993. colorSpace = _primitives.Name.get("DeviceRGB");
  46994. break;
  46995. case 4:
  46996. colorSpace = _primitives.Name.get("DeviceCMYK");
  46997. break;
  46998. default:
  46999. throw new Error(`JPX images with ${image.numComps} ` + "color components not supported.");
  47000. }
  47001. }
  47002. this.colorSpace = _colorspace.ColorSpace.parse({
  47003. cs: colorSpace,
  47004. xref,
  47005. resources: isInline ? res : null,
  47006. pdfFunctionFactory,
  47007. localColorSpaceCache
  47008. });
  47009. this.numComps = this.colorSpace.numComps;
  47010. }
  47011. this.decode = dict.getArray("Decode", "D");
  47012. this.needsDecode = false;
  47013. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  47014. this.needsDecode = true;
  47015. var max = (1 << bitsPerComponent) - 1;
  47016. this.decodeCoefficients = [];
  47017. this.decodeAddends = [];
  47018. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  47019. for (var i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  47020. var dmin = this.decode[i];
  47021. var dmax = this.decode[i + 1];
  47022. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  47023. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  47024. }
  47025. }
  47026. if (smask) {
  47027. this.smask = new PDFImage({
  47028. xref,
  47029. res,
  47030. image: smask,
  47031. isInline,
  47032. pdfFunctionFactory,
  47033. localColorSpaceCache
  47034. });
  47035. } else if (mask) {
  47036. if ((0, _primitives.isStream)(mask)) {
  47037. var maskDict = mask.dict,
  47038. imageMask = maskDict.get("ImageMask", "IM");
  47039. if (!imageMask) {
  47040. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  47041. } else {
  47042. this.mask = new PDFImage({
  47043. xref,
  47044. res,
  47045. image: mask,
  47046. isInline,
  47047. isMask: true,
  47048. pdfFunctionFactory,
  47049. localColorSpaceCache
  47050. });
  47051. }
  47052. } else {
  47053. this.mask = mask;
  47054. }
  47055. }
  47056. }
  47057. static async buildImage({
  47058. xref,
  47059. res,
  47060. image,
  47061. isInline = false,
  47062. pdfFunctionFactory,
  47063. localColorSpaceCache
  47064. }) {
  47065. const imageData = image;
  47066. let smaskData = null;
  47067. let maskData = null;
  47068. const smask = image.dict.get("SMask");
  47069. const mask = image.dict.get("Mask");
  47070. if (smask) {
  47071. smaskData = smask;
  47072. } else if (mask) {
  47073. if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) {
  47074. maskData = mask;
  47075. } else {
  47076. (0, _util.warn)("Unsupported mask format.");
  47077. }
  47078. }
  47079. return new PDFImage({
  47080. xref,
  47081. res,
  47082. image: imageData,
  47083. isInline,
  47084. smask: smaskData,
  47085. mask: maskData,
  47086. pdfFunctionFactory,
  47087. localColorSpaceCache
  47088. });
  47089. }
  47090. static createMask({
  47091. imgArray,
  47092. width,
  47093. height,
  47094. imageIsFromDecodeStream,
  47095. inverseDecode
  47096. }) {
  47097. var computedLength = (width + 7 >> 3) * height;
  47098. var actualLength = imgArray.byteLength;
  47099. var haveFullData = computedLength === actualLength;
  47100. var data, i;
  47101. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  47102. data = imgArray;
  47103. } else if (!inverseDecode) {
  47104. data = new Uint8ClampedArray(actualLength);
  47105. data.set(imgArray);
  47106. } else {
  47107. data = new Uint8ClampedArray(computedLength);
  47108. data.set(imgArray);
  47109. for (i = actualLength; i < computedLength; i++) {
  47110. data[i] = 0xff;
  47111. }
  47112. }
  47113. if (inverseDecode) {
  47114. for (i = 0; i < actualLength; i++) {
  47115. data[i] ^= 0xff;
  47116. }
  47117. }
  47118. return {
  47119. data,
  47120. width,
  47121. height
  47122. };
  47123. }
  47124. get drawWidth() {
  47125. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  47126. }
  47127. get drawHeight() {
  47128. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  47129. }
  47130. decodeBuffer(buffer) {
  47131. var bpc = this.bpc;
  47132. var numComps = this.numComps;
  47133. var decodeAddends = this.decodeAddends;
  47134. var decodeCoefficients = this.decodeCoefficients;
  47135. var max = (1 << bpc) - 1;
  47136. var i, ii;
  47137. if (bpc === 1) {
  47138. for (i = 0, ii = buffer.length; i < ii; i++) {
  47139. buffer[i] = +!buffer[i];
  47140. }
  47141. return;
  47142. }
  47143. var index = 0;
  47144. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  47145. for (var j = 0; j < numComps; j++) {
  47146. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  47147. index++;
  47148. }
  47149. }
  47150. }
  47151. getComponents(buffer) {
  47152. var bpc = this.bpc;
  47153. if (bpc === 8) {
  47154. return buffer;
  47155. }
  47156. var width = this.width;
  47157. var height = this.height;
  47158. var numComps = this.numComps;
  47159. var length = width * height * numComps;
  47160. var bufferPos = 0;
  47161. let output;
  47162. if (bpc <= 8) {
  47163. output = new Uint8Array(length);
  47164. } else if (bpc <= 16) {
  47165. output = new Uint16Array(length);
  47166. } else {
  47167. output = new Uint32Array(length);
  47168. }
  47169. var rowComps = width * numComps;
  47170. var max = (1 << bpc) - 1;
  47171. var i = 0,
  47172. ii,
  47173. buf;
  47174. if (bpc === 1) {
  47175. var mask, loop1End, loop2End;
  47176. for (var j = 0; j < height; j++) {
  47177. loop1End = i + (rowComps & ~7);
  47178. loop2End = i + rowComps;
  47179. while (i < loop1End) {
  47180. buf = buffer[bufferPos++];
  47181. output[i] = buf >> 7 & 1;
  47182. output[i + 1] = buf >> 6 & 1;
  47183. output[i + 2] = buf >> 5 & 1;
  47184. output[i + 3] = buf >> 4 & 1;
  47185. output[i + 4] = buf >> 3 & 1;
  47186. output[i + 5] = buf >> 2 & 1;
  47187. output[i + 6] = buf >> 1 & 1;
  47188. output[i + 7] = buf & 1;
  47189. i += 8;
  47190. }
  47191. if (i < loop2End) {
  47192. buf = buffer[bufferPos++];
  47193. mask = 128;
  47194. while (i < loop2End) {
  47195. output[i++] = +!!(buf & mask);
  47196. mask >>= 1;
  47197. }
  47198. }
  47199. }
  47200. } else {
  47201. var bits = 0;
  47202. buf = 0;
  47203. for (i = 0, ii = length; i < ii; ++i) {
  47204. if (i % rowComps === 0) {
  47205. buf = 0;
  47206. bits = 0;
  47207. }
  47208. while (bits < bpc) {
  47209. buf = buf << 8 | buffer[bufferPos++];
  47210. bits += 8;
  47211. }
  47212. var remainingBits = bits - bpc;
  47213. let value = buf >> remainingBits;
  47214. if (value < 0) {
  47215. value = 0;
  47216. } else if (value > max) {
  47217. value = max;
  47218. }
  47219. output[i] = value;
  47220. buf = buf & (1 << remainingBits) - 1;
  47221. bits = remainingBits;
  47222. }
  47223. }
  47224. return output;
  47225. }
  47226. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  47227. var smask = this.smask;
  47228. var mask = this.mask;
  47229. var alphaBuf, sw, sh, i, ii, j;
  47230. if (smask) {
  47231. sw = smask.width;
  47232. sh = smask.height;
  47233. alphaBuf = new Uint8ClampedArray(sw * sh);
  47234. smask.fillGrayBuffer(alphaBuf);
  47235. if (sw !== width || sh !== height) {
  47236. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  47237. }
  47238. } else if (mask) {
  47239. if (mask instanceof PDFImage) {
  47240. sw = mask.width;
  47241. sh = mask.height;
  47242. alphaBuf = new Uint8ClampedArray(sw * sh);
  47243. mask.numComps = 1;
  47244. mask.fillGrayBuffer(alphaBuf);
  47245. for (i = 0, ii = sw * sh; i < ii; ++i) {
  47246. alphaBuf[i] = 255 - alphaBuf[i];
  47247. }
  47248. if (sw !== width || sh !== height) {
  47249. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  47250. }
  47251. } else if (Array.isArray(mask)) {
  47252. alphaBuf = new Uint8ClampedArray(width * height);
  47253. var numComps = this.numComps;
  47254. for (i = 0, ii = width * height; i < ii; ++i) {
  47255. var opacity = 0;
  47256. var imageOffset = i * numComps;
  47257. for (j = 0; j < numComps; ++j) {
  47258. var color = image[imageOffset + j];
  47259. var maskOffset = j * 2;
  47260. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  47261. opacity = 255;
  47262. break;
  47263. }
  47264. }
  47265. alphaBuf[i] = opacity;
  47266. }
  47267. } else {
  47268. throw new _util.FormatError("Unknown mask format.");
  47269. }
  47270. }
  47271. if (alphaBuf) {
  47272. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  47273. rgbaBuf[j] = alphaBuf[i];
  47274. }
  47275. } else {
  47276. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  47277. rgbaBuf[j] = 255;
  47278. }
  47279. }
  47280. }
  47281. undoPreblend(buffer, width, height) {
  47282. var matte = this.smask && this.smask.matte;
  47283. if (!matte) {
  47284. return;
  47285. }
  47286. var matteRgb = this.colorSpace.getRgb(matte, 0);
  47287. var matteR = matteRgb[0];
  47288. var matteG = matteRgb[1];
  47289. var matteB = matteRgb[2];
  47290. var length = width * height * 4;
  47291. for (var i = 0; i < length; i += 4) {
  47292. var alpha = buffer[i + 3];
  47293. if (alpha === 0) {
  47294. buffer[i] = 255;
  47295. buffer[i + 1] = 255;
  47296. buffer[i + 2] = 255;
  47297. continue;
  47298. }
  47299. var k = 255 / alpha;
  47300. buffer[i] = (buffer[i] - matteR) * k + matteR;
  47301. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  47302. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  47303. }
  47304. }
  47305. createImageData(forceRGBA = false) {
  47306. var drawWidth = this.drawWidth;
  47307. var drawHeight = this.drawHeight;
  47308. var imgData = {
  47309. width: drawWidth,
  47310. height: drawHeight,
  47311. kind: 0,
  47312. data: null
  47313. };
  47314. var numComps = this.numComps;
  47315. var originalWidth = this.width;
  47316. var originalHeight = this.height;
  47317. var bpc = this.bpc;
  47318. var rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  47319. var imgArray;
  47320. if (!forceRGBA) {
  47321. var kind;
  47322. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  47323. kind = _util.ImageKind.GRAYSCALE_1BPP;
  47324. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  47325. kind = _util.ImageKind.RGB_24BPP;
  47326. }
  47327. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  47328. imgData.kind = kind;
  47329. imgArray = this.getImageBytes(originalHeight * rowBytes);
  47330. if (this.image instanceof _stream.DecodeStream) {
  47331. imgData.data = imgArray;
  47332. } else {
  47333. var newArray = new Uint8ClampedArray(imgArray.length);
  47334. newArray.set(imgArray);
  47335. imgData.data = newArray;
  47336. }
  47337. if (this.needsDecode) {
  47338. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  47339. var buffer = imgData.data;
  47340. for (var i = 0, ii = buffer.length; i < ii; i++) {
  47341. buffer[i] ^= 0xff;
  47342. }
  47343. }
  47344. return imgData;
  47345. }
  47346. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  47347. let imageLength = originalHeight * rowBytes;
  47348. switch (this.colorSpace.name) {
  47349. case "DeviceGray":
  47350. imageLength *= 3;
  47351. case "DeviceRGB":
  47352. case "DeviceCMYK":
  47353. imgData.kind = _util.ImageKind.RGB_24BPP;
  47354. imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
  47355. return imgData;
  47356. }
  47357. }
  47358. }
  47359. imgArray = this.getImageBytes(originalHeight * rowBytes);
  47360. var actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  47361. var comps = this.getComponents(imgArray);
  47362. var alpha01, maybeUndoPreblend;
  47363. if (!forceRGBA && !this.smask && !this.mask) {
  47364. imgData.kind = _util.ImageKind.RGB_24BPP;
  47365. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  47366. alpha01 = 0;
  47367. maybeUndoPreblend = false;
  47368. } else {
  47369. imgData.kind = _util.ImageKind.RGBA_32BPP;
  47370. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  47371. alpha01 = 1;
  47372. maybeUndoPreblend = true;
  47373. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  47374. }
  47375. if (this.needsDecode) {
  47376. this.decodeBuffer(comps);
  47377. }
  47378. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  47379. if (maybeUndoPreblend) {
  47380. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  47381. }
  47382. return imgData;
  47383. }
  47384. fillGrayBuffer(buffer) {
  47385. var numComps = this.numComps;
  47386. if (numComps !== 1) {
  47387. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  47388. }
  47389. var width = this.width;
  47390. var height = this.height;
  47391. var bpc = this.bpc;
  47392. var rowBytes = width * numComps * bpc + 7 >> 3;
  47393. var imgArray = this.getImageBytes(height * rowBytes);
  47394. var comps = this.getComponents(imgArray);
  47395. var i, length;
  47396. if (bpc === 1) {
  47397. length = width * height;
  47398. if (this.needsDecode) {
  47399. for (i = 0; i < length; ++i) {
  47400. buffer[i] = comps[i] - 1 & 255;
  47401. }
  47402. } else {
  47403. for (i = 0; i < length; ++i) {
  47404. buffer[i] = -comps[i] & 255;
  47405. }
  47406. }
  47407. return;
  47408. }
  47409. if (this.needsDecode) {
  47410. this.decodeBuffer(comps);
  47411. }
  47412. length = width * height;
  47413. var scale = 255 / ((1 << bpc) - 1);
  47414. for (i = 0; i < length; ++i) {
  47415. buffer[i] = scale * comps[i];
  47416. }
  47417. }
  47418. getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
  47419. this.image.reset();
  47420. this.image.drawWidth = drawWidth || this.width;
  47421. this.image.drawHeight = drawHeight || this.height;
  47422. this.image.forceRGB = !!forceRGB;
  47423. return this.image.getBytes(length, true);
  47424. }
  47425. }
  47426. exports.PDFImage = PDFImage;
  47427. /***/ }),
  47428. /* 48 */
  47429. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47430. Object.defineProperty(exports, "__esModule", ({
  47431. value: true
  47432. }));
  47433. exports.incrementalUpdate = incrementalUpdate;
  47434. exports.writeDict = writeDict;
  47435. var _util = __w_pdfjs_require__(2);
  47436. var _primitives = __w_pdfjs_require__(5);
  47437. var _core_utils = __w_pdfjs_require__(8);
  47438. var _xml_parser = __w_pdfjs_require__(26);
  47439. var _crypto = __w_pdfjs_require__(22);
  47440. function writeDict(dict, buffer, transform) {
  47441. buffer.push("<<");
  47442. for (const key of dict.getKeys()) {
  47443. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  47444. writeValue(dict.getRaw(key), buffer, transform);
  47445. }
  47446. buffer.push(">>");
  47447. }
  47448. function writeStream(stream, buffer, transform) {
  47449. writeDict(stream.dict, buffer, transform);
  47450. buffer.push(" stream\n");
  47451. let string = (0, _util.bytesToString)(stream.getBytes());
  47452. if (transform !== null) {
  47453. string = transform.encryptString(string);
  47454. }
  47455. buffer.push(string);
  47456. buffer.push("\nendstream\n");
  47457. }
  47458. function writeArray(array, buffer, transform) {
  47459. buffer.push("[");
  47460. let first = true;
  47461. for (const val of array) {
  47462. if (!first) {
  47463. buffer.push(" ");
  47464. } else {
  47465. first = false;
  47466. }
  47467. writeValue(val, buffer, transform);
  47468. }
  47469. buffer.push("]");
  47470. }
  47471. function numberToString(value) {
  47472. if (Number.isInteger(value)) {
  47473. return value.toString();
  47474. }
  47475. const roundedValue = Math.round(value * 100);
  47476. if (roundedValue % 100 === 0) {
  47477. return (roundedValue / 100).toString();
  47478. }
  47479. if (roundedValue % 10 === 0) {
  47480. return value.toFixed(1);
  47481. }
  47482. return value.toFixed(2);
  47483. }
  47484. function writeValue(value, buffer, transform) {
  47485. if ((0, _primitives.isName)(value)) {
  47486. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  47487. } else if ((0, _primitives.isRef)(value)) {
  47488. buffer.push(`${value.num} ${value.gen} R`);
  47489. } else if (Array.isArray(value)) {
  47490. writeArray(value, buffer, transform);
  47491. } else if (typeof value === "string") {
  47492. if (transform !== null) {
  47493. value = transform.encryptString(value);
  47494. }
  47495. buffer.push(`(${(0, _util.escapeString)(value)})`);
  47496. } else if (typeof value === "number") {
  47497. buffer.push(numberToString(value));
  47498. } else if ((0, _primitives.isDict)(value)) {
  47499. writeDict(value, buffer, transform);
  47500. } else if ((0, _primitives.isStream)(value)) {
  47501. writeStream(value, buffer, transform);
  47502. }
  47503. }
  47504. function writeInt(number, size, offset, buffer) {
  47505. for (let i = size + offset - 1; i > offset - 1; i--) {
  47506. buffer[i] = number & 0xff;
  47507. number >>= 8;
  47508. }
  47509. return offset + size;
  47510. }
  47511. function writeString(string, offset, buffer) {
  47512. for (let i = 0, len = string.length; i < len; i++) {
  47513. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  47514. }
  47515. }
  47516. function computeMD5(filesize, xrefInfo) {
  47517. const time = Math.floor(Date.now() / 1000);
  47518. const filename = xrefInfo.filename || "";
  47519. const md5Buffer = [time.toString(), filename, filesize.toString()];
  47520. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  47521. for (const value of Object.values(xrefInfo.info)) {
  47522. md5Buffer.push(value);
  47523. md5BufferLen += value.length;
  47524. }
  47525. const array = new Uint8Array(md5BufferLen);
  47526. let offset = 0;
  47527. for (const str of md5Buffer) {
  47528. writeString(str, offset, array);
  47529. offset += str.length;
  47530. }
  47531. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  47532. }
  47533. function updateXFA(datasetsRef, newRefs, xref) {
  47534. if (datasetsRef === null || xref === null) {
  47535. return;
  47536. }
  47537. const datasets = xref.fetchIfRef(datasetsRef);
  47538. const str = (0, _util.bytesToString)(datasets.getBytes());
  47539. const xml = new _xml_parser.SimpleXMLParser({
  47540. hasAttributes: true
  47541. }).parseFromString(str);
  47542. for (const {
  47543. xfa
  47544. } of newRefs) {
  47545. if (!xfa) {
  47546. continue;
  47547. }
  47548. const {
  47549. path,
  47550. value
  47551. } = xfa;
  47552. if (!path) {
  47553. continue;
  47554. }
  47555. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  47556. if (node) {
  47557. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  47558. } else {
  47559. (0, _util.warn)(`Node not found for path: ${path}`);
  47560. }
  47561. }
  47562. const buffer = [];
  47563. xml.documentElement.dump(buffer);
  47564. let updatedXml = buffer.join("");
  47565. const encrypt = xref.encrypt;
  47566. if (encrypt) {
  47567. const transform = encrypt.createCipherTransform(datasetsRef.num, datasetsRef.gen);
  47568. updatedXml = transform.encryptString(updatedXml);
  47569. }
  47570. const data = `${datasetsRef.num} ${datasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${updatedXml.length}>>\nstream\n` + updatedXml + "\nendstream\nendobj\n";
  47571. newRefs.push({
  47572. ref: datasetsRef,
  47573. data
  47574. });
  47575. }
  47576. function incrementalUpdate({
  47577. originalData,
  47578. xrefInfo,
  47579. newRefs,
  47580. xref = null,
  47581. datasetsRef = null
  47582. }) {
  47583. updateXFA(datasetsRef, newRefs, xref);
  47584. const newXref = new _primitives.Dict(null);
  47585. const refForXrefTable = xrefInfo.newRef;
  47586. let buffer, baseOffset;
  47587. const lastByte = originalData[originalData.length - 1];
  47588. if (lastByte === 0x0a || lastByte === 0x0d) {
  47589. buffer = [];
  47590. baseOffset = originalData.length;
  47591. } else {
  47592. buffer = ["\n"];
  47593. baseOffset = originalData.length + 1;
  47594. }
  47595. newXref.set("Size", refForXrefTable.num + 1);
  47596. newXref.set("Prev", xrefInfo.startXRef);
  47597. newXref.set("Type", _primitives.Name.get("XRef"));
  47598. if (xrefInfo.rootRef !== null) {
  47599. newXref.set("Root", xrefInfo.rootRef);
  47600. }
  47601. if (xrefInfo.infoRef !== null) {
  47602. newXref.set("Info", xrefInfo.infoRef);
  47603. }
  47604. if (xrefInfo.encrypt !== null) {
  47605. newXref.set("Encrypt", xrefInfo.encrypt);
  47606. }
  47607. newRefs.push({
  47608. ref: refForXrefTable,
  47609. data: ""
  47610. });
  47611. newRefs = newRefs.sort((a, b) => {
  47612. return a.ref.num - b.ref.num;
  47613. });
  47614. const xrefTableData = [[0, 1, 0xffff]];
  47615. const indexes = [0, 1];
  47616. let maxOffset = 0;
  47617. for (const {
  47618. ref,
  47619. data
  47620. } of newRefs) {
  47621. maxOffset = Math.max(maxOffset, baseOffset);
  47622. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  47623. baseOffset += data.length;
  47624. indexes.push(ref.num);
  47625. indexes.push(1);
  47626. buffer.push(data);
  47627. }
  47628. newXref.set("Index", indexes);
  47629. if (xrefInfo.fileIds.length !== 0) {
  47630. const md5 = computeMD5(baseOffset, xrefInfo);
  47631. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  47632. }
  47633. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  47634. const sizes = [1, offsetSize, 2];
  47635. const structSize = sizes[0] + sizes[1] + sizes[2];
  47636. const tableLength = structSize * xrefTableData.length;
  47637. newXref.set("W", sizes);
  47638. newXref.set("Length", tableLength);
  47639. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  47640. writeDict(newXref, buffer, null);
  47641. buffer.push(" stream\n");
  47642. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  47643. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  47644. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  47645. array.set(originalData);
  47646. let offset = originalData.length;
  47647. for (const str of buffer) {
  47648. writeString(str, offset, array);
  47649. offset += str.length;
  47650. }
  47651. for (const [type, objOffset, gen] of xrefTableData) {
  47652. offset = writeInt(type, sizes[0], offset, array);
  47653. offset = writeInt(objOffset, sizes[1], offset, array);
  47654. offset = writeInt(gen, sizes[2], offset, array);
  47655. }
  47656. writeString(footer, offset, array);
  47657. return array;
  47658. }
  47659. /***/ }),
  47660. /* 49 */
  47661. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47662. Object.defineProperty(exports, "__esModule", ({
  47663. value: true
  47664. }));
  47665. exports.XFAFactory = void 0;
  47666. var _xfa_object = __w_pdfjs_require__(50);
  47667. var _bind = __w_pdfjs_require__(53);
  47668. var _parser = __w_pdfjs_require__(57);
  47669. class XFAFactory {
  47670. constructor(data) {
  47671. try {
  47672. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  47673. this.form = new _bind.Binder(this.root).bind();
  47674. this.pages = this.form[_xfa_object.$toHTML]();
  47675. } catch (e) {
  47676. console.log(e);
  47677. }
  47678. }
  47679. getPage(pageIndex) {
  47680. return this.pages.children[pageIndex];
  47681. }
  47682. get numberPages() {
  47683. return this.pages.children.length;
  47684. }
  47685. static _createDocument(data) {
  47686. if (!data["/xdp:xdp"]) {
  47687. return data["xdp:xdp"];
  47688. }
  47689. return Object.values(data).join("");
  47690. }
  47691. }
  47692. exports.XFAFactory = XFAFactory;
  47693. /***/ }),
  47694. /* 50 */
  47695. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47696. Object.defineProperty(exports, "__esModule", ({
  47697. value: true
  47698. }));
  47699. exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject = exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject = exports.$uid = exports.$toStyle = exports.$toHTML = exports.$text = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$resolvePrototypes = exports.$removeChild = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = exports.$nodeName = exports.$namespaceId = exports.$isTransparent = exports.$isDescendent = exports.$isDataValue = exports.$insertAt = exports.$indexOf = exports.$hasSettableValue = exports.$hasItem = exports.$global = exports.$getRealChildrenByNameIt = exports.$getParent = exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = exports.$getChildren = exports.$getAttributeIt = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$clean = exports.$childrenToHTML = exports.$appendChild = void 0;
  47700. var _utils = __w_pdfjs_require__(51);
  47701. var _util = __w_pdfjs_require__(2);
  47702. var _namespaces = __w_pdfjs_require__(52);
  47703. const $appendChild = Symbol();
  47704. exports.$appendChild = $appendChild;
  47705. const $childrenToHTML = Symbol();
  47706. exports.$childrenToHTML = $childrenToHTML;
  47707. const $clean = Symbol();
  47708. exports.$clean = $clean;
  47709. const $cleanup = Symbol();
  47710. exports.$cleanup = $cleanup;
  47711. const $clone = Symbol();
  47712. exports.$clone = $clone;
  47713. const $consumed = Symbol();
  47714. exports.$consumed = $consumed;
  47715. const $content = Symbol("content");
  47716. exports.$content = $content;
  47717. const $data = Symbol("data");
  47718. exports.$data = $data;
  47719. const $dump = Symbol();
  47720. exports.$dump = $dump;
  47721. const $extra = Symbol("extra");
  47722. exports.$extra = $extra;
  47723. const $finalize = Symbol();
  47724. exports.$finalize = $finalize;
  47725. const $getAttributeIt = Symbol();
  47726. exports.$getAttributeIt = $getAttributeIt;
  47727. const $getChildrenByClass = Symbol();
  47728. exports.$getChildrenByClass = $getChildrenByClass;
  47729. const $getChildrenByName = Symbol();
  47730. exports.$getChildrenByName = $getChildrenByName;
  47731. const $getChildrenByNameIt = Symbol();
  47732. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  47733. const $getRealChildrenByNameIt = Symbol();
  47734. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  47735. const $getChildren = Symbol();
  47736. exports.$getChildren = $getChildren;
  47737. const $getParent = Symbol();
  47738. exports.$getParent = $getParent;
  47739. const $global = Symbol();
  47740. exports.$global = $global;
  47741. const $hasItem = Symbol();
  47742. exports.$hasItem = $hasItem;
  47743. const $hasSettableValue = Symbol();
  47744. exports.$hasSettableValue = $hasSettableValue;
  47745. const $indexOf = Symbol();
  47746. exports.$indexOf = $indexOf;
  47747. const $insertAt = Symbol();
  47748. exports.$insertAt = $insertAt;
  47749. const $isDataValue = Symbol();
  47750. exports.$isDataValue = $isDataValue;
  47751. const $isDescendent = Symbol();
  47752. exports.$isDescendent = $isDescendent;
  47753. const $isTransparent = Symbol();
  47754. exports.$isTransparent = $isTransparent;
  47755. const $lastAttribute = Symbol();
  47756. const $namespaceId = Symbol("namespaceId");
  47757. exports.$namespaceId = $namespaceId;
  47758. const $nodeName = Symbol("nodeName");
  47759. exports.$nodeName = $nodeName;
  47760. const $nsAttributes = Symbol();
  47761. exports.$nsAttributes = $nsAttributes;
  47762. const $onChild = Symbol();
  47763. exports.$onChild = $onChild;
  47764. const $onChildCheck = Symbol();
  47765. exports.$onChildCheck = $onChildCheck;
  47766. const $onText = Symbol();
  47767. exports.$onText = $onText;
  47768. const $removeChild = Symbol();
  47769. exports.$removeChild = $removeChild;
  47770. const $resolvePrototypes = Symbol();
  47771. exports.$resolvePrototypes = $resolvePrototypes;
  47772. const $setId = Symbol();
  47773. exports.$setId = $setId;
  47774. const $setSetAttributes = Symbol();
  47775. exports.$setSetAttributes = $setSetAttributes;
  47776. const $setValue = Symbol();
  47777. exports.$setValue = $setValue;
  47778. const $text = Symbol();
  47779. exports.$text = $text;
  47780. const $toHTML = Symbol();
  47781. exports.$toHTML = $toHTML;
  47782. const $toStyle = Symbol();
  47783. exports.$toStyle = $toStyle;
  47784. const $uid = Symbol("uid");
  47785. exports.$uid = $uid;
  47786. const _applyPrototype = Symbol();
  47787. const _attributes = Symbol();
  47788. const _attributeNames = Symbol();
  47789. const _children = Symbol("_children");
  47790. const _cloneAttribute = Symbol();
  47791. const _dataValue = Symbol();
  47792. const _defaultValue = Symbol();
  47793. const _getPrototype = Symbol();
  47794. const _getUnsetAttributes = Symbol();
  47795. const _hasChildren = Symbol();
  47796. const _max = Symbol();
  47797. const _options = Symbol();
  47798. const _parent = Symbol("parent");
  47799. const _setAttributes = Symbol();
  47800. const _validator = Symbol();
  47801. let uid = 0;
  47802. class XFAObject {
  47803. constructor(nsId, name, hasChildren = false) {
  47804. this[$namespaceId] = nsId;
  47805. this[$nodeName] = name;
  47806. this[_hasChildren] = hasChildren;
  47807. this[_parent] = null;
  47808. this[_children] = [];
  47809. this[$uid] = `${name}${uid++}`;
  47810. }
  47811. [$onChild](child) {
  47812. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  47813. return false;
  47814. }
  47815. const name = child[$nodeName];
  47816. const node = this[name];
  47817. if (node instanceof XFAObjectArray) {
  47818. if (node.push(child)) {
  47819. this[$appendChild](child);
  47820. return true;
  47821. }
  47822. } else {
  47823. if (node !== null) {
  47824. this[$removeChild](node);
  47825. }
  47826. this[name] = child;
  47827. this[$appendChild](child);
  47828. return true;
  47829. }
  47830. let id = "";
  47831. if (this.id) {
  47832. id = ` (id: ${this.id})`;
  47833. } else if (this.name) {
  47834. id = ` (name: ${this.name} ${this.h.value})`;
  47835. }
  47836. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  47837. return false;
  47838. }
  47839. [$onChildCheck](child) {
  47840. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  47841. }
  47842. [$setId](ids) {
  47843. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  47844. ids.set(this.id, this);
  47845. }
  47846. }
  47847. [$appendChild](child) {
  47848. child[_parent] = this;
  47849. this[_children].push(child);
  47850. }
  47851. [$removeChild](child) {
  47852. const i = this[_children].indexOf(child);
  47853. this[_children].splice(i, 1);
  47854. }
  47855. [$hasSettableValue]() {
  47856. return this.hasOwnProperty("value");
  47857. }
  47858. [$setValue](_) {}
  47859. [$onText](_) {}
  47860. [$finalize]() {}
  47861. [$clean](builder) {
  47862. delete this[_hasChildren];
  47863. if (this[$cleanup]) {
  47864. builder.clean(this[$cleanup]);
  47865. delete this[$cleanup];
  47866. }
  47867. }
  47868. [$hasItem]() {
  47869. return false;
  47870. }
  47871. [$indexOf](child) {
  47872. return this[_children].indexOf(child);
  47873. }
  47874. [$insertAt](i, child) {
  47875. child[_parent] = this;
  47876. this[_children].splice(i, 0, child);
  47877. }
  47878. [$isTransparent]() {
  47879. return this.name === "";
  47880. }
  47881. [$lastAttribute]() {
  47882. return "";
  47883. }
  47884. [$text]() {
  47885. if (this[_children].length === 0) {
  47886. return this[$content];
  47887. }
  47888. return this[_children].map(c => c[$text]()).join("");
  47889. }
  47890. get [_attributeNames]() {
  47891. const proto = Object.getPrototypeOf(this);
  47892. if (!proto._attributes) {
  47893. const attributes = proto._attributes = new Set();
  47894. for (const name of Object.getOwnPropertyNames(this)) {
  47895. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  47896. break;
  47897. }
  47898. attributes.add(name);
  47899. }
  47900. }
  47901. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  47902. }
  47903. [$isDescendent](parent) {
  47904. let node = this;
  47905. while (node) {
  47906. if (node === parent) {
  47907. return true;
  47908. }
  47909. node = node[$getParent]();
  47910. }
  47911. return false;
  47912. }
  47913. [$getParent]() {
  47914. return this[_parent];
  47915. }
  47916. [$getChildren](name = null) {
  47917. if (!name) {
  47918. return this[_children];
  47919. }
  47920. return this[name];
  47921. }
  47922. [$dump]() {
  47923. const dumped = Object.create(null);
  47924. if (this[$content]) {
  47925. dumped.$content = this[$content];
  47926. }
  47927. for (const name of Object.getOwnPropertyNames(this)) {
  47928. const value = this[name];
  47929. if (value === null) {
  47930. continue;
  47931. }
  47932. if (value instanceof XFAObject) {
  47933. dumped[name] = value[$dump]();
  47934. } else if (value instanceof XFAObjectArray) {
  47935. if (!value.isEmpty()) {
  47936. dumped[name] = value.dump();
  47937. }
  47938. } else {
  47939. dumped[name] = value;
  47940. }
  47941. }
  47942. return dumped;
  47943. }
  47944. [$toStyle]() {
  47945. return null;
  47946. }
  47947. [$toHTML]() {
  47948. return null;
  47949. }
  47950. [$childrenToHTML]({
  47951. filter = null,
  47952. include = true
  47953. }) {
  47954. const res = [];
  47955. this[$getChildren]().forEach(node => {
  47956. if (!filter || include === filter.has(node[$nodeName])) {
  47957. const html = node[$toHTML]();
  47958. if (html) {
  47959. res.push(html);
  47960. }
  47961. }
  47962. });
  47963. return res;
  47964. }
  47965. [$setSetAttributes](attributes) {
  47966. if (attributes.use || attributes.id) {
  47967. this[_setAttributes] = new Set(Object.keys(attributes));
  47968. }
  47969. }
  47970. [_getUnsetAttributes](protoAttributes) {
  47971. const allAttr = this[_attributeNames];
  47972. const setAttr = this[_setAttributes];
  47973. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  47974. }
  47975. [$resolvePrototypes](ids, ancestors = new Set()) {
  47976. for (const child of this[_children]) {
  47977. const proto = child[_getPrototype](ids, ancestors);
  47978. if (proto) {
  47979. child[_applyPrototype](proto, ids, ancestors);
  47980. } else {
  47981. child[$resolvePrototypes](ids, ancestors);
  47982. }
  47983. }
  47984. }
  47985. [_getPrototype](ids, ancestors) {
  47986. const {
  47987. use
  47988. } = this;
  47989. if (use && use.startsWith("#")) {
  47990. const id = use.slice(1);
  47991. const proto = ids.get(id);
  47992. this.use = "";
  47993. if (!proto) {
  47994. (0, _util.warn)(`XFA - Invalid prototype id: ${id}.`);
  47995. return null;
  47996. }
  47997. if (proto[$nodeName] !== this[$nodeName]) {
  47998. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  47999. return null;
  48000. }
  48001. if (ancestors.has(proto)) {
  48002. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  48003. return null;
  48004. }
  48005. ancestors.add(proto);
  48006. const protoProto = proto[_getPrototype](ids, ancestors);
  48007. if (!protoProto) {
  48008. ancestors.delete(proto);
  48009. return proto;
  48010. }
  48011. proto[_applyPrototype](protoProto, ids, ancestors);
  48012. ancestors.delete(proto);
  48013. return proto;
  48014. }
  48015. return null;
  48016. }
  48017. [_applyPrototype](proto, ids, ancestors) {
  48018. if (ancestors.has(proto)) {
  48019. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  48020. return;
  48021. }
  48022. if (!this[$content] && proto[$content]) {
  48023. this[$content] = proto[$content];
  48024. }
  48025. const newAncestors = new Set(ancestors);
  48026. newAncestors.add(proto);
  48027. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  48028. this[unsetAttrName] = proto[unsetAttrName];
  48029. if (this[_setAttributes]) {
  48030. this[_setAttributes].add(unsetAttrName);
  48031. }
  48032. }
  48033. for (const name of Object.getOwnPropertyNames(this)) {
  48034. if (this[_attributeNames].has(name)) {
  48035. continue;
  48036. }
  48037. const value = this[name];
  48038. const protoValue = proto[name];
  48039. if (value instanceof XFAObjectArray) {
  48040. for (const child of value[_children]) {
  48041. child[$resolvePrototypes](ids, ancestors);
  48042. }
  48043. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  48044. const child = proto[_children][i][$clone]();
  48045. if (value.push(child)) {
  48046. child[_parent] = this;
  48047. this[_children].push(child);
  48048. child[$resolvePrototypes](ids, newAncestors);
  48049. } else {
  48050. break;
  48051. }
  48052. }
  48053. continue;
  48054. }
  48055. if (value !== null) {
  48056. value[$resolvePrototypes](ids, ancestors);
  48057. continue;
  48058. }
  48059. if (protoValue !== null) {
  48060. const child = protoValue[$clone]();
  48061. child[_parent] = this;
  48062. this[name] = child;
  48063. this[_children].push(child);
  48064. child[$resolvePrototypes](ids, newAncestors);
  48065. }
  48066. }
  48067. }
  48068. static [_cloneAttribute](obj) {
  48069. if (Array.isArray(obj)) {
  48070. return obj.map(x => XFAObject[_cloneAttribute](x));
  48071. }
  48072. if (obj instanceof Object) {
  48073. return Object.assign({}, obj);
  48074. }
  48075. return obj;
  48076. }
  48077. [$clone]() {
  48078. const clone = Object.create(Object.getPrototypeOf(this));
  48079. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  48080. try {
  48081. clone[$symbol] = this[$symbol];
  48082. } catch (_) {
  48083. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  48084. }
  48085. }
  48086. clone[_children] = [];
  48087. for (const name of Object.getOwnPropertyNames(this)) {
  48088. if (this[_attributeNames].has(name)) {
  48089. clone[name] = XFAObject[_cloneAttribute](this[name]);
  48090. continue;
  48091. }
  48092. const value = this[name];
  48093. if (value instanceof XFAObjectArray) {
  48094. clone[name] = new XFAObjectArray(value[_max]);
  48095. } else {
  48096. clone[name] = null;
  48097. }
  48098. }
  48099. for (const child of this[_children]) {
  48100. const name = child[$nodeName];
  48101. const clonedChild = child[$clone]();
  48102. clone[_children].push(clonedChild);
  48103. clonedChild[_parent] = clone;
  48104. if (clone[name] === null) {
  48105. clone[name] = clonedChild;
  48106. } else {
  48107. clone[name][_children].push(clonedChild);
  48108. }
  48109. }
  48110. return clone;
  48111. }
  48112. [$getChildren](name = null) {
  48113. if (!name) {
  48114. return this[_children];
  48115. }
  48116. return this[_children].filter(c => c[$nodeName] === name);
  48117. }
  48118. [$getChildrenByClass](name) {
  48119. return this[name];
  48120. }
  48121. [$getChildrenByName](name, allTransparent, first = true) {
  48122. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  48123. }
  48124. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  48125. if (name === "parent") {
  48126. yield this[_parent];
  48127. return;
  48128. }
  48129. for (const child of this[_children]) {
  48130. if (child[$nodeName] === name) {
  48131. yield child;
  48132. }
  48133. if (child.name === name) {
  48134. yield child;
  48135. }
  48136. if (allTransparent || child[$isTransparent]()) {
  48137. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  48138. }
  48139. }
  48140. if (first && this[_attributeNames].has(name)) {
  48141. yield new XFAAttribute(this, name, this[name]);
  48142. }
  48143. }
  48144. }
  48145. exports.XFAObject = XFAObject;
  48146. class XFAObjectArray {
  48147. constructor(max = Infinity) {
  48148. this[_max] = max;
  48149. this[_children] = [];
  48150. }
  48151. push(child) {
  48152. const len = this[_children].length;
  48153. if (len <= this[_max]) {
  48154. this[_children].push(child);
  48155. return true;
  48156. }
  48157. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  48158. return false;
  48159. }
  48160. isEmpty() {
  48161. return this[_children].length === 0;
  48162. }
  48163. dump() {
  48164. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  48165. }
  48166. [$clone]() {
  48167. const clone = new XFAObjectArray(this[_max]);
  48168. clone[_children] = this[_children].map(c => c[$clone]());
  48169. return clone;
  48170. }
  48171. get children() {
  48172. return this[_children];
  48173. }
  48174. clear() {
  48175. this[_children].length = 0;
  48176. }
  48177. }
  48178. exports.XFAObjectArray = XFAObjectArray;
  48179. class XFAAttribute {
  48180. constructor(node, name, value) {
  48181. this[_parent] = node;
  48182. this[$nodeName] = name;
  48183. this[$content] = value;
  48184. this[$consumed] = false;
  48185. }
  48186. [$getParent]() {
  48187. return this[_parent];
  48188. }
  48189. [$isDataValue]() {
  48190. return true;
  48191. }
  48192. [$text]() {
  48193. return this[$content];
  48194. }
  48195. [$isDescendent](parent) {
  48196. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  48197. }
  48198. }
  48199. exports.XFAAttribute = XFAAttribute;
  48200. class XmlObject extends XFAObject {
  48201. constructor(nsId, name, attributes = {}) {
  48202. super(nsId, name);
  48203. this[$content] = "";
  48204. this[_dataValue] = null;
  48205. if (name !== "#text") {
  48206. const map = new Map();
  48207. this[_attributes] = map;
  48208. for (const [attrName, value] of Object.entries(attributes)) {
  48209. map.set(attrName, new XFAAttribute(this, attrName, value));
  48210. }
  48211. if (attributes.hasOwnProperty($nsAttributes)) {
  48212. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  48213. if (dataNode !== undefined) {
  48214. if (dataNode === "dataGroup") {
  48215. this[_dataValue] = false;
  48216. } else if (dataNode === "dataValue") {
  48217. this[_dataValue] = true;
  48218. }
  48219. }
  48220. }
  48221. }
  48222. this[$consumed] = false;
  48223. }
  48224. [$onChild](child) {
  48225. if (this[$content]) {
  48226. const node = new XmlObject(this[$namespaceId], "#text");
  48227. this[$appendChild](node);
  48228. node[$content] = this[$content];
  48229. this[$content] = "";
  48230. }
  48231. this[$appendChild](child);
  48232. return true;
  48233. }
  48234. [$onText](str) {
  48235. this[$content] += str;
  48236. }
  48237. [$finalize]() {
  48238. if (this[$content] && this[_children].length > 0) {
  48239. const node = new XmlObject(this[$namespaceId], "#text");
  48240. this[$appendChild](node);
  48241. node[$content] = this[$content];
  48242. delete this[$content];
  48243. }
  48244. }
  48245. [$toHTML]() {
  48246. if (this[$nodeName] === "#text") {
  48247. return {
  48248. name: "#text",
  48249. value: this[$content]
  48250. };
  48251. }
  48252. return null;
  48253. }
  48254. [$getChildren](name = null) {
  48255. if (!name) {
  48256. return this[_children];
  48257. }
  48258. return this[_children].filter(c => c[$nodeName] === name);
  48259. }
  48260. [$getChildrenByClass](name) {
  48261. const value = this[_attributes].get(name);
  48262. if (value !== undefined) {
  48263. return value;
  48264. }
  48265. return this[$getChildren](name);
  48266. }
  48267. *[$getChildrenByNameIt](name, allTransparent) {
  48268. const value = this[_attributes].get(name);
  48269. if (value) {
  48270. yield value;
  48271. }
  48272. for (const child of this[_children]) {
  48273. if (child[$nodeName] === name) {
  48274. yield child;
  48275. }
  48276. if (allTransparent) {
  48277. yield* child[$getChildrenByNameIt](name, allTransparent);
  48278. }
  48279. }
  48280. }
  48281. *[$getAttributeIt](name, skipConsumed) {
  48282. const value = this[_attributes].get(name);
  48283. if (value && (!skipConsumed || !value[$consumed])) {
  48284. yield value;
  48285. }
  48286. for (const child of this[_children]) {
  48287. yield* child[$getAttributeIt](name, skipConsumed);
  48288. }
  48289. }
  48290. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  48291. for (const child of this[_children]) {
  48292. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  48293. yield child;
  48294. }
  48295. if (allTransparent) {
  48296. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  48297. }
  48298. }
  48299. }
  48300. [$isDataValue]() {
  48301. if (this[_dataValue] === null) {
  48302. return this[_children].length === 0;
  48303. }
  48304. return this[_dataValue];
  48305. }
  48306. [$dump]() {
  48307. const dumped = Object.create(null);
  48308. if (this[$content]) {
  48309. dumped.$content = this[$content];
  48310. }
  48311. dumped.$name = this[$nodeName];
  48312. dumped.children = [];
  48313. for (const child of this[_children]) {
  48314. dumped.children.push(child[$dump]());
  48315. }
  48316. dumped.attributes = Object.create(null);
  48317. for (const [name, value] of this[_attributes]) {
  48318. dumped.attributes[name] = value[$content];
  48319. }
  48320. return dumped;
  48321. }
  48322. }
  48323. exports.XmlObject = XmlObject;
  48324. class ContentObject extends XFAObject {
  48325. constructor(nsId, name) {
  48326. super(nsId, name);
  48327. this[$content] = "";
  48328. }
  48329. [$onText](text) {
  48330. this[$content] += text;
  48331. }
  48332. [$finalize]() {}
  48333. }
  48334. exports.ContentObject = ContentObject;
  48335. class OptionObject extends ContentObject {
  48336. constructor(nsId, name, options) {
  48337. super(nsId, name);
  48338. this[_options] = options;
  48339. }
  48340. [$finalize]() {
  48341. this[$content] = (0, _utils.getKeyword)({
  48342. data: this[$content],
  48343. defaultValue: this[_options][0],
  48344. validate: k => this[_options].includes(k)
  48345. });
  48346. }
  48347. [$clean](builder) {
  48348. super[$clean](builder);
  48349. delete this[_options];
  48350. }
  48351. }
  48352. exports.OptionObject = OptionObject;
  48353. class StringObject extends ContentObject {
  48354. [$finalize]() {
  48355. this[$content] = this[$content].trim();
  48356. }
  48357. }
  48358. exports.StringObject = StringObject;
  48359. class IntegerObject extends ContentObject {
  48360. constructor(nsId, name, defaultValue, validator) {
  48361. super(nsId, name);
  48362. this[_defaultValue] = defaultValue;
  48363. this[_validator] = validator;
  48364. }
  48365. [$finalize]() {
  48366. this[$content] = (0, _utils.getInteger)({
  48367. data: this[$content],
  48368. defaultValue: this[_defaultValue],
  48369. validate: this[_validator]
  48370. });
  48371. }
  48372. [$clean](builder) {
  48373. super[$clean](builder);
  48374. delete this[_defaultValue];
  48375. delete this[_validator];
  48376. }
  48377. }
  48378. exports.IntegerObject = IntegerObject;
  48379. class Option01 extends IntegerObject {
  48380. constructor(nsId, name) {
  48381. super(nsId, name, 0, n => n === 1);
  48382. }
  48383. }
  48384. exports.Option01 = Option01;
  48385. class Option10 extends IntegerObject {
  48386. constructor(nsId, name) {
  48387. super(nsId, name, 1, n => n === 0);
  48388. }
  48389. }
  48390. exports.Option10 = Option10;
  48391. /***/ }),
  48392. /* 51 */
  48393. /***/ ((__unused_webpack_module, exports) => {
  48394. Object.defineProperty(exports, "__esModule", ({
  48395. value: true
  48396. }));
  48397. exports.getBBox = getBBox;
  48398. exports.getColor = getColor;
  48399. exports.getFloat = getFloat;
  48400. exports.getInteger = getInteger;
  48401. exports.getKeyword = getKeyword;
  48402. exports.getMeasurement = getMeasurement;
  48403. exports.getRatio = getRatio;
  48404. exports.getRelevant = getRelevant;
  48405. exports.getStringOption = getStringOption;
  48406. const dimConverters = {
  48407. pt: x => x,
  48408. cm: x => x / 2.54 * 72,
  48409. mm: x => x / (10 * 2.54) * 72,
  48410. in: x => x * 72
  48411. };
  48412. const measurementPattern = /([+-]?[0-9]+\.?[0-9]*)(.*)/;
  48413. function getInteger({
  48414. data,
  48415. defaultValue,
  48416. validate
  48417. }) {
  48418. if (!data) {
  48419. return defaultValue;
  48420. }
  48421. data = data.trim();
  48422. const n = parseInt(data, 10);
  48423. if (!isNaN(n) && validate(n)) {
  48424. return n;
  48425. }
  48426. return defaultValue;
  48427. }
  48428. function getFloat({
  48429. data,
  48430. defaultValue,
  48431. validate
  48432. }) {
  48433. if (!data) {
  48434. return defaultValue;
  48435. }
  48436. data = data.trim();
  48437. const n = parseFloat(data);
  48438. if (!isNaN(n) && validate(n)) {
  48439. return n;
  48440. }
  48441. return defaultValue;
  48442. }
  48443. function getKeyword({
  48444. data,
  48445. defaultValue,
  48446. validate
  48447. }) {
  48448. if (!data) {
  48449. return defaultValue;
  48450. }
  48451. data = data.trim();
  48452. if (validate(data)) {
  48453. return data;
  48454. }
  48455. return defaultValue;
  48456. }
  48457. function getStringOption(data, options) {
  48458. return getKeyword({
  48459. data,
  48460. defaultValue: options[0],
  48461. validate: k => options.includes(k)
  48462. });
  48463. }
  48464. function getMeasurement(str, def = "0") {
  48465. def = def || "0";
  48466. if (!str) {
  48467. return getMeasurement(def);
  48468. }
  48469. const match = str.trim().match(measurementPattern);
  48470. if (!match) {
  48471. return getMeasurement(def);
  48472. }
  48473. const [, valueStr, unit] = match;
  48474. const value = parseFloat(valueStr);
  48475. if (isNaN(value)) {
  48476. return getMeasurement(def);
  48477. }
  48478. if (value === 0) {
  48479. return 0;
  48480. }
  48481. const conv = dimConverters[unit];
  48482. if (conv) {
  48483. return conv(value);
  48484. }
  48485. return value;
  48486. }
  48487. function getRatio(data) {
  48488. if (!data) {
  48489. return {
  48490. num: 1,
  48491. den: 1
  48492. };
  48493. }
  48494. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  48495. if (ratio.length === 1) {
  48496. ratio.push(1);
  48497. }
  48498. if (ratio.length === 0) {
  48499. return {
  48500. num: 1,
  48501. den: 1
  48502. };
  48503. }
  48504. const [num, den] = ratio;
  48505. return {
  48506. num,
  48507. den
  48508. };
  48509. }
  48510. function getRelevant(data) {
  48511. if (!data) {
  48512. return [];
  48513. }
  48514. return data.trim().split(/\s+/).map(e => {
  48515. return {
  48516. excluded: e[0] === "-",
  48517. viewname: e.substring(1)
  48518. };
  48519. });
  48520. }
  48521. function getColor(data, def = [0, 0, 0]) {
  48522. let [r, g, b] = def;
  48523. if (!data) {
  48524. return {
  48525. r,
  48526. g,
  48527. b
  48528. };
  48529. }
  48530. const color = data.trim().split(/\s*,\s*/).map(c => Math.min(Math.max(0, parseInt(c.trim(), 10)), 255)).map(c => isNaN(c) ? 0 : c);
  48531. if (color.length < 3) {
  48532. return {
  48533. r,
  48534. g,
  48535. b
  48536. };
  48537. }
  48538. [r, g, b] = color;
  48539. return {
  48540. r,
  48541. g,
  48542. b
  48543. };
  48544. }
  48545. function getBBox(data) {
  48546. const def = -1;
  48547. if (!data) {
  48548. return {
  48549. x: def,
  48550. y: def,
  48551. width: def,
  48552. height: def
  48553. };
  48554. }
  48555. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  48556. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  48557. return {
  48558. x: def,
  48559. y: def,
  48560. width: def,
  48561. height: def
  48562. };
  48563. }
  48564. const [x, y, width, height] = bbox;
  48565. return {
  48566. x,
  48567. y,
  48568. width,
  48569. height
  48570. };
  48571. }
  48572. /***/ }),
  48573. /* 52 */
  48574. /***/ ((__unused_webpack_module, exports) => {
  48575. Object.defineProperty(exports, "__esModule", ({
  48576. value: true
  48577. }));
  48578. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  48579. const $buildXFAObject = Symbol();
  48580. exports.$buildXFAObject = $buildXFAObject;
  48581. const NamespaceIds = {
  48582. config: {
  48583. id: 0,
  48584. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  48585. },
  48586. connectionSet: {
  48587. id: 1,
  48588. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  48589. },
  48590. datasets: {
  48591. id: 2,
  48592. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  48593. },
  48594. form: {
  48595. id: 3,
  48596. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  48597. },
  48598. localeSet: {
  48599. id: 4,
  48600. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  48601. },
  48602. pdf: {
  48603. id: 5,
  48604. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  48605. },
  48606. signature: {
  48607. id: 6,
  48608. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  48609. },
  48610. sourceSet: {
  48611. id: 7,
  48612. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  48613. },
  48614. stylesheet: {
  48615. id: 8,
  48616. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  48617. },
  48618. template: {
  48619. id: 9,
  48620. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  48621. },
  48622. xdc: {
  48623. id: 10,
  48624. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  48625. },
  48626. xdp: {
  48627. id: 11,
  48628. check: ns => ns === "http://ns.adobe.com/xdp/"
  48629. },
  48630. xfdf: {
  48631. id: 12,
  48632. check: ns => ns === "http://ns.adobe.com/xfdf/"
  48633. },
  48634. xhtml: {
  48635. id: 13,
  48636. check: ns => ns === "http://www.w3.org/1999/xhtml"
  48637. },
  48638. xmpmeta: {
  48639. id: 14,
  48640. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  48641. }
  48642. };
  48643. exports.NamespaceIds = NamespaceIds;
  48644. /***/ }),
  48645. /* 53 */
  48646. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48647. Object.defineProperty(exports, "__esModule", ({
  48648. value: true
  48649. }));
  48650. exports.Binder = void 0;
  48651. var _xfa_object = __w_pdfjs_require__(50);
  48652. var _template = __w_pdfjs_require__(54);
  48653. var _som = __w_pdfjs_require__(56);
  48654. var _namespaces = __w_pdfjs_require__(52);
  48655. var _util = __w_pdfjs_require__(2);
  48656. function createText(content) {
  48657. const node = new _template.Text({});
  48658. node[_xfa_object.$content] = content;
  48659. return node;
  48660. }
  48661. class Binder {
  48662. constructor(root) {
  48663. this.root = root;
  48664. this.datasets = root.datasets;
  48665. if (root.datasets && root.datasets.data) {
  48666. this.emptyMerge = false;
  48667. this.data = root.datasets.data;
  48668. } else {
  48669. this.emptyMerge = true;
  48670. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  48671. }
  48672. this.root.form = this.form = root.template[_xfa_object.$clone]();
  48673. }
  48674. _isConsumeData() {
  48675. return !this.emptyMerge && this._mergeMode;
  48676. }
  48677. _isMatchTemplate() {
  48678. return !this._isConsumeData();
  48679. }
  48680. bind() {
  48681. this._bindElement(this.form, this.data);
  48682. return this.form;
  48683. }
  48684. getData() {
  48685. return this.data;
  48686. }
  48687. _bindValue(formNode, data, picture) {
  48688. if (formNode[_xfa_object.$hasSettableValue]()) {
  48689. if (data[_xfa_object.$isDataValue]()) {
  48690. const value = data[_xfa_object.$content].trim();
  48691. formNode[_xfa_object.$setValue](createText(value));
  48692. formNode[_xfa_object.$data] = data;
  48693. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  48694. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  48695. formNode[_xfa_object.$setValue](createText(value));
  48696. formNode[_xfa_object.$data] = data;
  48697. } else if (this._isConsumeData()) {
  48698. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  48699. }
  48700. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  48701. this._bindElement(formNode, data);
  48702. formNode[_xfa_object.$data] = data;
  48703. } else {
  48704. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  48705. }
  48706. }
  48707. _findDataByNameToConsume(name, dataNode, global) {
  48708. if (!name) {
  48709. return null;
  48710. }
  48711. let generator, match;
  48712. for (let i = 0; i < 3; i++) {
  48713. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  48714. match = generator.next().value;
  48715. if (match) {
  48716. return match;
  48717. }
  48718. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  48719. break;
  48720. }
  48721. dataNode = dataNode[_xfa_object.$getParent]();
  48722. }
  48723. if (!global) {
  48724. return null;
  48725. }
  48726. generator = this.datasets[_xfa_object.$getRealChildrenByNameIt](name, false, false);
  48727. while (true) {
  48728. match = generator.next().value;
  48729. if (!match) {
  48730. break;
  48731. }
  48732. if (match[_xfa_object.$global]) {
  48733. return match;
  48734. }
  48735. }
  48736. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  48737. match = generator.next().value;
  48738. if (match && match[_xfa_object.$isDataValue]()) {
  48739. return match;
  48740. }
  48741. return null;
  48742. }
  48743. _setProperties(formNode, dataNode) {
  48744. if (!formNode.hasOwnProperty("setProperty")) {
  48745. return;
  48746. }
  48747. for (const {
  48748. ref,
  48749. target,
  48750. connection
  48751. } of formNode.setProperty.children) {
  48752. if (connection) {
  48753. continue;
  48754. }
  48755. if (!ref) {
  48756. continue;
  48757. }
  48758. const [node] = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  48759. if (!node) {
  48760. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  48761. continue;
  48762. }
  48763. if (!node[_xfa_object.$isDescendent](this.data)) {
  48764. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  48765. continue;
  48766. }
  48767. const [targetNode] = (0, _som.searchNode)(this.root, formNode, target, false, false);
  48768. if (!targetNode) {
  48769. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  48770. continue;
  48771. }
  48772. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  48773. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  48774. continue;
  48775. }
  48776. const targetParent = targetNode[_xfa_object.$getParent]();
  48777. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  48778. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  48779. continue;
  48780. }
  48781. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  48782. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  48783. continue;
  48784. }
  48785. const content = node[_xfa_object.$text]();
  48786. const name = targetNode[_xfa_object.$nodeName];
  48787. if (targetNode instanceof _xfa_object.XFAAttribute) {
  48788. const attrs = Object.create(null);
  48789. attrs[name] = content;
  48790. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  48791. targetParent[name] = obj[name];
  48792. continue;
  48793. }
  48794. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  48795. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  48796. continue;
  48797. }
  48798. targetNode[_xfa_object.$data] = node;
  48799. targetNode[_xfa_object.$content] = content;
  48800. targetNode[_xfa_object.$finalize]();
  48801. }
  48802. }
  48803. _bindItems(formNode, dataNode) {
  48804. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  48805. return;
  48806. }
  48807. for (const item of formNode.items.children) {
  48808. formNode[_xfa_object.$removeChild](item);
  48809. }
  48810. formNode.items.clear();
  48811. const labels = new _template.Items({});
  48812. const values = new _template.Items({});
  48813. formNode[_xfa_object.$appendChild](labels);
  48814. formNode.items.push(labels);
  48815. formNode[_xfa_object.$appendChild](values);
  48816. formNode.items.push(values);
  48817. for (const {
  48818. ref,
  48819. labelRef,
  48820. valueRef,
  48821. connection
  48822. } of formNode.bindItems.children) {
  48823. if (connection) {
  48824. continue;
  48825. }
  48826. if (!ref) {
  48827. continue;
  48828. }
  48829. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  48830. if (!nodes) {
  48831. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  48832. continue;
  48833. }
  48834. for (const node of nodes) {
  48835. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  48836. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  48837. continue;
  48838. }
  48839. const [labelNode] = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  48840. if (!labelNode) {
  48841. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  48842. continue;
  48843. }
  48844. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  48845. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  48846. continue;
  48847. }
  48848. const [valueNode] = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  48849. if (!valueNode) {
  48850. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  48851. continue;
  48852. }
  48853. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  48854. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  48855. continue;
  48856. }
  48857. const label = createText(labelNode[_xfa_object.$text]());
  48858. const value = createText(valueNode[_xfa_object.$text]());
  48859. labels[_xfa_object.$appendChild](label);
  48860. labels.text.push(label);
  48861. values[_xfa_object.$appendChild](value);
  48862. values.text.push(value);
  48863. }
  48864. }
  48865. }
  48866. _bindOccurrences(formNode, matches, picture) {
  48867. let baseClone;
  48868. if (matches.length > 1) {
  48869. baseClone = formNode[_xfa_object.$clone]();
  48870. }
  48871. this._bindValue(formNode, matches[0], picture);
  48872. this._setProperties(formNode, matches[0]);
  48873. this._bindItems(formNode, matches[0]);
  48874. if (matches.length === 1) {
  48875. return;
  48876. }
  48877. const parent = formNode[_xfa_object.$getParent]();
  48878. const name = formNode[_xfa_object.$nodeName];
  48879. const pos = parent[_xfa_object.$indexOf](formNode);
  48880. for (let i = 1, ii = matches.length; i < ii; i++) {
  48881. const match = matches[i];
  48882. const clone = baseClone[_xfa_object.$clone]();
  48883. clone.occur.min = 1;
  48884. clone.occur.max = 1;
  48885. clone.occur.initial = 1;
  48886. parent[name].push(clone);
  48887. parent[_xfa_object.$insertAt](pos + i, clone);
  48888. this._bindValue(clone, match, picture);
  48889. this._setProperties(clone, match);
  48890. this._bindItems(clone, match);
  48891. }
  48892. }
  48893. _createOccurrences(formNode) {
  48894. if (!this.emptyMerge) {
  48895. return;
  48896. }
  48897. const {
  48898. occur
  48899. } = formNode;
  48900. if (!occur || occur.initial <= 1) {
  48901. return;
  48902. }
  48903. const parent = formNode[_xfa_object.$getParent]();
  48904. const name = formNode[_xfa_object.$nodeName];
  48905. for (let i = 0, ii = occur.initial; i < ii; i++) {
  48906. const clone = formNode[_xfa_object.$clone]();
  48907. clone.occur.min = 1;
  48908. clone.occur.max = 1;
  48909. clone.occur.initial = 1;
  48910. parent[name].push(clone);
  48911. parent[_xfa_object.$appendChild](clone);
  48912. }
  48913. }
  48914. _getOccurInfo(formNode) {
  48915. const {
  48916. occur
  48917. } = formNode;
  48918. const dataName = formNode.name;
  48919. if (!occur || !dataName) {
  48920. return [1, 1];
  48921. }
  48922. const max = occur.max === -1 ? Infinity : occur.max;
  48923. return [occur.min, max];
  48924. }
  48925. _bindElement(formNode, dataNode) {
  48926. const uselessNodes = [];
  48927. this._createOccurrences(formNode);
  48928. for (const child of formNode[_xfa_object.$getChildren]()) {
  48929. if (child[_xfa_object.$data]) {
  48930. continue;
  48931. }
  48932. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  48933. this._mergeMode = child.mergeMode === "consumeData";
  48934. }
  48935. let global = false;
  48936. let picture = null;
  48937. let ref = null;
  48938. let match = null;
  48939. if (child.bind) {
  48940. switch (child.bind.match) {
  48941. case "none":
  48942. continue;
  48943. case "global":
  48944. global = true;
  48945. break;
  48946. case "dataRef":
  48947. if (!child.bind.ref) {
  48948. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  48949. continue;
  48950. }
  48951. ref = child.bind.ref;
  48952. break;
  48953. default:
  48954. break;
  48955. }
  48956. if (child.bind.picture) {
  48957. picture = child.bind.picture[_xfa_object.$content];
  48958. }
  48959. }
  48960. const [min, max] = this._getOccurInfo(child);
  48961. if (ref) {
  48962. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  48963. if (match === null) {
  48964. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  48965. if (this._isConsumeData()) {
  48966. match[_xfa_object.$consumed] = true;
  48967. }
  48968. match = [match];
  48969. } else {
  48970. if (this._isConsumeData()) {
  48971. match = match.filter(node => !node[_xfa_object.$consumed]);
  48972. }
  48973. if (match.length > max) {
  48974. match = match.slice(0, max);
  48975. } else if (match.length === 0) {
  48976. match = null;
  48977. }
  48978. if (match && this._isConsumeData()) {
  48979. match.forEach(node => {
  48980. node[_xfa_object.$consumed] = true;
  48981. });
  48982. }
  48983. }
  48984. } else {
  48985. if (!child.name) {
  48986. this._bindElement(child, dataNode);
  48987. continue;
  48988. }
  48989. if (this._isConsumeData()) {
  48990. const matches = [];
  48991. while (matches.length < max) {
  48992. const found = this._findDataByNameToConsume(child.name, dataNode, global);
  48993. if (!found) {
  48994. break;
  48995. }
  48996. found[_xfa_object.$consumed] = true;
  48997. matches.push(found);
  48998. }
  48999. match = matches.length > 0 ? matches : null;
  49000. } else {
  49001. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, false).next().value;
  49002. if (!match) {
  49003. match = new _xfa_object.XmlObject(dataNode[_xfa_object.$namespaceId], child.name);
  49004. dataNode[_xfa_object.$appendChild](match);
  49005. }
  49006. match = [match];
  49007. }
  49008. }
  49009. if (match) {
  49010. if (match.length < min) {
  49011. (0, _util.warn)(`XFA - Must have at least ${min} occurrences: ${formNode[_xfa_object.$nodeName]}.`);
  49012. continue;
  49013. }
  49014. this._bindOccurrences(child, match, picture);
  49015. } else if (min > 0) {
  49016. this._bindElement(child, dataNode);
  49017. } else {
  49018. uselessNodes.push(child);
  49019. }
  49020. }
  49021. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  49022. }
  49023. }
  49024. exports.Binder = Binder;
  49025. /***/ }),
  49026. /* 54 */
  49027. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49028. Object.defineProperty(exports, "__esModule", ({
  49029. value: true
  49030. }));
  49031. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  49032. var _xfa_object = __w_pdfjs_require__(50);
  49033. var _namespaces = __w_pdfjs_require__(52);
  49034. var _utils = __w_pdfjs_require__(51);
  49035. var _html_utils = __w_pdfjs_require__(55);
  49036. var _util = __w_pdfjs_require__(2);
  49037. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  49038. function _setValue(templateNode, value) {
  49039. if (!templateNode.value) {
  49040. const nodeValue = new Value({});
  49041. templateNode[_xfa_object.$appendChild](nodeValue);
  49042. templateNode.value = nodeValue;
  49043. }
  49044. templateNode.value[_xfa_object.$setValue](value);
  49045. }
  49046. class AppearanceFilter extends _xfa_object.StringObject {
  49047. constructor(attributes) {
  49048. super(TEMPLATE_NS_ID, "appearanceFilter");
  49049. this.id = attributes.id || "";
  49050. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  49051. this.use = attributes.use || "";
  49052. this.usehref = attributes.usehref || "";
  49053. }
  49054. }
  49055. class Arc extends _xfa_object.XFAObject {
  49056. constructor(attributes) {
  49057. super(TEMPLATE_NS_ID, "arc", true);
  49058. this.circular = (0, _utils.getInteger)({
  49059. data: attributes.circular,
  49060. defaultValue: 0,
  49061. validate: x => x === 1
  49062. });
  49063. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  49064. this.id = attributes.id || "";
  49065. this.startAngle = (0, _utils.getFloat)({
  49066. data: attributes.startAngle,
  49067. defaultValue: 0,
  49068. validate: x => true
  49069. });
  49070. this.sweepAngle = (0, _utils.getFloat)({
  49071. data: attributes.sweepAngle,
  49072. defaultValue: 360,
  49073. validate: x => true
  49074. });
  49075. this.use = attributes.use || "";
  49076. this.usehref = attributes.usehref || "";
  49077. this.edge = null;
  49078. this.fill = null;
  49079. }
  49080. }
  49081. class Area extends _xfa_object.XFAObject {
  49082. constructor(attributes) {
  49083. super(TEMPLATE_NS_ID, "area", true);
  49084. this.colSpan = (0, _utils.getInteger)({
  49085. data: attributes.colSpan,
  49086. defaultValue: 1,
  49087. validate: n => n >= 1
  49088. });
  49089. this.id = attributes.id || "";
  49090. this.name = attributes.name || "";
  49091. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  49092. this.use = attributes.use || "";
  49093. this.usehref = attributes.usehref || "";
  49094. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  49095. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  49096. this.desc = null;
  49097. this.extras = null;
  49098. this.area = new _xfa_object.XFAObjectArray();
  49099. this.draw = new _xfa_object.XFAObjectArray();
  49100. this.exObject = new _xfa_object.XFAObjectArray();
  49101. this.exclGroup = new _xfa_object.XFAObjectArray();
  49102. this.field = new _xfa_object.XFAObjectArray();
  49103. this.subform = new _xfa_object.XFAObjectArray();
  49104. this.subformSet = new _xfa_object.XFAObjectArray();
  49105. }
  49106. [_xfa_object.$isTransparent]() {
  49107. return true;
  49108. }
  49109. }
  49110. class Assist extends _xfa_object.XFAObject {
  49111. constructor(attributes) {
  49112. super(TEMPLATE_NS_ID, "assist", true);
  49113. this.id = attributes.id || "";
  49114. this.role = attributes.role || "";
  49115. this.use = attributes.use || "";
  49116. this.usehref = attributes.usehref || "";
  49117. this.speak = null;
  49118. this.toolTip = null;
  49119. }
  49120. }
  49121. class Barcode extends _xfa_object.XFAObject {
  49122. constructor(attributes) {
  49123. super(TEMPLATE_NS_ID, "barcode", true);
  49124. this.charEncoding = (0, _utils.getKeyword)({
  49125. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  49126. defaultValue: "",
  49127. validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-[0-9]{2}/)
  49128. });
  49129. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  49130. this.dataColumnCount = (0, _utils.getInteger)({
  49131. data: attributes.dataColumnCount,
  49132. defaultValue: -1,
  49133. validate: x => x >= 0
  49134. });
  49135. this.dataLength = (0, _utils.getInteger)({
  49136. data: attributes.dataLength,
  49137. defaultValue: -1,
  49138. validate: x => x >= 0
  49139. });
  49140. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  49141. this.dataRowCount = (0, _utils.getInteger)({
  49142. data: attributes.dataRowCount,
  49143. defaultValue: -1,
  49144. validate: x => x >= 0
  49145. });
  49146. this.endChar = attributes.endChar || "";
  49147. this.errorCorrectionLevel = (0, _utils.getInteger)({
  49148. data: attributes.errorCorrectionLevel,
  49149. defaultValue: -1,
  49150. validate: x => x >= 0 && x <= 8
  49151. });
  49152. this.id = attributes.id || "";
  49153. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  49154. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  49155. this.printCheckDigit = (0, _utils.getInteger)({
  49156. data: attributes.printCheckDigit,
  49157. defaultValue: 0,
  49158. validate: x => x === 1
  49159. });
  49160. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  49161. this.startChar = attributes.startChar || "";
  49162. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  49163. this.truncate = (0, _utils.getInteger)({
  49164. data: attributes.truncate,
  49165. defaultValue: 0,
  49166. validate: x => x === 1
  49167. });
  49168. this.type = (0, _utils.getStringOption)(attributes.type ? attributes.type.toLowerCase() : "", ["aztec", "codabar", "code2of5industrial", "code2of5interleaved", "code2of5matrix", "code2of5standard", "code3of9", "code3of9extended", "code11", "code49", "code93", "code128", "code128a", "code128b", "code128c", "code128sscc", "datamatrix", "ean8", "ean8add2", "ean8add5", "ean13", "ean13add2", "ean13add5", "ean13pwcd", "fim", "logmars", "maxicode", "msi", "pdf417", "pdf417macro", "plessey", "postauscust2", "postauscust3", "postausreplypaid", "postausstandard", "postukrm4scc", "postusdpbc", "postusimb", "postusstandard", "postus5zip", "qrcode", "rfid", "rss14", "rss14expanded", "rss14limited", "rss14stacked", "rss14stackedomni", "rss14truncated", "telepen", "ucc128", "ucc128random", "ucc128sscc", "upca", "upcaadd2", "upcaadd5", "upcapwcd", "upce", "upceadd2", "upceadd5", "upcean2", "upcean5", "upsmaxicode"]);
  49169. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  49170. this.use = attributes.use || "";
  49171. this.usehref = attributes.usehref || "";
  49172. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  49173. this.encrypt = null;
  49174. this.extras = null;
  49175. }
  49176. }
  49177. class Bind extends _xfa_object.XFAObject {
  49178. constructor(attributes) {
  49179. super(TEMPLATE_NS_ID, "bind", true);
  49180. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  49181. this.ref = attributes.ref || "";
  49182. this.picture = null;
  49183. }
  49184. }
  49185. class BindItems extends _xfa_object.XFAObject {
  49186. constructor(attributes) {
  49187. super(TEMPLATE_NS_ID, "bindItems");
  49188. this.connection = attributes.connection || "";
  49189. this.labelRef = attributes.labelRef || "";
  49190. this.ref = attributes.ref || "";
  49191. this.valueRef = attributes.valueRef || "";
  49192. }
  49193. }
  49194. exports.BindItems = BindItems;
  49195. class Bookend extends _xfa_object.XFAObject {
  49196. constructor(attributes) {
  49197. super(TEMPLATE_NS_ID, "bookend");
  49198. this.id = attributes.id || "";
  49199. this.leader = attributes.leader || "";
  49200. this.trailer = attributes.trailer || "";
  49201. this.use = attributes.use || "";
  49202. this.usehref = attributes.usehref || "";
  49203. }
  49204. }
  49205. class BooleanElement extends _xfa_object.Option01 {
  49206. constructor(attributes) {
  49207. super(TEMPLATE_NS_ID, "boolean");
  49208. this.id = attributes.id || "";
  49209. this.name = attributes.name || "";
  49210. this.use = attributes.use || "";
  49211. this.usehref = attributes.usehref || "";
  49212. }
  49213. [_xfa_object.$toHTML]() {
  49214. return this[_xfa_object.$content] === 1;
  49215. }
  49216. }
  49217. class Border extends _xfa_object.XFAObject {
  49218. constructor(attributes) {
  49219. super(TEMPLATE_NS_ID, "border", true);
  49220. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  49221. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  49222. this.id = attributes.id || "";
  49223. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  49224. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  49225. this.use = attributes.use || "";
  49226. this.usehref = attributes.usehref || "";
  49227. this.corner = new _xfa_object.XFAObjectArray(4);
  49228. this.edge = new _xfa_object.XFAObjectArray(4);
  49229. this.extras = null;
  49230. this.fill = null;
  49231. this.margin = null;
  49232. }
  49233. [_xfa_object.$toStyle](widths, margins) {
  49234. const edgeStyles = this.edge.children.map(node => node[_xfa_object.$toStyle]());
  49235. const cornerStyles = this.edge.children.map(node => node[_xfa_object.$toStyle]());
  49236. let style;
  49237. if (this.margin) {
  49238. style = this.margin[_xfa_object.$toStyle]();
  49239. if (margins) {
  49240. margins.push(this.margin.topInset, this.margin.rightInset, this.margin.bottomInset, this.margin.leftInset);
  49241. }
  49242. } else {
  49243. style = Object.create(null);
  49244. if (margins) {
  49245. margins.push(0, 0, 0, 0);
  49246. }
  49247. }
  49248. if (this.fill) {
  49249. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  49250. }
  49251. if (edgeStyles.length > 0) {
  49252. if (widths) {
  49253. this.edge.children.forEach(node => widths.push(node.thickness));
  49254. if (widths.length < 4) {
  49255. const last = widths[widths.length - 1];
  49256. for (let i = widths.length; i < 4; i++) {
  49257. widths.push(last);
  49258. }
  49259. }
  49260. }
  49261. if (edgeStyles.length === 2 || edgeStyles.length === 3) {
  49262. const last = edgeStyles[edgeStyles.length - 1];
  49263. for (let i = edgeStyles.length; i < 4; i++) {
  49264. edgeStyles.push(last);
  49265. }
  49266. }
  49267. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  49268. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  49269. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  49270. } else {
  49271. if (widths) {
  49272. widths.push(0, 0, 0, 0);
  49273. }
  49274. }
  49275. if (cornerStyles.length > 0) {
  49276. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  49277. const last = cornerStyles[cornerStyles.length - 1];
  49278. for (let i = cornerStyles.length; i < 4; i++) {
  49279. cornerStyles.push(last);
  49280. }
  49281. }
  49282. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  49283. }
  49284. switch (this.presence) {
  49285. case "invisible":
  49286. case "hidden":
  49287. style.borderStyle = "";
  49288. break;
  49289. case "inactive":
  49290. style.borderStyle = "none";
  49291. break;
  49292. }
  49293. return style;
  49294. }
  49295. }
  49296. class Break extends _xfa_object.XFAObject {
  49297. constructor(attributes) {
  49298. super(TEMPLATE_NS_ID, "break", true);
  49299. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  49300. this.afterTarget = attributes.afterTarget || "";
  49301. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  49302. this.beforeTarget = attributes.beforeTarget || "";
  49303. this.bookendLeader = attributes.bookendLeader || "";
  49304. this.bookendTrailer = attributes.bookendTrailer || "";
  49305. this.id = attributes.id || "";
  49306. this.overflowLeader = attributes.overflowLeader || "";
  49307. this.overflowTarget = attributes.overflowTarget || "";
  49308. this.overflowTrailer = attributes.overflowTrailer || "";
  49309. this.startNew = (0, _utils.getInteger)({
  49310. data: attributes.startNew,
  49311. defaultValue: 0,
  49312. validate: x => x === 1
  49313. });
  49314. this.use = attributes.use || "";
  49315. this.usehref = attributes.usehref || "";
  49316. this.extras = null;
  49317. }
  49318. }
  49319. class BreakAfter extends _xfa_object.XFAObject {
  49320. constructor(attributes) {
  49321. super(TEMPLATE_NS_ID, "breakAfter", true);
  49322. this.id = attributes.id || "";
  49323. this.leader = attributes.leader || "";
  49324. this.startNew = (0, _utils.getInteger)({
  49325. data: attributes.startNew,
  49326. defaultValue: 0,
  49327. validate: x => x === 1
  49328. });
  49329. this.target = attributes.target || "";
  49330. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  49331. this.trailer = attributes.trailer || "";
  49332. this.use = attributes.use || "";
  49333. this.usehref = attributes.usehref || "";
  49334. this.script = null;
  49335. }
  49336. }
  49337. class BreakBefore extends _xfa_object.XFAObject {
  49338. constructor(attributes) {
  49339. super(TEMPLATE_NS_ID, "breakBefore", true);
  49340. this.id = attributes.id || "";
  49341. this.leader = attributes.leader || "";
  49342. this.startNew = (0, _utils.getInteger)({
  49343. data: attributes.startNew,
  49344. defaultValue: 0,
  49345. validate: x => x === 1
  49346. });
  49347. this.target = attributes.target || "";
  49348. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  49349. this.trailer = attributes.trailer || "";
  49350. this.use = attributes.use || "";
  49351. this.usehref = attributes.usehref || "";
  49352. this.script = null;
  49353. }
  49354. }
  49355. class Button extends _xfa_object.XFAObject {
  49356. constructor(attributes) {
  49357. super(TEMPLATE_NS_ID, "button", true);
  49358. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  49359. this.id = attributes.id || "";
  49360. this.use = attributes.use || "";
  49361. this.usehref = attributes.usehref || "";
  49362. this.extras = null;
  49363. }
  49364. [_xfa_object.$toHTML]() {
  49365. return {
  49366. name: "button",
  49367. attributes: {
  49368. class: "xfaButton",
  49369. style: {}
  49370. }
  49371. };
  49372. }
  49373. }
  49374. class Calculate extends _xfa_object.XFAObject {
  49375. constructor(attributes) {
  49376. super(TEMPLATE_NS_ID, "calculate", true);
  49377. this.id = attributes.id || "";
  49378. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  49379. this.use = attributes.use || "";
  49380. this.usehref = attributes.usehref || "";
  49381. this.extras = null;
  49382. this.message = null;
  49383. this.script = null;
  49384. }
  49385. }
  49386. class Caption extends _xfa_object.XFAObject {
  49387. constructor(attributes) {
  49388. super(TEMPLATE_NS_ID, "caption", true);
  49389. this.id = attributes.id || "";
  49390. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  49391. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  49392. this.reserve = (0, _utils.getMeasurement)(attributes.reserve);
  49393. this.use = attributes.use || "";
  49394. this.usehref = attributes.usehref || "";
  49395. this.extras = null;
  49396. this.font = null;
  49397. this.margin = null;
  49398. this.para = null;
  49399. this.value = null;
  49400. }
  49401. [_xfa_object.$setValue](value) {
  49402. _setValue(this, value);
  49403. }
  49404. [_xfa_object.$toHTML]() {
  49405. if (!this.value) {
  49406. return null;
  49407. }
  49408. const value = this.value[_xfa_object.$toHTML]();
  49409. if (!value) {
  49410. return null;
  49411. }
  49412. const children = [];
  49413. if (typeof value === "string") {
  49414. children.push({
  49415. name: "#text",
  49416. value
  49417. });
  49418. } else {
  49419. children.push(value);
  49420. }
  49421. const style = (0, _html_utils.toStyle)(this, "font", "margin", "para", "visibility");
  49422. switch (this.placement) {
  49423. case "left":
  49424. case "right":
  49425. style.minWidth = (0, _html_utils.measureToString)(this.reserve);
  49426. break;
  49427. case "top":
  49428. case "bottom":
  49429. style.minHeight = (0, _html_utils.measureToString)(this.reserve);
  49430. break;
  49431. }
  49432. return {
  49433. name: "div",
  49434. attributes: {
  49435. style
  49436. },
  49437. children
  49438. };
  49439. }
  49440. }
  49441. class Certificate extends _xfa_object.StringObject {
  49442. constructor(attributes) {
  49443. super(TEMPLATE_NS_ID, "certificate");
  49444. this.id = attributes.id || "";
  49445. this.name = attributes.name || "";
  49446. this.use = attributes.use || "";
  49447. this.usehref = attributes.usehref || "";
  49448. }
  49449. }
  49450. class Certificates extends _xfa_object.XFAObject {
  49451. constructor(attributes) {
  49452. super(TEMPLATE_NS_ID, "certificates", true);
  49453. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  49454. this.id = attributes.id || "";
  49455. this.url = attributes.url || "";
  49456. this.urlPolicy = attributes.urlPolicy || "";
  49457. this.use = attributes.use || "";
  49458. this.usehref = attributes.usehref || "";
  49459. this.encryption = null;
  49460. this.issuers = null;
  49461. this.keyUsage = null;
  49462. this.oids = null;
  49463. this.signing = null;
  49464. this.subjectDNs = null;
  49465. }
  49466. }
  49467. class CheckButton extends _xfa_object.XFAObject {
  49468. constructor(attributes) {
  49469. super(TEMPLATE_NS_ID, "checkButton", true);
  49470. this.id = attributes.id || "";
  49471. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  49472. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  49473. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  49474. this.use = attributes.use || "";
  49475. this.usehref = attributes.usehref || "";
  49476. this.border = null;
  49477. this.extras = null;
  49478. this.margin = null;
  49479. }
  49480. [_xfa_object.$toHTML]() {
  49481. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  49482. const size = (0, _html_utils.measureToString)(this.size);
  49483. style.width = style.height = size;
  49484. let mark, radius;
  49485. if (this.shape === "square") {
  49486. mark = "■";
  49487. radius = "10%";
  49488. } else {
  49489. mark = "●";
  49490. radius = "50%";
  49491. }
  49492. if (!style.borderRadius) {
  49493. style.borderRadius = radius;
  49494. }
  49495. if (this.mark !== "default") {
  49496. switch (this.mark) {
  49497. case "check":
  49498. mark = "✓";
  49499. break;
  49500. case "circle":
  49501. mark = "●";
  49502. break;
  49503. case "cross":
  49504. mark = "✕";
  49505. break;
  49506. case "diamond":
  49507. mark = "♦";
  49508. break;
  49509. case "square":
  49510. mark = "■";
  49511. break;
  49512. case "star":
  49513. mark = "★";
  49514. break;
  49515. }
  49516. }
  49517. if (size !== "10px") {
  49518. style.fontSize = size;
  49519. style.lineHeight = size;
  49520. style.width = size;
  49521. style.height = size;
  49522. }
  49523. return {
  49524. name: "label",
  49525. attributes: {
  49526. class: "xfaLabel"
  49527. },
  49528. children: [{
  49529. name: "input",
  49530. attributes: {
  49531. class: "xfaCheckbox",
  49532. type: "checkbox"
  49533. }
  49534. }, {
  49535. name: "span",
  49536. attributes: {
  49537. class: "xfaCheckboxMark",
  49538. mark,
  49539. style
  49540. }
  49541. }]
  49542. };
  49543. }
  49544. }
  49545. class ChoiceList extends _xfa_object.XFAObject {
  49546. constructor(attributes) {
  49547. super(TEMPLATE_NS_ID, "choiceList", true);
  49548. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  49549. this.id = attributes.id || "";
  49550. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  49551. this.textEntry = (0, _utils.getInteger)({
  49552. data: attributes.textEntry,
  49553. defaultValue: 0,
  49554. validate: x => x === 1
  49555. });
  49556. this.use = attributes.use || "";
  49557. this.usehref = attributes.usehref || "";
  49558. this.border = null;
  49559. this.extras = null;
  49560. this.margin = null;
  49561. }
  49562. [_xfa_object.$toHTML]() {
  49563. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  49564. return {
  49565. name: "label",
  49566. attributes: {
  49567. class: "xfaLabel"
  49568. },
  49569. children: [{
  49570. name: "select",
  49571. attributes: {
  49572. class: "xfaSxelect",
  49573. multiple: this.open === "multiSelect",
  49574. style
  49575. }
  49576. }]
  49577. };
  49578. }
  49579. }
  49580. class Color extends _xfa_object.XFAObject {
  49581. constructor(attributes) {
  49582. super(TEMPLATE_NS_ID, "color", true);
  49583. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  49584. this.id = attributes.id || "";
  49585. this.use = attributes.use || "";
  49586. this.usehref = attributes.usehref || "";
  49587. this.value = (0, _utils.getColor)(attributes.value);
  49588. this.extras = null;
  49589. }
  49590. [_xfa_object.$hasSettableValue]() {
  49591. return false;
  49592. }
  49593. [_xfa_object.$toStyle]() {
  49594. return _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b);
  49595. }
  49596. }
  49597. class Comb extends _xfa_object.XFAObject {
  49598. constructor(attributes) {
  49599. super(TEMPLATE_NS_ID, "comb");
  49600. this.id = attributes.id || "";
  49601. this.numberOfCells = (0, _utils.getInteger)({
  49602. data: attributes.numberOfCells,
  49603. defaultValue: 0,
  49604. validate: x => x >= 0
  49605. });
  49606. this.use = attributes.use || "";
  49607. this.usehref = attributes.usehref || "";
  49608. }
  49609. }
  49610. class Connect extends _xfa_object.XFAObject {
  49611. constructor(attributes) {
  49612. super(TEMPLATE_NS_ID, "connect", true);
  49613. this.connection = attributes.connection || "";
  49614. this.id = attributes.id || "";
  49615. this.ref = attributes.ref || "";
  49616. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  49617. this.use = attributes.use || "";
  49618. this.usehref = attributes.usehref || "";
  49619. this.picture = null;
  49620. }
  49621. }
  49622. class ContentArea extends _xfa_object.XFAObject {
  49623. constructor(attributes) {
  49624. super(TEMPLATE_NS_ID, "contentArea", true);
  49625. this.h = (0, _utils.getMeasurement)(attributes.h);
  49626. this.id = attributes.id || "";
  49627. this.name = attributes.name || "";
  49628. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  49629. this.use = attributes.use || "";
  49630. this.usehref = attributes.usehref || "";
  49631. this.w = (0, _utils.getMeasurement)(attributes.w);
  49632. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  49633. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  49634. this.desc = null;
  49635. this.extras = null;
  49636. }
  49637. [_xfa_object.$toHTML]() {
  49638. const left = (0, _html_utils.measureToString)(this.x);
  49639. const top = (0, _html_utils.measureToString)(this.y);
  49640. const style = {
  49641. position: "absolute",
  49642. left,
  49643. top,
  49644. width: (0, _html_utils.measureToString)(this.w),
  49645. height: (0, _html_utils.measureToString)(this.h)
  49646. };
  49647. return {
  49648. name: "div",
  49649. children: [],
  49650. attributes: {
  49651. style,
  49652. class: "xfaContentarea",
  49653. id: this[_xfa_object.$uid]
  49654. }
  49655. };
  49656. }
  49657. }
  49658. class Corner extends _xfa_object.XFAObject {
  49659. constructor(attributes) {
  49660. super(TEMPLATE_NS_ID, "corner", true);
  49661. this.id = attributes.id || "";
  49662. this.inverted = (0, _utils.getInteger)({
  49663. data: attributes.inverted,
  49664. defaultValue: 0,
  49665. validate: x => x === 1
  49666. });
  49667. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  49668. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  49669. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  49670. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  49671. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  49672. this.use = attributes.use || "";
  49673. this.usehref = attributes.usehref || "";
  49674. this.color = null;
  49675. this.extras = null;
  49676. }
  49677. [_xfa_object.$toStyle]() {
  49678. const style = (0, _html_utils.toStyle)(this, "visibility");
  49679. style.radius = (0, _html_utils.measureToString)(this.radius);
  49680. return style;
  49681. }
  49682. }
  49683. class DateElement extends _xfa_object.ContentObject {
  49684. constructor(attributes) {
  49685. super(TEMPLATE_NS_ID, "date");
  49686. this.id = attributes.id || "";
  49687. this.name = attributes.name || "";
  49688. this.use = attributes.use || "";
  49689. this.usehref = attributes.usehref || "";
  49690. }
  49691. [_xfa_object.$finalize]() {
  49692. this[_xfa_object.$content] = new Date(this[_xfa_object.$content].trim());
  49693. }
  49694. [_xfa_object.$toHTML]() {
  49695. return this[_xfa_object.$content].toString();
  49696. }
  49697. }
  49698. class DateTime extends _xfa_object.ContentObject {
  49699. constructor(attributes) {
  49700. super(TEMPLATE_NS_ID, "dateTime");
  49701. this.id = attributes.id || "";
  49702. this.name = attributes.name || "";
  49703. this.use = attributes.use || "";
  49704. this.usehref = attributes.usehref || "";
  49705. }
  49706. [_xfa_object.$finalize]() {
  49707. this[_xfa_object.$content] = new Date(this[_xfa_object.$content].trim());
  49708. }
  49709. [_xfa_object.$toHTML]() {
  49710. return this[_xfa_object.$content].toString();
  49711. }
  49712. }
  49713. class DateTimeEdit extends _xfa_object.XFAObject {
  49714. constructor(attributes) {
  49715. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  49716. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  49717. this.id = attributes.id || "";
  49718. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  49719. this.use = attributes.use || "";
  49720. this.usehref = attributes.usehref || "";
  49721. this.border = null;
  49722. this.comb = null;
  49723. this.extras = null;
  49724. this.margin = null;
  49725. }
  49726. [_xfa_object.$toHTML]() {
  49727. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  49728. const html = {
  49729. name: "input",
  49730. attributes: {
  49731. type: "text",
  49732. class: "xfaTextfield",
  49733. style
  49734. }
  49735. };
  49736. return {
  49737. name: "label",
  49738. attributes: {
  49739. class: "xfaLabel"
  49740. },
  49741. children: [html]
  49742. };
  49743. }
  49744. }
  49745. class Decimal extends _xfa_object.ContentObject {
  49746. constructor(attributes) {
  49747. super(TEMPLATE_NS_ID, "decimal");
  49748. this.fracDigits = (0, _utils.getInteger)({
  49749. data: attributes.fracDigits,
  49750. defaultValue: 2,
  49751. validate: x => true
  49752. });
  49753. this.id = attributes.id || "";
  49754. this.leadDigits = (0, _utils.getInteger)({
  49755. data: attributes.leadDigits,
  49756. defaultValue: -1,
  49757. validate: x => true
  49758. });
  49759. this.name = attributes.name || "";
  49760. this.use = attributes.use || "";
  49761. this.usehref = attributes.usehref || "";
  49762. }
  49763. [_xfa_object.$finalize]() {
  49764. const number = parseFloat(this[_xfa_object.$content].trim());
  49765. this[_xfa_object.$content] = isNaN(number) ? null : number;
  49766. }
  49767. [_xfa_object.$toHTML]() {
  49768. return this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "";
  49769. }
  49770. }
  49771. class DefaultUi extends _xfa_object.XFAObject {
  49772. constructor(attributes) {
  49773. super(TEMPLATE_NS_ID, "defaultUi", true);
  49774. this.id = attributes.id || "";
  49775. this.use = attributes.use || "";
  49776. this.usehref = attributes.usehref || "";
  49777. this.extras = null;
  49778. }
  49779. }
  49780. class Desc extends _xfa_object.XFAObject {
  49781. constructor(attributes) {
  49782. super(TEMPLATE_NS_ID, "desc", true);
  49783. this.id = attributes.id || "";
  49784. this.use = attributes.use || "";
  49785. this.usehref = attributes.usehref || "";
  49786. this.boolean = new _xfa_object.XFAObjectArray();
  49787. this.date = new _xfa_object.XFAObjectArray();
  49788. this.dateTime = new _xfa_object.XFAObjectArray();
  49789. this.decimal = new _xfa_object.XFAObjectArray();
  49790. this.exData = new _xfa_object.XFAObjectArray();
  49791. this.float = new _xfa_object.XFAObjectArray();
  49792. this.image = new _xfa_object.XFAObjectArray();
  49793. this.integer = new _xfa_object.XFAObjectArray();
  49794. this.text = new _xfa_object.XFAObjectArray();
  49795. this.time = new _xfa_object.XFAObjectArray();
  49796. }
  49797. }
  49798. class DigestMethod extends _xfa_object.OptionObject {
  49799. constructor(attributes) {
  49800. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  49801. this.id = attributes.id || "";
  49802. this.use = attributes.use || "";
  49803. this.usehref = attributes.usehref || "";
  49804. }
  49805. }
  49806. class DigestMethods extends _xfa_object.XFAObject {
  49807. constructor(attributes) {
  49808. super(TEMPLATE_NS_ID, "digestMethods", true);
  49809. this.id = attributes.id || "";
  49810. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  49811. this.use = attributes.use || "";
  49812. this.usehref = attributes.usehref || "";
  49813. this.digestMethod = new _xfa_object.XFAObjectArray();
  49814. }
  49815. }
  49816. class Draw extends _xfa_object.XFAObject {
  49817. constructor(attributes) {
  49818. super(TEMPLATE_NS_ID, "draw", true);
  49819. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  49820. this.colSpan = (0, _utils.getInteger)({
  49821. data: attributes.colSpan,
  49822. defaultValue: 1,
  49823. validate: x => x >= 1
  49824. });
  49825. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  49826. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  49827. this.id = attributes.id || "";
  49828. this.locale = attributes.locale || "";
  49829. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  49830. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  49831. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  49832. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  49833. this.name = attributes.name || "";
  49834. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  49835. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  49836. this.rotate = (0, _utils.getInteger)({
  49837. data: attributes.rotate,
  49838. defaultValue: 0,
  49839. validate: x => x % 90 === 0
  49840. });
  49841. this.use = attributes.use || "";
  49842. this.usehref = attributes.usehref || "";
  49843. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  49844. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  49845. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  49846. this.assist = null;
  49847. this.border = null;
  49848. this.caption = null;
  49849. this.desc = null;
  49850. this.extras = null;
  49851. this.font = null;
  49852. this.keep = null;
  49853. this.margin = null;
  49854. this.para = null;
  49855. this.traversal = null;
  49856. this.ui = null;
  49857. this.value = null;
  49858. this.setProperty = new _xfa_object.XFAObjectArray();
  49859. }
  49860. [_xfa_object.$setValue](value) {
  49861. _setValue(this, value);
  49862. }
  49863. [_xfa_object.$toHTML]() {
  49864. if (!this.value) {
  49865. return null;
  49866. }
  49867. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "presence", "rotate", "anchorType");
  49868. const clazz = ["xfaDraw"];
  49869. if (this.font) {
  49870. clazz.push("xfaFont");
  49871. }
  49872. const attributes = {
  49873. style,
  49874. id: this[_xfa_object.$uid],
  49875. class: clazz.join(" ")
  49876. };
  49877. if (this.name) {
  49878. attributes.xfaName = this.name;
  49879. }
  49880. return {
  49881. name: "div",
  49882. attributes,
  49883. children: []
  49884. };
  49885. }
  49886. }
  49887. class Edge extends _xfa_object.XFAObject {
  49888. constructor(attributes) {
  49889. super(TEMPLATE_NS_ID, "edge", true);
  49890. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  49891. this.id = attributes.id || "";
  49892. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  49893. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  49894. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  49895. this.use = attributes.use || "";
  49896. this.usehref = attributes.usehref || "";
  49897. this.color = null;
  49898. this.extras = null;
  49899. }
  49900. [_xfa_object.$toStyle]() {
  49901. const style = (0, _html_utils.toStyle)(this, "visibility");
  49902. Object.assign(style, {
  49903. linecap: this.cap,
  49904. width: (0, _html_utils.measureToString)(this.thickness),
  49905. color: this.color ? this.color[_xfa_object.$toHTML]() : "#000000",
  49906. style: ""
  49907. });
  49908. if (this.presence !== "visible") {
  49909. style.style = "none";
  49910. } else {
  49911. switch (this.stroke) {
  49912. case "solid":
  49913. style.style = "solid";
  49914. break;
  49915. case "dashDot":
  49916. style.style = "dashed";
  49917. break;
  49918. case "dashDotDot":
  49919. style.style = "dashed";
  49920. break;
  49921. case "dashed":
  49922. style.style = "dashed";
  49923. break;
  49924. case "dotted":
  49925. style.style = "dotted";
  49926. break;
  49927. case "embossed":
  49928. style.style = "ridge";
  49929. break;
  49930. case "etched":
  49931. style.style = "groove";
  49932. break;
  49933. case "lowered":
  49934. style.style = "inset";
  49935. break;
  49936. case "raised":
  49937. style.style = "outset";
  49938. break;
  49939. }
  49940. }
  49941. return style;
  49942. }
  49943. }
  49944. class Encoding extends _xfa_object.OptionObject {
  49945. constructor(attributes) {
  49946. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  49947. this.id = attributes.id || "";
  49948. this.use = attributes.use || "";
  49949. this.usehref = attributes.usehref || "";
  49950. }
  49951. }
  49952. class Encodings extends _xfa_object.XFAObject {
  49953. constructor(attributes) {
  49954. super(TEMPLATE_NS_ID, "encodings", true);
  49955. this.id = attributes.id || "";
  49956. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  49957. this.use = attributes.use || "";
  49958. this.usehref = attributes.usehref || "";
  49959. this.encoding = new _xfa_object.XFAObjectArray();
  49960. }
  49961. }
  49962. class Encrypt extends _xfa_object.XFAObject {
  49963. constructor(attributes) {
  49964. super(TEMPLATE_NS_ID, "encrypt", true);
  49965. this.id = attributes.id || "";
  49966. this.use = attributes.use || "";
  49967. this.usehref = attributes.usehref || "";
  49968. this.certificate = null;
  49969. }
  49970. }
  49971. class EncryptData extends _xfa_object.XFAObject {
  49972. constructor(attributes) {
  49973. super(TEMPLATE_NS_ID, "encryptData", true);
  49974. this.id = attributes.id || "";
  49975. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  49976. this.target = attributes.target || "";
  49977. this.use = attributes.use || "";
  49978. this.usehref = attributes.usehref || "";
  49979. this.filter = null;
  49980. this.manifest = null;
  49981. }
  49982. }
  49983. class Encryption extends _xfa_object.XFAObject {
  49984. constructor(attributes) {
  49985. super(TEMPLATE_NS_ID, "encryption", true);
  49986. this.id = attributes.id || "";
  49987. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  49988. this.use = attributes.use || "";
  49989. this.usehref = attributes.usehref || "";
  49990. this.certificate = new _xfa_object.XFAObjectArray();
  49991. }
  49992. }
  49993. class EncryptionMethod extends _xfa_object.OptionObject {
  49994. constructor(attributes) {
  49995. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  49996. this.id = attributes.id || "";
  49997. this.use = attributes.use || "";
  49998. this.usehref = attributes.usehref || "";
  49999. }
  50000. }
  50001. class EncryptionMethods extends _xfa_object.XFAObject {
  50002. constructor(attributes) {
  50003. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  50004. this.id = attributes.id || "";
  50005. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50006. this.use = attributes.use || "";
  50007. this.usehref = attributes.usehref || "";
  50008. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  50009. }
  50010. }
  50011. class Event extends _xfa_object.XFAObject {
  50012. constructor(attributes) {
  50013. super(TEMPLATE_NS_ID, "event", true);
  50014. this.activity = (0, _utils.getStringOption)(attributes.activity, ["click", "change", "docClose", "docReady", "enter", "exit", "full", "indexChange", "initialize", "mouseDown", "mouseEnter", "mouseExit", "mouseUp", "postExecute", "postOpen", "postPrint", "postSave", "postSign", "postSubmit", "preExecute", "preOpen", "prePrint", "preSave", "preSign", "preSubmit", "ready", "validationState"]);
  50015. this.id = attributes.id || "";
  50016. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  50017. this.name = attributes.name || "";
  50018. this.ref = attributes.ref || "";
  50019. this.use = attributes.use || "";
  50020. this.usehref = attributes.usehref || "";
  50021. this.extras = null;
  50022. this.encryptData = null;
  50023. this.execute = null;
  50024. this.script = null;
  50025. this.signData = null;
  50026. this.submit = null;
  50027. }
  50028. }
  50029. class ExData extends _xfa_object.ContentObject {
  50030. constructor(attributes) {
  50031. super(TEMPLATE_NS_ID, "exData");
  50032. this.contentType = attributes.contentType || "";
  50033. this.href = attributes.href || "";
  50034. this.id = attributes.id || "";
  50035. this.maxLength = (0, _utils.getInteger)({
  50036. data: attributes.maxLength,
  50037. defaultValue: -1,
  50038. validate: x => x >= -1
  50039. });
  50040. this.name = attributes.name || "";
  50041. this.rid = attributes.rid || "";
  50042. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  50043. this.use = attributes.use || "";
  50044. this.usehref = attributes.usehref || "";
  50045. }
  50046. [_xfa_object.$onChild](child) {
  50047. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  50048. this[_xfa_object.$content] = child;
  50049. return true;
  50050. }
  50051. if (this.contentType === "text/xml") {
  50052. this[_xfa_object.$content] = child;
  50053. return true;
  50054. }
  50055. return false;
  50056. }
  50057. }
  50058. class ExObject extends _xfa_object.XFAObject {
  50059. constructor(attributes) {
  50060. super(TEMPLATE_NS_ID, "exObject", true);
  50061. this.archive = attributes.archive || "";
  50062. this.classId = attributes.classId || "";
  50063. this.codeBase = attributes.codeBase || "";
  50064. this.codeType = attributes.codeType || "";
  50065. this.id = attributes.id || "";
  50066. this.name = attributes.name || "";
  50067. this.use = attributes.use || "";
  50068. this.usehref = attributes.usehref || "";
  50069. this.extras = null;
  50070. this.boolean = new _xfa_object.XFAObjectArray();
  50071. this.date = new _xfa_object.XFAObjectArray();
  50072. this.dateTime = new _xfa_object.XFAObjectArray();
  50073. this.decimal = new _xfa_object.XFAObjectArray();
  50074. this.exData = new _xfa_object.XFAObjectArray();
  50075. this.exObject = new _xfa_object.XFAObjectArray();
  50076. this.float = new _xfa_object.XFAObjectArray();
  50077. this.image = new _xfa_object.XFAObjectArray();
  50078. this.integer = new _xfa_object.XFAObjectArray();
  50079. this.text = new _xfa_object.XFAObjectArray();
  50080. this.time = new _xfa_object.XFAObjectArray();
  50081. }
  50082. }
  50083. class ExclGroup extends _xfa_object.XFAObject {
  50084. constructor(attributes) {
  50085. super(TEMPLATE_NS_ID, "exclGroup", true);
  50086. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  50087. this.accessKey = attributes.accessKey || "";
  50088. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  50089. this.colSpan = (0, _utils.getInteger)({
  50090. data: attributes.colSpan,
  50091. defaultValue: 1,
  50092. validate: x => x >= 1
  50093. });
  50094. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  50095. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  50096. this.id = attributes.id || "";
  50097. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  50098. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  50099. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  50100. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  50101. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  50102. this.name = attributes.name || "";
  50103. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50104. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  50105. this.use = attributes.use || "";
  50106. this.usehref = attributes.usehref || "";
  50107. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  50108. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  50109. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  50110. this.assist = null;
  50111. this.bind = null;
  50112. this.border = null;
  50113. this.calculate = null;
  50114. this.caption = null;
  50115. this.desc = null;
  50116. this.extras = null;
  50117. this.margin = null;
  50118. this.para = null;
  50119. this.traversal = null;
  50120. this.validate = null;
  50121. this.connect = new _xfa_object.XFAObjectArray();
  50122. this.event = new _xfa_object.XFAObjectArray();
  50123. this.field = new _xfa_object.XFAObjectArray();
  50124. this.setProperty = new _xfa_object.XFAObjectArray();
  50125. }
  50126. [_xfa_object.$hasSettableValue]() {
  50127. return true;
  50128. }
  50129. [_xfa_object.$setValue](value) {
  50130. for (const field of this.field.children) {
  50131. if (!field.value) {
  50132. const nodeValue = new Value({});
  50133. field[_xfa_object.$appendChild](nodeValue);
  50134. field.value = nodeValue;
  50135. }
  50136. const nodeBoolean = new BooleanElement({});
  50137. nodeBoolean[_xfa_object.$content] = 0;
  50138. for (const item of field.items.children) {
  50139. if (item[_xfa_object.$hasItem](value)) {
  50140. nodeBoolean[_xfa_object.$content] = 1;
  50141. break;
  50142. }
  50143. }
  50144. field.value[_xfa_object.$setValue](nodeBoolean);
  50145. }
  50146. }
  50147. [_xfa_object.$toHTML]() {
  50148. if (!this.value) {
  50149. return null;
  50150. }
  50151. const style = (0, _html_utils.toStyle)(this, "dimensions", "position", "anchorType");
  50152. const attributes = {
  50153. style,
  50154. id: this[_xfa_object.$uid],
  50155. class: "xfaExclgroup"
  50156. };
  50157. const children = this[_xfa_object.$childrenToHTML]({
  50158. filter: new Set(["field"]),
  50159. include: true
  50160. });
  50161. return {
  50162. name: "div",
  50163. attributes,
  50164. children
  50165. };
  50166. }
  50167. }
  50168. class Execute extends _xfa_object.XFAObject {
  50169. constructor(attributes) {
  50170. super(TEMPLATE_NS_ID, "execute");
  50171. this.connection = attributes.connection || "";
  50172. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  50173. this.id = attributes.id || "";
  50174. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  50175. this.use = attributes.use || "";
  50176. this.usehref = attributes.usehref || "";
  50177. }
  50178. }
  50179. class Extras extends _xfa_object.XFAObject {
  50180. constructor(attributes) {
  50181. super(TEMPLATE_NS_ID, "extras", true);
  50182. this.id = attributes.id || "";
  50183. this.name = attributes.name || "";
  50184. this.use = attributes.use || "";
  50185. this.usehref = attributes.usehref || "";
  50186. this.boolean = new _xfa_object.XFAObjectArray();
  50187. this.date = new _xfa_object.XFAObjectArray();
  50188. this.dateTime = new _xfa_object.XFAObjectArray();
  50189. this.decimal = new _xfa_object.XFAObjectArray();
  50190. this.exData = new _xfa_object.XFAObjectArray();
  50191. this.extras = new _xfa_object.XFAObjectArray();
  50192. this.float = new _xfa_object.XFAObjectArray();
  50193. this.image = new _xfa_object.XFAObjectArray();
  50194. this.integer = new _xfa_object.XFAObjectArray();
  50195. this.text = new _xfa_object.XFAObjectArray();
  50196. this.time = new _xfa_object.XFAObjectArray();
  50197. }
  50198. }
  50199. class Field extends _xfa_object.XFAObject {
  50200. constructor(attributes) {
  50201. super(TEMPLATE_NS_ID, "field", true);
  50202. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  50203. this.accessKey = attributes.accessKey || "";
  50204. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  50205. this.colSpan = (0, _utils.getInteger)({
  50206. data: attributes.colSpan,
  50207. defaultValue: 1,
  50208. validate: x => x >= 1
  50209. });
  50210. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  50211. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  50212. this.id = attributes.id || "";
  50213. this.locale = attributes.locale || "";
  50214. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  50215. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  50216. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  50217. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  50218. this.name = attributes.name || "";
  50219. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50220. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  50221. this.rotate = (0, _utils.getInteger)({
  50222. data: attributes.rotate,
  50223. defaultValue: 0,
  50224. validate: x => x % 90 === 0
  50225. });
  50226. this.use = attributes.use || "";
  50227. this.usehref = attributes.usehref || "";
  50228. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  50229. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  50230. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  50231. this.assist = null;
  50232. this.bind = null;
  50233. this.border = null;
  50234. this.calculate = null;
  50235. this.caption = null;
  50236. this.desc = null;
  50237. this.extras = null;
  50238. this.font = null;
  50239. this.format = null;
  50240. this.items = new _xfa_object.XFAObjectArray(2);
  50241. this.keep = null;
  50242. this.margin = null;
  50243. this.para = null;
  50244. this.traversal = null;
  50245. this.ui = null;
  50246. this.validate = null;
  50247. this.value = null;
  50248. this.bindItems = new _xfa_object.XFAObjectArray();
  50249. this.connect = new _xfa_object.XFAObjectArray();
  50250. this.event = new _xfa_object.XFAObjectArray();
  50251. this.setProperty = new _xfa_object.XFAObjectArray();
  50252. }
  50253. [_xfa_object.$setValue](value) {
  50254. _setValue(this, value);
  50255. }
  50256. [_xfa_object.$toHTML]() {
  50257. if (!this.ui) {
  50258. return null;
  50259. }
  50260. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence");
  50261. const borderWidths = [];
  50262. const marginWidths = [];
  50263. if (this.border) {
  50264. Object.assign(style, this.border[_xfa_object.$toStyle](borderWidths, marginWidths));
  50265. }
  50266. if (this.margin) {
  50267. style.paddingTop = (0, _html_utils.measureToString)(this.margin.topInset - borderWidths[0] - marginWidths[0]);
  50268. style.paddingRight = (0, _html_utils.measureToString)(this.margin.rightInset - borderWidths[1] - marginWidths[1]);
  50269. style.paddingBottom = (0, _html_utils.measureToString)(this.margin.bottomInset - borderWidths[2] - marginWidths[2]);
  50270. style.paddingLeft = (0, _html_utils.measureToString)(this.margin.leftInset - borderWidths[3] - marginWidths[3]);
  50271. } else {
  50272. style.paddingTop = (0, _html_utils.measureToString)(-borderWidths[0] - marginWidths[0]);
  50273. style.paddingRight = (0, _html_utils.measureToString)(-borderWidths[1] - marginWidths[1]);
  50274. style.paddingBottom = (0, _html_utils.measureToString)(-borderWidths[2] - marginWidths[2]);
  50275. style.paddingLeft = (0, _html_utils.measureToString)(-borderWidths[3] - marginWidths[3]);
  50276. }
  50277. const clazz = ["xfaField"];
  50278. if (this.font) {
  50279. clazz.push("xfaFont");
  50280. }
  50281. const attributes = {
  50282. style,
  50283. id: this[_xfa_object.$uid],
  50284. class: clazz.join(" ")
  50285. };
  50286. if (this.name) {
  50287. attributes.xfaName = this.name;
  50288. }
  50289. const children = [];
  50290. const html = {
  50291. name: "div",
  50292. attributes,
  50293. children
  50294. };
  50295. const ui = this.ui ? this.ui[_xfa_object.$toHTML]() : null;
  50296. if (!ui) {
  50297. return html;
  50298. }
  50299. if (!ui.attributes.style) {
  50300. ui.attributes.style = Object.create(null);
  50301. }
  50302. children.push(ui);
  50303. if (this.value && ui.name !== "button") {
  50304. ui.children[0].attributes.value = this.value[_xfa_object.$toHTML]();
  50305. }
  50306. const caption = this.caption ? this.caption[_xfa_object.$toHTML]() : null;
  50307. if (!caption) {
  50308. return html;
  50309. }
  50310. if (ui.name === "button") {
  50311. ui.attributes.style.background = style.color;
  50312. delete style.color;
  50313. if (caption.name === "div") {
  50314. caption.name = "span";
  50315. }
  50316. ui.children = [caption];
  50317. return html;
  50318. }
  50319. ui.children.splice(0, 0, caption);
  50320. switch (this.caption.placement) {
  50321. case "left":
  50322. ui.attributes.style.flexDirection = "row";
  50323. break;
  50324. case "right":
  50325. ui.attributes.style.flexDirection = "row-reverse";
  50326. break;
  50327. case "top":
  50328. ui.attributes.style.flexDirection = "column";
  50329. break;
  50330. case "bottom":
  50331. ui.attributes.style.flexDirection = "column-reverse";
  50332. break;
  50333. case "inline":
  50334. delete ui.attributes.class;
  50335. caption.attributes.style.float = "left";
  50336. break;
  50337. }
  50338. return html;
  50339. }
  50340. }
  50341. exports.Field = Field;
  50342. class Fill extends _xfa_object.XFAObject {
  50343. constructor(attributes) {
  50344. super(TEMPLATE_NS_ID, "fill", true);
  50345. this.id = attributes.id || "";
  50346. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50347. this.use = attributes.use || "";
  50348. this.usehref = attributes.usehref || "";
  50349. this.color = null;
  50350. this.extras = null;
  50351. this.linear = null;
  50352. this.pattern = null;
  50353. this.radial = null;
  50354. this.solid = null;
  50355. this.stipple = null;
  50356. }
  50357. [_xfa_object.$toStyle]() {
  50358. for (const name of Object.getOwnPropertyNames(this)) {
  50359. if (name === "extras" || name === "color") {
  50360. continue;
  50361. }
  50362. const obj = this[name];
  50363. if (!(obj instanceof _xfa_object.XFAObject)) {
  50364. continue;
  50365. }
  50366. return {
  50367. color: obj[_xfa_object.$toStyle](this.color)
  50368. };
  50369. }
  50370. return {
  50371. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000"
  50372. };
  50373. }
  50374. }
  50375. class Filter extends _xfa_object.XFAObject {
  50376. constructor(attributes) {
  50377. super(TEMPLATE_NS_ID, "filter", true);
  50378. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  50379. this.id = attributes.id || "";
  50380. this.name = attributes.name || "";
  50381. this.use = attributes.use || "";
  50382. this.usehref = attributes.usehref || "";
  50383. this.version = (0, _utils.getInteger)({
  50384. data: this.version,
  50385. defaultValue: 5,
  50386. validate: x => x >= 1 && x <= 5
  50387. });
  50388. this.appearanceFilter = null;
  50389. this.certificates = null;
  50390. this.digestMethods = null;
  50391. this.encodings = null;
  50392. this.encryptionMethods = null;
  50393. this.handler = null;
  50394. this.lockDocument = null;
  50395. this.mdp = null;
  50396. this.reasons = null;
  50397. this.timeStamp = null;
  50398. }
  50399. }
  50400. class Float extends _xfa_object.ContentObject {
  50401. constructor(attributes) {
  50402. super(TEMPLATE_NS_ID, "float");
  50403. this.id = attributes.id || "";
  50404. this.name = attributes.name || "";
  50405. this.use = attributes.use || "";
  50406. this.usehref = attributes.usehref || "";
  50407. }
  50408. [_xfa_object.$finalize]() {
  50409. const number = parseFloat(this[_xfa_object.$content].trim());
  50410. this[_xfa_object.$content] = isNaN(number) ? null : number;
  50411. }
  50412. [_xfa_object.$toHTML]() {
  50413. return this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "";
  50414. }
  50415. }
  50416. class Font extends _xfa_object.XFAObject {
  50417. constructor(attributes) {
  50418. super(TEMPLATE_NS_ID, "font", true);
  50419. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  50420. this.fontHorizontalScale = (0, _utils.getFloat)({
  50421. data: attributes.fontHorizontalScale,
  50422. defaultValue: 100,
  50423. validate: x => x >= 0
  50424. });
  50425. this.fontVerticalScale = (0, _utils.getFloat)({
  50426. data: attributes.fontVerticalScale,
  50427. defaultValue: 100,
  50428. validate: x => x >= 0
  50429. });
  50430. this.id = attributes.id || "";
  50431. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  50432. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  50433. this.lineThrough = (0, _utils.getInteger)({
  50434. data: attributes.lineThrough,
  50435. defaultValue: 0,
  50436. validate: x => x === 1 || x === 2
  50437. });
  50438. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  50439. this.overline = (0, _utils.getInteger)({
  50440. data: attributes.overline,
  50441. defaultValue: 0,
  50442. validate: x => x === 1 || x === 2
  50443. });
  50444. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  50445. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  50446. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  50447. this.typeface = attributes.typeface || "";
  50448. this.underline = (0, _utils.getInteger)({
  50449. data: attributes.underline,
  50450. defaultValue: 0,
  50451. validate: x => x === 1 || x === 2
  50452. });
  50453. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  50454. this.use = attributes.use || "";
  50455. this.usehref = attributes.usehref || "";
  50456. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  50457. this.extras = null;
  50458. this.fill = null;
  50459. }
  50460. [_xfa_object.$toStyle]() {
  50461. const style = (0, _html_utils.toStyle)(this, "fill");
  50462. if (style.color) {
  50463. if (!style.color.startsWith("#")) {
  50464. style.backgroundClip = "text";
  50465. style.background = style.color;
  50466. style.color = "transparent";
  50467. } else if (style.color === "#000000") {
  50468. delete style.color;
  50469. }
  50470. }
  50471. if (this.baselineShift) {
  50472. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  50473. }
  50474. if (this.kerningMode !== "none") {
  50475. style.fontKerning = "normal";
  50476. }
  50477. if (this.letterSpacing) {
  50478. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  50479. }
  50480. if (this.lineThrough !== 0) {
  50481. style.textDecoration = "line-through";
  50482. if (this.lineThrough === 2) {
  50483. style.textDecorationStyle = "double";
  50484. }
  50485. }
  50486. if (this.overline !== 0) {
  50487. style.textDecoration = "overline";
  50488. if (this.overline === 2) {
  50489. style.textDecorationStyle = "double";
  50490. }
  50491. }
  50492. if (this.posture !== "normal") {
  50493. style.fontStyle = this.posture;
  50494. }
  50495. const fontSize = (0, _html_utils.measureToString)(this.size);
  50496. if (fontSize !== "10px") {
  50497. style.fontSize = fontSize;
  50498. }
  50499. style.fontFamily = this.typeface;
  50500. if (this.underline !== 0) {
  50501. style.textDecoration = "underline";
  50502. if (this.underline === 2) {
  50503. style.textDecorationStyle = "double";
  50504. }
  50505. }
  50506. if (this.weight !== "normal") {
  50507. style.fontWeight = this.weight;
  50508. }
  50509. return style;
  50510. }
  50511. }
  50512. class Format extends _xfa_object.XFAObject {
  50513. constructor(attributes) {
  50514. super(TEMPLATE_NS_ID, "format", true);
  50515. this.id = attributes.id || "";
  50516. this.use = attributes.use || "";
  50517. this.usehref = attributes.usehref || "";
  50518. this.extras = null;
  50519. this.picture = null;
  50520. }
  50521. }
  50522. class Handler extends _xfa_object.StringObject {
  50523. constructor(attributes) {
  50524. super(TEMPLATE_NS_ID, "handler");
  50525. this.id = attributes.id || "";
  50526. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50527. this.use = attributes.use || "";
  50528. this.usehref = attributes.usehref || "";
  50529. }
  50530. }
  50531. class Hyphenation extends _xfa_object.XFAObject {
  50532. constructor(attributes) {
  50533. super(TEMPLATE_NS_ID, "hyphenation");
  50534. this.excludeAllCaps = (0, _utils.getInteger)({
  50535. data: attributes.excludeAllCaps,
  50536. defaultValue: 0,
  50537. validate: x => x === 1
  50538. });
  50539. this.excludeInitialCap = (0, _utils.getInteger)({
  50540. data: attributes.excludeInitialCap,
  50541. defaultValue: 0,
  50542. validate: x => x === 1
  50543. });
  50544. this.hyphenate = (0, _utils.getInteger)({
  50545. data: attributes.hyphenate,
  50546. defaultValue: 0,
  50547. validate: x => x === 1
  50548. });
  50549. this.id = attributes.id || "";
  50550. this.pushCharacterCount = (0, _utils.getInteger)({
  50551. data: attributes.pushCharacterCount,
  50552. defaultValue: 3,
  50553. validate: x => x >= 0
  50554. });
  50555. this.remainCharacterCount = (0, _utils.getInteger)({
  50556. data: attributes.remainCharacterCount,
  50557. defaultValue: 3,
  50558. validate: x => x >= 0
  50559. });
  50560. this.use = attributes.use || "";
  50561. this.usehref = attributes.usehref || "";
  50562. this.wordCharacterCount = (0, _utils.getInteger)({
  50563. data: attributes.wordCharacterCount,
  50564. defaultValue: 7,
  50565. validate: x => x >= 0
  50566. });
  50567. }
  50568. }
  50569. class Image extends _xfa_object.StringObject {
  50570. constructor(attributes) {
  50571. super(TEMPLATE_NS_ID, "image");
  50572. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  50573. this.contentType = attributes.contentType || "";
  50574. this.href = attributes.href || "";
  50575. this.id = attributes.id || "";
  50576. this.name = attributes.name || "";
  50577. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  50578. this.use = attributes.use || "";
  50579. this.usehref = attributes.usehref || "";
  50580. }
  50581. [_xfa_object.$toHTML]() {
  50582. const html = {
  50583. name: "img",
  50584. attributes: {
  50585. style: {}
  50586. }
  50587. };
  50588. if (this.href) {
  50589. html.attributes.src = new URL(this.href);
  50590. return html;
  50591. }
  50592. if (this.transferEncoding === "base64") {
  50593. const buffer = Uint8Array.from(atob(this[_xfa_object.$content]), c => c.charCodeAt(0));
  50594. const blob = new Blob([buffer], {
  50595. type: this.contentType
  50596. });
  50597. html.attributes.src = URL.createObjectURL(blob);
  50598. return html;
  50599. }
  50600. return null;
  50601. }
  50602. }
  50603. class ImageEdit extends _xfa_object.XFAObject {
  50604. constructor(attributes) {
  50605. super(TEMPLATE_NS_ID, "imageEdit", true);
  50606. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  50607. this.id = attributes.id || "";
  50608. this.use = attributes.use || "";
  50609. this.usehref = attributes.usehref || "";
  50610. this.border = null;
  50611. this.extras = null;
  50612. this.margin = null;
  50613. }
  50614. }
  50615. class Integer extends _xfa_object.ContentObject {
  50616. constructor(attributes) {
  50617. super(TEMPLATE_NS_ID, "integer");
  50618. this.id = attributes.id || "";
  50619. this.name = attributes.name || "";
  50620. this.use = attributes.use || "";
  50621. this.usehref = attributes.usehref || "";
  50622. }
  50623. [_xfa_object.$finalize]() {
  50624. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  50625. this[_xfa_object.$content] = isNaN(number) ? null : number;
  50626. }
  50627. [_xfa_object.$toHTML]() {
  50628. return this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "";
  50629. }
  50630. }
  50631. class Issuers extends _xfa_object.XFAObject {
  50632. constructor(attributes) {
  50633. super(TEMPLATE_NS_ID, "issuers", true);
  50634. this.id = attributes.id || "";
  50635. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50636. this.use = attributes.use || "";
  50637. this.usehref = attributes.usehref || "";
  50638. this.certificate = new _xfa_object.XFAObjectArray();
  50639. }
  50640. }
  50641. class Items extends _xfa_object.XFAObject {
  50642. constructor(attributes) {
  50643. super(TEMPLATE_NS_ID, "items", true);
  50644. this.id = attributes.id || "";
  50645. this.name = attributes.name || "";
  50646. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  50647. this.ref = attributes.ref || "";
  50648. this.save = (0, _utils.getInteger)({
  50649. data: attributes.save,
  50650. defaultValue: 0,
  50651. validate: x => x === 1
  50652. });
  50653. this.use = attributes.use || "";
  50654. this.usehref = attributes.usehref || "";
  50655. this.boolean = new _xfa_object.XFAObjectArray();
  50656. this.date = new _xfa_object.XFAObjectArray();
  50657. this.dateTime = new _xfa_object.XFAObjectArray();
  50658. this.decimal = new _xfa_object.XFAObjectArray();
  50659. this.exData = new _xfa_object.XFAObjectArray();
  50660. this.float = new _xfa_object.XFAObjectArray();
  50661. this.image = new _xfa_object.XFAObjectArray();
  50662. this.integer = new _xfa_object.XFAObjectArray();
  50663. this.text = new _xfa_object.XFAObjectArray();
  50664. this.time = new _xfa_object.XFAObjectArray();
  50665. }
  50666. [_xfa_object.$hasItem](value) {
  50667. return this.hasOwnProperty(value[_xfa_object.$nodeName]) && this[value[_xfa_object.$nodeName]].children.some(node => node[_xfa_object.$content] === value[_xfa_object.$content]);
  50668. }
  50669. }
  50670. exports.Items = Items;
  50671. class Keep extends _xfa_object.XFAObject {
  50672. constructor(attributes) {
  50673. super(TEMPLATE_NS_ID, "keep", true);
  50674. this.id = attributes.id || "";
  50675. const options = ["none", "contentArea", "pageArea"];
  50676. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  50677. this.next = (0, _utils.getStringOption)(attributes.next, options);
  50678. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  50679. this.use = attributes.use || "";
  50680. this.usehref = attributes.usehref || "";
  50681. this.extras = null;
  50682. }
  50683. }
  50684. class KeyUsage extends _xfa_object.XFAObject {
  50685. constructor(attributes) {
  50686. super(TEMPLATE_NS_ID, "keyUsage");
  50687. const options = ["", "yes", "no"];
  50688. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  50689. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  50690. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  50691. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  50692. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  50693. this.id = attributes.id || "";
  50694. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  50695. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  50696. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  50697. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  50698. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50699. this.use = attributes.use || "";
  50700. this.usehref = attributes.usehref || "";
  50701. }
  50702. }
  50703. class Line extends _xfa_object.XFAObject {
  50704. constructor(attributes) {
  50705. super(TEMPLATE_NS_ID, "line", true);
  50706. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  50707. this.id = attributes.id || "";
  50708. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  50709. this.use = attributes.use || "";
  50710. this.usehref = attributes.usehref || "";
  50711. this.edge = null;
  50712. }
  50713. }
  50714. class Linear extends _xfa_object.XFAObject {
  50715. constructor(attributes) {
  50716. super(TEMPLATE_NS_ID, "linear", true);
  50717. this.id = attributes.id || "";
  50718. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  50719. this.use = attributes.use || "";
  50720. this.usehref = attributes.usehref || "";
  50721. this.color = null;
  50722. this.extras = null;
  50723. }
  50724. [_xfa_object.$toStyle](startColor) {
  50725. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  50726. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  50727. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  50728. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  50729. }
  50730. }
  50731. class LockDocument extends _xfa_object.ContentObject {
  50732. constructor(attributes) {
  50733. super(TEMPLATE_NS_ID, "lockDocument");
  50734. this.id = attributes.id || "";
  50735. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50736. this.use = attributes.use || "";
  50737. this.usehref = attributes.usehref || "";
  50738. }
  50739. [_xfa_object.$finalize]() {
  50740. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  50741. }
  50742. }
  50743. class Manifest extends _xfa_object.XFAObject {
  50744. constructor(attributes) {
  50745. super(TEMPLATE_NS_ID, "manifest", true);
  50746. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  50747. this.id = attributes.id || "";
  50748. this.name = attributes.name || "";
  50749. this.use = attributes.use || "";
  50750. this.usehref = attributes.usehref || "";
  50751. this.extras = null;
  50752. this.ref = new _xfa_object.XFAObjectArray();
  50753. }
  50754. }
  50755. class Margin extends _xfa_object.XFAObject {
  50756. constructor(attributes) {
  50757. super(TEMPLATE_NS_ID, "margin", true);
  50758. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  50759. this.id = attributes.id || "";
  50760. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  50761. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  50762. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  50763. this.use = attributes.use || "";
  50764. this.usehref = attributes.usehref || "";
  50765. this.extras = null;
  50766. }
  50767. [_xfa_object.$toStyle]() {
  50768. return {
  50769. marginLeft: (0, _html_utils.measureToString)(this.leftInset),
  50770. marginRight: (0, _html_utils.measureToString)(this.rightInset),
  50771. marginTop: (0, _html_utils.measureToString)(this.topInset),
  50772. marginBottom: (0, _html_utils.measureToString)(this.bottomInset)
  50773. };
  50774. }
  50775. }
  50776. class Mdp extends _xfa_object.XFAObject {
  50777. constructor(attributes) {
  50778. super(TEMPLATE_NS_ID, "mdp");
  50779. this.id = attributes.id || "";
  50780. this.permissions = (0, _utils.getInteger)({
  50781. data: attributes.permissions,
  50782. defaultValue: 2,
  50783. validate: x => x === 1 || x === 3
  50784. });
  50785. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  50786. this.use = attributes.use || "";
  50787. this.usehref = attributes.usehref || "";
  50788. }
  50789. }
  50790. class Medium extends _xfa_object.XFAObject {
  50791. constructor(attributes) {
  50792. super(TEMPLATE_NS_ID, "medium");
  50793. this.id = attributes.id || "";
  50794. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  50795. this.long = (0, _utils.getMeasurement)(attributes.long);
  50796. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  50797. this.short = (0, _utils.getMeasurement)(attributes.short);
  50798. this.stock = attributes.stock || "";
  50799. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  50800. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  50801. this.use = attributes.use || "";
  50802. this.usehref = attributes.usehref || "";
  50803. }
  50804. }
  50805. class Message extends _xfa_object.XFAObject {
  50806. constructor(attributes) {
  50807. super(TEMPLATE_NS_ID, "message", true);
  50808. this.id = attributes.id || "";
  50809. this.use = attributes.use || "";
  50810. this.usehref = attributes.usehref || "";
  50811. this.text = new _xfa_object.XFAObjectArray();
  50812. }
  50813. }
  50814. class NumericEdit extends _xfa_object.XFAObject {
  50815. constructor(attributes) {
  50816. super(TEMPLATE_NS_ID, "numericEdit", true);
  50817. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  50818. this.id = attributes.id || "";
  50819. this.use = attributes.use || "";
  50820. this.usehref = attributes.usehref || "";
  50821. this.border = null;
  50822. this.comb = null;
  50823. this.extras = null;
  50824. this.margin = null;
  50825. }
  50826. [_xfa_object.$toHTML]() {
  50827. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  50828. const html = {
  50829. name: "input",
  50830. attributes: {
  50831. type: "text",
  50832. class: "xfaTextfield",
  50833. style
  50834. }
  50835. };
  50836. return {
  50837. name: "label",
  50838. attributes: {
  50839. class: "xfaLabel"
  50840. },
  50841. children: [html]
  50842. };
  50843. }
  50844. }
  50845. class Occur extends _xfa_object.XFAObject {
  50846. constructor(attributes) {
  50847. super(TEMPLATE_NS_ID, "occur", true);
  50848. this.id = attributes.id || "";
  50849. this.initial = (0, _utils.getInteger)({
  50850. data: attributes.initial,
  50851. defaultValue: 1,
  50852. validate: x => true
  50853. });
  50854. this.max = (0, _utils.getInteger)({
  50855. data: attributes.max,
  50856. defaultValue: 1,
  50857. validate: x => true
  50858. });
  50859. this.min = (0, _utils.getInteger)({
  50860. data: attributes.min,
  50861. defaultValue: 1,
  50862. validate: x => true
  50863. });
  50864. this.use = attributes.use || "";
  50865. this.usehref = attributes.usehref || "";
  50866. this.extras = null;
  50867. }
  50868. }
  50869. class Oid extends _xfa_object.StringObject {
  50870. constructor(attributes) {
  50871. super(TEMPLATE_NS_ID, "oid");
  50872. this.id = attributes.id || "";
  50873. this.name = attributes.name || "";
  50874. this.use = attributes.use || "";
  50875. this.usehref = attributes.usehref || "";
  50876. }
  50877. }
  50878. class Oids extends _xfa_object.XFAObject {
  50879. constructor(attributes) {
  50880. super(TEMPLATE_NS_ID, "oids", true);
  50881. this.id = attributes.id || "";
  50882. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  50883. this.use = attributes.use || "";
  50884. this.usehref = attributes.usehref || "";
  50885. this.oid = new _xfa_object.XFAObjectArray();
  50886. }
  50887. }
  50888. class Overflow extends _xfa_object.XFAObject {
  50889. constructor(attributes) {
  50890. super(TEMPLATE_NS_ID, "overflow");
  50891. this.id = attributes.id || "";
  50892. this.leader = attributes.leader || "";
  50893. this.target = attributes.target || "";
  50894. this.trailer = attributes.trailer || "";
  50895. this.use = attributes.use || "";
  50896. this.usehref = attributes.usehref || "";
  50897. }
  50898. }
  50899. class PageArea extends _xfa_object.XFAObject {
  50900. constructor(attributes) {
  50901. super(TEMPLATE_NS_ID, "pageArea", true);
  50902. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  50903. this.id = attributes.id || "";
  50904. this.initialNumber = (0, _utils.getInteger)({
  50905. data: attributes.initialNumber,
  50906. defaultValue: 1,
  50907. validate: x => true
  50908. });
  50909. this.name = attributes.name || "";
  50910. this.numbered = (0, _utils.getInteger)({
  50911. data: attributes.numbered,
  50912. defaultValue: 1,
  50913. validate: x => true
  50914. });
  50915. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  50916. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  50917. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  50918. this.use = attributes.use || "";
  50919. this.usehref = attributes.usehref || "";
  50920. this.desc = null;
  50921. this.extras = null;
  50922. this.medium = null;
  50923. this.occur = null;
  50924. this.area = new _xfa_object.XFAObjectArray();
  50925. this.contentArea = new _xfa_object.XFAObjectArray();
  50926. this.draw = new _xfa_object.XFAObjectArray();
  50927. this.exclGroup = new _xfa_object.XFAObjectArray();
  50928. this.field = new _xfa_object.XFAObjectArray();
  50929. this.subform = new _xfa_object.XFAObjectArray();
  50930. }
  50931. [_xfa_object.$toHTML]() {
  50932. if (this.contentArea.children.length === 0) {
  50933. return null;
  50934. }
  50935. const children = this[_xfa_object.$childrenToHTML]({
  50936. filter: new Set(["area", "draw", "field", "subform", "contentArea"]),
  50937. include: true
  50938. });
  50939. const contentArea = children.find(node => node.attributes.class === "xfaContentarea");
  50940. const style = Object.create(null);
  50941. if (this.medium && this.medium.short && this.medium.long) {
  50942. style.width = (0, _html_utils.measureToString)(this.medium.short);
  50943. style.height = (0, _html_utils.measureToString)(this.medium.long);
  50944. } else {}
  50945. return {
  50946. name: "div",
  50947. children,
  50948. attributes: {
  50949. id: this[_xfa_object.$uid],
  50950. style
  50951. },
  50952. contentArea
  50953. };
  50954. }
  50955. }
  50956. class PageSet extends _xfa_object.XFAObject {
  50957. constructor(attributes) {
  50958. super(TEMPLATE_NS_ID, "pageSet", true);
  50959. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  50960. this.id = attributes.id || "";
  50961. this.name = attributes.name || "";
  50962. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  50963. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  50964. this.use = attributes.use || "";
  50965. this.usehref = attributes.usehref || "";
  50966. this.extras = null;
  50967. this.occur = null;
  50968. this.pageArea = new _xfa_object.XFAObjectArray();
  50969. this.pageSet = new _xfa_object.XFAObjectArray();
  50970. }
  50971. [_xfa_object.$toHTML]() {
  50972. return {
  50973. name: "div",
  50974. children: this[_xfa_object.$childrenToHTML]({
  50975. filter: new Set(["pageArea", "pageSet"]),
  50976. include: true
  50977. }),
  50978. attributes: {
  50979. id: this[_xfa_object.$uid]
  50980. }
  50981. };
  50982. }
  50983. }
  50984. class Para extends _xfa_object.XFAObject {
  50985. constructor(attributes) {
  50986. super(TEMPLATE_NS_ID, "para", true);
  50987. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  50988. this.id = attributes.id || "";
  50989. this.lineHeight = (0, _utils.getMeasurement)(attributes.lineHeight, "0pt");
  50990. this.marginLeft = (0, _utils.getMeasurement)(attributes.marginLeft, "0");
  50991. this.marginRight = (0, _utils.getMeasurement)(attributes.marginRight, "0");
  50992. this.orphans = (0, _utils.getInteger)({
  50993. data: attributes.orphans,
  50994. defaultValue: 0,
  50995. validate: x => x >= 0
  50996. });
  50997. this.preserve = attributes.preserve || "";
  50998. this.radixOffset = (0, _utils.getMeasurement)(attributes.radixOffset, "0");
  50999. this.spaceAbove = (0, _utils.getMeasurement)(attributes.spaceAbove, "0");
  51000. this.spaceBelow = (0, _utils.getMeasurement)(attributes.spaceBelow, "0");
  51001. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : null;
  51002. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  51003. this.textIndent = (0, _utils.getMeasurement)(attributes.textIndent, "0");
  51004. this.use = attributes.use || "";
  51005. this.usehref = attributes.usehref || "";
  51006. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  51007. this.widows = (0, _utils.getInteger)({
  51008. data: attributes.widows,
  51009. defaultValue: 0,
  51010. validate: x => x >= 0
  51011. });
  51012. this.hyphenation = null;
  51013. }
  51014. [_xfa_object.$toHTML]() {
  51015. const style = {
  51016. marginLeft: (0, _html_utils.measureToString)(this.marginLeft),
  51017. marginRight: (0, _html_utils.measureToString)(this.marginRight),
  51018. paddingTop: (0, _html_utils.measureToString)(this.spaceAbove),
  51019. paddingBottom: (0, _html_utils.measureToString)(this.spaceBelow),
  51020. textIndent: (0, _html_utils.measureToString)(this.textIndent),
  51021. verticalAlign: this.vAlign
  51022. };
  51023. if (this.lineHeight.value >= 0) {
  51024. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  51025. }
  51026. if (this.tabDefault) {
  51027. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  51028. }
  51029. if (this.tabStops.length > 0) {}
  51030. if (this.hyphenatation) {
  51031. Object.assign(style, this.hyphenatation[_xfa_object.$toHTML]());
  51032. }
  51033. return style;
  51034. }
  51035. }
  51036. class PasswordEdit extends _xfa_object.XFAObject {
  51037. constructor(attributes) {
  51038. super(TEMPLATE_NS_ID, "passwordEdit", true);
  51039. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  51040. this.id = attributes.id || "";
  51041. this.passwordChar = attributes.passwordChar || "*";
  51042. this.use = attributes.use || "";
  51043. this.usehref = attributes.usehref || "";
  51044. this.border = null;
  51045. this.extras = null;
  51046. this.margin = null;
  51047. }
  51048. }
  51049. class Pattern extends _xfa_object.XFAObject {
  51050. constructor(attributes) {
  51051. super(TEMPLATE_NS_ID, "pattern", true);
  51052. this.id = attributes.id || "";
  51053. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  51054. this.use = attributes.use || "";
  51055. this.usehref = attributes.usehref || "";
  51056. this.color = null;
  51057. this.extras = null;
  51058. }
  51059. [_xfa_object.$toStyle](startColor) {
  51060. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  51061. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  51062. const width = 5;
  51063. const cmd = "repeating-linear-gradient";
  51064. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  51065. switch (this.type) {
  51066. case "crossHatch":
  51067. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  51068. case "crossDiagonal":
  51069. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  51070. case "diagonalLeft":
  51071. return `${cmd}(45deg,${colors})`;
  51072. case "diagonalRight":
  51073. return `${cmd}(-45deg,${colors})`;
  51074. case "horizontal":
  51075. return `${cmd}(to top,${colors})`;
  51076. case "vertical":
  51077. return `${cmd}(to right,${colors})`;
  51078. }
  51079. return "";
  51080. }
  51081. }
  51082. class Picture extends _xfa_object.StringObject {
  51083. constructor(attributes) {
  51084. super(TEMPLATE_NS_ID, "picture");
  51085. this.id = attributes.id || "";
  51086. this.use = attributes.use || "";
  51087. this.usehref = attributes.usehref || "";
  51088. }
  51089. }
  51090. class Proto extends _xfa_object.XFAObject {
  51091. constructor(attributes) {
  51092. super(TEMPLATE_NS_ID, "proto", true);
  51093. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  51094. this.arc = new _xfa_object.XFAObjectArray();
  51095. this.area = new _xfa_object.XFAObjectArray();
  51096. this.assist = new _xfa_object.XFAObjectArray();
  51097. this.barcode = new _xfa_object.XFAObjectArray();
  51098. this.bindItems = new _xfa_object.XFAObjectArray();
  51099. this.bookend = new _xfa_object.XFAObjectArray();
  51100. this.boolean = new _xfa_object.XFAObjectArray();
  51101. this.border = new _xfa_object.XFAObjectArray();
  51102. this.break = new _xfa_object.XFAObjectArray();
  51103. this.breakAfter = new _xfa_object.XFAObjectArray();
  51104. this.breakBefore = new _xfa_object.XFAObjectArray();
  51105. this.button = new _xfa_object.XFAObjectArray();
  51106. this.calculate = new _xfa_object.XFAObjectArray();
  51107. this.caption = new _xfa_object.XFAObjectArray();
  51108. this.certificate = new _xfa_object.XFAObjectArray();
  51109. this.certificates = new _xfa_object.XFAObjectArray();
  51110. this.checkButton = new _xfa_object.XFAObjectArray();
  51111. this.choiceList = new _xfa_object.XFAObjectArray();
  51112. this.color = new _xfa_object.XFAObjectArray();
  51113. this.comb = new _xfa_object.XFAObjectArray();
  51114. this.connect = new _xfa_object.XFAObjectArray();
  51115. this.contentArea = new _xfa_object.XFAObjectArray();
  51116. this.corner = new _xfa_object.XFAObjectArray();
  51117. this.date = new _xfa_object.XFAObjectArray();
  51118. this.dateTime = new _xfa_object.XFAObjectArray();
  51119. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  51120. this.decimal = new _xfa_object.XFAObjectArray();
  51121. this.defaultUi = new _xfa_object.XFAObjectArray();
  51122. this.desc = new _xfa_object.XFAObjectArray();
  51123. this.digestMethod = new _xfa_object.XFAObjectArray();
  51124. this.digestMethods = new _xfa_object.XFAObjectArray();
  51125. this.draw = new _xfa_object.XFAObjectArray();
  51126. this.edge = new _xfa_object.XFAObjectArray();
  51127. this.encoding = new _xfa_object.XFAObjectArray();
  51128. this.encodings = new _xfa_object.XFAObjectArray();
  51129. this.encrypt = new _xfa_object.XFAObjectArray();
  51130. this.encryptData = new _xfa_object.XFAObjectArray();
  51131. this.encryption = new _xfa_object.XFAObjectArray();
  51132. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  51133. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  51134. this.event = new _xfa_object.XFAObjectArray();
  51135. this.exData = new _xfa_object.XFAObjectArray();
  51136. this.exObject = new _xfa_object.XFAObjectArray();
  51137. this.exclGroup = new _xfa_object.XFAObjectArray();
  51138. this.execute = new _xfa_object.XFAObjectArray();
  51139. this.extras = new _xfa_object.XFAObjectArray();
  51140. this.field = new _xfa_object.XFAObjectArray();
  51141. this.fill = new _xfa_object.XFAObjectArray();
  51142. this.filter = new _xfa_object.XFAObjectArray();
  51143. this.float = new _xfa_object.XFAObjectArray();
  51144. this.font = new _xfa_object.XFAObjectArray();
  51145. this.format = new _xfa_object.XFAObjectArray();
  51146. this.handler = new _xfa_object.XFAObjectArray();
  51147. this.hyphenation = new _xfa_object.XFAObjectArray();
  51148. this.image = new _xfa_object.XFAObjectArray();
  51149. this.imageEdit = new _xfa_object.XFAObjectArray();
  51150. this.integer = new _xfa_object.XFAObjectArray();
  51151. this.issuers = new _xfa_object.XFAObjectArray();
  51152. this.items = new _xfa_object.XFAObjectArray();
  51153. this.keep = new _xfa_object.XFAObjectArray();
  51154. this.keyUsage = new _xfa_object.XFAObjectArray();
  51155. this.line = new _xfa_object.XFAObjectArray();
  51156. this.linear = new _xfa_object.XFAObjectArray();
  51157. this.lockDocument = new _xfa_object.XFAObjectArray();
  51158. this.manifest = new _xfa_object.XFAObjectArray();
  51159. this.margin = new _xfa_object.XFAObjectArray();
  51160. this.mdp = new _xfa_object.XFAObjectArray();
  51161. this.medium = new _xfa_object.XFAObjectArray();
  51162. this.message = new _xfa_object.XFAObjectArray();
  51163. this.numericEdit = new _xfa_object.XFAObjectArray();
  51164. this.occur = new _xfa_object.XFAObjectArray();
  51165. this.oid = new _xfa_object.XFAObjectArray();
  51166. this.oids = new _xfa_object.XFAObjectArray();
  51167. this.overflow = new _xfa_object.XFAObjectArray();
  51168. this.pageArea = new _xfa_object.XFAObjectArray();
  51169. this.pageSet = new _xfa_object.XFAObjectArray();
  51170. this.para = new _xfa_object.XFAObjectArray();
  51171. this.passwordEdit = new _xfa_object.XFAObjectArray();
  51172. this.pattern = new _xfa_object.XFAObjectArray();
  51173. this.picture = new _xfa_object.XFAObjectArray();
  51174. this.radial = new _xfa_object.XFAObjectArray();
  51175. this.reason = new _xfa_object.XFAObjectArray();
  51176. this.reasons = new _xfa_object.XFAObjectArray();
  51177. this.rectangle = new _xfa_object.XFAObjectArray();
  51178. this.ref = new _xfa_object.XFAObjectArray();
  51179. this.script = new _xfa_object.XFAObjectArray();
  51180. this.setProperty = new _xfa_object.XFAObjectArray();
  51181. this.signData = new _xfa_object.XFAObjectArray();
  51182. this.signature = new _xfa_object.XFAObjectArray();
  51183. this.signing = new _xfa_object.XFAObjectArray();
  51184. this.solid = new _xfa_object.XFAObjectArray();
  51185. this.speak = new _xfa_object.XFAObjectArray();
  51186. this.stipple = new _xfa_object.XFAObjectArray();
  51187. this.subform = new _xfa_object.XFAObjectArray();
  51188. this.subformSet = new _xfa_object.XFAObjectArray();
  51189. this.subjectDN = new _xfa_object.XFAObjectArray();
  51190. this.subjectDNs = new _xfa_object.XFAObjectArray();
  51191. this.submit = new _xfa_object.XFAObjectArray();
  51192. this.text = new _xfa_object.XFAObjectArray();
  51193. this.textEdit = new _xfa_object.XFAObjectArray();
  51194. this.time = new _xfa_object.XFAObjectArray();
  51195. this.timeStamp = new _xfa_object.XFAObjectArray();
  51196. this.toolTip = new _xfa_object.XFAObjectArray();
  51197. this.traversal = new _xfa_object.XFAObjectArray();
  51198. this.traverse = new _xfa_object.XFAObjectArray();
  51199. this.ui = new _xfa_object.XFAObjectArray();
  51200. this.validate = new _xfa_object.XFAObjectArray();
  51201. this.value = new _xfa_object.XFAObjectArray();
  51202. this.variables = new _xfa_object.XFAObjectArray();
  51203. }
  51204. }
  51205. class Radial extends _xfa_object.XFAObject {
  51206. constructor(attributes) {
  51207. super(TEMPLATE_NS_ID, "radial", true);
  51208. this.id = attributes.id || "";
  51209. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  51210. this.use = attributes.use || "";
  51211. this.usehref = attributes.usehref || "";
  51212. this.color = null;
  51213. this.extras = null;
  51214. }
  51215. [_xfa_object.$toStyle](startColor) {
  51216. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  51217. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  51218. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  51219. return `radial-gradient(circle to center, ${colors})`;
  51220. }
  51221. }
  51222. class Reason extends _xfa_object.StringObject {
  51223. constructor(attributes) {
  51224. super(TEMPLATE_NS_ID, "reason");
  51225. this.id = attributes.id || "";
  51226. this.name = attributes.name || "";
  51227. this.use = attributes.use || "";
  51228. this.usehref = attributes.usehref || "";
  51229. }
  51230. }
  51231. class Reasons extends _xfa_object.XFAObject {
  51232. constructor(attributes) {
  51233. super(TEMPLATE_NS_ID, "reasons", true);
  51234. this.id = attributes.id || "";
  51235. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51236. this.use = attributes.use || "";
  51237. this.usehref = attributes.usehref || "";
  51238. this.reason = new _xfa_object.XFAObjectArray();
  51239. }
  51240. }
  51241. class Rectangle extends _xfa_object.XFAObject {
  51242. constructor(attributes) {
  51243. super(TEMPLATE_NS_ID, "rectangle", true);
  51244. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  51245. this.id = attributes.id || "";
  51246. this.use = attributes.use || "";
  51247. this.usehref = attributes.usehref || "";
  51248. this.corner = new _xfa_object.XFAObjectArray(4);
  51249. this.edge = new _xfa_object.XFAObjectArray(4);
  51250. this.fill = null;
  51251. }
  51252. }
  51253. class RefElement extends _xfa_object.StringObject {
  51254. constructor(attributes) {
  51255. super(TEMPLATE_NS_ID, "ref");
  51256. this.id = attributes.id || "";
  51257. this.use = attributes.use || "";
  51258. this.usehref = attributes.usehref || "";
  51259. }
  51260. }
  51261. class Script extends _xfa_object.StringObject {
  51262. constructor(attributes) {
  51263. super(TEMPLATE_NS_ID, "script");
  51264. this.binding = attributes.binding || "";
  51265. this.contentType = attributes.contentType || "";
  51266. this.id = attributes.id || "";
  51267. this.name = attributes.name || "";
  51268. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  51269. this.use = attributes.use || "";
  51270. this.usehref = attributes.usehref || "";
  51271. }
  51272. }
  51273. class SetProperty extends _xfa_object.XFAObject {
  51274. constructor(attributes) {
  51275. super(TEMPLATE_NS_ID, "setProperty");
  51276. this.connection = attributes.connection || "";
  51277. this.ref = attributes.ref || "";
  51278. this.target = attributes.target || "";
  51279. }
  51280. }
  51281. exports.SetProperty = SetProperty;
  51282. class SignData extends _xfa_object.XFAObject {
  51283. constructor(attributes) {
  51284. super(TEMPLATE_NS_ID, "signData", true);
  51285. this.id = attributes.id || "";
  51286. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  51287. this.ref = attributes.ref || "";
  51288. this.target = attributes.target || "";
  51289. this.use = attributes.use || "";
  51290. this.usehref = attributes.usehref || "";
  51291. this.filter = null;
  51292. this.manifest = null;
  51293. }
  51294. }
  51295. class Signature extends _xfa_object.XFAObject {
  51296. constructor(attributes) {
  51297. super(TEMPLATE_NS_ID, "signature", true);
  51298. this.id = attributes.id || "";
  51299. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  51300. this.use = attributes.use || "";
  51301. this.usehref = attributes.usehref || "";
  51302. this.border = null;
  51303. this.extras = null;
  51304. this.filter = null;
  51305. this.manifest = null;
  51306. this.margin = null;
  51307. }
  51308. }
  51309. class Signing extends _xfa_object.XFAObject {
  51310. constructor(attributes) {
  51311. super(TEMPLATE_NS_ID, "signing", true);
  51312. this.id = attributes.id || "";
  51313. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51314. this.use = attributes.use || "";
  51315. this.usehref = attributes.usehref || "";
  51316. this.certificate = new _xfa_object.XFAObjectArray();
  51317. }
  51318. }
  51319. class Solid extends _xfa_object.XFAObject {
  51320. constructor(attributes) {
  51321. super(TEMPLATE_NS_ID, "solid", true);
  51322. this.id = attributes.id || "";
  51323. this.use = attributes.use || "";
  51324. this.usehref = attributes.usehref || "";
  51325. this.extras = null;
  51326. }
  51327. [_xfa_object.$toStyle](startColor) {
  51328. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  51329. }
  51330. }
  51331. class Speak extends _xfa_object.StringObject {
  51332. constructor(attributes) {
  51333. super(TEMPLATE_NS_ID, "speak");
  51334. this.disable = (0, _utils.getInteger)({
  51335. data: attributes.disable,
  51336. defaultValue: 0,
  51337. validate: x => x === 1
  51338. });
  51339. this.id = attributes.id || "";
  51340. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  51341. this.rid = attributes.rid || "";
  51342. this.use = attributes.use || "";
  51343. this.usehref = attributes.usehref || "";
  51344. }
  51345. }
  51346. class Stipple extends _xfa_object.XFAObject {
  51347. constructor(attributes) {
  51348. super(TEMPLATE_NS_ID, "stipple", true);
  51349. this.id = attributes.id || "";
  51350. this.rate = (0, _utils.getInteger)({
  51351. data: attributes.rate,
  51352. defaultValue: 50,
  51353. validate: x => x >= 0 && x <= 100
  51354. });
  51355. this.use = attributes.use || "";
  51356. this.usehref = attributes.usehref || "";
  51357. this.color = null;
  51358. this.extras = null;
  51359. }
  51360. [_xfa_object.$toStyle](bgColor) {
  51361. const alpha = this.rate / 100;
  51362. return _util.Util.makeHexColor(Math.round(bgColor.value.r * (1 - alpha) + this.value.r * alpha), Math.round(bgColor.value.g * (1 - alpha) + this.value.g * alpha), Math.round(bgColor.value.b * (1 - alpha) + this.value.b * alpha));
  51363. }
  51364. }
  51365. class Subform extends _xfa_object.XFAObject {
  51366. constructor(attributes) {
  51367. super(TEMPLATE_NS_ID, "subform", true);
  51368. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  51369. this.allowMacro = (0, _utils.getInteger)({
  51370. data: attributes.allowMacro,
  51371. defaultValue: 0,
  51372. validate: x => x === 1
  51373. });
  51374. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  51375. this.colSpan = (0, _utils.getInteger)({
  51376. data: attributes.colSpan,
  51377. defaultValue: 1,
  51378. validate: x => x >= 1
  51379. });
  51380. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  51381. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  51382. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  51383. this.id = attributes.id || "";
  51384. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  51385. this.locale = attributes.locale || "";
  51386. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  51387. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  51388. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  51389. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  51390. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  51391. this.name = attributes.name || "";
  51392. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  51393. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  51394. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  51395. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  51396. this.use = attributes.use || "";
  51397. this.usehref = attributes.usehref || "";
  51398. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  51399. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  51400. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  51401. this.assist = null;
  51402. this.bind = null;
  51403. this.bookend = null;
  51404. this.border = null;
  51405. this.break = null;
  51406. this.calculate = null;
  51407. this.desc = null;
  51408. this.extras = null;
  51409. this.keep = null;
  51410. this.margin = null;
  51411. this.occur = null;
  51412. this.overflow = null;
  51413. this.pageSet = null;
  51414. this.para = null;
  51415. this.traversal = null;
  51416. this.validate = null;
  51417. this.variables = null;
  51418. this.area = new _xfa_object.XFAObjectArray();
  51419. this.breakAfter = new _xfa_object.XFAObjectArray();
  51420. this.breakBefore = new _xfa_object.XFAObjectArray();
  51421. this.connect = new _xfa_object.XFAObjectArray();
  51422. this.draw = new _xfa_object.XFAObjectArray();
  51423. this.event = new _xfa_object.XFAObjectArray();
  51424. this.exObject = new _xfa_object.XFAObjectArray();
  51425. this.exclGroup = new _xfa_object.XFAObjectArray();
  51426. this.field = new _xfa_object.XFAObjectArray();
  51427. this.proto = new _xfa_object.XFAObjectArray();
  51428. this.setProperty = new _xfa_object.XFAObjectArray();
  51429. this.subform = new _xfa_object.XFAObjectArray();
  51430. this.subformSet = new _xfa_object.XFAObjectArray();
  51431. }
  51432. [_xfa_object.$toHTML]() {
  51433. this[_xfa_object.$extra] = Object.create(null);
  51434. const parent = this[_xfa_object.$getParent]();
  51435. let page = null;
  51436. if (parent[_xfa_object.$nodeName] === "template") {
  51437. if (this.pageSet !== null) {
  51438. this[_xfa_object.$extra].pageNumber = 0;
  51439. } else {
  51440. (0, _util.warn)("XFA - No pageSet in root subform");
  51441. }
  51442. } else if (parent[_xfa_object.$extra] && parent[_xfa_object.$extra].pageNumber !== undefined) {
  51443. const pageNumber = parent[_xfa_object.$extra].pageNumber;
  51444. const pageAreas = parent.pageSet.pageArea.children;
  51445. parent[_xfa_object.$extra].pageNumber = (parent[_xfa_object.$extra].pageNumber + 1) % pageAreas.length;
  51446. page = pageAreas[pageNumber][_xfa_object.$toHTML]();
  51447. }
  51448. const style = (0, _html_utils.toStyle)(this, "dimensions", "position", "presence");
  51449. const clazz = ["xfaSubform"];
  51450. const cl = (0, _html_utils.layoutClass)(this);
  51451. if (cl) {
  51452. clazz.push(cl);
  51453. }
  51454. const attributes = {
  51455. style,
  51456. id: this[_xfa_object.$uid],
  51457. class: clazz.join(" ")
  51458. };
  51459. if (this.name) {
  51460. attributes.xfaName = this.name;
  51461. }
  51462. const children = this[_xfa_object.$childrenToHTML]({
  51463. filter: new Set(["area", "draw", "field", "subform", "subformSet"]),
  51464. include: true
  51465. });
  51466. const html = {
  51467. name: "div",
  51468. attributes,
  51469. children
  51470. };
  51471. if (page) {
  51472. page.contentArea.children.push(html);
  51473. delete page.contentArea;
  51474. return page;
  51475. }
  51476. return html;
  51477. }
  51478. }
  51479. class SubformSet extends _xfa_object.XFAObject {
  51480. constructor(attributes) {
  51481. super(TEMPLATE_NS_ID, "subformSet", true);
  51482. this.id = attributes.id || "";
  51483. this.name = attributes.name || "";
  51484. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  51485. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  51486. this.use = attributes.use || "";
  51487. this.usehref = attributes.usehref || "";
  51488. this.bookend = null;
  51489. this.break = null;
  51490. this.desc = null;
  51491. this.extras = null;
  51492. this.occur = null;
  51493. this.overflow = null;
  51494. this.breakAfter = new _xfa_object.XFAObjectArray();
  51495. this.breakBefore = new _xfa_object.XFAObjectArray();
  51496. this.subform = new _xfa_object.XFAObjectArray();
  51497. this.subformSet = new _xfa_object.XFAObjectArray();
  51498. }
  51499. }
  51500. class SubjectDN extends _xfa_object.ContentObject {
  51501. constructor(attributes) {
  51502. super(TEMPLATE_NS_ID, "subjectDN");
  51503. this.delimiter = attributes.delimiter || ",";
  51504. this.id = attributes.id || "";
  51505. this.name = attributes.name || "";
  51506. this.use = attributes.use || "";
  51507. this.usehref = attributes.usehref || "";
  51508. }
  51509. [_xfa_object.$finalize]() {
  51510. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  51511. kv = kv.split("=", 2);
  51512. kv[0] = kv[0].trim();
  51513. return kv;
  51514. }));
  51515. }
  51516. }
  51517. class SubjectDNs extends _xfa_object.XFAObject {
  51518. constructor(attributes) {
  51519. super(TEMPLATE_NS_ID, "subjectDNs", true);
  51520. this.id = attributes.id || "";
  51521. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51522. this.use = attributes.use || "";
  51523. this.usehref = attributes.usehref || "";
  51524. this.subjectDN = new _xfa_object.XFAObjectArray();
  51525. }
  51526. }
  51527. class Submit extends _xfa_object.XFAObject {
  51528. constructor(attributes) {
  51529. super(TEMPLATE_NS_ID, "submit", true);
  51530. this.embedPDF = (0, _utils.getInteger)({
  51531. data: attributes.embedPDF,
  51532. defaultValue: 0,
  51533. validate: x => x === 1
  51534. });
  51535. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  51536. this.id = attributes.id || "";
  51537. this.target = attributes.target || "";
  51538. this.textEncoding = (0, _utils.getKeyword)({
  51539. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  51540. defaultValue: "",
  51541. validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-[0-9]{2}/)
  51542. });
  51543. this.use = attributes.use || "";
  51544. this.usehref = attributes.usehref || "";
  51545. this.xdpContent = attributes.xdpContent || "";
  51546. this.encrypt = null;
  51547. this.encryptData = new _xfa_object.XFAObjectArray();
  51548. this.signData = new _xfa_object.XFAObjectArray();
  51549. }
  51550. }
  51551. class Template extends _xfa_object.XFAObject {
  51552. constructor(attributes) {
  51553. super(TEMPLATE_NS_ID, "template", true);
  51554. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  51555. this.extras = null;
  51556. this.subform = new _xfa_object.XFAObjectArray();
  51557. }
  51558. [_xfa_object.$finalize]() {
  51559. if (this.subform.children.length === 0) {
  51560. (0, _util.warn)("XFA - No subforms in template node.");
  51561. }
  51562. if (this.subform.children.length >= 2) {
  51563. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  51564. }
  51565. }
  51566. [_xfa_object.$toHTML]() {
  51567. if (this.subform.children.length > 0) {
  51568. return this.subform.children[0][_xfa_object.$toHTML]();
  51569. }
  51570. return {
  51571. name: "div",
  51572. children: []
  51573. };
  51574. }
  51575. }
  51576. exports.Template = Template;
  51577. class Text extends _xfa_object.ContentObject {
  51578. constructor(attributes) {
  51579. super(TEMPLATE_NS_ID, "text");
  51580. this.id = attributes.id || "";
  51581. this.maxChars = (0, _utils.getInteger)({
  51582. data: attributes.maxChars,
  51583. defaultValue: 0,
  51584. validate: x => x >= 0
  51585. });
  51586. this.name = attributes.name || "";
  51587. this.rid = attributes.rid || "";
  51588. this.use = attributes.use || "";
  51589. this.usehref = attributes.usehref || "";
  51590. }
  51591. [_xfa_object.$onChild](child) {
  51592. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  51593. this[_xfa_object.$content] = child;
  51594. return true;
  51595. }
  51596. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  51597. return false;
  51598. }
  51599. [_xfa_object.$toHTML]() {
  51600. if (typeof this[_xfa_object.$content] === "string") {
  51601. return this[_xfa_object.$content];
  51602. }
  51603. return this[_xfa_object.$content][_xfa_object.$toHTML]();
  51604. }
  51605. }
  51606. exports.Text = Text;
  51607. class TextEdit extends _xfa_object.XFAObject {
  51608. constructor(attributes) {
  51609. super(TEMPLATE_NS_ID, "textEdit", true);
  51610. this.allowRichText = (0, _utils.getInteger)({
  51611. data: attributes.allowRichText,
  51612. defaultValue: 0,
  51613. validate: x => x === 1
  51614. });
  51615. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  51616. this.id = attributes.id || "";
  51617. this.multiLine = (0, _utils.getInteger)({
  51618. data: attributes.multiLine,
  51619. defaultValue: 1,
  51620. validate: x => x === 0
  51621. });
  51622. this.use = attributes.use || "";
  51623. this.usehref = attributes.usehref || "";
  51624. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  51625. this.border = null;
  51626. this.comb = null;
  51627. this.extras = null;
  51628. this.margin = null;
  51629. }
  51630. [_xfa_object.$toHTML]() {
  51631. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  51632. let html;
  51633. if (this.multiline === 1) {
  51634. html = {
  51635. name: "textarea",
  51636. attributes: {
  51637. style
  51638. }
  51639. };
  51640. } else {
  51641. html = {
  51642. name: "input",
  51643. attributes: {
  51644. type: "text",
  51645. class: "xfaTextfield",
  51646. style
  51647. }
  51648. };
  51649. }
  51650. return {
  51651. name: "label",
  51652. attributes: {
  51653. class: "xfaLabel"
  51654. },
  51655. children: [html]
  51656. };
  51657. }
  51658. }
  51659. class Time extends _xfa_object.StringObject {
  51660. constructor(attributes) {
  51661. super(TEMPLATE_NS_ID, "time");
  51662. this.id = attributes.id || "";
  51663. this.name = attributes.name || "";
  51664. this.use = attributes.use || "";
  51665. this.usehref = attributes.usehref || "";
  51666. }
  51667. [_xfa_object.$finalize]() {
  51668. this[_xfa_object.$content] = new Date(this[_xfa_object.$content]);
  51669. }
  51670. [_xfa_object.$toHTML]() {
  51671. return this[_xfa_object.$content].toString();
  51672. }
  51673. }
  51674. class TimeStamp extends _xfa_object.XFAObject {
  51675. constructor(attributes) {
  51676. super(TEMPLATE_NS_ID, "timeStamp");
  51677. this.id = attributes.id || "";
  51678. this.server = attributes.server || "";
  51679. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51680. this.use = attributes.use || "";
  51681. this.usehref = attributes.usehref || "";
  51682. }
  51683. }
  51684. class ToolTip extends _xfa_object.StringObject {
  51685. constructor(attributes) {
  51686. super(TEMPLATE_NS_ID, "toolTip");
  51687. this.id = attributes.id || "";
  51688. this.rid = attributes.rid || "";
  51689. this.use = attributes.use || "";
  51690. this.usehref = attributes.usehref || "";
  51691. }
  51692. }
  51693. class Traversal extends _xfa_object.XFAObject {
  51694. constructor(attributes) {
  51695. super(TEMPLATE_NS_ID, "traversal", true);
  51696. this.id = attributes.id || "";
  51697. this.use = attributes.use || "";
  51698. this.usehref = attributes.usehref || "";
  51699. this.extras = null;
  51700. this.traverse = new _xfa_object.XFAObjectArray();
  51701. }
  51702. }
  51703. class Traverse extends _xfa_object.XFAObject {
  51704. constructor(attributes) {
  51705. super(TEMPLATE_NS_ID, "traverse", true);
  51706. this.id = attributes.id || "";
  51707. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  51708. this.ref = attributes.ref || "";
  51709. this.use = attributes.use || "";
  51710. this.usehref = attributes.usehref || "";
  51711. this.extras = null;
  51712. this.script = null;
  51713. }
  51714. get name() {
  51715. return this.operation;
  51716. }
  51717. [_xfa_object.$isTransparent]() {
  51718. return false;
  51719. }
  51720. }
  51721. class Ui extends _xfa_object.XFAObject {
  51722. constructor(attributes) {
  51723. super(TEMPLATE_NS_ID, "ui", true);
  51724. this.id = attributes.id || "";
  51725. this.use = attributes.use || "";
  51726. this.usehref = attributes.usehref || "";
  51727. this.extras = null;
  51728. this.picture = null;
  51729. this.barcode = null;
  51730. this.button = null;
  51731. this.checkButton = null;
  51732. this.choiceList = null;
  51733. this.dateTimeEdit = null;
  51734. this.defaultUi = null;
  51735. this.imageEdit = null;
  51736. this.numericEdit = null;
  51737. this.passwordEdit = null;
  51738. this.signature = null;
  51739. this.textEdit = null;
  51740. }
  51741. [_xfa_object.$toHTML]() {
  51742. for (const name of Object.getOwnPropertyNames(this)) {
  51743. if (name === "extras" || name === "picture") {
  51744. continue;
  51745. }
  51746. const obj = this[name];
  51747. if (!(obj instanceof _xfa_object.XFAObject)) {
  51748. continue;
  51749. }
  51750. return obj[_xfa_object.$toHTML]();
  51751. }
  51752. return null;
  51753. }
  51754. }
  51755. class Validate extends _xfa_object.XFAObject {
  51756. constructor(attributes) {
  51757. super(TEMPLATE_NS_ID, "validate", true);
  51758. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  51759. this.id = attributes.id || "";
  51760. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  51761. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  51762. this.use = attributes.use || "";
  51763. this.usehref = attributes.usehref || "";
  51764. this.extras = null;
  51765. this.message = null;
  51766. this.picture = null;
  51767. this.script = null;
  51768. }
  51769. }
  51770. class Value extends _xfa_object.XFAObject {
  51771. constructor(attributes) {
  51772. super(TEMPLATE_NS_ID, "value", true);
  51773. this.id = attributes.id || "";
  51774. this.override = (0, _utils.getInteger)({
  51775. data: attributes.override,
  51776. defaultValue: 0,
  51777. validate: x => x === 1
  51778. });
  51779. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  51780. this.use = attributes.use || "";
  51781. this.usehref = attributes.usehref || "";
  51782. this.arc = null;
  51783. this.boolean = null;
  51784. this.date = null;
  51785. this.dateTime = null;
  51786. this.decimal = null;
  51787. this.exData = null;
  51788. this.float = null;
  51789. this.image = null;
  51790. this.integer = null;
  51791. this.line = null;
  51792. this.rectangle = null;
  51793. this.text = null;
  51794. this.time = null;
  51795. }
  51796. [_xfa_object.$setValue](value) {
  51797. const valueName = value[_xfa_object.$nodeName];
  51798. if (this[valueName] !== null) {
  51799. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  51800. return;
  51801. }
  51802. for (const name of Object.getOwnPropertyNames(this)) {
  51803. const obj = this[name];
  51804. if (obj instanceof _xfa_object.XFAObject) {
  51805. this[name] = null;
  51806. this[_xfa_object.$removeChild](obj);
  51807. }
  51808. }
  51809. this[value[_xfa_object.$nodeName]] = value;
  51810. this[_xfa_object.$appendChild](value);
  51811. }
  51812. [_xfa_object.$toHTML]() {
  51813. for (const name of Object.getOwnPropertyNames(this)) {
  51814. const obj = this[name];
  51815. if (!(obj instanceof _xfa_object.XFAObject)) {
  51816. continue;
  51817. }
  51818. return obj[_xfa_object.$toHTML]();
  51819. }
  51820. return null;
  51821. }
  51822. }
  51823. exports.Value = Value;
  51824. class Variables extends _xfa_object.XFAObject {
  51825. constructor(attributes) {
  51826. super(TEMPLATE_NS_ID, "variables", true);
  51827. this.id = attributes.id || "";
  51828. this.use = attributes.use || "";
  51829. this.usehref = attributes.usehref || "";
  51830. this.boolean = new _xfa_object.XFAObjectArray();
  51831. this.date = new _xfa_object.XFAObjectArray();
  51832. this.dateTime = new _xfa_object.XFAObjectArray();
  51833. this.decimal = new _xfa_object.XFAObjectArray();
  51834. this.exData = new _xfa_object.XFAObjectArray();
  51835. this.float = new _xfa_object.XFAObjectArray();
  51836. this.image = new _xfa_object.XFAObjectArray();
  51837. this.integer = new _xfa_object.XFAObjectArray();
  51838. this.manifest = new _xfa_object.XFAObjectArray();
  51839. this.script = new _xfa_object.XFAObjectArray();
  51840. this.text = new _xfa_object.XFAObjectArray();
  51841. this.time = new _xfa_object.XFAObjectArray();
  51842. }
  51843. [_xfa_object.$isTransparent]() {
  51844. return true;
  51845. }
  51846. }
  51847. class TemplateNamespace {
  51848. static [_namespaces.$buildXFAObject](name, attributes) {
  51849. if (TemplateNamespace.hasOwnProperty(name)) {
  51850. const node = TemplateNamespace[name](attributes);
  51851. node[_xfa_object.$setSetAttributes](attributes);
  51852. return node;
  51853. }
  51854. return undefined;
  51855. }
  51856. static appearanceFilter(attrs) {
  51857. return new AppearanceFilter(attrs);
  51858. }
  51859. static arc(attrs) {
  51860. return new Arc(attrs);
  51861. }
  51862. static area(attrs) {
  51863. return new Area(attrs);
  51864. }
  51865. static assist(attrs) {
  51866. return new Assist(attrs);
  51867. }
  51868. static barcode(attrs) {
  51869. return new Barcode(attrs);
  51870. }
  51871. static bind(attrs) {
  51872. return new Bind(attrs);
  51873. }
  51874. static bindItems(attrs) {
  51875. return new BindItems(attrs);
  51876. }
  51877. static bookend(attrs) {
  51878. return new Bookend(attrs);
  51879. }
  51880. static boolean(attrs) {
  51881. return new BooleanElement(attrs);
  51882. }
  51883. static border(attrs) {
  51884. return new Border(attrs);
  51885. }
  51886. static break(attrs) {
  51887. return new Break(attrs);
  51888. }
  51889. static breakAfter(attrs) {
  51890. return new BreakAfter(attrs);
  51891. }
  51892. static breakBefore(attrs) {
  51893. return new BreakBefore(attrs);
  51894. }
  51895. static button(attrs) {
  51896. return new Button(attrs);
  51897. }
  51898. static calculate(attrs) {
  51899. return new Calculate(attrs);
  51900. }
  51901. static caption(attrs) {
  51902. return new Caption(attrs);
  51903. }
  51904. static certificate(attrs) {
  51905. return new Certificate(attrs);
  51906. }
  51907. static certificates(attrs) {
  51908. return new Certificates(attrs);
  51909. }
  51910. static checkButton(attrs) {
  51911. return new CheckButton(attrs);
  51912. }
  51913. static choiceList(attrs) {
  51914. return new ChoiceList(attrs);
  51915. }
  51916. static color(attrs) {
  51917. return new Color(attrs);
  51918. }
  51919. static comb(attrs) {
  51920. return new Comb(attrs);
  51921. }
  51922. static connect(attrs) {
  51923. return new Connect(attrs);
  51924. }
  51925. static contentArea(attrs) {
  51926. return new ContentArea(attrs);
  51927. }
  51928. static corner(attrs) {
  51929. return new Corner(attrs);
  51930. }
  51931. static date(attrs) {
  51932. return new DateElement(attrs);
  51933. }
  51934. static dateTime(attrs) {
  51935. return new DateTime(attrs);
  51936. }
  51937. static dateTimeEdit(attrs) {
  51938. return new DateTimeEdit(attrs);
  51939. }
  51940. static decimal(attrs) {
  51941. return new Decimal(attrs);
  51942. }
  51943. static defaultUi(attrs) {
  51944. return new DefaultUi(attrs);
  51945. }
  51946. static desc(attrs) {
  51947. return new Desc(attrs);
  51948. }
  51949. static digestMethod(attrs) {
  51950. return new DigestMethod(attrs);
  51951. }
  51952. static digestMethods(attrs) {
  51953. return new DigestMethods(attrs);
  51954. }
  51955. static draw(attrs) {
  51956. return new Draw(attrs);
  51957. }
  51958. static edge(attrs) {
  51959. return new Edge(attrs);
  51960. }
  51961. static encoding(attrs) {
  51962. return new Encoding(attrs);
  51963. }
  51964. static encodings(attrs) {
  51965. return new Encodings(attrs);
  51966. }
  51967. static encrypt(attrs) {
  51968. return new Encrypt(attrs);
  51969. }
  51970. static encryptData(attrs) {
  51971. return new EncryptData(attrs);
  51972. }
  51973. static encryption(attrs) {
  51974. return new Encryption(attrs);
  51975. }
  51976. static encryptionMethod(attrs) {
  51977. return new EncryptionMethod(attrs);
  51978. }
  51979. static encryptionMethods(attrs) {
  51980. return new EncryptionMethods(attrs);
  51981. }
  51982. static event(attrs) {
  51983. return new Event(attrs);
  51984. }
  51985. static exData(attrs) {
  51986. return new ExData(attrs);
  51987. }
  51988. static exObject(attrs) {
  51989. return new ExObject(attrs);
  51990. }
  51991. static exclGroup(attrs) {
  51992. return new ExclGroup(attrs);
  51993. }
  51994. static execute(attrs) {
  51995. return new Execute(attrs);
  51996. }
  51997. static extras(attrs) {
  51998. return new Extras(attrs);
  51999. }
  52000. static field(attrs) {
  52001. return new Field(attrs);
  52002. }
  52003. static fill(attrs) {
  52004. return new Fill(attrs);
  52005. }
  52006. static filter(attrs) {
  52007. return new Filter(attrs);
  52008. }
  52009. static float(attrs) {
  52010. return new Float(attrs);
  52011. }
  52012. static font(attrs) {
  52013. return new Font(attrs);
  52014. }
  52015. static format(attrs) {
  52016. return new Format(attrs);
  52017. }
  52018. static handler(attrs) {
  52019. return new Handler(attrs);
  52020. }
  52021. static hyphenation(attrs) {
  52022. return new Hyphenation(attrs);
  52023. }
  52024. static image(attrs) {
  52025. return new Image(attrs);
  52026. }
  52027. static imageEdit(attrs) {
  52028. return new ImageEdit(attrs);
  52029. }
  52030. static integer(attrs) {
  52031. return new Integer(attrs);
  52032. }
  52033. static issuers(attrs) {
  52034. return new Issuers(attrs);
  52035. }
  52036. static items(attrs) {
  52037. return new Items(attrs);
  52038. }
  52039. static keep(attrs) {
  52040. return new Keep(attrs);
  52041. }
  52042. static keyUsage(attrs) {
  52043. return new KeyUsage(attrs);
  52044. }
  52045. static line(attrs) {
  52046. return new Line(attrs);
  52047. }
  52048. static linear(attrs) {
  52049. return new Linear(attrs);
  52050. }
  52051. static lockDocument(attrs) {
  52052. return new LockDocument(attrs);
  52053. }
  52054. static manifest(attrs) {
  52055. return new Manifest(attrs);
  52056. }
  52057. static margin(attrs) {
  52058. return new Margin(attrs);
  52059. }
  52060. static mdp(attrs) {
  52061. return new Mdp(attrs);
  52062. }
  52063. static medium(attrs) {
  52064. return new Medium(attrs);
  52065. }
  52066. static message(attrs) {
  52067. return new Message(attrs);
  52068. }
  52069. static numericEdit(attrs) {
  52070. return new NumericEdit(attrs);
  52071. }
  52072. static occur(attrs) {
  52073. return new Occur(attrs);
  52074. }
  52075. static oid(attrs) {
  52076. return new Oid(attrs);
  52077. }
  52078. static oids(attrs) {
  52079. return new Oids(attrs);
  52080. }
  52081. static overflow(attrs) {
  52082. return new Overflow(attrs);
  52083. }
  52084. static pageArea(attrs) {
  52085. return new PageArea(attrs);
  52086. }
  52087. static pageSet(attrs) {
  52088. return new PageSet(attrs);
  52089. }
  52090. static para(attrs) {
  52091. return new Para(attrs);
  52092. }
  52093. static passwordEdit(attrs) {
  52094. return new PasswordEdit(attrs);
  52095. }
  52096. static pattern(attrs) {
  52097. return new Pattern(attrs);
  52098. }
  52099. static picture(attrs) {
  52100. return new Picture(attrs);
  52101. }
  52102. static proto(attrs) {
  52103. return new Proto(attrs);
  52104. }
  52105. static radial(attrs) {
  52106. return new Radial(attrs);
  52107. }
  52108. static reason(attrs) {
  52109. return new Reason(attrs);
  52110. }
  52111. static reasons(attrs) {
  52112. return new Reasons(attrs);
  52113. }
  52114. static rectangle(attrs) {
  52115. return new Rectangle(attrs);
  52116. }
  52117. static ref(attrs) {
  52118. return new RefElement(attrs);
  52119. }
  52120. static script(attrs) {
  52121. return new Script(attrs);
  52122. }
  52123. static setProperty(attrs) {
  52124. return new SetProperty(attrs);
  52125. }
  52126. static signData(attrs) {
  52127. return new SignData(attrs);
  52128. }
  52129. static signature(attrs) {
  52130. return new Signature(attrs);
  52131. }
  52132. static signing(attrs) {
  52133. return new Signing(attrs);
  52134. }
  52135. static solid(attrs) {
  52136. return new Solid(attrs);
  52137. }
  52138. static speak(attrs) {
  52139. return new Speak(attrs);
  52140. }
  52141. static stipple(attrs) {
  52142. return new Stipple(attrs);
  52143. }
  52144. static subform(attrs) {
  52145. return new Subform(attrs);
  52146. }
  52147. static subformSet(attrs) {
  52148. return new SubformSet(attrs);
  52149. }
  52150. static subjectDN(attrs) {
  52151. return new SubjectDN(attrs);
  52152. }
  52153. static subjectDNs(attrs) {
  52154. return new SubjectDNs(attrs);
  52155. }
  52156. static submit(attrs) {
  52157. return new Submit(attrs);
  52158. }
  52159. static template(attrs) {
  52160. return new Template(attrs);
  52161. }
  52162. static text(attrs) {
  52163. return new Text(attrs);
  52164. }
  52165. static textEdit(attrs) {
  52166. return new TextEdit(attrs);
  52167. }
  52168. static time(attrs) {
  52169. return new Time(attrs);
  52170. }
  52171. static timeStamp(attrs) {
  52172. return new TimeStamp(attrs);
  52173. }
  52174. static toolTip(attrs) {
  52175. return new ToolTip(attrs);
  52176. }
  52177. static traversal(attrs) {
  52178. return new Traversal(attrs);
  52179. }
  52180. static traverse(attrs) {
  52181. return new Traverse(attrs);
  52182. }
  52183. static ui(attrs) {
  52184. return new Ui(attrs);
  52185. }
  52186. static validate(attrs) {
  52187. return new Validate(attrs);
  52188. }
  52189. static value(attrs) {
  52190. return new Value(attrs);
  52191. }
  52192. static variables(attrs) {
  52193. return new Variables(attrs);
  52194. }
  52195. }
  52196. exports.TemplateNamespace = TemplateNamespace;
  52197. /***/ }),
  52198. /* 55 */
  52199. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52200. Object.defineProperty(exports, "__esModule", ({
  52201. value: true
  52202. }));
  52203. exports.layoutClass = layoutClass;
  52204. exports.measureToString = measureToString;
  52205. exports.toStyle = toStyle;
  52206. var _xfa_object = __w_pdfjs_require__(50);
  52207. var _util = __w_pdfjs_require__(2);
  52208. function measureToString(m) {
  52209. if (typeof m === "string") {
  52210. return "0px";
  52211. }
  52212. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  52213. }
  52214. const converters = {
  52215. anchorType(node, style) {
  52216. if (!("transform" in style)) {
  52217. style.transform = "";
  52218. }
  52219. switch (node.anchorType) {
  52220. case "bottomCenter":
  52221. style.transform += "translate(-50%, -100%)";
  52222. break;
  52223. case "bottomLeft":
  52224. style.transform += "translate(0,-100%)";
  52225. break;
  52226. case "bottomRight":
  52227. style.transform += "translate(-100%,-100%)";
  52228. break;
  52229. case "middleCenter":
  52230. style.transform += "translate(-50%,-50%)";
  52231. break;
  52232. case "middleLeft":
  52233. style.transform += "translate(0,-50%)";
  52234. break;
  52235. case "middleRight":
  52236. style.transform += "translate(-100%,-50%)";
  52237. break;
  52238. case "topCenter":
  52239. style.transform += "translate(-50%,0)";
  52240. break;
  52241. case "topRight":
  52242. style.transform += "translate(-100%,0)";
  52243. break;
  52244. }
  52245. },
  52246. dimensions(node, style) {
  52247. if (node.w) {
  52248. style.width = measureToString(node.w);
  52249. } else {
  52250. style.width = "auto";
  52251. if (node.maxW > 0) {
  52252. style.maxWidth = measureToString(node.maxW);
  52253. }
  52254. style.minWidth = measureToString(node.minW);
  52255. }
  52256. if (node.h) {
  52257. style.height = measureToString(node.h);
  52258. } else {
  52259. style.height = "auto";
  52260. if (node.maxH > 0) {
  52261. style.maxHeight = measureToString(node.maxH);
  52262. }
  52263. style.minHeight = measureToString(node.minH);
  52264. }
  52265. },
  52266. position(node, style) {
  52267. const parent = node[_xfa_object.$getParent]();
  52268. if (parent && parent.layout && parent.layout !== "position") {
  52269. return;
  52270. }
  52271. style.position = "absolute";
  52272. style.left = measureToString(node.x);
  52273. style.top = measureToString(node.y);
  52274. },
  52275. rotate(node, style) {
  52276. if (node.rotate) {
  52277. if (!("transform" in style)) {
  52278. style.transform = "";
  52279. }
  52280. style.transform += `rotate(-${node.rotate}deg)`;
  52281. style.transformOrigin = "top left";
  52282. }
  52283. },
  52284. presence(node, style) {
  52285. switch (node.presence) {
  52286. case "invisible":
  52287. style.visibility = "hidden";
  52288. break;
  52289. case "hidden":
  52290. case "inactive":
  52291. style.display = "none";
  52292. break;
  52293. }
  52294. }
  52295. };
  52296. function layoutClass(node) {
  52297. switch (node.layout) {
  52298. case "position":
  52299. return "xfaPosition";
  52300. case "lr-tb":
  52301. return "xfaLrTb";
  52302. case "rl-row":
  52303. return "xfaRlRow";
  52304. case "rl-tb":
  52305. return "xfaRlTb";
  52306. case "row":
  52307. return "xfaRow";
  52308. case "table":
  52309. return "xfaTable";
  52310. case "tb":
  52311. return "xfaTb";
  52312. default:
  52313. return "xfaPosition";
  52314. }
  52315. }
  52316. function toStyle(node, ...names) {
  52317. const style = Object.create(null);
  52318. for (const name of names) {
  52319. const value = node[name];
  52320. if (value === null) {
  52321. continue;
  52322. }
  52323. if (value instanceof _xfa_object.XFAObject) {
  52324. const newStyle = value[_xfa_object.$toStyle]();
  52325. if (newStyle) {
  52326. Object.assign(style, newStyle);
  52327. } else {
  52328. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  52329. }
  52330. continue;
  52331. }
  52332. if (converters.hasOwnProperty(name)) {
  52333. converters[name](node, style);
  52334. }
  52335. }
  52336. return style;
  52337. }
  52338. /***/ }),
  52339. /* 56 */
  52340. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52341. Object.defineProperty(exports, "__esModule", ({
  52342. value: true
  52343. }));
  52344. exports.createDataNode = createDataNode;
  52345. exports.searchNode = searchNode;
  52346. var _xfa_object = __w_pdfjs_require__(50);
  52347. var _util = __w_pdfjs_require__(2);
  52348. const namePattern = /^[^.[]+/;
  52349. const indexPattern = /^[^\]]+/;
  52350. const operators = {
  52351. dot: 0,
  52352. dotDot: 1,
  52353. dotHash: 2,
  52354. dotBracket: 3,
  52355. dotParen: 4
  52356. };
  52357. const shortcuts = new Map([["$data", (root, current) => root.datasets.data], ["$template", (root, current) => root.template], ["$connectionSet", (root, current) => root.connectionSet], ["$form", (root, current) => root.form], ["$layout", (root, current) => root.layout], ["$host", (root, current) => root.host], ["$dataWindow", (root, current) => root.dataWindow], ["$event", (root, current) => root.event], ["!", (root, current) => root.datasets], ["$xfa", (root, current) => root], ["xfa", (root, current) => root], ["$", (root, current) => current]]);
  52358. const somCache = new WeakMap();
  52359. function parseIndex(index) {
  52360. index = index.trim();
  52361. if (index === "*") {
  52362. return Infinity;
  52363. }
  52364. return parseInt(index, 10) || 0;
  52365. }
  52366. function parseExpression(expr, dotDotAllowed) {
  52367. let match = expr.match(namePattern);
  52368. if (!match) {
  52369. return null;
  52370. }
  52371. let [name] = match;
  52372. const parsed = [{
  52373. name,
  52374. cacheName: "." + name,
  52375. index: 0,
  52376. js: null,
  52377. formCalc: null,
  52378. operator: operators.dot
  52379. }];
  52380. let pos = name.length;
  52381. while (pos < expr.length) {
  52382. const spos = pos;
  52383. const char = expr.charAt(pos++);
  52384. if (char === "[") {
  52385. match = expr.slice(pos).match(indexPattern);
  52386. if (!match) {
  52387. (0, _util.warn)("XFA - Invalid index in SOM expression");
  52388. return null;
  52389. }
  52390. parsed[parsed.length - 1].index = parseIndex(match[0]);
  52391. pos += match[0].length + 1;
  52392. continue;
  52393. }
  52394. let operator;
  52395. switch (expr.charAt(pos)) {
  52396. case ".":
  52397. if (!dotDotAllowed) {
  52398. return null;
  52399. }
  52400. pos++;
  52401. operator = operators.dotDot;
  52402. break;
  52403. case "#":
  52404. pos++;
  52405. operator = operators.dotHash;
  52406. break;
  52407. case "[":
  52408. operator = operators.dotBracket;
  52409. break;
  52410. case "(":
  52411. operator = operators.dotParen;
  52412. break;
  52413. default:
  52414. operator = operators.dot;
  52415. break;
  52416. }
  52417. match = expr.slice(pos).match(namePattern);
  52418. if (!match) {
  52419. break;
  52420. }
  52421. [name] = match;
  52422. pos += name.length;
  52423. parsed.push({
  52424. name,
  52425. cacheName: expr.slice(spos, pos),
  52426. operator,
  52427. index: 0,
  52428. js: null,
  52429. formCalc: null
  52430. });
  52431. }
  52432. return parsed;
  52433. }
  52434. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  52435. const parsed = parseExpression(expr, dotDotAllowed);
  52436. if (!parsed) {
  52437. return null;
  52438. }
  52439. const fn = shortcuts.get(parsed[0].name);
  52440. let i = 0;
  52441. let isQualified;
  52442. if (fn) {
  52443. isQualified = true;
  52444. root = [fn(root, container)];
  52445. i = 1;
  52446. } else {
  52447. isQualified = container === null;
  52448. root = [container || root];
  52449. }
  52450. for (let ii = parsed.length; i < ii; i++) {
  52451. const {
  52452. name,
  52453. cacheName,
  52454. operator,
  52455. index
  52456. } = parsed[i];
  52457. const nodes = [];
  52458. for (const node of root) {
  52459. if (!(node instanceof _xfa_object.XFAObject)) {
  52460. continue;
  52461. }
  52462. let children, cached;
  52463. if (useCache) {
  52464. cached = somCache.get(node);
  52465. if (!cached) {
  52466. cached = new Map();
  52467. somCache.set(node, cached);
  52468. }
  52469. children = cached.get(cacheName);
  52470. }
  52471. if (!children) {
  52472. switch (operator) {
  52473. case operators.dot:
  52474. children = node[_xfa_object.$getChildrenByName](name, false);
  52475. break;
  52476. case operators.dotDot:
  52477. children = node[_xfa_object.$getChildrenByName](name, true);
  52478. break;
  52479. case operators.dotHash:
  52480. children = node[_xfa_object.$getChildrenByClass](name);
  52481. if (children instanceof _xfa_object.XFAObjectArray) {
  52482. children = children.children;
  52483. } else {
  52484. children = [children];
  52485. }
  52486. break;
  52487. default:
  52488. break;
  52489. }
  52490. if (useCache) {
  52491. cached.set(cacheName, children);
  52492. }
  52493. }
  52494. if (children.length > 0) {
  52495. nodes.push(children);
  52496. }
  52497. }
  52498. if (nodes.length === 0 && !isQualified && i === 0) {
  52499. const parent = container[_xfa_object.$getParent]();
  52500. container = parent;
  52501. if (!container) {
  52502. return null;
  52503. }
  52504. i = -1;
  52505. root = [container];
  52506. continue;
  52507. }
  52508. if (isFinite(index)) {
  52509. root = nodes.filter(node => index < node.length).map(node => node[index]);
  52510. } else {
  52511. root = nodes.reduce((acc, node) => acc.concat(node), []);
  52512. }
  52513. }
  52514. if (root.length === 0) {
  52515. return null;
  52516. }
  52517. return root;
  52518. }
  52519. function createNodes(root, path) {
  52520. let node = null;
  52521. for (const {
  52522. name,
  52523. index
  52524. } of path) {
  52525. for (let i = 0; i <= index; i++) {
  52526. node = new _xfa_object.XmlObject(root[_xfa_object.$namespaceId], name);
  52527. root[_xfa_object.$appendChild](node);
  52528. }
  52529. root = node;
  52530. }
  52531. return node;
  52532. }
  52533. function createDataNode(root, container, expr) {
  52534. const parsed = parseExpression(expr);
  52535. if (!parsed) {
  52536. return null;
  52537. }
  52538. if (parsed.some(x => x.operator === operators.dotDot)) {
  52539. return null;
  52540. }
  52541. const fn = shortcuts.get(parsed[0].name);
  52542. let i = 0;
  52543. if (fn) {
  52544. root = fn(root, container);
  52545. i = 1;
  52546. } else {
  52547. root = container || root;
  52548. }
  52549. for (let ii = parsed.length; i < ii; i++) {
  52550. const {
  52551. cacheName,
  52552. index
  52553. } = parsed[i];
  52554. if (!isFinite(index)) {
  52555. parsed[i].index = 0;
  52556. return createNodes(root, parsed.slice(i));
  52557. }
  52558. const cached = somCache.get(root);
  52559. if (!cached) {
  52560. (0, _util.warn)(`XFA - createDataNode must be called after searchNode.`);
  52561. return null;
  52562. }
  52563. const children = cached.get(cacheName);
  52564. if (children.length === 0) {
  52565. return createNodes(root, parsed.slice(i));
  52566. }
  52567. if (index < children.length) {
  52568. const child = children[index];
  52569. if (!(child instanceof _xfa_object.XFAObject)) {
  52570. (0, _util.warn)(`XFA - Cannot create a node.`);
  52571. return null;
  52572. }
  52573. root = child;
  52574. } else {
  52575. parsed[i].index = children.length - index;
  52576. return createNodes(root, parsed.slice(i));
  52577. }
  52578. }
  52579. return null;
  52580. }
  52581. /***/ }),
  52582. /* 57 */
  52583. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52584. Object.defineProperty(exports, "__esModule", ({
  52585. value: true
  52586. }));
  52587. exports.XFAParser = void 0;
  52588. var _xfa_object = __w_pdfjs_require__(50);
  52589. var _xml_parser = __w_pdfjs_require__(26);
  52590. var _builder = __w_pdfjs_require__(58);
  52591. var _util = __w_pdfjs_require__(2);
  52592. class XFAParser extends _xml_parser.XMLParserBase {
  52593. constructor() {
  52594. super();
  52595. this._builder = new _builder.Builder();
  52596. this._stack = [];
  52597. this._ids = new Map();
  52598. this._current = this._builder.buildRoot(this._ids);
  52599. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  52600. this._whiteRegex = /^\s+$/;
  52601. }
  52602. parse(data) {
  52603. this.parseXml(data);
  52604. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  52605. return undefined;
  52606. }
  52607. this._current[_xfa_object.$finalize]();
  52608. return this._current.element;
  52609. }
  52610. onText(text) {
  52611. if (this._whiteRegex.test(text)) {
  52612. return;
  52613. }
  52614. this._current[_xfa_object.$onText](text.trim());
  52615. }
  52616. onCdata(text) {
  52617. this._current[_xfa_object.$onText](text);
  52618. }
  52619. _mkAttributes(attributes, tagName) {
  52620. let namespace = null;
  52621. let prefixes = null;
  52622. const attributeObj = Object.create({});
  52623. for (const {
  52624. name,
  52625. value
  52626. } of attributes) {
  52627. if (name === "xmlns") {
  52628. if (!namespace) {
  52629. namespace = value;
  52630. } else {
  52631. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  52632. }
  52633. } else if (name.startsWith("xmlns:")) {
  52634. const prefix = name.substring("xmlns:".length);
  52635. if (!prefixes) {
  52636. prefixes = [];
  52637. }
  52638. prefixes.push({
  52639. prefix,
  52640. value
  52641. });
  52642. } else {
  52643. const i = name.indexOf(":");
  52644. if (i === -1) {
  52645. attributeObj[name] = value;
  52646. } else {
  52647. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  52648. if (!nsAttrs) {
  52649. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  52650. }
  52651. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  52652. let attrs = nsAttrs[ns];
  52653. if (!attrs) {
  52654. attrs = nsAttrs[ns] = Object.create(null);
  52655. }
  52656. attrs[attrName] = value;
  52657. }
  52658. }
  52659. }
  52660. return [namespace, prefixes, attributeObj];
  52661. }
  52662. _getNameAndPrefix(name) {
  52663. const i = name.indexOf(":");
  52664. if (i === -1) {
  52665. return [name, null];
  52666. }
  52667. return [name.substring(i + 1), name.substring(0, i)];
  52668. }
  52669. onBeginElement(tagName, attributes, isEmpty) {
  52670. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  52671. const [name, nsPrefix] = this._getNameAndPrefix(tagName);
  52672. const node = this._builder.build({
  52673. nsPrefix,
  52674. name,
  52675. attributes: attributesObj,
  52676. namespace,
  52677. prefixes
  52678. });
  52679. if (isEmpty) {
  52680. node[_xfa_object.$finalize]();
  52681. if (this._current[_xfa_object.$onChild](node)) {
  52682. node[_xfa_object.$setId](this._ids);
  52683. }
  52684. node[_xfa_object.$clean](this._builder);
  52685. return;
  52686. }
  52687. this._stack.push(this._current);
  52688. this._current = node;
  52689. }
  52690. onEndElement(name) {
  52691. const node = this._current;
  52692. node[_xfa_object.$finalize]();
  52693. this._current = this._stack.pop();
  52694. if (this._current[_xfa_object.$onChild](node)) {
  52695. node[_xfa_object.$setId](this._ids);
  52696. }
  52697. node[_xfa_object.$clean](this._builder);
  52698. }
  52699. onError(code) {
  52700. this._errorCode = code;
  52701. }
  52702. }
  52703. exports.XFAParser = XFAParser;
  52704. /***/ }),
  52705. /* 58 */
  52706. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52707. Object.defineProperty(exports, "__esModule", ({
  52708. value: true
  52709. }));
  52710. exports.Builder = void 0;
  52711. var _namespaces = __w_pdfjs_require__(52);
  52712. var _xfa_object = __w_pdfjs_require__(50);
  52713. var _setup = __w_pdfjs_require__(59);
  52714. var _template = __w_pdfjs_require__(54);
  52715. var _unknown = __w_pdfjs_require__(68);
  52716. var _util = __w_pdfjs_require__(2);
  52717. const _ids = Symbol();
  52718. class Root extends _xfa_object.XFAObject {
  52719. constructor(ids) {
  52720. super(-1, "root", Object.create(null));
  52721. this.element = null;
  52722. this[_ids] = ids;
  52723. }
  52724. [_xfa_object.$onChild](child) {
  52725. this.element = child;
  52726. return true;
  52727. }
  52728. [_xfa_object.$finalize]() {
  52729. super[_xfa_object.$finalize]();
  52730. if (this.element.template instanceof _template.Template) {
  52731. this.element.template[_xfa_object.$resolvePrototypes](this[_ids]);
  52732. }
  52733. }
  52734. }
  52735. class Empty extends _xfa_object.XFAObject {
  52736. constructor() {
  52737. super(-1, "", Object.create(null));
  52738. }
  52739. [_xfa_object.$onChild](_) {
  52740. return false;
  52741. }
  52742. }
  52743. class Builder {
  52744. constructor() {
  52745. this._namespaceStack = [];
  52746. this._namespacePrefixes = new Map();
  52747. this._namespaces = new Map();
  52748. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  52749. id
  52750. }) => id));
  52751. this._currentNamespace = new _unknown.UnknownNamespace(++this._nextNsId);
  52752. }
  52753. buildRoot(ids) {
  52754. return new Root(ids);
  52755. }
  52756. build({
  52757. nsPrefix,
  52758. name,
  52759. attributes,
  52760. namespace,
  52761. prefixes
  52762. }) {
  52763. const hasNamespaceDef = namespace !== null;
  52764. if (hasNamespaceDef) {
  52765. this._namespaceStack.push(this._currentNamespace);
  52766. this._currentNamespace = this._searchNamespace(namespace);
  52767. }
  52768. if (prefixes) {
  52769. this._addNamespacePrefix(prefixes);
  52770. }
  52771. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  52772. const dataTemplate = _setup.NamespaceSetUp.datasets;
  52773. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  52774. let xfaAttrs = null;
  52775. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  52776. const nsToUse = this._getNamespaceToUse(ns);
  52777. if (nsToUse === dataTemplate) {
  52778. xfaAttrs = {
  52779. xfa: attrs
  52780. };
  52781. break;
  52782. }
  52783. }
  52784. if (xfaAttrs) {
  52785. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  52786. } else {
  52787. delete attributes[_xfa_object.$nsAttributes];
  52788. }
  52789. }
  52790. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  52791. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  52792. if (hasNamespaceDef || prefixes) {
  52793. node[_xfa_object.$cleanup] = {
  52794. hasNamespace: hasNamespaceDef,
  52795. prefixes
  52796. };
  52797. }
  52798. return node;
  52799. }
  52800. _searchNamespace(nsName) {
  52801. let ns = this._namespaces.get(nsName);
  52802. if (ns) {
  52803. return ns;
  52804. }
  52805. for (const [name, {
  52806. check
  52807. }] of Object.entries(_namespaces.NamespaceIds)) {
  52808. if (check(nsName)) {
  52809. ns = _setup.NamespaceSetUp[name];
  52810. if (ns) {
  52811. this._namespaces.set(nsName, ns);
  52812. return ns;
  52813. }
  52814. break;
  52815. }
  52816. }
  52817. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  52818. this._namespaces.set(nsName, ns);
  52819. return ns;
  52820. }
  52821. _addNamespacePrefix(prefixes) {
  52822. for (const {
  52823. prefix,
  52824. value
  52825. } of prefixes) {
  52826. const namespace = this._searchNamespace(value);
  52827. let prefixStack = this._namespacePrefixes.get(prefix);
  52828. if (!prefixStack) {
  52829. prefixStack = [];
  52830. this._namespacePrefixes.set(prefix, prefixStack);
  52831. }
  52832. prefixStack.push(namespace);
  52833. }
  52834. }
  52835. _getNamespaceToUse(prefix) {
  52836. if (!prefix) {
  52837. return this._currentNamespace;
  52838. }
  52839. const prefixStack = this._namespacePrefixes.get(prefix);
  52840. if (prefixStack && prefixStack.length > 0) {
  52841. return prefixStack[prefixStack.length - 1];
  52842. }
  52843. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  52844. return null;
  52845. }
  52846. clean(data) {
  52847. const {
  52848. hasNamespace,
  52849. prefixes
  52850. } = data;
  52851. if (hasNamespace) {
  52852. this._currentNamespace = this._namespaceStack.pop();
  52853. }
  52854. if (prefixes) {
  52855. prefixes.forEach(({
  52856. prefix
  52857. }) => {
  52858. this._namespacePrefixes.get(prefix).pop();
  52859. });
  52860. }
  52861. }
  52862. }
  52863. exports.Builder = Builder;
  52864. /***/ }),
  52865. /* 59 */
  52866. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52867. Object.defineProperty(exports, "__esModule", ({
  52868. value: true
  52869. }));
  52870. exports.NamespaceSetUp = void 0;
  52871. var _config = __w_pdfjs_require__(60);
  52872. var _connection_set = __w_pdfjs_require__(61);
  52873. var _datasets = __w_pdfjs_require__(62);
  52874. var _locale_set = __w_pdfjs_require__(63);
  52875. var _signature = __w_pdfjs_require__(64);
  52876. var _stylesheet = __w_pdfjs_require__(65);
  52877. var _template = __w_pdfjs_require__(54);
  52878. var _xdp = __w_pdfjs_require__(66);
  52879. var _xhtml = __w_pdfjs_require__(67);
  52880. const NamespaceSetUp = {
  52881. config: _config.ConfigNamespace,
  52882. connection: _connection_set.ConnectionSetNamespace,
  52883. datasets: _datasets.DatasetsNamespace,
  52884. localeSet: _locale_set.LocaleSetNamespace,
  52885. signature: _signature.SignatureNamespace,
  52886. stylesheet: _stylesheet.StylesheetNamespace,
  52887. template: _template.TemplateNamespace,
  52888. xdp: _xdp.XdpNamespace,
  52889. xhtml: _xhtml.XhtmlNamespace
  52890. };
  52891. exports.NamespaceSetUp = NamespaceSetUp;
  52892. /***/ }),
  52893. /* 60 */
  52894. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52895. Object.defineProperty(exports, "__esModule", ({
  52896. value: true
  52897. }));
  52898. exports.ConfigNamespace = void 0;
  52899. var _namespaces = __w_pdfjs_require__(52);
  52900. var _xfa_object = __w_pdfjs_require__(50);
  52901. var _utils = __w_pdfjs_require__(51);
  52902. var _util = __w_pdfjs_require__(2);
  52903. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  52904. class Acrobat extends _xfa_object.XFAObject {
  52905. constructor(attributes) {
  52906. super(CONFIG_NS_ID, "acrobat", true);
  52907. this.acrobat7 = null;
  52908. this.autoSave = null;
  52909. this.common = null;
  52910. this.validate = null;
  52911. this.validateApprovalSignatures = null;
  52912. this.submitUrl = new _xfa_object.XFAObjectArray();
  52913. }
  52914. }
  52915. class Acrobat7 extends _xfa_object.XFAObject {
  52916. constructor(attributes) {
  52917. super(CONFIG_NS_ID, "acrobat7", true);
  52918. this.dynamicRender = null;
  52919. }
  52920. }
  52921. class ADBE_JSConsole extends _xfa_object.OptionObject {
  52922. constructor(attributes) {
  52923. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  52924. }
  52925. }
  52926. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  52927. constructor(attributes) {
  52928. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  52929. }
  52930. }
  52931. class AddSilentPrint extends _xfa_object.Option01 {
  52932. constructor(attributes) {
  52933. super(CONFIG_NS_ID, "addSilentPrint");
  52934. }
  52935. }
  52936. class AddViewerPreferences extends _xfa_object.Option01 {
  52937. constructor(attributes) {
  52938. super(CONFIG_NS_ID, "addViewerPreferences");
  52939. }
  52940. }
  52941. class AdjustData extends _xfa_object.Option10 {
  52942. constructor(attributes) {
  52943. super(CONFIG_NS_ID, "adjustData");
  52944. }
  52945. }
  52946. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  52947. constructor(attributes) {
  52948. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  52949. }
  52950. }
  52951. class Agent extends _xfa_object.XFAObject {
  52952. constructor(attributes) {
  52953. super(CONFIG_NS_ID, "agent", true);
  52954. this.name = attributes.name ? attributes.name.trim() : "";
  52955. this.common = new _xfa_object.XFAObjectArray();
  52956. }
  52957. }
  52958. class AlwaysEmbed extends _xfa_object.ContentObject {
  52959. constructor(attributes) {
  52960. super(CONFIG_NS_ID, "alwaysEmbed");
  52961. }
  52962. }
  52963. class Amd extends _xfa_object.StringObject {
  52964. constructor(attributes) {
  52965. super(CONFIG_NS_ID, "amd");
  52966. }
  52967. }
  52968. class Area extends _xfa_object.XFAObject {
  52969. constructor(attributes) {
  52970. super(CONFIG_NS_ID, "area");
  52971. this.level = (0, _utils.getInteger)({
  52972. data: attributes.level,
  52973. defaultValue: 0,
  52974. validator: n => n >= 1 && n <= 3
  52975. });
  52976. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  52977. }
  52978. }
  52979. class Attributes extends _xfa_object.OptionObject {
  52980. constructor(attributes) {
  52981. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  52982. }
  52983. }
  52984. class AutoSave extends _xfa_object.OptionObject {
  52985. constructor(attributes) {
  52986. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  52987. }
  52988. }
  52989. class Base extends _xfa_object.StringObject {
  52990. constructor(attributes) {
  52991. super(CONFIG_NS_ID, "base");
  52992. }
  52993. }
  52994. class BatchOutput extends _xfa_object.XFAObject {
  52995. constructor(attributes) {
  52996. super(CONFIG_NS_ID, "batchOutput");
  52997. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  52998. }
  52999. }
  53000. class BehaviorOverride extends _xfa_object.ContentObject {
  53001. constructor(attributes) {
  53002. super(CONFIG_NS_ID, "behaviorOverride");
  53003. }
  53004. [_xfa_object.$finalize]() {
  53005. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => !!x && x.include(":")).map(x => x.split(":", 2)));
  53006. }
  53007. }
  53008. class Cache extends _xfa_object.XFAObject {
  53009. constructor(attributes) {
  53010. super(CONFIG_NS_ID, "cache", true);
  53011. this.templateCache = null;
  53012. }
  53013. }
  53014. class Change extends _xfa_object.Option01 {
  53015. constructor(attributes) {
  53016. super(CONFIG_NS_ID, "change");
  53017. }
  53018. }
  53019. class Common extends _xfa_object.XFAObject {
  53020. constructor(attributes) {
  53021. super(CONFIG_NS_ID, "common", true);
  53022. this.data = null;
  53023. this.locale = null;
  53024. this.localeSet = null;
  53025. this.messaging = null;
  53026. this.suppressBanner = null;
  53027. this.template = null;
  53028. this.validationMessaging = null;
  53029. this.versionControl = null;
  53030. this.log = new _xfa_object.XFAObjectArray();
  53031. }
  53032. }
  53033. class Compress extends _xfa_object.XFAObject {
  53034. constructor(attributes) {
  53035. super(CONFIG_NS_ID, "compress");
  53036. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  53037. }
  53038. }
  53039. class CompressLogicalStructure extends _xfa_object.Option01 {
  53040. constructor(attributes) {
  53041. super(CONFIG_NS_ID, "compressLogicalStructure");
  53042. }
  53043. }
  53044. class CompressObjectStream extends _xfa_object.Option10 {
  53045. constructor(attributes) {
  53046. super(CONFIG_NS_ID, "compressObjectStream");
  53047. }
  53048. }
  53049. class Compression extends _xfa_object.XFAObject {
  53050. constructor(attributes) {
  53051. super(CONFIG_NS_ID, "compression", true);
  53052. this.compressLogicalStructure = null;
  53053. this.compressObjectStream = null;
  53054. this.level = null;
  53055. this.type = null;
  53056. }
  53057. }
  53058. class Config extends _xfa_object.XFAObject {
  53059. constructor(attributes) {
  53060. super(CONFIG_NS_ID, "config", true);
  53061. this.acrobat = null;
  53062. this.present = null;
  53063. this.trace = null;
  53064. this.agent = new _xfa_object.XFAObjectArray();
  53065. }
  53066. }
  53067. class Conformance extends _xfa_object.OptionObject {
  53068. constructor(attributes) {
  53069. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  53070. }
  53071. }
  53072. class ContentCopy extends _xfa_object.Option01 {
  53073. constructor(attributes) {
  53074. super(CONFIG_NS_ID, "contentCopy");
  53075. }
  53076. }
  53077. class Copies extends _xfa_object.IntegerObject {
  53078. constructor(attributes) {
  53079. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  53080. }
  53081. }
  53082. class Creator extends _xfa_object.StringObject {
  53083. constructor(attributes) {
  53084. super(CONFIG_NS_ID, "creator");
  53085. }
  53086. }
  53087. class CurrentPage extends _xfa_object.IntegerObject {
  53088. constructor(attributes) {
  53089. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  53090. }
  53091. }
  53092. class Data extends _xfa_object.XFAObject {
  53093. constructor(attributes) {
  53094. super(CONFIG_NS_ID, "data", true);
  53095. this.adjustData = null;
  53096. this.attributes = null;
  53097. this.incrementalLoad = null;
  53098. this.outputXSL = null;
  53099. this.range = null;
  53100. this.record = null;
  53101. this.startNode = null;
  53102. this.uri = null;
  53103. this.window = null;
  53104. this.xsl = null;
  53105. this.excludeNS = new _xfa_object.XFAObjectArray();
  53106. this.transform = new _xfa_object.XFAObjectArray();
  53107. }
  53108. }
  53109. class Debug extends _xfa_object.XFAObject {
  53110. constructor(attributes) {
  53111. super(CONFIG_NS_ID, "debug", true);
  53112. this.uri = null;
  53113. }
  53114. }
  53115. class DefaultTypeface extends _xfa_object.ContentObject {
  53116. constructor(attributes) {
  53117. super(CONFIG_NS_ID, "defaultTypeface");
  53118. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  53119. }
  53120. }
  53121. class Destination extends _xfa_object.OptionObject {
  53122. constructor(attributes) {
  53123. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  53124. }
  53125. }
  53126. class DocumentAssembly extends _xfa_object.Option01 {
  53127. constructor(attributes) {
  53128. super(CONFIG_NS_ID, "documentAssembly");
  53129. }
  53130. }
  53131. class Driver extends _xfa_object.XFAObject {
  53132. constructor(attributes) {
  53133. super(CONFIG_NS_ID, "driver", true);
  53134. this.name = attributes.name ? attributes.name.trim() : "";
  53135. this.fontInfo = null;
  53136. this.xdc = null;
  53137. }
  53138. }
  53139. class DuplexOption extends _xfa_object.OptionObject {
  53140. constructor(attributes) {
  53141. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  53142. }
  53143. }
  53144. class DynamicRender extends _xfa_object.OptionObject {
  53145. constructor(attributes) {
  53146. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  53147. }
  53148. }
  53149. class Embed extends _xfa_object.Option01 {
  53150. constructor(attributes) {
  53151. super(CONFIG_NS_ID, "embed");
  53152. }
  53153. }
  53154. class Encrypt extends _xfa_object.Option01 {
  53155. constructor(attributes) {
  53156. super(CONFIG_NS_ID, "encrypt");
  53157. }
  53158. }
  53159. class Encryption extends _xfa_object.XFAObject {
  53160. constructor(attributes) {
  53161. super(CONFIG_NS_ID, "encryption", true);
  53162. this.encrypt = null;
  53163. this.encryptionLevel = null;
  53164. this.permissions = null;
  53165. }
  53166. }
  53167. class EncryptionLevel extends _xfa_object.OptionObject {
  53168. constructor(attributes) {
  53169. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  53170. }
  53171. }
  53172. class Enforce extends _xfa_object.StringObject {
  53173. constructor(attributes) {
  53174. super(CONFIG_NS_ID, "enforce");
  53175. }
  53176. }
  53177. class Equate extends _xfa_object.XFAObject {
  53178. constructor(attributes) {
  53179. super(CONFIG_NS_ID, "equate");
  53180. this.force = (0, _utils.getInteger)({
  53181. data: attributes.force,
  53182. defaultValue: 1,
  53183. validator: n => n === 0
  53184. });
  53185. this.from = attributes.from || "";
  53186. this.to = attributes.to || "";
  53187. }
  53188. }
  53189. class EquateRange extends _xfa_object.XFAObject {
  53190. constructor(attributes) {
  53191. super(CONFIG_NS_ID, "equateRange");
  53192. this.from = attributes.from || "";
  53193. this.to = attributes.to || "";
  53194. this._unicodeRange = attributes.unicodeRange || "";
  53195. }
  53196. get unicodeRange() {
  53197. const ranges = [];
  53198. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  53199. const unicodeRange = this._unicodeRange;
  53200. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  53201. range = range.split("-", 2).map(x => {
  53202. const found = x.match(unicodeRegex);
  53203. if (!found) {
  53204. return 0;
  53205. }
  53206. return parseInt(found[1], 16);
  53207. });
  53208. if (range.length === 1) {
  53209. range.push(range[0]);
  53210. }
  53211. ranges.push(range);
  53212. }
  53213. return (0, _util.shadow)(this, "unicodeRange", ranges);
  53214. }
  53215. }
  53216. class Exclude extends _xfa_object.ContentObject {
  53217. constructor(attributes) {
  53218. super(CONFIG_NS_ID, "exclude");
  53219. }
  53220. [_xfa_object.$finalize]() {
  53221. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  53222. }
  53223. }
  53224. class ExcludeNS extends _xfa_object.StringObject {
  53225. constructor(attributes) {
  53226. super(CONFIG_NS_ID, "excludeNS");
  53227. }
  53228. }
  53229. class FlipLabel extends _xfa_object.OptionObject {
  53230. constructor(attributes) {
  53231. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  53232. }
  53233. }
  53234. class FontInfo extends _xfa_object.XFAObject {
  53235. constructor(attributes) {
  53236. super(CONFIG_NS_ID, "fontInfo", true);
  53237. this.embed = null;
  53238. this.map = null;
  53239. this.subsetBelow = null;
  53240. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  53241. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  53242. this.neverEmbed = new _xfa_object.XFAObjectArray();
  53243. }
  53244. }
  53245. class FormFieldFilling extends _xfa_object.Option01 {
  53246. constructor(attributes) {
  53247. super(CONFIG_NS_ID, "formFieldFilling");
  53248. }
  53249. }
  53250. class GroupParent extends _xfa_object.StringObject {
  53251. constructor(attributes) {
  53252. super(CONFIG_NS_ID, "groupParent");
  53253. }
  53254. }
  53255. class IfEmpty extends _xfa_object.OptionObject {
  53256. constructor(attributes) {
  53257. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  53258. }
  53259. }
  53260. class IncludeXDPContent extends _xfa_object.StringObject {
  53261. constructor(attributes) {
  53262. super(CONFIG_NS_ID, "includeXDPContent");
  53263. }
  53264. }
  53265. class IncrementalLoad extends _xfa_object.OptionObject {
  53266. constructor(attributes) {
  53267. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  53268. }
  53269. }
  53270. class IncrementalMerge extends _xfa_object.Option01 {
  53271. constructor(attributes) {
  53272. super(CONFIG_NS_ID, "incrementalMerge");
  53273. }
  53274. }
  53275. class Interactive extends _xfa_object.Option01 {
  53276. constructor(attributes) {
  53277. super(CONFIG_NS_ID, "interactive");
  53278. }
  53279. }
  53280. class Jog extends _xfa_object.OptionObject {
  53281. constructor(attributes) {
  53282. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  53283. }
  53284. }
  53285. class LabelPrinter extends _xfa_object.XFAObject {
  53286. constructor(attributes) {
  53287. super(CONFIG_NS_ID, "labelPrinter", true);
  53288. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  53289. this.batchOutput = null;
  53290. this.flipLabel = null;
  53291. this.fontInfo = null;
  53292. this.xdc = null;
  53293. }
  53294. }
  53295. class Layout extends _xfa_object.OptionObject {
  53296. constructor(attributes) {
  53297. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  53298. }
  53299. }
  53300. class Level extends _xfa_object.IntegerObject {
  53301. constructor(attributes) {
  53302. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  53303. }
  53304. }
  53305. class Linearized extends _xfa_object.Option01 {
  53306. constructor(attributes) {
  53307. super(CONFIG_NS_ID, "linearized");
  53308. }
  53309. }
  53310. class Locale extends _xfa_object.StringObject {
  53311. constructor(attributes) {
  53312. super(CONFIG_NS_ID, "locale");
  53313. }
  53314. }
  53315. class LocaleSet extends _xfa_object.StringObject {
  53316. constructor(attributes) {
  53317. super(CONFIG_NS_ID, "localeSet");
  53318. }
  53319. }
  53320. class Log extends _xfa_object.XFAObject {
  53321. constructor(attributes) {
  53322. super(CONFIG_NS_ID, "log", true);
  53323. this.mode = null;
  53324. this.threshold = null;
  53325. this.to = null;
  53326. this.uri = null;
  53327. }
  53328. }
  53329. class MapElement extends _xfa_object.XFAObject {
  53330. constructor(attributes) {
  53331. super(CONFIG_NS_ID, "map", true);
  53332. this.equate = new _xfa_object.XFAObjectArray();
  53333. this.equateRange = new _xfa_object.XFAObjectArray();
  53334. }
  53335. }
  53336. class MediumInfo extends _xfa_object.XFAObject {
  53337. constructor(attributes) {
  53338. super(CONFIG_NS_ID, "mediumInfo", true);
  53339. this.map = null;
  53340. }
  53341. }
  53342. class Message extends _xfa_object.XFAObject {
  53343. constructor(attributes) {
  53344. super(CONFIG_NS_ID, "message", true);
  53345. this.msgId = null;
  53346. this.severity = null;
  53347. }
  53348. }
  53349. class Messaging extends _xfa_object.XFAObject {
  53350. constructor(attributes) {
  53351. super(CONFIG_NS_ID, "messaging", true);
  53352. this.message = new _xfa_object.XFAObjectArray();
  53353. }
  53354. }
  53355. class Mode extends _xfa_object.OptionObject {
  53356. constructor(attributes) {
  53357. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  53358. }
  53359. }
  53360. class ModifyAnnots extends _xfa_object.Option01 {
  53361. constructor(attributes) {
  53362. super(CONFIG_NS_ID, "modifyAnnots");
  53363. }
  53364. }
  53365. class MsgId extends _xfa_object.IntegerObject {
  53366. constructor(attributes) {
  53367. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  53368. }
  53369. }
  53370. class NameAttr extends _xfa_object.StringObject {
  53371. constructor(attributes) {
  53372. super(CONFIG_NS_ID, "nameAttr");
  53373. }
  53374. }
  53375. class NeverEmbed extends _xfa_object.ContentObject {
  53376. constructor(attributes) {
  53377. super(CONFIG_NS_ID, "neverEmbed");
  53378. }
  53379. }
  53380. class NumberOfCopies extends _xfa_object.IntegerObject {
  53381. constructor(attributes) {
  53382. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  53383. }
  53384. }
  53385. class OpenAction extends _xfa_object.XFAObject {
  53386. constructor(attributes) {
  53387. super(CONFIG_NS_ID, "openAction", true);
  53388. this.destination = null;
  53389. }
  53390. }
  53391. class Output extends _xfa_object.XFAObject {
  53392. constructor(attributes) {
  53393. super(CONFIG_NS_ID, "output", true);
  53394. this.to = null;
  53395. this.type = null;
  53396. this.uri = null;
  53397. }
  53398. }
  53399. class OutputBin extends _xfa_object.StringObject {
  53400. constructor(attributes) {
  53401. super(CONFIG_NS_ID, "outputBin");
  53402. }
  53403. }
  53404. class OutputXSL extends _xfa_object.XFAObject {
  53405. constructor(attributes) {
  53406. super(CONFIG_NS_ID, "outputXSL", true);
  53407. this.uri = null;
  53408. }
  53409. }
  53410. class Overprint extends _xfa_object.OptionObject {
  53411. constructor(attributes) {
  53412. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  53413. }
  53414. }
  53415. class Packets extends _xfa_object.StringObject {
  53416. constructor(attributes) {
  53417. super(CONFIG_NS_ID, "packets");
  53418. }
  53419. [_xfa_object.$finalize]() {
  53420. if (this[_xfa_object.$content] === "*") {
  53421. return;
  53422. }
  53423. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  53424. }
  53425. }
  53426. class PageOffset extends _xfa_object.XFAObject {
  53427. constructor(attributes) {
  53428. super(CONFIG_NS_ID, "pageOffset");
  53429. this.x = (0, _utils.getInteger)({
  53430. data: attributes.x,
  53431. defaultValue: "useXDCSetting",
  53432. validator: n => true
  53433. });
  53434. this.y = (0, _utils.getInteger)({
  53435. data: attributes.y,
  53436. defaultValue: "useXDCSetting",
  53437. validator: n => true
  53438. });
  53439. }
  53440. }
  53441. class PageRange extends _xfa_object.StringObject {
  53442. constructor(attributes) {
  53443. super(CONFIG_NS_ID, "pageRange");
  53444. }
  53445. [_xfa_object.$finalize]() {
  53446. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  53447. const ranges = [];
  53448. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  53449. ranges.push(numbers.slice(i, i + 2));
  53450. }
  53451. this[_xfa_object.$content] = ranges;
  53452. }
  53453. }
  53454. class Pagination extends _xfa_object.OptionObject {
  53455. constructor(attributes) {
  53456. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  53457. }
  53458. }
  53459. class PaginationOverride extends _xfa_object.OptionObject {
  53460. constructor(attributes) {
  53461. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  53462. }
  53463. }
  53464. class Part extends _xfa_object.IntegerObject {
  53465. constructor(attributes) {
  53466. super(CONFIG_NS_ID, "part", 1, n => false);
  53467. }
  53468. }
  53469. class Pcl extends _xfa_object.XFAObject {
  53470. constructor(attributes) {
  53471. super(CONFIG_NS_ID, "pcl", true);
  53472. this.name = attributes.name || "";
  53473. this.batchOutput = null;
  53474. this.fontInfo = null;
  53475. this.jog = null;
  53476. this.mediumInfo = null;
  53477. this.outputBin = null;
  53478. this.pageOffset = null;
  53479. this.staple = null;
  53480. this.xdc = null;
  53481. }
  53482. }
  53483. class Pdf extends _xfa_object.XFAObject {
  53484. constructor(attributes) {
  53485. super(CONFIG_NS_ID, "pdf", true);
  53486. this.name = attributes.name || "";
  53487. this.adobeExtensionLevel = null;
  53488. this.batchOutput = null;
  53489. this.compression = null;
  53490. this.creator = null;
  53491. this.encryption = null;
  53492. this.fontInfo = null;
  53493. this.interactive = null;
  53494. this.linearized = null;
  53495. this.openAction = null;
  53496. this.pdfa = null;
  53497. this.producer = null;
  53498. this.renderPolicy = null;
  53499. this.scriptModel = null;
  53500. this.silentPrint = null;
  53501. this.submitFormat = null;
  53502. this.tagged = null;
  53503. this.version = null;
  53504. this.viewerPreferences = null;
  53505. this.xdc = null;
  53506. }
  53507. }
  53508. class Pdfa extends _xfa_object.XFAObject {
  53509. constructor(attributes) {
  53510. super(CONFIG_NS_ID, "pdfa", true);
  53511. this.amd = null;
  53512. this.conformance = null;
  53513. this.includeXDPContent = null;
  53514. this.part = null;
  53515. }
  53516. }
  53517. class Permissions extends _xfa_object.XFAObject {
  53518. constructor(attributes) {
  53519. super(CONFIG_NS_ID, "permissions", true);
  53520. this.accessibleContent = null;
  53521. this.change = null;
  53522. this.contentCopy = null;
  53523. this.documentAssembly = null;
  53524. this.formFieldFilling = null;
  53525. this.modifyAnnots = null;
  53526. this.plaintextMetadata = null;
  53527. this.print = null;
  53528. this.printHighQuality = null;
  53529. }
  53530. }
  53531. class PickTrayByPDFSize extends _xfa_object.Option01 {
  53532. constructor(attributes) {
  53533. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  53534. }
  53535. }
  53536. class Picture extends _xfa_object.StringObject {
  53537. constructor(attributes) {
  53538. super(CONFIG_NS_ID, "picture");
  53539. }
  53540. }
  53541. class PlaintextMetadata extends _xfa_object.Option01 {
  53542. constructor(attributes) {
  53543. super(CONFIG_NS_ID, "plaintextMetadata");
  53544. }
  53545. }
  53546. class Presence extends _xfa_object.OptionObject {
  53547. constructor(attributes) {
  53548. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  53549. }
  53550. }
  53551. class Present extends _xfa_object.XFAObject {
  53552. constructor(attributes) {
  53553. super(CONFIG_NS_ID, "present", true);
  53554. this.behaviorOverride = null;
  53555. this.cache = null;
  53556. this.common = null;
  53557. this.copies = null;
  53558. this.destination = null;
  53559. this.incrementalMerge = null;
  53560. this.layout = null;
  53561. this.output = null;
  53562. this.overprint = null;
  53563. this.pagination = null;
  53564. this.paginationOverride = null;
  53565. this.script = null;
  53566. this.validate = null;
  53567. this.xdp = null;
  53568. this.driver = new _xfa_object.XFAObjectArray();
  53569. this.labelPrinter = new _xfa_object.XFAObjectArray();
  53570. this.pcl = new _xfa_object.XFAObjectArray();
  53571. this.pdf = new _xfa_object.XFAObjectArray();
  53572. this.ps = new _xfa_object.XFAObjectArray();
  53573. this.submitUrl = new _xfa_object.XFAObjectArray();
  53574. this.webClient = new _xfa_object.XFAObjectArray();
  53575. this.zpl = new _xfa_object.XFAObjectArray();
  53576. }
  53577. }
  53578. class Print extends _xfa_object.Option01 {
  53579. constructor(attributes) {
  53580. super(CONFIG_NS_ID, "print");
  53581. }
  53582. }
  53583. class PrintHighQuality extends _xfa_object.Option01 {
  53584. constructor(attributes) {
  53585. super(CONFIG_NS_ID, "printHighQuality");
  53586. }
  53587. }
  53588. class PrintScaling extends _xfa_object.OptionObject {
  53589. constructor(attributes) {
  53590. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  53591. }
  53592. }
  53593. class PrinterName extends _xfa_object.StringObject {
  53594. constructor(attributes) {
  53595. super(CONFIG_NS_ID, "printerName");
  53596. }
  53597. }
  53598. class Producer extends _xfa_object.StringObject {
  53599. constructor(attributes) {
  53600. super(CONFIG_NS_ID, "producer");
  53601. }
  53602. }
  53603. class Ps extends _xfa_object.XFAObject {
  53604. constructor(attributes) {
  53605. super(CONFIG_NS_ID, "ps", true);
  53606. this.name = attributes.name || "";
  53607. this.batchOutput = null;
  53608. this.fontInfo = null;
  53609. this.jog = null;
  53610. this.mediumInfo = null;
  53611. this.outputBin = null;
  53612. this.staple = null;
  53613. this.xdc = null;
  53614. }
  53615. }
  53616. class Range extends _xfa_object.ContentObject {
  53617. constructor(attributes) {
  53618. super(CONFIG_NS_ID, "range");
  53619. }
  53620. [_xfa_object.$finalize]() {
  53621. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(range => range.split("-").map(x => parseInt(x.trim(), 10))).filter(range => range.every(x => !isNaN(x))).map(range => {
  53622. if (range.length === 1) {
  53623. range.push(range[0]);
  53624. }
  53625. return range;
  53626. });
  53627. }
  53628. }
  53629. class Record extends _xfa_object.ContentObject {
  53630. constructor(attributes) {
  53631. super(CONFIG_NS_ID, "record");
  53632. }
  53633. [_xfa_object.$finalize]() {
  53634. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  53635. const n = parseInt(this[_xfa_object.$content], 10);
  53636. if (!isNaN(n) && n >= 0) {
  53637. this[_xfa_object.$content] = n;
  53638. }
  53639. }
  53640. }
  53641. class Relevant extends _xfa_object.ContentObject {
  53642. constructor(attributes) {
  53643. super(CONFIG_NS_ID, "relevant");
  53644. }
  53645. [_xfa_object.$finalize]() {
  53646. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  53647. }
  53648. }
  53649. class Rename extends _xfa_object.ContentObject {
  53650. constructor(attributes) {
  53651. super(CONFIG_NS_ID, "rename");
  53652. }
  53653. [_xfa_object.$finalize]() {
  53654. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  53655. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  53656. (0, _util.warn)("XFA - Rename: invalid XFA name");
  53657. }
  53658. }
  53659. }
  53660. class RenderPolicy extends _xfa_object.OptionObject {
  53661. constructor(attributes) {
  53662. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  53663. }
  53664. }
  53665. class RunScripts extends _xfa_object.OptionObject {
  53666. constructor(attributes) {
  53667. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  53668. }
  53669. }
  53670. class Script extends _xfa_object.XFAObject {
  53671. constructor(attributes) {
  53672. super(CONFIG_NS_ID, "script", true);
  53673. this.currentPage = null;
  53674. this.exclude = null;
  53675. this.runScripts = null;
  53676. }
  53677. }
  53678. class ScriptModel extends _xfa_object.OptionObject {
  53679. constructor(attributes) {
  53680. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  53681. }
  53682. }
  53683. class Severity extends _xfa_object.OptionObject {
  53684. constructor(attributes) {
  53685. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  53686. }
  53687. }
  53688. class SilentPrint extends _xfa_object.XFAObject {
  53689. constructor(attributes) {
  53690. super(CONFIG_NS_ID, "silentPrint", true);
  53691. this.addSilentPrint = null;
  53692. this.printerName = null;
  53693. }
  53694. }
  53695. class Staple extends _xfa_object.XFAObject {
  53696. constructor(attributes) {
  53697. super(CONFIG_NS_ID, "staple");
  53698. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  53699. }
  53700. }
  53701. class StartNode extends _xfa_object.StringObject {
  53702. constructor(attributes) {
  53703. super(CONFIG_NS_ID, "startNode");
  53704. }
  53705. }
  53706. class StartPage extends _xfa_object.IntegerObject {
  53707. constructor(attributes) {
  53708. super(CONFIG_NS_ID, "startPage", 0, n => true);
  53709. }
  53710. }
  53711. class SubmitFormat extends _xfa_object.OptionObject {
  53712. constructor(attributes) {
  53713. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  53714. }
  53715. }
  53716. class SubmitUrl extends _xfa_object.StringObject {
  53717. constructor(attributes) {
  53718. super(CONFIG_NS_ID, "submitUrl");
  53719. }
  53720. }
  53721. class SubsetBelow extends _xfa_object.IntegerObject {
  53722. constructor(attributes) {
  53723. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  53724. }
  53725. }
  53726. class SuppressBanner extends _xfa_object.Option01 {
  53727. constructor(attributes) {
  53728. super(CONFIG_NS_ID, "suppressBanner");
  53729. }
  53730. }
  53731. class Tagged extends _xfa_object.Option01 {
  53732. constructor(attributes) {
  53733. super(CONFIG_NS_ID, "tagged");
  53734. }
  53735. }
  53736. class Template extends _xfa_object.XFAObject {
  53737. constructor(attributes) {
  53738. super(CONFIG_NS_ID, "template", true);
  53739. this.base = null;
  53740. this.relevant = null;
  53741. this.startPage = null;
  53742. this.uri = null;
  53743. this.xsl = null;
  53744. }
  53745. }
  53746. class Threshold extends _xfa_object.OptionObject {
  53747. constructor(attributes) {
  53748. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  53749. }
  53750. }
  53751. class To extends _xfa_object.OptionObject {
  53752. constructor(attributes) {
  53753. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  53754. }
  53755. }
  53756. class TemplateCache extends _xfa_object.XFAObject {
  53757. constructor(attributes) {
  53758. super(CONFIG_NS_ID, "templateCache");
  53759. this.maxEntries = (0, _utils.getInteger)({
  53760. data: attributes.maxEntries,
  53761. defaultValue: 5,
  53762. validator: n => n >= 0
  53763. });
  53764. }
  53765. }
  53766. class Trace extends _xfa_object.XFAObject {
  53767. constructor(attributes) {
  53768. super(CONFIG_NS_ID, "trace", true);
  53769. this.area = new _xfa_object.XFAObjectArray();
  53770. }
  53771. }
  53772. class Transform extends _xfa_object.XFAObject {
  53773. constructor(attributes) {
  53774. super(CONFIG_NS_ID, "transform", true);
  53775. this.groupParent = null;
  53776. this.ifEmpty = null;
  53777. this.nameAttr = null;
  53778. this.picture = null;
  53779. this.presence = null;
  53780. this.rename = null;
  53781. this.whitespace = null;
  53782. }
  53783. }
  53784. class Type extends _xfa_object.OptionObject {
  53785. constructor(attributes) {
  53786. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  53787. }
  53788. }
  53789. class Uri extends _xfa_object.StringObject {
  53790. constructor(attributes) {
  53791. super(CONFIG_NS_ID, "uri");
  53792. }
  53793. }
  53794. class Validate extends _xfa_object.OptionObject {
  53795. constructor(attributes) {
  53796. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  53797. }
  53798. }
  53799. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  53800. constructor(attributes) {
  53801. super(CONFIG_NS_ID, "validateApprovalSignatures");
  53802. }
  53803. [_xfa_object.$finalize]() {
  53804. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  53805. }
  53806. }
  53807. class ValidationMessaging extends _xfa_object.OptionObject {
  53808. constructor(attributes) {
  53809. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  53810. }
  53811. }
  53812. class Version extends _xfa_object.OptionObject {
  53813. constructor(attributes) {
  53814. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  53815. }
  53816. }
  53817. class VersionControl extends _xfa_object.XFAObject {
  53818. constructor(attributes) {
  53819. super(CONFIG_NS_ID, "VersionControl");
  53820. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  53821. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  53822. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  53823. }
  53824. }
  53825. class ViewerPreferences extends _xfa_object.XFAObject {
  53826. constructor(attributes) {
  53827. super(CONFIG_NS_ID, "viewerPreferences", true);
  53828. this.ADBE_JSConsole = null;
  53829. this.ADBE_JSDebugger = null;
  53830. this.addViewerPreferences = null;
  53831. this.duplexOption = null;
  53832. this.enforce = null;
  53833. this.numberOfCopies = null;
  53834. this.pageRange = null;
  53835. this.pickTrayByPDFSize = null;
  53836. this.printScaling = null;
  53837. }
  53838. }
  53839. class WebClient extends _xfa_object.XFAObject {
  53840. constructor(attributes) {
  53841. super(CONFIG_NS_ID, "webClient", true);
  53842. this.name = attributes.name ? attributes.name.trim() : "";
  53843. this.fontInfo = null;
  53844. this.xdc = null;
  53845. }
  53846. }
  53847. class Whitespace extends _xfa_object.OptionObject {
  53848. constructor(attributes) {
  53849. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  53850. }
  53851. }
  53852. class Window extends _xfa_object.ContentObject {
  53853. constructor(attributes) {
  53854. super(CONFIG_NS_ID, "window");
  53855. }
  53856. [_xfa_object.$finalize]() {
  53857. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  53858. if (pair.some(x => isNaN(x))) {
  53859. this[_xfa_object.$content] = [0, 0];
  53860. return;
  53861. }
  53862. if (pair.length === 1) {
  53863. pair.push(pair[0]);
  53864. }
  53865. this[_xfa_object.$content] = pair;
  53866. }
  53867. }
  53868. class Xdc extends _xfa_object.XFAObject {
  53869. constructor(attributes) {
  53870. super(CONFIG_NS_ID, "xdc", true);
  53871. this.uri = new _xfa_object.XFAObjectArray();
  53872. this.xsl = new _xfa_object.XFAObjectArray();
  53873. }
  53874. }
  53875. class Xdp extends _xfa_object.XFAObject {
  53876. constructor(attributes) {
  53877. super(CONFIG_NS_ID, "xdp", true);
  53878. this.packets = null;
  53879. }
  53880. }
  53881. class Xsl extends _xfa_object.XFAObject {
  53882. constructor(attributes) {
  53883. super(CONFIG_NS_ID, "xsl", true);
  53884. this.debug = null;
  53885. this.uri = null;
  53886. }
  53887. }
  53888. class Zpl extends _xfa_object.XFAObject {
  53889. constructor(attributes) {
  53890. super(CONFIG_NS_ID, "zpl", true);
  53891. this.name = attributes.name ? attributes.name.trim() : "";
  53892. this.batchOutput = null;
  53893. this.flipLabel = null;
  53894. this.fontInfo = null;
  53895. this.xdc = null;
  53896. }
  53897. }
  53898. class ConfigNamespace {
  53899. static [_namespaces.$buildXFAObject](name, attributes) {
  53900. if (ConfigNamespace.hasOwnProperty(name)) {
  53901. return ConfigNamespace[name](attributes);
  53902. }
  53903. return undefined;
  53904. }
  53905. static acrobat(attrs) {
  53906. return new Acrobat(attrs);
  53907. }
  53908. static acrobat7(attrs) {
  53909. return new Acrobat7(attrs);
  53910. }
  53911. static ADBE_JSConsole(attrs) {
  53912. return new ADBE_JSConsole(attrs);
  53913. }
  53914. static ADBE_JSDebugger(attrs) {
  53915. return new ADBE_JSDebugger(attrs);
  53916. }
  53917. static addSilentPrint(attrs) {
  53918. return new AddSilentPrint(attrs);
  53919. }
  53920. static addViewerPreferences(attrs) {
  53921. return new AddViewerPreferences(attrs);
  53922. }
  53923. static adjustData(attrs) {
  53924. return new AdjustData(attrs);
  53925. }
  53926. static adobeExtensionLevel(attrs) {
  53927. return new AdobeExtensionLevel(attrs);
  53928. }
  53929. static agent(attrs) {
  53930. return new Agent(attrs);
  53931. }
  53932. static alwaysEmbed(attrs) {
  53933. return new AlwaysEmbed(attrs);
  53934. }
  53935. static amd(attrs) {
  53936. return new Amd(attrs);
  53937. }
  53938. static area(attrs) {
  53939. return new Area(attrs);
  53940. }
  53941. static attributes(attrs) {
  53942. return new Attributes(attrs);
  53943. }
  53944. static autoSave(attrs) {
  53945. return new AutoSave(attrs);
  53946. }
  53947. static base(attrs) {
  53948. return new Base(attrs);
  53949. }
  53950. static batchOutput(attrs) {
  53951. return new BatchOutput(attrs);
  53952. }
  53953. static behaviorOverride(attrs) {
  53954. return new BehaviorOverride(attrs);
  53955. }
  53956. static cache(attrs) {
  53957. return new Cache(attrs);
  53958. }
  53959. static change(attrs) {
  53960. return new Change(attrs);
  53961. }
  53962. static common(attrs) {
  53963. return new Common(attrs);
  53964. }
  53965. static compress(attrs) {
  53966. return new Compress(attrs);
  53967. }
  53968. static compressLogicalStructure(attrs) {
  53969. return new CompressLogicalStructure(attrs);
  53970. }
  53971. static compressObjectStream(attrs) {
  53972. return new CompressObjectStream(attrs);
  53973. }
  53974. static compression(attrs) {
  53975. return new Compression(attrs);
  53976. }
  53977. static config(attrs) {
  53978. return new Config(attrs);
  53979. }
  53980. static conformance(attrs) {
  53981. return new Conformance(attrs);
  53982. }
  53983. static contentCopy(attrs) {
  53984. return new ContentCopy(attrs);
  53985. }
  53986. static copies(attrs) {
  53987. return new Copies(attrs);
  53988. }
  53989. static creator(attrs) {
  53990. return new Creator(attrs);
  53991. }
  53992. static currentPage(attrs) {
  53993. return new CurrentPage(attrs);
  53994. }
  53995. static data(attrs) {
  53996. return new Data(attrs);
  53997. }
  53998. static debug(attrs) {
  53999. return new Debug(attrs);
  54000. }
  54001. static defaultTypeface(attrs) {
  54002. return new DefaultTypeface(attrs);
  54003. }
  54004. static destination(attrs) {
  54005. return new Destination(attrs);
  54006. }
  54007. static documentAssembly(attrs) {
  54008. return new DocumentAssembly(attrs);
  54009. }
  54010. static driver(attrs) {
  54011. return new Driver(attrs);
  54012. }
  54013. static duplexOption(attrs) {
  54014. return new DuplexOption(attrs);
  54015. }
  54016. static dynamicRender(attrs) {
  54017. return new DynamicRender(attrs);
  54018. }
  54019. static embed(attrs) {
  54020. return new Embed(attrs);
  54021. }
  54022. static encrypt(attrs) {
  54023. return new Encrypt(attrs);
  54024. }
  54025. static encryption(attrs) {
  54026. return new Encryption(attrs);
  54027. }
  54028. static encryptionLevel(attrs) {
  54029. return new EncryptionLevel(attrs);
  54030. }
  54031. static enforce(attrs) {
  54032. return new Enforce(attrs);
  54033. }
  54034. static equate(attrs) {
  54035. return new Equate(attrs);
  54036. }
  54037. static equateRange(attrs) {
  54038. return new EquateRange(attrs);
  54039. }
  54040. static exclude(attrs) {
  54041. return new Exclude(attrs);
  54042. }
  54043. static excludeNS(attrs) {
  54044. return new ExcludeNS(attrs);
  54045. }
  54046. static flipLabel(attrs) {
  54047. return new FlipLabel(attrs);
  54048. }
  54049. static fontInfo(attrs) {
  54050. return new FontInfo(attrs);
  54051. }
  54052. static formFieldFilling(attrs) {
  54053. return new FormFieldFilling(attrs);
  54054. }
  54055. static groupParent(attrs) {
  54056. return new GroupParent(attrs);
  54057. }
  54058. static ifEmpty(attrs) {
  54059. return new IfEmpty(attrs);
  54060. }
  54061. static includeXDPContent(attrs) {
  54062. return new IncludeXDPContent(attrs);
  54063. }
  54064. static incrementalLoad(attrs) {
  54065. return new IncrementalLoad(attrs);
  54066. }
  54067. static incrementalMerge(attrs) {
  54068. return new IncrementalMerge(attrs);
  54069. }
  54070. static interactive(attrs) {
  54071. return new Interactive(attrs);
  54072. }
  54073. static jog(attrs) {
  54074. return new Jog(attrs);
  54075. }
  54076. static labelPrinter(attrs) {
  54077. return new LabelPrinter(attrs);
  54078. }
  54079. static layout(attrs) {
  54080. return new Layout(attrs);
  54081. }
  54082. static level(attrs) {
  54083. return new Level(attrs);
  54084. }
  54085. static linearized(attrs) {
  54086. return new Linearized(attrs);
  54087. }
  54088. static locale(attrs) {
  54089. return new Locale(attrs);
  54090. }
  54091. static localeSet(attrs) {
  54092. return new LocaleSet(attrs);
  54093. }
  54094. static log(attrs) {
  54095. return new Log(attrs);
  54096. }
  54097. static map(attrs) {
  54098. return new MapElement(attrs);
  54099. }
  54100. static mediumInfo(attrs) {
  54101. return new MediumInfo(attrs);
  54102. }
  54103. static message(attrs) {
  54104. return new Message(attrs);
  54105. }
  54106. static messaging(attrs) {
  54107. return new Messaging(attrs);
  54108. }
  54109. static mode(attrs) {
  54110. return new Mode(attrs);
  54111. }
  54112. static modifyAnnots(attrs) {
  54113. return new ModifyAnnots(attrs);
  54114. }
  54115. static msgId(attrs) {
  54116. return new MsgId(attrs);
  54117. }
  54118. static nameAttr(attrs) {
  54119. return new NameAttr(attrs);
  54120. }
  54121. static neverEmbed(attrs) {
  54122. return new NeverEmbed(attrs);
  54123. }
  54124. static numberOfCopies(attrs) {
  54125. return new NumberOfCopies(attrs);
  54126. }
  54127. static openAction(attrs) {
  54128. return new OpenAction(attrs);
  54129. }
  54130. static output(attrs) {
  54131. return new Output(attrs);
  54132. }
  54133. static outputBin(attrs) {
  54134. return new OutputBin(attrs);
  54135. }
  54136. static outputXSL(attrs) {
  54137. return new OutputXSL(attrs);
  54138. }
  54139. static overprint(attrs) {
  54140. return new Overprint(attrs);
  54141. }
  54142. static packets(attrs) {
  54143. return new Packets(attrs);
  54144. }
  54145. static pageOffset(attrs) {
  54146. return new PageOffset(attrs);
  54147. }
  54148. static pageRange(attrs) {
  54149. return new PageRange(attrs);
  54150. }
  54151. static pagination(attrs) {
  54152. return new Pagination(attrs);
  54153. }
  54154. static paginationOverride(attrs) {
  54155. return new PaginationOverride(attrs);
  54156. }
  54157. static part(attrs) {
  54158. return new Part(attrs);
  54159. }
  54160. static pcl(attrs) {
  54161. return new Pcl(attrs);
  54162. }
  54163. static pdf(attrs) {
  54164. return new Pdf(attrs);
  54165. }
  54166. static pdfa(attrs) {
  54167. return new Pdfa(attrs);
  54168. }
  54169. static permissions(attrs) {
  54170. return new Permissions(attrs);
  54171. }
  54172. static pickTrayByPDFSize(attrs) {
  54173. return new PickTrayByPDFSize(attrs);
  54174. }
  54175. static picture(attrs) {
  54176. return new Picture(attrs);
  54177. }
  54178. static plaintextMetadata(attrs) {
  54179. return new PlaintextMetadata(attrs);
  54180. }
  54181. static presence(attrs) {
  54182. return new Presence(attrs);
  54183. }
  54184. static present(attrs) {
  54185. return new Present(attrs);
  54186. }
  54187. static print(attrs) {
  54188. return new Print(attrs);
  54189. }
  54190. static printHighQuality(attrs) {
  54191. return new PrintHighQuality(attrs);
  54192. }
  54193. static printScaling(attrs) {
  54194. return new PrintScaling(attrs);
  54195. }
  54196. static printerName(attrs) {
  54197. return new PrinterName(attrs);
  54198. }
  54199. static producer(attrs) {
  54200. return new Producer(attrs);
  54201. }
  54202. static ps(attrs) {
  54203. return new Ps(attrs);
  54204. }
  54205. static range(attrs) {
  54206. return new Range(attrs);
  54207. }
  54208. static record(attrs) {
  54209. return new Record(attrs);
  54210. }
  54211. static relevant(attrs) {
  54212. return new Relevant(attrs);
  54213. }
  54214. static rename(attrs) {
  54215. return new Rename(attrs);
  54216. }
  54217. static renderPolicy(attrs) {
  54218. return new RenderPolicy(attrs);
  54219. }
  54220. static runScripts(attrs) {
  54221. return new RunScripts(attrs);
  54222. }
  54223. static script(attrs) {
  54224. return new Script(attrs);
  54225. }
  54226. static scriptModel(attrs) {
  54227. return new ScriptModel(attrs);
  54228. }
  54229. static severity(attrs) {
  54230. return new Severity(attrs);
  54231. }
  54232. static silentPrint(attrs) {
  54233. return new SilentPrint(attrs);
  54234. }
  54235. static staple(attrs) {
  54236. return new Staple(attrs);
  54237. }
  54238. static startNode(attrs) {
  54239. return new StartNode(attrs);
  54240. }
  54241. static startPage(attrs) {
  54242. return new StartPage(attrs);
  54243. }
  54244. static submitFormat(attrs) {
  54245. return new SubmitFormat(attrs);
  54246. }
  54247. static submitUrl(attrs) {
  54248. return new SubmitUrl(attrs);
  54249. }
  54250. static subsetBelow(attrs) {
  54251. return new SubsetBelow(attrs);
  54252. }
  54253. static suppressBanner(attrs) {
  54254. return new SuppressBanner(attrs);
  54255. }
  54256. static tagged(attrs) {
  54257. return new Tagged(attrs);
  54258. }
  54259. static template(attrs) {
  54260. return new Template(attrs);
  54261. }
  54262. static templateCache(attrs) {
  54263. return new TemplateCache(attrs);
  54264. }
  54265. static threshold(attrs) {
  54266. return new Threshold(attrs);
  54267. }
  54268. static to(attrs) {
  54269. return new To(attrs);
  54270. }
  54271. static trace(attrs) {
  54272. return new Trace(attrs);
  54273. }
  54274. static transform(attrs) {
  54275. return new Transform(attrs);
  54276. }
  54277. static type(attrs) {
  54278. return new Type(attrs);
  54279. }
  54280. static uri(attrs) {
  54281. return new Uri(attrs);
  54282. }
  54283. static validate(attrs) {
  54284. return new Validate(attrs);
  54285. }
  54286. static validateApprovalSignatures(attrs) {
  54287. return new ValidateApprovalSignatures(attrs);
  54288. }
  54289. static validationMessaging(attrs) {
  54290. return new ValidationMessaging(attrs);
  54291. }
  54292. static version(attrs) {
  54293. return new Version(attrs);
  54294. }
  54295. static versionControl(attrs) {
  54296. return new VersionControl(attrs);
  54297. }
  54298. static viewerPreferences(attrs) {
  54299. return new ViewerPreferences(attrs);
  54300. }
  54301. static webClient(attrs) {
  54302. return new WebClient(attrs);
  54303. }
  54304. static whitespace(attrs) {
  54305. return new Whitespace(attrs);
  54306. }
  54307. static window(attrs) {
  54308. return new Window(attrs);
  54309. }
  54310. static xdc(attrs) {
  54311. return new Xdc(attrs);
  54312. }
  54313. static xdp(attrs) {
  54314. return new Xdp(attrs);
  54315. }
  54316. static xsl(attrs) {
  54317. return new Xsl(attrs);
  54318. }
  54319. static zpl(attrs) {
  54320. return new Zpl(attrs);
  54321. }
  54322. }
  54323. exports.ConfigNamespace = ConfigNamespace;
  54324. /***/ }),
  54325. /* 61 */
  54326. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54327. Object.defineProperty(exports, "__esModule", ({
  54328. value: true
  54329. }));
  54330. exports.ConnectionSetNamespace = void 0;
  54331. var _namespaces = __w_pdfjs_require__(52);
  54332. var _xfa_object = __w_pdfjs_require__(50);
  54333. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  54334. class ConnectionSet extends _xfa_object.XFAObject {
  54335. constructor(attributes) {
  54336. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  54337. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  54338. this.xmlConnection = new _xfa_object.XFAObjectArray();
  54339. this.xsdConnection = new _xfa_object.XFAObjectArray();
  54340. }
  54341. }
  54342. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  54343. constructor(attributes) {
  54344. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  54345. this.id = attributes.id || "";
  54346. this.name = attributes.name || "";
  54347. this.use = attributes.use || "";
  54348. this.usehref = attributes.usehref || "";
  54349. }
  54350. }
  54351. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  54352. constructor(attributes) {
  54353. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  54354. this.id = attributes.id || "";
  54355. this.name = attributes.name || "";
  54356. this.use = attributes.use || "";
  54357. this.usehref = attributes.usehref || "";
  54358. }
  54359. }
  54360. class Operation extends _xfa_object.StringObject {
  54361. constructor(attributes) {
  54362. super(CONNECTION_SET_NS_ID, "operation");
  54363. this.id = attributes.id || "";
  54364. this.input = attributes.input || "";
  54365. this.name = attributes.name || "";
  54366. this.output = attributes.output || "";
  54367. this.use = attributes.use || "";
  54368. this.usehref = attributes.usehref || "";
  54369. }
  54370. }
  54371. class RootElement extends _xfa_object.StringObject {
  54372. constructor(attributes) {
  54373. super(CONNECTION_SET_NS_ID, "rootElement");
  54374. this.id = attributes.id || "";
  54375. this.name = attributes.name || "";
  54376. this.use = attributes.use || "";
  54377. this.usehref = attributes.usehref || "";
  54378. }
  54379. }
  54380. class SoapAction extends _xfa_object.StringObject {
  54381. constructor(attributes) {
  54382. super(CONNECTION_SET_NS_ID, "soapAction");
  54383. this.id = attributes.id || "";
  54384. this.name = attributes.name || "";
  54385. this.use = attributes.use || "";
  54386. this.usehref = attributes.usehref || "";
  54387. }
  54388. }
  54389. class SoapAddress extends _xfa_object.StringObject {
  54390. constructor(attributes) {
  54391. super(CONNECTION_SET_NS_ID, "soapAddress");
  54392. this.id = attributes.id || "";
  54393. this.name = attributes.name || "";
  54394. this.use = attributes.use || "";
  54395. this.usehref = attributes.usehref || "";
  54396. }
  54397. }
  54398. class Uri extends _xfa_object.StringObject {
  54399. constructor(attributes) {
  54400. super(CONNECTION_SET_NS_ID, "uri");
  54401. this.id = attributes.id || "";
  54402. this.name = attributes.name || "";
  54403. this.use = attributes.use || "";
  54404. this.usehref = attributes.usehref || "";
  54405. }
  54406. }
  54407. class WsdlAddress extends _xfa_object.StringObject {
  54408. constructor(attributes) {
  54409. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  54410. this.id = attributes.id || "";
  54411. this.name = attributes.name || "";
  54412. this.use = attributes.use || "";
  54413. this.usehref = attributes.usehref || "";
  54414. }
  54415. }
  54416. class WsdlConnection extends _xfa_object.XFAObject {
  54417. constructor(attributes) {
  54418. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  54419. this.dataDescription = attributes.dataDescription || "";
  54420. this.name = attributes.name || "";
  54421. this.effectiveInputPolicy = null;
  54422. this.effectiveOutputPolicy = null;
  54423. this.operation = null;
  54424. this.soapAction = null;
  54425. this.soapAddress = null;
  54426. this.wsdlAddress = null;
  54427. }
  54428. }
  54429. class XmlConnection extends _xfa_object.XFAObject {
  54430. constructor(attributes) {
  54431. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  54432. this.dataDescription = attributes.dataDescription || "";
  54433. this.name = attributes.name || "";
  54434. this.uri = null;
  54435. }
  54436. }
  54437. class XsdConnection extends _xfa_object.XFAObject {
  54438. constructor(attributes) {
  54439. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  54440. this.dataDescription = attributes.dataDescription || "";
  54441. this.name = attributes.name || "";
  54442. this.rootElement = null;
  54443. this.uri = null;
  54444. }
  54445. }
  54446. class ConnectionSetNamespace {
  54447. static [_namespaces.$buildXFAObject](name, attributes) {
  54448. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  54449. return ConnectionSetNamespace[name](attributes);
  54450. }
  54451. return undefined;
  54452. }
  54453. static connectionSet(attrs) {
  54454. return new ConnectionSet(attrs);
  54455. }
  54456. static effectiveInputPolicy(attrs) {
  54457. return new EffectiveInputPolicy(attrs);
  54458. }
  54459. static effectiveOutputPolicy(attrs) {
  54460. return new EffectiveOutputPolicy(attrs);
  54461. }
  54462. static operation(attrs) {
  54463. return new Operation(attrs);
  54464. }
  54465. static rootElement(attrs) {
  54466. return new RootElement(attrs);
  54467. }
  54468. static soapAction(attrs) {
  54469. return new SoapAction(attrs);
  54470. }
  54471. static soapAddress(attrs) {
  54472. return new SoapAddress(attrs);
  54473. }
  54474. static uri(attrs) {
  54475. return new Uri(attrs);
  54476. }
  54477. static wsdlAddress(attrs) {
  54478. return new WsdlAddress(attrs);
  54479. }
  54480. static wsdlConnection(attrs) {
  54481. return new WsdlConnection(attrs);
  54482. }
  54483. static xmlConnection(attrs) {
  54484. return new XmlConnection(attrs);
  54485. }
  54486. static xsdConnection(attrs) {
  54487. return new XsdConnection(attrs);
  54488. }
  54489. }
  54490. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  54491. /***/ }),
  54492. /* 62 */
  54493. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54494. Object.defineProperty(exports, "__esModule", ({
  54495. value: true
  54496. }));
  54497. exports.DatasetsNamespace = void 0;
  54498. var _xfa_object = __w_pdfjs_require__(50);
  54499. var _namespaces = __w_pdfjs_require__(52);
  54500. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  54501. class Data extends _xfa_object.XmlObject {
  54502. constructor(attributes) {
  54503. super(DATASETS_NS_ID, "data", attributes);
  54504. }
  54505. }
  54506. class Datasets extends _xfa_object.XFAObject {
  54507. constructor(attributes) {
  54508. super(DATASETS_NS_ID, "datasets", true);
  54509. this.data = null;
  54510. this.Signature = null;
  54511. }
  54512. [_xfa_object.$onChild](child) {
  54513. const name = child[_xfa_object.$nodeName];
  54514. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  54515. this[name] = child;
  54516. } else {
  54517. child[_xfa_object.$global] = true;
  54518. }
  54519. this[_xfa_object.$appendChild](child);
  54520. }
  54521. }
  54522. class DatasetsNamespace {
  54523. static [_namespaces.$buildXFAObject](name, attributes) {
  54524. if (DatasetsNamespace.hasOwnProperty(name)) {
  54525. return DatasetsNamespace[name](attributes);
  54526. }
  54527. return undefined;
  54528. }
  54529. static datasets(attributes) {
  54530. return new Datasets(attributes);
  54531. }
  54532. static data(attributes) {
  54533. return new Data(attributes);
  54534. }
  54535. }
  54536. exports.DatasetsNamespace = DatasetsNamespace;
  54537. /***/ }),
  54538. /* 63 */
  54539. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54540. Object.defineProperty(exports, "__esModule", ({
  54541. value: true
  54542. }));
  54543. exports.LocaleSetNamespace = void 0;
  54544. var _namespaces = __w_pdfjs_require__(52);
  54545. var _xfa_object = __w_pdfjs_require__(50);
  54546. var _utils = __w_pdfjs_require__(51);
  54547. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  54548. class CalendarSymbols extends _xfa_object.XFAObject {
  54549. constructor(attributes) {
  54550. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  54551. this.name = "gregorian";
  54552. this.dayNames = new _xfa_object.XFAObjectArray(2);
  54553. this.eraNames = null;
  54554. this.meridiemNames = null;
  54555. this.monthNames = new _xfa_object.XFAObjectArray(2);
  54556. }
  54557. }
  54558. class CurrencySymbol extends _xfa_object.StringObject {
  54559. constructor(attributes) {
  54560. super(LOCALE_SET_NS_ID, "currencySymbol");
  54561. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  54562. }
  54563. }
  54564. class CurrencySymbols extends _xfa_object.XFAObject {
  54565. constructor(attributes) {
  54566. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  54567. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  54568. }
  54569. }
  54570. class DatePattern extends _xfa_object.StringObject {
  54571. constructor(attributes) {
  54572. super(LOCALE_SET_NS_ID, "datePattern");
  54573. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  54574. }
  54575. }
  54576. class DatePatterns extends _xfa_object.XFAObject {
  54577. constructor(attributes) {
  54578. super(LOCALE_SET_NS_ID, "datePatterns", true);
  54579. this.datePattern = new _xfa_object.XFAObjectArray(4);
  54580. }
  54581. }
  54582. class DateTimeSymbols extends _xfa_object.ContentObject {
  54583. constructor(attributes) {
  54584. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  54585. }
  54586. }
  54587. class Day extends _xfa_object.StringObject {
  54588. constructor(attributes) {
  54589. super(LOCALE_SET_NS_ID, "day");
  54590. }
  54591. }
  54592. class DayNames extends _xfa_object.XFAObject {
  54593. constructor(attributes) {
  54594. super(LOCALE_SET_NS_ID, "dayNames", true);
  54595. this.abbr = (0, _utils.getInteger)({
  54596. data: attributes.abbr,
  54597. defaultValue: 0,
  54598. validate: x => x === 1
  54599. });
  54600. this.day = new _xfa_object.XFAObjectArray(7);
  54601. }
  54602. }
  54603. class Era extends _xfa_object.StringObject {
  54604. constructor(attributes) {
  54605. super(LOCALE_SET_NS_ID, "era");
  54606. }
  54607. }
  54608. class EraNames extends _xfa_object.XFAObject {
  54609. constructor(attributes) {
  54610. super(LOCALE_SET_NS_ID, "eraNames", true);
  54611. this.era = new _xfa_object.XFAObjectArray(2);
  54612. }
  54613. }
  54614. class Locale extends _xfa_object.XFAObject {
  54615. constructor(attributes) {
  54616. super(LOCALE_SET_NS_ID, "locale", true);
  54617. this.desc = attributes.desc || "";
  54618. this.name = "isoname";
  54619. this.calendarSymbols = null;
  54620. this.currencySymbols = null;
  54621. this.datePatterns = null;
  54622. this.dateTimeSymbols = null;
  54623. this.numberPatterns = null;
  54624. this.numberSymbols = null;
  54625. this.timePatterns = null;
  54626. this.typeFaces = null;
  54627. }
  54628. }
  54629. class LocaleSet extends _xfa_object.XFAObject {
  54630. constructor(attributes) {
  54631. super(LOCALE_SET_NS_ID, "localeSet", true);
  54632. this.locale = new _xfa_object.XFAObjectArray();
  54633. }
  54634. }
  54635. class Meridiem extends _xfa_object.StringObject {
  54636. constructor(attributes) {
  54637. super(LOCALE_SET_NS_ID, "meridiem");
  54638. }
  54639. }
  54640. class MeridiemNames extends _xfa_object.XFAObject {
  54641. constructor(attributes) {
  54642. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  54643. this.meridiem = new _xfa_object.XFAObjectArray(2);
  54644. }
  54645. }
  54646. class Month extends _xfa_object.StringObject {
  54647. constructor(attributes) {
  54648. super(LOCALE_SET_NS_ID, "month");
  54649. }
  54650. }
  54651. class MonthNames extends _xfa_object.XFAObject {
  54652. constructor(attributes) {
  54653. super(LOCALE_SET_NS_ID, "monthNames", true);
  54654. this.abbr = (0, _utils.getInteger)({
  54655. data: attributes.abbr,
  54656. defaultValue: 0,
  54657. validate: x => x === 1
  54658. });
  54659. this.month = new _xfa_object.XFAObjectArray(12);
  54660. }
  54661. }
  54662. class NumberPattern extends _xfa_object.StringObject {
  54663. constructor(attributes) {
  54664. super(LOCALE_SET_NS_ID, "numberPattern");
  54665. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  54666. }
  54667. }
  54668. class NumberPatterns extends _xfa_object.XFAObject {
  54669. constructor(attributes) {
  54670. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  54671. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  54672. }
  54673. }
  54674. class NumberSymbol extends _xfa_object.StringObject {
  54675. constructor(attributes) {
  54676. super(LOCALE_SET_NS_ID, "numberSymbol");
  54677. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  54678. }
  54679. }
  54680. class NumberSymbols extends _xfa_object.XFAObject {
  54681. constructor(attributes) {
  54682. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  54683. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  54684. }
  54685. }
  54686. class TimePattern extends _xfa_object.StringObject {
  54687. constructor(attributes) {
  54688. super(LOCALE_SET_NS_ID, "timePattern");
  54689. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  54690. }
  54691. }
  54692. class TimePatterns extends _xfa_object.XFAObject {
  54693. constructor(attributes) {
  54694. super(LOCALE_SET_NS_ID, "timePatterns", true);
  54695. this.timePattern = new _xfa_object.XFAObjectArray(4);
  54696. }
  54697. }
  54698. class TypeFace extends _xfa_object.XFAObject {
  54699. constructor(attributes) {
  54700. super(LOCALE_SET_NS_ID, "typeFace", true);
  54701. this.name = attributes.name | "";
  54702. }
  54703. }
  54704. class TypeFaces extends _xfa_object.XFAObject {
  54705. constructor(attributes) {
  54706. super(LOCALE_SET_NS_ID, "typeFaces", true);
  54707. this.typeFace = new _xfa_object.XFAObjectArray();
  54708. }
  54709. }
  54710. class LocaleSetNamespace {
  54711. static [_namespaces.$buildXFAObject](name, attributes) {
  54712. if (LocaleSetNamespace.hasOwnProperty(name)) {
  54713. return LocaleSetNamespace[name](attributes);
  54714. }
  54715. return undefined;
  54716. }
  54717. static calendarSymbols(attrs) {
  54718. return new CalendarSymbols(attrs);
  54719. }
  54720. static currencySymbol(attrs) {
  54721. return new CurrencySymbol(attrs);
  54722. }
  54723. static currencySymbols(attrs) {
  54724. return new CurrencySymbols(attrs);
  54725. }
  54726. static datePattern(attrs) {
  54727. return new DatePattern(attrs);
  54728. }
  54729. static datePatterns(attrs) {
  54730. return new DatePatterns(attrs);
  54731. }
  54732. static dateTimeSymbols(attrs) {
  54733. return new DateTimeSymbols(attrs);
  54734. }
  54735. static day(attrs) {
  54736. return new Day(attrs);
  54737. }
  54738. static dayNames(attrs) {
  54739. return new DayNames(attrs);
  54740. }
  54741. static era(attrs) {
  54742. return new Era(attrs);
  54743. }
  54744. static eraNames(attrs) {
  54745. return new EraNames(attrs);
  54746. }
  54747. static locale(attrs) {
  54748. return new Locale(attrs);
  54749. }
  54750. static localeSet(attrs) {
  54751. return new LocaleSet(attrs);
  54752. }
  54753. static meridiem(attrs) {
  54754. return new Meridiem(attrs);
  54755. }
  54756. static meridiemNames(attrs) {
  54757. return new MeridiemNames(attrs);
  54758. }
  54759. static month(attrs) {
  54760. return new Month(attrs);
  54761. }
  54762. static monthNames(attrs) {
  54763. return new MonthNames(attrs);
  54764. }
  54765. static numberPattern(attrs) {
  54766. return new NumberPattern(attrs);
  54767. }
  54768. static numberPatterns(attrs) {
  54769. return new NumberPatterns(attrs);
  54770. }
  54771. static numberSymbol(attrs) {
  54772. return new NumberSymbol(attrs);
  54773. }
  54774. static numberSymbols(attrs) {
  54775. return new NumberSymbols(attrs);
  54776. }
  54777. static timePattern(attrs) {
  54778. return new TimePattern(attrs);
  54779. }
  54780. static timePatterns(attrs) {
  54781. return new TimePatterns(attrs);
  54782. }
  54783. static typeFace(attrs) {
  54784. return new TypeFace(attrs);
  54785. }
  54786. static typeFaces(attrs) {
  54787. return new TypeFaces(attrs);
  54788. }
  54789. }
  54790. exports.LocaleSetNamespace = LocaleSetNamespace;
  54791. /***/ }),
  54792. /* 64 */
  54793. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54794. Object.defineProperty(exports, "__esModule", ({
  54795. value: true
  54796. }));
  54797. exports.SignatureNamespace = void 0;
  54798. var _namespaces = __w_pdfjs_require__(52);
  54799. var _xfa_object = __w_pdfjs_require__(50);
  54800. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  54801. class Signature extends _xfa_object.XFAObject {
  54802. constructor(attributes) {
  54803. super(SIGNATURE_NS_ID, "signature", true);
  54804. }
  54805. }
  54806. class SignatureNamespace {
  54807. static [_namespaces.$buildXFAObject](name, attributes) {
  54808. if (SignatureNamespace.hasOwnProperty(name)) {
  54809. return SignatureNamespace[name](attributes);
  54810. }
  54811. return undefined;
  54812. }
  54813. static signature(attributes) {
  54814. return new Signature(attributes);
  54815. }
  54816. }
  54817. exports.SignatureNamespace = SignatureNamespace;
  54818. /***/ }),
  54819. /* 65 */
  54820. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54821. Object.defineProperty(exports, "__esModule", ({
  54822. value: true
  54823. }));
  54824. exports.StylesheetNamespace = void 0;
  54825. var _namespaces = __w_pdfjs_require__(52);
  54826. var _xfa_object = __w_pdfjs_require__(50);
  54827. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  54828. class Stylesheet extends _xfa_object.XFAObject {
  54829. constructor(attributes) {
  54830. super(STYLESHEET_NS_ID, "stylesheet", true);
  54831. }
  54832. }
  54833. class StylesheetNamespace {
  54834. static [_namespaces.$buildXFAObject](name, attributes) {
  54835. if (StylesheetNamespace.hasOwnProperty(name)) {
  54836. return StylesheetNamespace[name](attributes);
  54837. }
  54838. return undefined;
  54839. }
  54840. static stylesheet(attributes) {
  54841. return new Stylesheet(attributes);
  54842. }
  54843. }
  54844. exports.StylesheetNamespace = StylesheetNamespace;
  54845. /***/ }),
  54846. /* 66 */
  54847. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54848. Object.defineProperty(exports, "__esModule", ({
  54849. value: true
  54850. }));
  54851. exports.XdpNamespace = void 0;
  54852. var _namespaces = __w_pdfjs_require__(52);
  54853. var _xfa_object = __w_pdfjs_require__(50);
  54854. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  54855. class Xdp extends _xfa_object.XFAObject {
  54856. constructor(attributes) {
  54857. super(XDP_NS_ID, "xdp", true);
  54858. this.uuid = attributes.uuid || "";
  54859. this.timeStamp = attributes.timeStamp || "";
  54860. this.config = null;
  54861. this.connectionSet = null;
  54862. this.datasets = null;
  54863. this.localeSet = null;
  54864. this.stylesheet = new _xfa_object.XFAObjectArray();
  54865. this.template = null;
  54866. }
  54867. [_xfa_object.$onChildCheck](child) {
  54868. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  54869. return ns && child[_xfa_object.$namespaceId] === ns.id;
  54870. }
  54871. }
  54872. class XdpNamespace {
  54873. static [_namespaces.$buildXFAObject](name, attributes) {
  54874. if (XdpNamespace.hasOwnProperty(name)) {
  54875. return XdpNamespace[name](attributes);
  54876. }
  54877. return undefined;
  54878. }
  54879. static xdp(attributes) {
  54880. return new Xdp(attributes);
  54881. }
  54882. }
  54883. exports.XdpNamespace = XdpNamespace;
  54884. /***/ }),
  54885. /* 67 */
  54886. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  54887. Object.defineProperty(exports, "__esModule", ({
  54888. value: true
  54889. }));
  54890. exports.XhtmlNamespace = void 0;
  54891. var _namespaces = __w_pdfjs_require__(52);
  54892. var _xfa_object = __w_pdfjs_require__(50);
  54893. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  54894. const VALID_STYLES = new Set(["color", "font", "font-family", "font-size", "font-stretch", "font-style", "font-weight", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "letter-spacing", "line-height", "orphans", "page-break-after", "page-break-before", "page-break-inside", "tab-interval", "tab-stop", "text-decoration", "text-indent", "vertical-align", "widows", "kerning-mode", "xfa-font-horizontal-scale", "xfa-font-vertical-scale", "xfa-tab-stops"]);
  54895. function checkStyle(style) {
  54896. if (!style) {
  54897. return "";
  54898. }
  54899. return style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key]) => VALID_STYLES.has(key)).map(kv => kv.join(":")).join(";");
  54900. }
  54901. class A extends _xfa_object.XmlObject {
  54902. constructor(attributes) {
  54903. super(XHTML_NS_ID, "a");
  54904. this.href = attributes.href || "";
  54905. this.style = checkStyle(attributes.style);
  54906. }
  54907. }
  54908. class B extends _xfa_object.XmlObject {
  54909. constructor(attributes) {
  54910. super(XHTML_NS_ID, "b");
  54911. this.style = checkStyle(attributes.style);
  54912. }
  54913. }
  54914. class Body extends _xfa_object.XmlObject {
  54915. constructor(attributes) {
  54916. super(XHTML_NS_ID, "body");
  54917. this.style = checkStyle(attributes.style);
  54918. }
  54919. }
  54920. class Br extends _xfa_object.XmlObject {
  54921. constructor(attributes) {
  54922. super(XHTML_NS_ID, "br");
  54923. this.style = checkStyle(attributes.style);
  54924. }
  54925. [_xfa_object.$text]() {
  54926. return "\n";
  54927. }
  54928. }
  54929. class Html extends _xfa_object.XmlObject {
  54930. constructor(attributes) {
  54931. super(XHTML_NS_ID, "html");
  54932. this.style = checkStyle(attributes.style);
  54933. }
  54934. }
  54935. class I extends _xfa_object.XmlObject {
  54936. constructor(attributes) {
  54937. super(XHTML_NS_ID, "i");
  54938. this.style = checkStyle(attributes.style);
  54939. }
  54940. }
  54941. class Li extends _xfa_object.XmlObject {
  54942. constructor(attributes) {
  54943. super(XHTML_NS_ID, "li");
  54944. this.style = checkStyle(attributes.style);
  54945. }
  54946. }
  54947. class Ol extends _xfa_object.XmlObject {
  54948. constructor(attributes) {
  54949. super(XHTML_NS_ID, "ol");
  54950. this.style = checkStyle(attributes.style);
  54951. }
  54952. }
  54953. class P extends _xfa_object.XmlObject {
  54954. constructor(attributes) {
  54955. super(XHTML_NS_ID, "p");
  54956. this.style = checkStyle(attributes.style);
  54957. }
  54958. }
  54959. class Span extends _xfa_object.XmlObject {
  54960. constructor(attributes) {
  54961. super(XHTML_NS_ID, "span");
  54962. this.style = checkStyle(attributes.style);
  54963. }
  54964. }
  54965. class Sub extends _xfa_object.XmlObject {
  54966. constructor(attributes) {
  54967. super(XHTML_NS_ID, "sub");
  54968. this.style = checkStyle(attributes.style);
  54969. }
  54970. }
  54971. class Sup extends _xfa_object.XmlObject {
  54972. constructor(attributes) {
  54973. super(XHTML_NS_ID, "sup");
  54974. this.style = checkStyle(attributes.style);
  54975. }
  54976. }
  54977. class Ul extends _xfa_object.XmlObject {
  54978. constructor(attributes) {
  54979. super(XHTML_NS_ID, "ul");
  54980. this.style = checkStyle(attributes.style);
  54981. }
  54982. }
  54983. class XhtmlNamespace {
  54984. static [_namespaces.$buildXFAObject](name, attributes) {
  54985. if (XhtmlNamespace.hasOwnProperty(name)) {
  54986. return XhtmlNamespace[name](attributes);
  54987. }
  54988. return undefined;
  54989. }
  54990. static a(attributes) {
  54991. return new A(attributes);
  54992. }
  54993. static b(attributes) {
  54994. return new B(attributes);
  54995. }
  54996. static body(attributes) {
  54997. return new Body(attributes);
  54998. }
  54999. static br(attributes) {
  55000. return new Br(attributes);
  55001. }
  55002. static html(attributes) {
  55003. return new Html(attributes);
  55004. }
  55005. static i(attributes) {
  55006. return new I(attributes);
  55007. }
  55008. static li(attributes) {
  55009. return new Li(attributes);
  55010. }
  55011. static ol(attributes) {
  55012. return new Ol(attributes);
  55013. }
  55014. static p(attributes) {
  55015. return new P(attributes);
  55016. }
  55017. static span(attributes) {
  55018. return new Span(attributes);
  55019. }
  55020. static sub(attributes) {
  55021. return new Sub(attributes);
  55022. }
  55023. static sup(attributes) {
  55024. return new Sup(attributes);
  55025. }
  55026. static ul(attributes) {
  55027. return new Ul(attributes);
  55028. }
  55029. }
  55030. exports.XhtmlNamespace = XhtmlNamespace;
  55031. /***/ }),
  55032. /* 68 */
  55033. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55034. Object.defineProperty(exports, "__esModule", ({
  55035. value: true
  55036. }));
  55037. exports.UnknownNamespace = void 0;
  55038. var _namespaces = __w_pdfjs_require__(52);
  55039. var _xfa_object = __w_pdfjs_require__(50);
  55040. class UnknownNamespace {
  55041. constructor(nsId) {
  55042. this.namespaceId = nsId;
  55043. }
  55044. [_namespaces.$buildXFAObject](name, attributes) {
  55045. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  55046. }
  55047. }
  55048. exports.UnknownNamespace = UnknownNamespace;
  55049. /***/ }),
  55050. /* 69 */
  55051. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55052. Object.defineProperty(exports, "__esModule", ({
  55053. value: true
  55054. }));
  55055. exports.MessageHandler = void 0;
  55056. var _util = __w_pdfjs_require__(2);
  55057. const CallbackKind = {
  55058. UNKNOWN: 0,
  55059. DATA: 1,
  55060. ERROR: 2
  55061. };
  55062. const StreamKind = {
  55063. UNKNOWN: 0,
  55064. CANCEL: 1,
  55065. CANCEL_COMPLETE: 2,
  55066. CLOSE: 3,
  55067. ENQUEUE: 4,
  55068. ERROR: 5,
  55069. PULL: 6,
  55070. PULL_COMPLETE: 7,
  55071. START_COMPLETE: 8
  55072. };
  55073. function wrapReason(reason) {
  55074. if (typeof reason !== "object" || reason === null) {
  55075. return reason;
  55076. }
  55077. switch (reason.name) {
  55078. case "AbortException":
  55079. return new _util.AbortException(reason.message);
  55080. case "MissingPDFException":
  55081. return new _util.MissingPDFException(reason.message);
  55082. case "UnexpectedResponseException":
  55083. return new _util.UnexpectedResponseException(reason.message, reason.status);
  55084. case "UnknownErrorException":
  55085. return new _util.UnknownErrorException(reason.message, reason.details);
  55086. default:
  55087. return new _util.UnknownErrorException(reason.message, reason.toString());
  55088. }
  55089. }
  55090. class MessageHandler {
  55091. constructor(sourceName, targetName, comObj) {
  55092. this.sourceName = sourceName;
  55093. this.targetName = targetName;
  55094. this.comObj = comObj;
  55095. this.callbackId = 1;
  55096. this.streamId = 1;
  55097. this.postMessageTransfers = true;
  55098. this.streamSinks = Object.create(null);
  55099. this.streamControllers = Object.create(null);
  55100. this.callbackCapabilities = Object.create(null);
  55101. this.actionHandler = Object.create(null);
  55102. this._onComObjOnMessage = event => {
  55103. const data = event.data;
  55104. if (data.targetName !== this.sourceName) {
  55105. return;
  55106. }
  55107. if (data.stream) {
  55108. this._processStreamMessage(data);
  55109. return;
  55110. }
  55111. if (data.callback) {
  55112. const callbackId = data.callbackId;
  55113. const capability = this.callbackCapabilities[callbackId];
  55114. if (!capability) {
  55115. throw new Error(`Cannot resolve callback ${callbackId}`);
  55116. }
  55117. delete this.callbackCapabilities[callbackId];
  55118. if (data.callback === CallbackKind.DATA) {
  55119. capability.resolve(data.data);
  55120. } else if (data.callback === CallbackKind.ERROR) {
  55121. capability.reject(wrapReason(data.reason));
  55122. } else {
  55123. throw new Error("Unexpected callback case");
  55124. }
  55125. return;
  55126. }
  55127. const action = this.actionHandler[data.action];
  55128. if (!action) {
  55129. throw new Error(`Unknown action from worker: ${data.action}`);
  55130. }
  55131. if (data.callbackId) {
  55132. const cbSourceName = this.sourceName;
  55133. const cbTargetName = data.sourceName;
  55134. new Promise(function (resolve) {
  55135. resolve(action(data.data));
  55136. }).then(function (result) {
  55137. comObj.postMessage({
  55138. sourceName: cbSourceName,
  55139. targetName: cbTargetName,
  55140. callback: CallbackKind.DATA,
  55141. callbackId: data.callbackId,
  55142. data: result
  55143. });
  55144. }, function (reason) {
  55145. comObj.postMessage({
  55146. sourceName: cbSourceName,
  55147. targetName: cbTargetName,
  55148. callback: CallbackKind.ERROR,
  55149. callbackId: data.callbackId,
  55150. reason: wrapReason(reason)
  55151. });
  55152. });
  55153. return;
  55154. }
  55155. if (data.streamId) {
  55156. this._createStreamSink(data);
  55157. return;
  55158. }
  55159. action(data.data);
  55160. };
  55161. comObj.addEventListener("message", this._onComObjOnMessage);
  55162. }
  55163. on(actionName, handler) {
  55164. const ah = this.actionHandler;
  55165. if (ah[actionName]) {
  55166. throw new Error(`There is already an actionName called "${actionName}"`);
  55167. }
  55168. ah[actionName] = handler;
  55169. }
  55170. send(actionName, data, transfers) {
  55171. this._postMessage({
  55172. sourceName: this.sourceName,
  55173. targetName: this.targetName,
  55174. action: actionName,
  55175. data
  55176. }, transfers);
  55177. }
  55178. sendWithPromise(actionName, data, transfers) {
  55179. const callbackId = this.callbackId++;
  55180. const capability = (0, _util.createPromiseCapability)();
  55181. this.callbackCapabilities[callbackId] = capability;
  55182. try {
  55183. this._postMessage({
  55184. sourceName: this.sourceName,
  55185. targetName: this.targetName,
  55186. action: actionName,
  55187. callbackId,
  55188. data
  55189. }, transfers);
  55190. } catch (ex) {
  55191. capability.reject(ex);
  55192. }
  55193. return capability.promise;
  55194. }
  55195. sendWithStream(actionName, data, queueingStrategy, transfers) {
  55196. const streamId = this.streamId++;
  55197. const sourceName = this.sourceName;
  55198. const targetName = this.targetName;
  55199. const comObj = this.comObj;
  55200. return new ReadableStream({
  55201. start: controller => {
  55202. const startCapability = (0, _util.createPromiseCapability)();
  55203. this.streamControllers[streamId] = {
  55204. controller,
  55205. startCall: startCapability,
  55206. pullCall: null,
  55207. cancelCall: null,
  55208. isClosed: false
  55209. };
  55210. this._postMessage({
  55211. sourceName,
  55212. targetName,
  55213. action: actionName,
  55214. streamId,
  55215. data,
  55216. desiredSize: controller.desiredSize
  55217. }, transfers);
  55218. return startCapability.promise;
  55219. },
  55220. pull: controller => {
  55221. const pullCapability = (0, _util.createPromiseCapability)();
  55222. this.streamControllers[streamId].pullCall = pullCapability;
  55223. comObj.postMessage({
  55224. sourceName,
  55225. targetName,
  55226. stream: StreamKind.PULL,
  55227. streamId,
  55228. desiredSize: controller.desiredSize
  55229. });
  55230. return pullCapability.promise;
  55231. },
  55232. cancel: reason => {
  55233. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  55234. const cancelCapability = (0, _util.createPromiseCapability)();
  55235. this.streamControllers[streamId].cancelCall = cancelCapability;
  55236. this.streamControllers[streamId].isClosed = true;
  55237. comObj.postMessage({
  55238. sourceName,
  55239. targetName,
  55240. stream: StreamKind.CANCEL,
  55241. streamId,
  55242. reason: wrapReason(reason)
  55243. });
  55244. return cancelCapability.promise;
  55245. }
  55246. }, queueingStrategy);
  55247. }
  55248. _createStreamSink(data) {
  55249. const self = this;
  55250. const action = this.actionHandler[data.action];
  55251. const streamId = data.streamId;
  55252. const sourceName = this.sourceName;
  55253. const targetName = data.sourceName;
  55254. const comObj = this.comObj;
  55255. const streamSink = {
  55256. enqueue(chunk, size = 1, transfers) {
  55257. if (this.isCancelled) {
  55258. return;
  55259. }
  55260. const lastDesiredSize = this.desiredSize;
  55261. this.desiredSize -= size;
  55262. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  55263. this.sinkCapability = (0, _util.createPromiseCapability)();
  55264. this.ready = this.sinkCapability.promise;
  55265. }
  55266. self._postMessage({
  55267. sourceName,
  55268. targetName,
  55269. stream: StreamKind.ENQUEUE,
  55270. streamId,
  55271. chunk
  55272. }, transfers);
  55273. },
  55274. close() {
  55275. if (this.isCancelled) {
  55276. return;
  55277. }
  55278. this.isCancelled = true;
  55279. comObj.postMessage({
  55280. sourceName,
  55281. targetName,
  55282. stream: StreamKind.CLOSE,
  55283. streamId
  55284. });
  55285. delete self.streamSinks[streamId];
  55286. },
  55287. error(reason) {
  55288. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  55289. if (this.isCancelled) {
  55290. return;
  55291. }
  55292. this.isCancelled = true;
  55293. comObj.postMessage({
  55294. sourceName,
  55295. targetName,
  55296. stream: StreamKind.ERROR,
  55297. streamId,
  55298. reason: wrapReason(reason)
  55299. });
  55300. },
  55301. sinkCapability: (0, _util.createPromiseCapability)(),
  55302. onPull: null,
  55303. onCancel: null,
  55304. isCancelled: false,
  55305. desiredSize: data.desiredSize,
  55306. ready: null
  55307. };
  55308. streamSink.sinkCapability.resolve();
  55309. streamSink.ready = streamSink.sinkCapability.promise;
  55310. this.streamSinks[streamId] = streamSink;
  55311. new Promise(function (resolve) {
  55312. resolve(action(data.data, streamSink));
  55313. }).then(function () {
  55314. comObj.postMessage({
  55315. sourceName,
  55316. targetName,
  55317. stream: StreamKind.START_COMPLETE,
  55318. streamId,
  55319. success: true
  55320. });
  55321. }, function (reason) {
  55322. comObj.postMessage({
  55323. sourceName,
  55324. targetName,
  55325. stream: StreamKind.START_COMPLETE,
  55326. streamId,
  55327. reason: wrapReason(reason)
  55328. });
  55329. });
  55330. }
  55331. _processStreamMessage(data) {
  55332. const streamId = data.streamId;
  55333. const sourceName = this.sourceName;
  55334. const targetName = data.sourceName;
  55335. const comObj = this.comObj;
  55336. switch (data.stream) {
  55337. case StreamKind.START_COMPLETE:
  55338. if (data.success) {
  55339. this.streamControllers[streamId].startCall.resolve();
  55340. } else {
  55341. this.streamControllers[streamId].startCall.reject(wrapReason(data.reason));
  55342. }
  55343. break;
  55344. case StreamKind.PULL_COMPLETE:
  55345. if (data.success) {
  55346. this.streamControllers[streamId].pullCall.resolve();
  55347. } else {
  55348. this.streamControllers[streamId].pullCall.reject(wrapReason(data.reason));
  55349. }
  55350. break;
  55351. case StreamKind.PULL:
  55352. if (!this.streamSinks[streamId]) {
  55353. comObj.postMessage({
  55354. sourceName,
  55355. targetName,
  55356. stream: StreamKind.PULL_COMPLETE,
  55357. streamId,
  55358. success: true
  55359. });
  55360. break;
  55361. }
  55362. if (this.streamSinks[streamId].desiredSize <= 0 && data.desiredSize > 0) {
  55363. this.streamSinks[streamId].sinkCapability.resolve();
  55364. }
  55365. this.streamSinks[streamId].desiredSize = data.desiredSize;
  55366. const {
  55367. onPull
  55368. } = this.streamSinks[data.streamId];
  55369. new Promise(function (resolve) {
  55370. resolve(onPull && onPull());
  55371. }).then(function () {
  55372. comObj.postMessage({
  55373. sourceName,
  55374. targetName,
  55375. stream: StreamKind.PULL_COMPLETE,
  55376. streamId,
  55377. success: true
  55378. });
  55379. }, function (reason) {
  55380. comObj.postMessage({
  55381. sourceName,
  55382. targetName,
  55383. stream: StreamKind.PULL_COMPLETE,
  55384. streamId,
  55385. reason: wrapReason(reason)
  55386. });
  55387. });
  55388. break;
  55389. case StreamKind.ENQUEUE:
  55390. (0, _util.assert)(this.streamControllers[streamId], "enqueue should have stream controller");
  55391. if (this.streamControllers[streamId].isClosed) {
  55392. break;
  55393. }
  55394. this.streamControllers[streamId].controller.enqueue(data.chunk);
  55395. break;
  55396. case StreamKind.CLOSE:
  55397. (0, _util.assert)(this.streamControllers[streamId], "close should have stream controller");
  55398. if (this.streamControllers[streamId].isClosed) {
  55399. break;
  55400. }
  55401. this.streamControllers[streamId].isClosed = true;
  55402. this.streamControllers[streamId].controller.close();
  55403. this._deleteStreamController(streamId);
  55404. break;
  55405. case StreamKind.ERROR:
  55406. (0, _util.assert)(this.streamControllers[streamId], "error should have stream controller");
  55407. this.streamControllers[streamId].controller.error(wrapReason(data.reason));
  55408. this._deleteStreamController(streamId);
  55409. break;
  55410. case StreamKind.CANCEL_COMPLETE:
  55411. if (data.success) {
  55412. this.streamControllers[streamId].cancelCall.resolve();
  55413. } else {
  55414. this.streamControllers[streamId].cancelCall.reject(wrapReason(data.reason));
  55415. }
  55416. this._deleteStreamController(streamId);
  55417. break;
  55418. case StreamKind.CANCEL:
  55419. if (!this.streamSinks[streamId]) {
  55420. break;
  55421. }
  55422. const {
  55423. onCancel
  55424. } = this.streamSinks[data.streamId];
  55425. new Promise(function (resolve) {
  55426. resolve(onCancel && onCancel(wrapReason(data.reason)));
  55427. }).then(function () {
  55428. comObj.postMessage({
  55429. sourceName,
  55430. targetName,
  55431. stream: StreamKind.CANCEL_COMPLETE,
  55432. streamId,
  55433. success: true
  55434. });
  55435. }, function (reason) {
  55436. comObj.postMessage({
  55437. sourceName,
  55438. targetName,
  55439. stream: StreamKind.CANCEL_COMPLETE,
  55440. streamId,
  55441. reason: wrapReason(reason)
  55442. });
  55443. });
  55444. this.streamSinks[streamId].sinkCapability.reject(wrapReason(data.reason));
  55445. this.streamSinks[streamId].isCancelled = true;
  55446. delete this.streamSinks[streamId];
  55447. break;
  55448. default:
  55449. throw new Error("Unexpected stream case");
  55450. }
  55451. }
  55452. async _deleteStreamController(streamId) {
  55453. await Promise.allSettled([this.streamControllers[streamId].startCall, this.streamControllers[streamId].pullCall, this.streamControllers[streamId].cancelCall].map(function (capability) {
  55454. return capability && capability.promise;
  55455. }));
  55456. delete this.streamControllers[streamId];
  55457. }
  55458. _postMessage(message, transfers) {
  55459. if (transfers && this.postMessageTransfers) {
  55460. this.comObj.postMessage(message, transfers);
  55461. } else {
  55462. this.comObj.postMessage(message);
  55463. }
  55464. }
  55465. destroy() {
  55466. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  55467. }
  55468. }
  55469. exports.MessageHandler = MessageHandler;
  55470. /***/ }),
  55471. /* 70 */
  55472. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  55473. Object.defineProperty(exports, "__esModule", ({
  55474. value: true
  55475. }));
  55476. exports.PDFWorkerStream = void 0;
  55477. var _util = __w_pdfjs_require__(2);
  55478. class PDFWorkerStream {
  55479. constructor(msgHandler) {
  55480. this._msgHandler = msgHandler;
  55481. this._contentLength = null;
  55482. this._fullRequestReader = null;
  55483. this._rangeRequestReaders = [];
  55484. }
  55485. getFullReader() {
  55486. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  55487. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  55488. return this._fullRequestReader;
  55489. }
  55490. getRangeReader(begin, end) {
  55491. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  55492. this._rangeRequestReaders.push(reader);
  55493. return reader;
  55494. }
  55495. cancelAllRequests(reason) {
  55496. if (this._fullRequestReader) {
  55497. this._fullRequestReader.cancel(reason);
  55498. }
  55499. const readers = this._rangeRequestReaders.slice(0);
  55500. readers.forEach(function (reader) {
  55501. reader.cancel(reason);
  55502. });
  55503. }
  55504. }
  55505. exports.PDFWorkerStream = PDFWorkerStream;
  55506. class PDFWorkerStreamReader {
  55507. constructor(msgHandler) {
  55508. this._msgHandler = msgHandler;
  55509. this.onProgress = null;
  55510. this._contentLength = null;
  55511. this._isRangeSupported = false;
  55512. this._isStreamingSupported = false;
  55513. const readableStream = this._msgHandler.sendWithStream("GetReader");
  55514. this._reader = readableStream.getReader();
  55515. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  55516. this._isStreamingSupported = data.isStreamingSupported;
  55517. this._isRangeSupported = data.isRangeSupported;
  55518. this._contentLength = data.contentLength;
  55519. });
  55520. }
  55521. get headersReady() {
  55522. return this._headersReady;
  55523. }
  55524. get contentLength() {
  55525. return this._contentLength;
  55526. }
  55527. get isStreamingSupported() {
  55528. return this._isStreamingSupported;
  55529. }
  55530. get isRangeSupported() {
  55531. return this._isRangeSupported;
  55532. }
  55533. async read() {
  55534. const {
  55535. value,
  55536. done
  55537. } = await this._reader.read();
  55538. if (done) {
  55539. return {
  55540. value: undefined,
  55541. done: true
  55542. };
  55543. }
  55544. return {
  55545. value: value.buffer,
  55546. done: false
  55547. };
  55548. }
  55549. cancel(reason) {
  55550. this._reader.cancel(reason);
  55551. }
  55552. }
  55553. class PDFWorkerStreamRangeReader {
  55554. constructor(begin, end, msgHandler) {
  55555. this._msgHandler = msgHandler;
  55556. this.onProgress = null;
  55557. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  55558. begin,
  55559. end
  55560. });
  55561. this._reader = readableStream.getReader();
  55562. }
  55563. get isStreamingSupported() {
  55564. return false;
  55565. }
  55566. async read() {
  55567. const {
  55568. value,
  55569. done
  55570. } = await this._reader.read();
  55571. if (done) {
  55572. return {
  55573. value: undefined,
  55574. done: true
  55575. };
  55576. }
  55577. return {
  55578. value: value.buffer,
  55579. done: false
  55580. };
  55581. }
  55582. cancel(reason) {
  55583. this._reader.cancel(reason);
  55584. }
  55585. }
  55586. /***/ })
  55587. /******/ ]);
  55588. /************************************************************************/
  55589. /******/ // The module cache
  55590. /******/ var __webpack_module_cache__ = {};
  55591. /******/
  55592. /******/ // The require function
  55593. /******/ function __w_pdfjs_require__(moduleId) {
  55594. /******/ // Check if module is in cache
  55595. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  55596. /******/ if (cachedModule !== undefined) {
  55597. /******/ return cachedModule.exports;
  55598. /******/ }
  55599. /******/ // Create a new module (and put it into the cache)
  55600. /******/ var module = __webpack_module_cache__[moduleId] = {
  55601. /******/ // no module.id needed
  55602. /******/ // no module.loaded needed
  55603. /******/ exports: {}
  55604. /******/ };
  55605. /******/
  55606. /******/ // Execute the module function
  55607. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  55608. /******/
  55609. /******/ // Return the exports of the module
  55610. /******/ return module.exports;
  55611. /******/ }
  55612. /******/
  55613. /************************************************************************/
  55614. /******/ /* webpack/runtime/define property getters */
  55615. /******/ (() => {
  55616. /******/ // define getter functions for harmony exports
  55617. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  55618. /******/ for(var key in definition) {
  55619. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  55620. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  55621. /******/ }
  55622. /******/ }
  55623. /******/ };
  55624. /******/ })();
  55625. /******/
  55626. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  55627. /******/ (() => {
  55628. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  55629. /******/ })();
  55630. /******/
  55631. /******/ /* webpack/runtime/make namespace object */
  55632. /******/ (() => {
  55633. /******/ // define __esModule on exports
  55634. /******/ __w_pdfjs_require__.r = (exports) => {
  55635. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  55636. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  55637. /******/ }
  55638. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  55639. /******/ };
  55640. /******/ })();
  55641. /******/
  55642. /************************************************************************/
  55643. var __webpack_exports__ = {};
  55644. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  55645. (() => {
  55646. var exports = __webpack_exports__;
  55647. Object.defineProperty(exports, "__esModule", ({
  55648. value: true
  55649. }));
  55650. Object.defineProperty(exports, "WorkerMessageHandler", ({
  55651. enumerable: true,
  55652. get: function () {
  55653. return _worker.WorkerMessageHandler;
  55654. }
  55655. }));
  55656. var _worker = __w_pdfjs_require__(1);
  55657. const pdfjsVersion = '2.8.335';
  55658. const pdfjsBuild = '228adbf67';
  55659. })();
  55660. /******/ return __webpack_exports__;
  55661. /******/ })()
  55662. ;
  55663. });
  55664. //# sourceMappingURL=pdf.worker.js.map