pdf.worker.js 1.8 MB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935
  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__(7);
  45. var _writer = __w_pdfjs_require__(71);
  46. var _is_node = __w_pdfjs_require__(4);
  47. var _message_handler = __w_pdfjs_require__(99);
  48. var _worker_stream = __w_pdfjs_require__(100);
  49. var _core_utils = __w_pdfjs_require__(9);
  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. let 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. let pdfManager;
  99. let terminated = false;
  100. let cancelXHRs = null;
  101. const WorkerTasks = [];
  102. const verbosity = (0, _util.getVerbosityLevel)();
  103. const apiVersion = docParams.apiVersion;
  104. const workerVersion = '2.11.338';
  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. const docId = docParams.docId;
  119. const docBaseUrl = docParams.docBaseUrl;
  120. const workerHandlerName = docParams.docId + "_worker";
  121. let 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. const 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 isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  144. if (isPureXfa) {
  145. const task = new WorkerTask("loadXfaFonts");
  146. startWorkerTask(task);
  147. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  148. }
  149. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  150. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  151. return {
  152. numPages,
  153. fingerprints,
  154. htmlForXfa
  155. };
  156. }
  157. function getPdfManager(data, evaluatorOptions, enableXfa) {
  158. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  159. let newPdfManager;
  160. const source = data.source;
  161. if (source.data) {
  162. try {
  163. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, evaluatorOptions, enableXfa, docBaseUrl);
  164. pdfManagerCapability.resolve(newPdfManager);
  165. } catch (ex) {
  166. pdfManagerCapability.reject(ex);
  167. }
  168. return pdfManagerCapability.promise;
  169. }
  170. let pdfStream,
  171. cachedChunks = [];
  172. try {
  173. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  174. } catch (ex) {
  175. pdfManagerCapability.reject(ex);
  176. return pdfManagerCapability.promise;
  177. }
  178. const fullRequest = pdfStream.getFullReader();
  179. fullRequest.headersReady.then(function () {
  180. if (!fullRequest.isRangeSupported) {
  181. return;
  182. }
  183. const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  184. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  185. msgHandler: handler,
  186. password: source.password,
  187. length: fullRequest.contentLength,
  188. disableAutoFetch,
  189. rangeChunkSize: source.rangeChunkSize
  190. }, evaluatorOptions, enableXfa, docBaseUrl);
  191. for (let i = 0; i < cachedChunks.length; i++) {
  192. newPdfManager.sendProgressiveData(cachedChunks[i]);
  193. }
  194. cachedChunks = [];
  195. pdfManagerCapability.resolve(newPdfManager);
  196. cancelXHRs = null;
  197. }).catch(function (reason) {
  198. pdfManagerCapability.reject(reason);
  199. cancelXHRs = null;
  200. });
  201. let loaded = 0;
  202. const flushChunks = function () {
  203. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  204. if (source.length && pdfFile.length !== source.length) {
  205. (0, _util.warn)("reported HTTP length is different from actual");
  206. }
  207. try {
  208. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, evaluatorOptions, enableXfa, docBaseUrl);
  209. pdfManagerCapability.resolve(newPdfManager);
  210. } catch (ex) {
  211. pdfManagerCapability.reject(ex);
  212. }
  213. cachedChunks = [];
  214. };
  215. const readPromise = new Promise(function (resolve, reject) {
  216. const readChunk = function ({
  217. value,
  218. done
  219. }) {
  220. try {
  221. ensureNotTerminated();
  222. if (done) {
  223. if (!newPdfManager) {
  224. flushChunks();
  225. }
  226. cancelXHRs = null;
  227. return;
  228. }
  229. loaded += (0, _util.arrayByteLength)(value);
  230. if (!fullRequest.isStreamingSupported) {
  231. handler.send("DocProgress", {
  232. loaded,
  233. total: Math.max(loaded, fullRequest.contentLength || 0)
  234. });
  235. }
  236. if (newPdfManager) {
  237. newPdfManager.sendProgressiveData(value);
  238. } else {
  239. cachedChunks.push(value);
  240. }
  241. fullRequest.read().then(readChunk, reject);
  242. } catch (e) {
  243. reject(e);
  244. }
  245. };
  246. fullRequest.read().then(readChunk, reject);
  247. });
  248. readPromise.catch(function (e) {
  249. pdfManagerCapability.reject(e);
  250. cancelXHRs = null;
  251. });
  252. cancelXHRs = function (reason) {
  253. pdfStream.cancelAllRequests(reason);
  254. };
  255. return pdfManagerCapability.promise;
  256. }
  257. function setupDoc(data) {
  258. function onSuccess(doc) {
  259. ensureNotTerminated();
  260. handler.send("GetDoc", {
  261. pdfInfo: doc
  262. });
  263. }
  264. function onFailure(ex) {
  265. ensureNotTerminated();
  266. if (ex instanceof _util.PasswordException) {
  267. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  268. startWorkerTask(task);
  269. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  270. password
  271. }) {
  272. finishWorkerTask(task);
  273. pdfManager.updatePassword(password);
  274. pdfManagerReady();
  275. }).catch(function () {
  276. finishWorkerTask(task);
  277. handler.send("DocException", ex);
  278. });
  279. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  280. handler.send("DocException", ex);
  281. } else {
  282. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  283. }
  284. }
  285. function pdfManagerReady() {
  286. ensureNotTerminated();
  287. loadDocument(false).then(onSuccess, function (reason) {
  288. ensureNotTerminated();
  289. if (!(reason instanceof _core_utils.XRefParseException)) {
  290. onFailure(reason);
  291. return;
  292. }
  293. pdfManager.requestLoadedStream();
  294. pdfManager.onLoadedStream().then(function () {
  295. ensureNotTerminated();
  296. loadDocument(true).then(onSuccess, onFailure);
  297. });
  298. });
  299. }
  300. ensureNotTerminated();
  301. const evaluatorOptions = {
  302. maxImageSize: data.maxImageSize,
  303. disableFontFace: data.disableFontFace,
  304. ignoreErrors: data.ignoreErrors,
  305. isEvalSupported: data.isEvalSupported,
  306. fontExtraProperties: data.fontExtraProperties,
  307. useSystemFonts: data.useSystemFonts,
  308. cMapUrl: data.cMapUrl,
  309. standardFontDataUrl: data.standardFontDataUrl
  310. };
  311. getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) {
  312. if (terminated) {
  313. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  314. throw new Error("Worker was terminated");
  315. }
  316. pdfManager = newPdfManager;
  317. pdfManager.onLoadedStream().then(function (stream) {
  318. handler.send("DataLoaded", {
  319. length: stream.bytes.byteLength
  320. });
  321. });
  322. }).then(pdfManagerReady, onFailure);
  323. }
  324. handler.on("GetPage", function wphSetupGetPage(data) {
  325. return pdfManager.getPage(data.pageIndex).then(function (page) {
  326. 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]) {
  327. return {
  328. rotate,
  329. ref,
  330. userUnit,
  331. view
  332. };
  333. });
  334. });
  335. });
  336. handler.on("GetPageIndex", function wphSetupGetPageIndex({
  337. ref
  338. }) {
  339. const pageRef = _primitives.Ref.get(ref.num, ref.gen);
  340. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  341. });
  342. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  343. return pdfManager.ensureCatalog("destinations");
  344. });
  345. handler.on("GetDestination", function wphSetupGetDestination(data) {
  346. return pdfManager.ensureCatalog("getDestination", [data.id]);
  347. });
  348. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  349. return pdfManager.ensureCatalog("pageLabels");
  350. });
  351. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  352. return pdfManager.ensureCatalog("pageLayout");
  353. });
  354. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  355. return pdfManager.ensureCatalog("pageMode");
  356. });
  357. handler.on("GetViewerPreferences", function (data) {
  358. return pdfManager.ensureCatalog("viewerPreferences");
  359. });
  360. handler.on("GetOpenAction", function (data) {
  361. return pdfManager.ensureCatalog("openAction");
  362. });
  363. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  364. return pdfManager.ensureCatalog("attachments");
  365. });
  366. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  367. return pdfManager.ensureCatalog("javaScript");
  368. });
  369. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  370. return pdfManager.ensureCatalog("jsActions");
  371. });
  372. handler.on("GetPageJSActions", function ({
  373. pageIndex
  374. }) {
  375. return pdfManager.getPage(pageIndex).then(function (page) {
  376. return pdfManager.ensure(page, "jsActions");
  377. });
  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. isPureXfa,
  422. numPages,
  423. annotationStorage,
  424. filename
  425. }) {
  426. pdfManager.requestLoadedStream();
  427. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  428. if (isPureXfa) {
  429. promises.push(pdfManager.serializeXfaData(annotationStorage));
  430. } else {
  431. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  432. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  433. const task = new WorkerTask(`Save: page ${pageIndex}`);
  434. return page.save(handler, task, annotationStorage).finally(function () {
  435. finishWorkerTask(task);
  436. });
  437. }));
  438. }
  439. }
  440. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  441. let newRefs = [];
  442. let xfaData = null;
  443. if (isPureXfa) {
  444. xfaData = refs[0];
  445. if (!xfaData) {
  446. return stream.bytes;
  447. }
  448. } else {
  449. for (const ref of refs) {
  450. newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs);
  451. }
  452. if (newRefs.length === 0) {
  453. return stream.bytes;
  454. }
  455. }
  456. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  457. let xfaDatasetsRef = null;
  458. let hasXfaDatasetsEntry = false;
  459. if (Array.isArray(xfa)) {
  460. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  461. if (xfa[i] === "datasets") {
  462. xfaDatasetsRef = xfa[i + 1];
  463. acroFormRef = null;
  464. hasXfaDatasetsEntry = true;
  465. }
  466. }
  467. if (xfaDatasetsRef === null) {
  468. xfaDatasetsRef = xref.getNewRef();
  469. }
  470. } else if (xfa) {
  471. acroFormRef = null;
  472. (0, _util.warn)("Unsupported XFA type.");
  473. }
  474. let newXrefInfo = Object.create(null);
  475. if (xref.trailer) {
  476. const infoObj = Object.create(null);
  477. const xrefInfo = xref.trailer.get("Info") || null;
  478. if (xrefInfo instanceof _primitives.Dict) {
  479. xrefInfo.forEach((key, value) => {
  480. if ((0, _util.isString)(key) && (0, _util.isString)(value)) {
  481. infoObj[key] = (0, _util.stringToPDFString)(value);
  482. }
  483. });
  484. }
  485. newXrefInfo = {
  486. rootRef: xref.trailer.getRaw("Root") || null,
  487. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  488. newRef: xref.getNewRef(),
  489. infoRef: xref.trailer.getRaw("Info") || null,
  490. info: infoObj,
  491. fileIds: xref.trailer.get("ID") || null,
  492. startXRef,
  493. filename
  494. };
  495. }
  496. xref.resetNewRef();
  497. return (0, _writer.incrementalUpdate)({
  498. originalData: stream.bytes,
  499. xrefInfo: newXrefInfo,
  500. newRefs,
  501. xref,
  502. hasXfa: !!xfa,
  503. xfaDatasetsRef,
  504. hasXfaDatasetsEntry,
  505. acroFormRef,
  506. acroForm,
  507. xfaData
  508. });
  509. });
  510. });
  511. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  512. const pageIndex = data.pageIndex;
  513. pdfManager.getPage(pageIndex).then(function (page) {
  514. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  515. startWorkerTask(task);
  516. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  517. page.getOperatorList({
  518. handler,
  519. sink,
  520. task,
  521. intent: data.intent,
  522. cacheKey: data.cacheKey,
  523. annotationStorage: data.annotationStorage
  524. }).then(function (operatorListInfo) {
  525. finishWorkerTask(task);
  526. if (start) {
  527. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  528. }
  529. sink.close();
  530. }, function (reason) {
  531. finishWorkerTask(task);
  532. if (task.terminated) {
  533. return;
  534. }
  535. handler.send("UnsupportedFeature", {
  536. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  537. });
  538. sink.error(reason);
  539. });
  540. });
  541. });
  542. handler.on("GetTextContent", function wphExtractText(data, sink) {
  543. const pageIndex = data.pageIndex;
  544. pdfManager.getPage(pageIndex).then(function (page) {
  545. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  546. startWorkerTask(task);
  547. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  548. page.extractTextContent({
  549. handler,
  550. task,
  551. sink,
  552. normalizeWhitespace: data.normalizeWhitespace,
  553. includeMarkedContent: data.includeMarkedContent,
  554. combineTextItems: data.combineTextItems
  555. }).then(function () {
  556. finishWorkerTask(task);
  557. if (start) {
  558. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  559. }
  560. sink.close();
  561. }, function (reason) {
  562. finishWorkerTask(task);
  563. if (task.terminated) {
  564. return;
  565. }
  566. sink.error(reason);
  567. });
  568. });
  569. });
  570. handler.on("GetStructTree", function wphGetStructTree(data) {
  571. return pdfManager.getPage(data.pageIndex).then(function (page) {
  572. return pdfManager.ensure(page, "getStructTree");
  573. });
  574. });
  575. handler.on("FontFallback", function (data) {
  576. return pdfManager.fontFallback(data.id, handler);
  577. });
  578. handler.on("Cleanup", function wphCleanup(data) {
  579. return pdfManager.cleanup(true);
  580. });
  581. handler.on("Terminate", function wphTerminate(data) {
  582. terminated = true;
  583. const waitOn = [];
  584. if (pdfManager) {
  585. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  586. const cleanupPromise = pdfManager.cleanup();
  587. waitOn.push(cleanupPromise);
  588. pdfManager = null;
  589. } else {
  590. (0, _primitives.clearPrimitiveCaches)();
  591. }
  592. if (cancelXHRs) {
  593. cancelXHRs(new _util.AbortException("Worker was terminated."));
  594. }
  595. for (const task of WorkerTasks) {
  596. waitOn.push(task.finished);
  597. task.terminate();
  598. }
  599. return Promise.all(waitOn).then(function () {
  600. handler.destroy();
  601. handler = null;
  602. });
  603. });
  604. handler.on("Ready", function wphReady(data) {
  605. setupDoc(docParams);
  606. docParams = null;
  607. });
  608. return workerHandlerName;
  609. }
  610. static initializeFromPort(port) {
  611. const handler = new _message_handler.MessageHandler("worker", "main", port);
  612. WorkerMessageHandler.setup(handler, port);
  613. handler.send("ready", null);
  614. }
  615. }
  616. exports.WorkerMessageHandler = WorkerMessageHandler;
  617. function isMessagePort(maybePort) {
  618. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  619. }
  620. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  621. WorkerMessageHandler.initializeFromPort(self);
  622. }
  623. /***/ }),
  624. /* 2 */
  625. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  626. Object.defineProperty(exports, "__esModule", ({
  627. value: true
  628. }));
  629. exports.arrayByteLength = arrayByteLength;
  630. exports.arraysToBytes = arraysToBytes;
  631. exports.assert = assert;
  632. exports.bytesToString = bytesToString;
  633. exports.createObjectURL = createObjectURL;
  634. exports.createPromiseCapability = createPromiseCapability;
  635. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  636. exports.escapeString = escapeString;
  637. exports.getModificationDate = getModificationDate;
  638. exports.getVerbosityLevel = getVerbosityLevel;
  639. exports.info = info;
  640. exports.isArrayBuffer = isArrayBuffer;
  641. exports.isArrayEqual = isArrayEqual;
  642. exports.isAscii = isAscii;
  643. exports.isBool = isBool;
  644. exports.isNum = isNum;
  645. exports.isSameOrigin = isSameOrigin;
  646. exports.isString = isString;
  647. exports.objectFromMap = objectFromMap;
  648. exports.objectSize = objectSize;
  649. exports.removeNullCharacters = removeNullCharacters;
  650. exports.setVerbosityLevel = setVerbosityLevel;
  651. exports.shadow = shadow;
  652. exports.string32 = string32;
  653. exports.stringToBytes = stringToBytes;
  654. exports.stringToPDFString = stringToPDFString;
  655. exports.stringToUTF16BEString = stringToUTF16BEString;
  656. exports.stringToUTF8String = stringToUTF8String;
  657. exports.unreachable = unreachable;
  658. exports.utf8StringToString = utf8StringToString;
  659. exports.warn = warn;
  660. exports.VerbosityLevel = exports.Util = exports.UNSUPPORTED_FEATURES = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = 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.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  661. __w_pdfjs_require__(3);
  662. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  663. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  664. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  665. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  666. const RenderingIntentFlag = {
  667. ANY: 0x01,
  668. DISPLAY: 0x02,
  669. PRINT: 0x04,
  670. ANNOTATIONS_FORMS: 0x10,
  671. ANNOTATIONS_STORAGE: 0x20,
  672. ANNOTATIONS_DISABLE: 0x40,
  673. OPLIST: 0x100
  674. };
  675. exports.RenderingIntentFlag = RenderingIntentFlag;
  676. const AnnotationMode = {
  677. DISABLE: 0,
  678. ENABLE: 1,
  679. ENABLE_FORMS: 2,
  680. ENABLE_STORAGE: 3
  681. };
  682. exports.AnnotationMode = AnnotationMode;
  683. const PermissionFlag = {
  684. PRINT: 0x04,
  685. MODIFY_CONTENTS: 0x08,
  686. COPY: 0x10,
  687. MODIFY_ANNOTATIONS: 0x20,
  688. FILL_INTERACTIVE_FORMS: 0x100,
  689. COPY_FOR_ACCESSIBILITY: 0x200,
  690. ASSEMBLE: 0x400,
  691. PRINT_HIGH_QUALITY: 0x800
  692. };
  693. exports.PermissionFlag = PermissionFlag;
  694. const TextRenderingMode = {
  695. FILL: 0,
  696. STROKE: 1,
  697. FILL_STROKE: 2,
  698. INVISIBLE: 3,
  699. FILL_ADD_TO_PATH: 4,
  700. STROKE_ADD_TO_PATH: 5,
  701. FILL_STROKE_ADD_TO_PATH: 6,
  702. ADD_TO_PATH: 7,
  703. FILL_STROKE_MASK: 3,
  704. ADD_TO_PATH_FLAG: 4
  705. };
  706. exports.TextRenderingMode = TextRenderingMode;
  707. const ImageKind = {
  708. GRAYSCALE_1BPP: 1,
  709. RGB_24BPP: 2,
  710. RGBA_32BPP: 3
  711. };
  712. exports.ImageKind = ImageKind;
  713. const AnnotationType = {
  714. TEXT: 1,
  715. LINK: 2,
  716. FREETEXT: 3,
  717. LINE: 4,
  718. SQUARE: 5,
  719. CIRCLE: 6,
  720. POLYGON: 7,
  721. POLYLINE: 8,
  722. HIGHLIGHT: 9,
  723. UNDERLINE: 10,
  724. SQUIGGLY: 11,
  725. STRIKEOUT: 12,
  726. STAMP: 13,
  727. CARET: 14,
  728. INK: 15,
  729. POPUP: 16,
  730. FILEATTACHMENT: 17,
  731. SOUND: 18,
  732. MOVIE: 19,
  733. WIDGET: 20,
  734. SCREEN: 21,
  735. PRINTERMARK: 22,
  736. TRAPNET: 23,
  737. WATERMARK: 24,
  738. THREED: 25,
  739. REDACT: 26
  740. };
  741. exports.AnnotationType = AnnotationType;
  742. const AnnotationStateModelType = {
  743. MARKED: "Marked",
  744. REVIEW: "Review"
  745. };
  746. exports.AnnotationStateModelType = AnnotationStateModelType;
  747. const AnnotationMarkedState = {
  748. MARKED: "Marked",
  749. UNMARKED: "Unmarked"
  750. };
  751. exports.AnnotationMarkedState = AnnotationMarkedState;
  752. const AnnotationReviewState = {
  753. ACCEPTED: "Accepted",
  754. REJECTED: "Rejected",
  755. CANCELLED: "Cancelled",
  756. COMPLETED: "Completed",
  757. NONE: "None"
  758. };
  759. exports.AnnotationReviewState = AnnotationReviewState;
  760. const AnnotationReplyType = {
  761. GROUP: "Group",
  762. REPLY: "R"
  763. };
  764. exports.AnnotationReplyType = AnnotationReplyType;
  765. const AnnotationFlag = {
  766. INVISIBLE: 0x01,
  767. HIDDEN: 0x02,
  768. PRINT: 0x04,
  769. NOZOOM: 0x08,
  770. NOROTATE: 0x10,
  771. NOVIEW: 0x20,
  772. READONLY: 0x40,
  773. LOCKED: 0x80,
  774. TOGGLENOVIEW: 0x100,
  775. LOCKEDCONTENTS: 0x200
  776. };
  777. exports.AnnotationFlag = AnnotationFlag;
  778. const AnnotationFieldFlag = {
  779. READONLY: 0x0000001,
  780. REQUIRED: 0x0000002,
  781. NOEXPORT: 0x0000004,
  782. MULTILINE: 0x0001000,
  783. PASSWORD: 0x0002000,
  784. NOTOGGLETOOFF: 0x0004000,
  785. RADIO: 0x0008000,
  786. PUSHBUTTON: 0x0010000,
  787. COMBO: 0x0020000,
  788. EDIT: 0x0040000,
  789. SORT: 0x0080000,
  790. FILESELECT: 0x0100000,
  791. MULTISELECT: 0x0200000,
  792. DONOTSPELLCHECK: 0x0400000,
  793. DONOTSCROLL: 0x0800000,
  794. COMB: 0x1000000,
  795. RICHTEXT: 0x2000000,
  796. RADIOSINUNISON: 0x2000000,
  797. COMMITONSELCHANGE: 0x4000000
  798. };
  799. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  800. const AnnotationBorderStyleType = {
  801. SOLID: 1,
  802. DASHED: 2,
  803. BEVELED: 3,
  804. INSET: 4,
  805. UNDERLINE: 5
  806. };
  807. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  808. const AnnotationActionEventType = {
  809. E: "Mouse Enter",
  810. X: "Mouse Exit",
  811. D: "Mouse Down",
  812. U: "Mouse Up",
  813. Fo: "Focus",
  814. Bl: "Blur",
  815. PO: "PageOpen",
  816. PC: "PageClose",
  817. PV: "PageVisible",
  818. PI: "PageInvisible",
  819. K: "Keystroke",
  820. F: "Format",
  821. V: "Validate",
  822. C: "Calculate"
  823. };
  824. exports.AnnotationActionEventType = AnnotationActionEventType;
  825. const DocumentActionEventType = {
  826. WC: "WillClose",
  827. WS: "WillSave",
  828. DS: "DidSave",
  829. WP: "WillPrint",
  830. DP: "DidPrint"
  831. };
  832. exports.DocumentActionEventType = DocumentActionEventType;
  833. const PageActionEventType = {
  834. O: "PageOpen",
  835. C: "PageClose"
  836. };
  837. exports.PageActionEventType = PageActionEventType;
  838. const StreamType = {
  839. UNKNOWN: "UNKNOWN",
  840. FLATE: "FLATE",
  841. LZW: "LZW",
  842. DCT: "DCT",
  843. JPX: "JPX",
  844. JBIG: "JBIG",
  845. A85: "A85",
  846. AHX: "AHX",
  847. CCF: "CCF",
  848. RLX: "RLX"
  849. };
  850. exports.StreamType = StreamType;
  851. const FontType = {
  852. UNKNOWN: "UNKNOWN",
  853. TYPE1: "TYPE1",
  854. TYPE1STANDARD: "TYPE1STANDARD",
  855. TYPE1C: "TYPE1C",
  856. CIDFONTTYPE0: "CIDFONTTYPE0",
  857. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  858. TRUETYPE: "TRUETYPE",
  859. CIDFONTTYPE2: "CIDFONTTYPE2",
  860. TYPE3: "TYPE3",
  861. OPENTYPE: "OPENTYPE",
  862. TYPE0: "TYPE0",
  863. MMTYPE1: "MMTYPE1"
  864. };
  865. exports.FontType = FontType;
  866. const VerbosityLevel = {
  867. ERRORS: 0,
  868. WARNINGS: 1,
  869. INFOS: 5
  870. };
  871. exports.VerbosityLevel = VerbosityLevel;
  872. const CMapCompressionType = {
  873. NONE: 0,
  874. BINARY: 1,
  875. STREAM: 2
  876. };
  877. exports.CMapCompressionType = CMapCompressionType;
  878. const OPS = {
  879. dependency: 1,
  880. setLineWidth: 2,
  881. setLineCap: 3,
  882. setLineJoin: 4,
  883. setMiterLimit: 5,
  884. setDash: 6,
  885. setRenderingIntent: 7,
  886. setFlatness: 8,
  887. setGState: 9,
  888. save: 10,
  889. restore: 11,
  890. transform: 12,
  891. moveTo: 13,
  892. lineTo: 14,
  893. curveTo: 15,
  894. curveTo2: 16,
  895. curveTo3: 17,
  896. closePath: 18,
  897. rectangle: 19,
  898. stroke: 20,
  899. closeStroke: 21,
  900. fill: 22,
  901. eoFill: 23,
  902. fillStroke: 24,
  903. eoFillStroke: 25,
  904. closeFillStroke: 26,
  905. closeEOFillStroke: 27,
  906. endPath: 28,
  907. clip: 29,
  908. eoClip: 30,
  909. beginText: 31,
  910. endText: 32,
  911. setCharSpacing: 33,
  912. setWordSpacing: 34,
  913. setHScale: 35,
  914. setLeading: 36,
  915. setFont: 37,
  916. setTextRenderingMode: 38,
  917. setTextRise: 39,
  918. moveText: 40,
  919. setLeadingMoveText: 41,
  920. setTextMatrix: 42,
  921. nextLine: 43,
  922. showText: 44,
  923. showSpacedText: 45,
  924. nextLineShowText: 46,
  925. nextLineSetSpacingShowText: 47,
  926. setCharWidth: 48,
  927. setCharWidthAndBounds: 49,
  928. setStrokeColorSpace: 50,
  929. setFillColorSpace: 51,
  930. setStrokeColor: 52,
  931. setStrokeColorN: 53,
  932. setFillColor: 54,
  933. setFillColorN: 55,
  934. setStrokeGray: 56,
  935. setFillGray: 57,
  936. setStrokeRGBColor: 58,
  937. setFillRGBColor: 59,
  938. setStrokeCMYKColor: 60,
  939. setFillCMYKColor: 61,
  940. shadingFill: 62,
  941. beginInlineImage: 63,
  942. beginImageData: 64,
  943. endInlineImage: 65,
  944. paintXObject: 66,
  945. markPoint: 67,
  946. markPointProps: 68,
  947. beginMarkedContent: 69,
  948. beginMarkedContentProps: 70,
  949. endMarkedContent: 71,
  950. beginCompat: 72,
  951. endCompat: 73,
  952. paintFormXObjectBegin: 74,
  953. paintFormXObjectEnd: 75,
  954. beginGroup: 76,
  955. endGroup: 77,
  956. beginAnnotations: 78,
  957. endAnnotations: 79,
  958. beginAnnotation: 80,
  959. endAnnotation: 81,
  960. paintJpegXObject: 82,
  961. paintImageMaskXObject: 83,
  962. paintImageMaskXObjectGroup: 84,
  963. paintImageXObject: 85,
  964. paintInlineImageXObject: 86,
  965. paintInlineImageXObjectGroup: 87,
  966. paintImageXObjectRepeat: 88,
  967. paintImageMaskXObjectRepeat: 89,
  968. paintSolidColorImageMask: 90,
  969. constructPath: 91
  970. };
  971. exports.OPS = OPS;
  972. const UNSUPPORTED_FEATURES = {
  973. unknown: "unknown",
  974. forms: "forms",
  975. javaScript: "javaScript",
  976. signatures: "signatures",
  977. smask: "smask",
  978. shadingPattern: "shadingPattern",
  979. font: "font",
  980. errorTilingPattern: "errorTilingPattern",
  981. errorExtGState: "errorExtGState",
  982. errorXObject: "errorXObject",
  983. errorFontLoadType3: "errorFontLoadType3",
  984. errorFontState: "errorFontState",
  985. errorFontMissing: "errorFontMissing",
  986. errorFontTranslate: "errorFontTranslate",
  987. errorColorSpace: "errorColorSpace",
  988. errorOperatorList: "errorOperatorList",
  989. errorFontToUnicode: "errorFontToUnicode",
  990. errorFontLoadNative: "errorFontLoadNative",
  991. errorFontBuildPath: "errorFontBuildPath",
  992. errorFontGetPath: "errorFontGetPath",
  993. errorMarkedContent: "errorMarkedContent",
  994. errorContentSubStream: "errorContentSubStream"
  995. };
  996. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  997. const PasswordResponses = {
  998. NEED_PASSWORD: 1,
  999. INCORRECT_PASSWORD: 2
  1000. };
  1001. exports.PasswordResponses = PasswordResponses;
  1002. let verbosity = VerbosityLevel.WARNINGS;
  1003. function setVerbosityLevel(level) {
  1004. if (Number.isInteger(level)) {
  1005. verbosity = level;
  1006. }
  1007. }
  1008. function getVerbosityLevel() {
  1009. return verbosity;
  1010. }
  1011. function info(msg) {
  1012. if (verbosity >= VerbosityLevel.INFOS) {
  1013. console.log(`Info: ${msg}`);
  1014. }
  1015. }
  1016. function warn(msg) {
  1017. if (verbosity >= VerbosityLevel.WARNINGS) {
  1018. console.log(`Warning: ${msg}`);
  1019. }
  1020. }
  1021. function unreachable(msg) {
  1022. throw new Error(msg);
  1023. }
  1024. function assert(cond, msg) {
  1025. if (!cond) {
  1026. unreachable(msg);
  1027. }
  1028. }
  1029. function isSameOrigin(baseUrl, otherUrl) {
  1030. let base;
  1031. try {
  1032. base = new URL(baseUrl);
  1033. if (!base.origin || base.origin === "null") {
  1034. return false;
  1035. }
  1036. } catch (e) {
  1037. return false;
  1038. }
  1039. const other = new URL(otherUrl, base);
  1040. return base.origin === other.origin;
  1041. }
  1042. function _isValidProtocol(url) {
  1043. if (!url) {
  1044. return false;
  1045. }
  1046. switch (url.protocol) {
  1047. case "http:":
  1048. case "https:":
  1049. case "ftp:":
  1050. case "mailto:":
  1051. case "tel:":
  1052. return true;
  1053. default:
  1054. return false;
  1055. }
  1056. }
  1057. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1058. if (!url) {
  1059. return null;
  1060. }
  1061. try {
  1062. if (options && typeof url === "string") {
  1063. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1064. const dots = url.match(/\./g);
  1065. if (dots && dots.length >= 2) {
  1066. url = `http://${url}`;
  1067. }
  1068. }
  1069. if (options.tryConvertEncoding) {
  1070. try {
  1071. url = stringToUTF8String(url);
  1072. } catch (ex) {}
  1073. }
  1074. }
  1075. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1076. if (_isValidProtocol(absoluteUrl)) {
  1077. return absoluteUrl;
  1078. }
  1079. } catch (ex) {}
  1080. return null;
  1081. }
  1082. function shadow(obj, prop, value) {
  1083. Object.defineProperty(obj, prop, {
  1084. value,
  1085. enumerable: true,
  1086. configurable: true,
  1087. writable: false
  1088. });
  1089. return value;
  1090. }
  1091. const BaseException = function BaseExceptionClosure() {
  1092. function BaseException(message, name) {
  1093. if (this.constructor === BaseException) {
  1094. unreachable("Cannot initialize BaseException.");
  1095. }
  1096. this.message = message;
  1097. this.name = name;
  1098. }
  1099. BaseException.prototype = new Error();
  1100. BaseException.constructor = BaseException;
  1101. return BaseException;
  1102. }();
  1103. exports.BaseException = BaseException;
  1104. class PasswordException extends BaseException {
  1105. constructor(msg, code) {
  1106. super(msg, "PasswordException");
  1107. this.code = code;
  1108. }
  1109. }
  1110. exports.PasswordException = PasswordException;
  1111. class UnknownErrorException extends BaseException {
  1112. constructor(msg, details) {
  1113. super(msg, "UnknownErrorException");
  1114. this.details = details;
  1115. }
  1116. }
  1117. exports.UnknownErrorException = UnknownErrorException;
  1118. class InvalidPDFException extends BaseException {
  1119. constructor(msg) {
  1120. super(msg, "InvalidPDFException");
  1121. }
  1122. }
  1123. exports.InvalidPDFException = InvalidPDFException;
  1124. class MissingPDFException extends BaseException {
  1125. constructor(msg) {
  1126. super(msg, "MissingPDFException");
  1127. }
  1128. }
  1129. exports.MissingPDFException = MissingPDFException;
  1130. class UnexpectedResponseException extends BaseException {
  1131. constructor(msg, status) {
  1132. super(msg, "UnexpectedResponseException");
  1133. this.status = status;
  1134. }
  1135. }
  1136. exports.UnexpectedResponseException = UnexpectedResponseException;
  1137. class FormatError extends BaseException {
  1138. constructor(msg) {
  1139. super(msg, "FormatError");
  1140. }
  1141. }
  1142. exports.FormatError = FormatError;
  1143. class AbortException extends BaseException {
  1144. constructor(msg) {
  1145. super(msg, "AbortException");
  1146. }
  1147. }
  1148. exports.AbortException = AbortException;
  1149. const NullCharactersRegExp = /\x00/g;
  1150. function removeNullCharacters(str) {
  1151. if (typeof str !== "string") {
  1152. warn("The argument for removeNullCharacters must be a string.");
  1153. return str;
  1154. }
  1155. return str.replace(NullCharactersRegExp, "");
  1156. }
  1157. function bytesToString(bytes) {
  1158. assert(bytes !== null && typeof bytes === "object" && bytes.length !== undefined, "Invalid argument for bytesToString");
  1159. const length = bytes.length;
  1160. const MAX_ARGUMENT_COUNT = 8192;
  1161. if (length < MAX_ARGUMENT_COUNT) {
  1162. return String.fromCharCode.apply(null, bytes);
  1163. }
  1164. const strBuf = [];
  1165. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1166. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1167. const chunk = bytes.subarray(i, chunkEnd);
  1168. strBuf.push(String.fromCharCode.apply(null, chunk));
  1169. }
  1170. return strBuf.join("");
  1171. }
  1172. function stringToBytes(str) {
  1173. assert(typeof str === "string", "Invalid argument for stringToBytes");
  1174. const length = str.length;
  1175. const bytes = new Uint8Array(length);
  1176. for (let i = 0; i < length; ++i) {
  1177. bytes[i] = str.charCodeAt(i) & 0xff;
  1178. }
  1179. return bytes;
  1180. }
  1181. function arrayByteLength(arr) {
  1182. if (arr.length !== undefined) {
  1183. return arr.length;
  1184. }
  1185. assert(arr.byteLength !== undefined, "arrayByteLength - invalid argument.");
  1186. return arr.byteLength;
  1187. }
  1188. function arraysToBytes(arr) {
  1189. const length = arr.length;
  1190. if (length === 1 && arr[0] instanceof Uint8Array) {
  1191. return arr[0];
  1192. }
  1193. let resultLength = 0;
  1194. for (let i = 0; i < length; i++) {
  1195. resultLength += arrayByteLength(arr[i]);
  1196. }
  1197. let pos = 0;
  1198. const data = new Uint8Array(resultLength);
  1199. for (let i = 0; i < length; i++) {
  1200. let item = arr[i];
  1201. if (!(item instanceof Uint8Array)) {
  1202. if (typeof item === "string") {
  1203. item = stringToBytes(item);
  1204. } else {
  1205. item = new Uint8Array(item);
  1206. }
  1207. }
  1208. const itemLength = item.byteLength;
  1209. data.set(item, pos);
  1210. pos += itemLength;
  1211. }
  1212. return data;
  1213. }
  1214. function string32(value) {
  1215. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1216. }
  1217. function objectSize(obj) {
  1218. return Object.keys(obj).length;
  1219. }
  1220. function objectFromMap(map) {
  1221. const obj = Object.create(null);
  1222. for (const [key, value] of map) {
  1223. obj[key] = value;
  1224. }
  1225. return obj;
  1226. }
  1227. function isLittleEndian() {
  1228. const buffer8 = new Uint8Array(4);
  1229. buffer8[0] = 1;
  1230. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1231. return view32[0] === 1;
  1232. }
  1233. const IsLittleEndianCached = {
  1234. get value() {
  1235. return shadow(this, "value", isLittleEndian());
  1236. }
  1237. };
  1238. exports.IsLittleEndianCached = IsLittleEndianCached;
  1239. function isEvalSupported() {
  1240. try {
  1241. new Function("");
  1242. return true;
  1243. } catch (e) {
  1244. return false;
  1245. }
  1246. }
  1247. const IsEvalSupportedCached = {
  1248. get value() {
  1249. return shadow(this, "value", isEvalSupported());
  1250. }
  1251. };
  1252. exports.IsEvalSupportedCached = IsEvalSupportedCached;
  1253. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1254. class Util {
  1255. static makeHexColor(r, g, b) {
  1256. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1257. }
  1258. static transform(m1, m2) {
  1259. 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]];
  1260. }
  1261. static applyTransform(p, m) {
  1262. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1263. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1264. return [xt, yt];
  1265. }
  1266. static applyInverseTransform(p, m) {
  1267. const d = m[0] * m[3] - m[1] * m[2];
  1268. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1269. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1270. return [xt, yt];
  1271. }
  1272. static getAxialAlignedBoundingBox(r, m) {
  1273. const p1 = Util.applyTransform(r, m);
  1274. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1275. const p3 = Util.applyTransform([r[0], r[3]], m);
  1276. const p4 = Util.applyTransform([r[2], r[1]], m);
  1277. 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])];
  1278. }
  1279. static inverseTransform(m) {
  1280. const d = m[0] * m[3] - m[1] * m[2];
  1281. 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];
  1282. }
  1283. static apply3dTransform(m, v) {
  1284. 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]];
  1285. }
  1286. static singularValueDecompose2dScale(m) {
  1287. const transpose = [m[0], m[2], m[1], m[3]];
  1288. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1289. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1290. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1291. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1292. const first = (a + d) / 2;
  1293. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1294. const sx = first + second || 1;
  1295. const sy = first - second || 1;
  1296. return [Math.sqrt(sx), Math.sqrt(sy)];
  1297. }
  1298. static normalizeRect(rect) {
  1299. const r = rect.slice(0);
  1300. if (rect[0] > rect[2]) {
  1301. r[0] = rect[2];
  1302. r[2] = rect[0];
  1303. }
  1304. if (rect[1] > rect[3]) {
  1305. r[1] = rect[3];
  1306. r[3] = rect[1];
  1307. }
  1308. return r;
  1309. }
  1310. static intersect(rect1, rect2) {
  1311. function compare(a, b) {
  1312. return a - b;
  1313. }
  1314. const orderedX = [rect1[0], rect1[2], rect2[0], rect2[2]].sort(compare);
  1315. const orderedY = [rect1[1], rect1[3], rect2[1], rect2[3]].sort(compare);
  1316. const result = [];
  1317. rect1 = Util.normalizeRect(rect1);
  1318. rect2 = Util.normalizeRect(rect2);
  1319. if (orderedX[0] === rect1[0] && orderedX[1] === rect2[0] || orderedX[0] === rect2[0] && orderedX[1] === rect1[0]) {
  1320. result[0] = orderedX[1];
  1321. result[2] = orderedX[2];
  1322. } else {
  1323. return null;
  1324. }
  1325. if (orderedY[0] === rect1[1] && orderedY[1] === rect2[1] || orderedY[0] === rect2[1] && orderedY[1] === rect1[1]) {
  1326. result[1] = orderedY[1];
  1327. result[3] = orderedY[2];
  1328. } else {
  1329. return null;
  1330. }
  1331. return result;
  1332. }
  1333. }
  1334. exports.Util = Util;
  1335. 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];
  1336. function stringToPDFString(str) {
  1337. const length = str.length,
  1338. strBuf = [];
  1339. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1340. for (let i = 2; i < length; i += 2) {
  1341. strBuf.push(String.fromCharCode(str.charCodeAt(i) << 8 | str.charCodeAt(i + 1)));
  1342. }
  1343. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1344. for (let i = 2; i < length; i += 2) {
  1345. strBuf.push(String.fromCharCode(str.charCodeAt(i + 1) << 8 | str.charCodeAt(i)));
  1346. }
  1347. } else {
  1348. for (let i = 0; i < length; ++i) {
  1349. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1350. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1351. }
  1352. }
  1353. return strBuf.join("");
  1354. }
  1355. function escapeString(str) {
  1356. return str.replace(/([()\\\n\r])/g, match => {
  1357. if (match === "\n") {
  1358. return "\\n";
  1359. } else if (match === "\r") {
  1360. return "\\r";
  1361. }
  1362. return `\\${match}`;
  1363. });
  1364. }
  1365. function isAscii(str) {
  1366. return /^[\x00-\x7F]*$/.test(str);
  1367. }
  1368. function stringToUTF16BEString(str) {
  1369. const buf = ["\xFE\xFF"];
  1370. for (let i = 0, ii = str.length; i < ii; i++) {
  1371. const char = str.charCodeAt(i);
  1372. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1373. }
  1374. return buf.join("");
  1375. }
  1376. function stringToUTF8String(str) {
  1377. return decodeURIComponent(escape(str));
  1378. }
  1379. function utf8StringToString(str) {
  1380. return unescape(encodeURIComponent(str));
  1381. }
  1382. function isBool(v) {
  1383. return typeof v === "boolean";
  1384. }
  1385. function isNum(v) {
  1386. return typeof v === "number";
  1387. }
  1388. function isString(v) {
  1389. return typeof v === "string";
  1390. }
  1391. function isArrayBuffer(v) {
  1392. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1393. }
  1394. function isArrayEqual(arr1, arr2) {
  1395. if (arr1.length !== arr2.length) {
  1396. return false;
  1397. }
  1398. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1399. if (arr1[i] !== arr2[i]) {
  1400. return false;
  1401. }
  1402. }
  1403. return true;
  1404. }
  1405. function getModificationDate(date = new Date()) {
  1406. 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")];
  1407. return buffer.join("");
  1408. }
  1409. function createPromiseCapability() {
  1410. const capability = Object.create(null);
  1411. let isSettled = false;
  1412. Object.defineProperty(capability, "settled", {
  1413. get() {
  1414. return isSettled;
  1415. }
  1416. });
  1417. capability.promise = new Promise(function (resolve, reject) {
  1418. capability.resolve = function (data) {
  1419. isSettled = true;
  1420. resolve(data);
  1421. };
  1422. capability.reject = function (reason) {
  1423. isSettled = true;
  1424. reject(reason);
  1425. };
  1426. });
  1427. return capability;
  1428. }
  1429. function createObjectURL(data, contentType = "", forceDataSchema = false) {
  1430. if (URL.createObjectURL && !forceDataSchema) {
  1431. return URL.createObjectURL(new Blob([data], {
  1432. type: contentType
  1433. }));
  1434. }
  1435. const digits = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  1436. let buffer = `data:${contentType};base64,`;
  1437. for (let i = 0, ii = data.length; i < ii; i += 3) {
  1438. const b1 = data[i] & 0xff;
  1439. const b2 = data[i + 1] & 0xff;
  1440. const b3 = data[i + 2] & 0xff;
  1441. const d1 = b1 >> 2,
  1442. d2 = (b1 & 3) << 4 | b2 >> 4;
  1443. const d3 = i + 1 < ii ? (b2 & 0xf) << 2 | b3 >> 6 : 64;
  1444. const d4 = i + 2 < ii ? b3 & 0x3f : 64;
  1445. buffer += digits[d1] + digits[d2] + digits[d3] + digits[d4];
  1446. }
  1447. return buffer;
  1448. }
  1449. /***/ }),
  1450. /* 3 */
  1451. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1452. var _is_node = __w_pdfjs_require__(4);
  1453. ;
  1454. /***/ }),
  1455. /* 4 */
  1456. /***/ ((__unused_webpack_module, exports) => {
  1457. Object.defineProperty(exports, "__esModule", ({
  1458. value: true
  1459. }));
  1460. exports.isNodeJS = void 0;
  1461. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1462. exports.isNodeJS = isNodeJS;
  1463. /***/ }),
  1464. /* 5 */
  1465. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1466. Object.defineProperty(exports, "__esModule", ({
  1467. value: true
  1468. }));
  1469. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1470. exports.isCmd = isCmd;
  1471. exports.isDict = isDict;
  1472. exports.isName = isName;
  1473. exports.isRef = isRef;
  1474. exports.isRefsEqual = isRefsEqual;
  1475. exports.isStream = isStream;
  1476. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = void 0;
  1477. var _util = __w_pdfjs_require__(2);
  1478. var _base_stream = __w_pdfjs_require__(6);
  1479. const EOF = Symbol("EOF");
  1480. exports.EOF = EOF;
  1481. const Name = function NameClosure() {
  1482. let nameCache = Object.create(null);
  1483. class Name {
  1484. constructor(name) {
  1485. this.name = name;
  1486. }
  1487. static get(name) {
  1488. const nameValue = nameCache[name];
  1489. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1490. }
  1491. static _clearCache() {
  1492. nameCache = Object.create(null);
  1493. }
  1494. }
  1495. return Name;
  1496. }();
  1497. exports.Name = Name;
  1498. const Cmd = function CmdClosure() {
  1499. let cmdCache = Object.create(null);
  1500. class Cmd {
  1501. constructor(cmd) {
  1502. this.cmd = cmd;
  1503. }
  1504. static get(cmd) {
  1505. const cmdValue = cmdCache[cmd];
  1506. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1507. }
  1508. static _clearCache() {
  1509. cmdCache = Object.create(null);
  1510. }
  1511. }
  1512. return Cmd;
  1513. }();
  1514. exports.Cmd = Cmd;
  1515. const nonSerializable = function nonSerializableClosure() {
  1516. return nonSerializable;
  1517. };
  1518. class Dict {
  1519. constructor(xref = null) {
  1520. this._map = Object.create(null);
  1521. this.xref = xref;
  1522. this.objId = null;
  1523. this.suppressEncryption = false;
  1524. this.__nonSerializable__ = nonSerializable;
  1525. }
  1526. assignXref(newXref) {
  1527. this.xref = newXref;
  1528. }
  1529. get size() {
  1530. return Object.keys(this._map).length;
  1531. }
  1532. get(key1, key2, key3) {
  1533. let value = this._map[key1];
  1534. if (value === undefined && key2 !== undefined) {
  1535. value = this._map[key2];
  1536. if (value === undefined && key3 !== undefined) {
  1537. value = this._map[key3];
  1538. }
  1539. }
  1540. if (value instanceof Ref && this.xref) {
  1541. return this.xref.fetch(value, this.suppressEncryption);
  1542. }
  1543. return value;
  1544. }
  1545. async getAsync(key1, key2, key3) {
  1546. let value = this._map[key1];
  1547. if (value === undefined && key2 !== undefined) {
  1548. value = this._map[key2];
  1549. if (value === undefined && key3 !== undefined) {
  1550. value = this._map[key3];
  1551. }
  1552. }
  1553. if (value instanceof Ref && this.xref) {
  1554. return this.xref.fetchAsync(value, this.suppressEncryption);
  1555. }
  1556. return value;
  1557. }
  1558. getArray(key1, key2, key3) {
  1559. let value = this._map[key1];
  1560. if (value === undefined && key2 !== undefined) {
  1561. value = this._map[key2];
  1562. if (value === undefined && key3 !== undefined) {
  1563. value = this._map[key3];
  1564. }
  1565. }
  1566. if (value instanceof Ref && this.xref) {
  1567. value = this.xref.fetch(value, this.suppressEncryption);
  1568. }
  1569. if (Array.isArray(value)) {
  1570. value = value.slice();
  1571. for (let i = 0, ii = value.length; i < ii; i++) {
  1572. if (value[i] instanceof Ref && this.xref) {
  1573. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1574. }
  1575. }
  1576. }
  1577. return value;
  1578. }
  1579. getRaw(key) {
  1580. return this._map[key];
  1581. }
  1582. getKeys() {
  1583. return Object.keys(this._map);
  1584. }
  1585. getRawValues() {
  1586. return Object.values(this._map);
  1587. }
  1588. set(key, value) {
  1589. this._map[key] = value;
  1590. }
  1591. has(key) {
  1592. return this._map[key] !== undefined;
  1593. }
  1594. forEach(callback) {
  1595. for (const key in this._map) {
  1596. callback(key, this.get(key));
  1597. }
  1598. }
  1599. static get empty() {
  1600. const emptyDict = new Dict(null);
  1601. emptyDict.set = (key, value) => {
  1602. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1603. };
  1604. return (0, _util.shadow)(this, "empty", emptyDict);
  1605. }
  1606. static merge({
  1607. xref,
  1608. dictArray,
  1609. mergeSubDicts = false
  1610. }) {
  1611. const mergedDict = new Dict(xref),
  1612. properties = new Map();
  1613. for (const dict of dictArray) {
  1614. if (!(dict instanceof Dict)) {
  1615. continue;
  1616. }
  1617. for (const [key, value] of Object.entries(dict._map)) {
  1618. let property = properties.get(key);
  1619. if (property === undefined) {
  1620. property = [];
  1621. properties.set(key, property);
  1622. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1623. continue;
  1624. }
  1625. property.push(value);
  1626. }
  1627. }
  1628. for (const [name, values] of properties) {
  1629. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1630. mergedDict._map[name] = values[0];
  1631. continue;
  1632. }
  1633. const subDict = new Dict(xref);
  1634. for (const dict of values) {
  1635. for (const [key, value] of Object.entries(dict._map)) {
  1636. if (subDict._map[key] === undefined) {
  1637. subDict._map[key] = value;
  1638. }
  1639. }
  1640. }
  1641. if (subDict.size > 0) {
  1642. mergedDict._map[name] = subDict;
  1643. }
  1644. }
  1645. properties.clear();
  1646. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1647. }
  1648. }
  1649. exports.Dict = Dict;
  1650. const Ref = function RefClosure() {
  1651. let refCache = Object.create(null);
  1652. class Ref {
  1653. constructor(num, gen) {
  1654. this.num = num;
  1655. this.gen = gen;
  1656. }
  1657. toString() {
  1658. if (this.gen === 0) {
  1659. return `${this.num}R`;
  1660. }
  1661. return `${this.num}R${this.gen}`;
  1662. }
  1663. static get(num, gen) {
  1664. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1665. const refValue = refCache[key];
  1666. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1667. }
  1668. static _clearCache() {
  1669. refCache = Object.create(null);
  1670. }
  1671. }
  1672. return Ref;
  1673. }();
  1674. exports.Ref = Ref;
  1675. class RefSet {
  1676. constructor(parent = null) {
  1677. this._set = new Set(parent && parent._set);
  1678. }
  1679. has(ref) {
  1680. return this._set.has(ref.toString());
  1681. }
  1682. put(ref) {
  1683. this._set.add(ref.toString());
  1684. }
  1685. remove(ref) {
  1686. this._set.delete(ref.toString());
  1687. }
  1688. forEach(callback) {
  1689. for (const ref of this._set.values()) {
  1690. callback(ref);
  1691. }
  1692. }
  1693. clear() {
  1694. this._set.clear();
  1695. }
  1696. }
  1697. exports.RefSet = RefSet;
  1698. class RefSetCache {
  1699. constructor() {
  1700. this._map = new Map();
  1701. }
  1702. get size() {
  1703. return this._map.size;
  1704. }
  1705. get(ref) {
  1706. return this._map.get(ref.toString());
  1707. }
  1708. has(ref) {
  1709. return this._map.has(ref.toString());
  1710. }
  1711. put(ref, obj) {
  1712. this._map.set(ref.toString(), obj);
  1713. }
  1714. putAlias(ref, aliasRef) {
  1715. this._map.set(ref.toString(), this.get(aliasRef));
  1716. }
  1717. forEach(callback) {
  1718. for (const value of this._map.values()) {
  1719. callback(value);
  1720. }
  1721. }
  1722. clear() {
  1723. this._map.clear();
  1724. }
  1725. }
  1726. exports.RefSetCache = RefSetCache;
  1727. function isName(v, name) {
  1728. return v instanceof Name && (name === undefined || v.name === name);
  1729. }
  1730. function isCmd(v, cmd) {
  1731. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1732. }
  1733. function isDict(v, type) {
  1734. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1735. }
  1736. function isRef(v) {
  1737. return v instanceof Ref;
  1738. }
  1739. function isRefsEqual(v1, v2) {
  1740. return v1.num === v2.num && v1.gen === v2.gen;
  1741. }
  1742. function isStream(v) {
  1743. return v instanceof _base_stream.BaseStream;
  1744. }
  1745. function clearPrimitiveCaches() {
  1746. Cmd._clearCache();
  1747. Name._clearCache();
  1748. Ref._clearCache();
  1749. }
  1750. /***/ }),
  1751. /* 6 */
  1752. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1753. Object.defineProperty(exports, "__esModule", ({
  1754. value: true
  1755. }));
  1756. exports.BaseStream = void 0;
  1757. var _util = __w_pdfjs_require__(2);
  1758. class BaseStream {
  1759. constructor() {
  1760. if (this.constructor === BaseStream) {
  1761. (0, _util.unreachable)("Cannot initialize BaseStream.");
  1762. }
  1763. }
  1764. get length() {
  1765. (0, _util.unreachable)("Abstract getter `length` accessed");
  1766. }
  1767. get isEmpty() {
  1768. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  1769. }
  1770. get isDataLoaded() {
  1771. return (0, _util.shadow)(this, "isDataLoaded", true);
  1772. }
  1773. getByte() {
  1774. (0, _util.unreachable)("Abstract method `getByte` called");
  1775. }
  1776. getBytes(length, forceClamped = false) {
  1777. (0, _util.unreachable)("Abstract method `getBytes` called");
  1778. }
  1779. peekByte() {
  1780. const peekedByte = this.getByte();
  1781. if (peekedByte !== -1) {
  1782. this.pos--;
  1783. }
  1784. return peekedByte;
  1785. }
  1786. peekBytes(length, forceClamped = false) {
  1787. const bytes = this.getBytes(length, forceClamped);
  1788. this.pos -= bytes.length;
  1789. return bytes;
  1790. }
  1791. getUint16() {
  1792. const b0 = this.getByte();
  1793. const b1 = this.getByte();
  1794. if (b0 === -1 || b1 === -1) {
  1795. return -1;
  1796. }
  1797. return (b0 << 8) + b1;
  1798. }
  1799. getInt32() {
  1800. const b0 = this.getByte();
  1801. const b1 = this.getByte();
  1802. const b2 = this.getByte();
  1803. const b3 = this.getByte();
  1804. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1805. }
  1806. getByteRange(begin, end) {
  1807. (0, _util.unreachable)("Abstract method `getByteRange` called");
  1808. }
  1809. getString(length) {
  1810. return (0, _util.bytesToString)(this.getBytes(length, false));
  1811. }
  1812. skip(n) {
  1813. this.pos += n || 1;
  1814. }
  1815. reset() {
  1816. (0, _util.unreachable)("Abstract method `reset` called");
  1817. }
  1818. moveStart() {
  1819. (0, _util.unreachable)("Abstract method `moveStart` called");
  1820. }
  1821. makeSubStream(start, length, dict = null) {
  1822. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  1823. }
  1824. getBaseStreams() {
  1825. return null;
  1826. }
  1827. }
  1828. exports.BaseStream = BaseStream;
  1829. /***/ }),
  1830. /* 7 */
  1831. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1832. Object.defineProperty(exports, "__esModule", ({
  1833. value: true
  1834. }));
  1835. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1836. var _util = __w_pdfjs_require__(2);
  1837. var _chunked_stream = __w_pdfjs_require__(8);
  1838. var _core_utils = __w_pdfjs_require__(9);
  1839. var _document = __w_pdfjs_require__(11);
  1840. var _stream = __w_pdfjs_require__(10);
  1841. function parseDocBaseUrl(url) {
  1842. if (url) {
  1843. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  1844. if (absoluteUrl) {
  1845. return absoluteUrl.href;
  1846. }
  1847. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  1848. }
  1849. return null;
  1850. }
  1851. class BasePdfManager {
  1852. constructor() {
  1853. if (this.constructor === BasePdfManager) {
  1854. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1855. }
  1856. }
  1857. get docId() {
  1858. return this._docId;
  1859. }
  1860. get password() {
  1861. return this._password;
  1862. }
  1863. get docBaseUrl() {
  1864. return this._docBaseUrl;
  1865. }
  1866. onLoadedStream() {
  1867. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1868. }
  1869. ensureDoc(prop, args) {
  1870. return this.ensure(this.pdfDocument, prop, args);
  1871. }
  1872. ensureXRef(prop, args) {
  1873. return this.ensure(this.pdfDocument.xref, prop, args);
  1874. }
  1875. ensureCatalog(prop, args) {
  1876. return this.ensure(this.pdfDocument.catalog, prop, args);
  1877. }
  1878. getPage(pageIndex) {
  1879. return this.pdfDocument.getPage(pageIndex);
  1880. }
  1881. fontFallback(id, handler) {
  1882. return this.pdfDocument.fontFallback(id, handler);
  1883. }
  1884. loadXfaFonts(handler, task) {
  1885. return this.pdfDocument.loadXfaFonts(handler, task);
  1886. }
  1887. loadXfaImages() {
  1888. return this.pdfDocument.loadXfaImages();
  1889. }
  1890. serializeXfaData(annotationStorage) {
  1891. return this.pdfDocument.serializeXfaData(annotationStorage);
  1892. }
  1893. cleanup(manuallyTriggered = false) {
  1894. return this.pdfDocument.cleanup(manuallyTriggered);
  1895. }
  1896. async ensure(obj, prop, args) {
  1897. (0, _util.unreachable)("Abstract method `ensure` called");
  1898. }
  1899. requestRange(begin, end) {
  1900. (0, _util.unreachable)("Abstract method `requestRange` called");
  1901. }
  1902. requestLoadedStream() {
  1903. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1904. }
  1905. sendProgressiveData(chunk) {
  1906. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1907. }
  1908. updatePassword(password) {
  1909. this._password = password;
  1910. }
  1911. terminate(reason) {
  1912. (0, _util.unreachable)("Abstract method `terminate` called");
  1913. }
  1914. }
  1915. class LocalPdfManager extends BasePdfManager {
  1916. constructor(docId, data, password, evaluatorOptions, enableXfa, docBaseUrl) {
  1917. super();
  1918. this._docId = docId;
  1919. this._password = password;
  1920. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1921. this.evaluatorOptions = evaluatorOptions;
  1922. this.enableXfa = enableXfa;
  1923. const stream = new _stream.Stream(data);
  1924. this.pdfDocument = new _document.PDFDocument(this, stream);
  1925. this._loadedStreamPromise = Promise.resolve(stream);
  1926. }
  1927. async ensure(obj, prop, args) {
  1928. const value = obj[prop];
  1929. if (typeof value === "function") {
  1930. return value.apply(obj, args);
  1931. }
  1932. return value;
  1933. }
  1934. requestRange(begin, end) {
  1935. return Promise.resolve();
  1936. }
  1937. requestLoadedStream() {}
  1938. onLoadedStream() {
  1939. return this._loadedStreamPromise;
  1940. }
  1941. terminate(reason) {}
  1942. }
  1943. exports.LocalPdfManager = LocalPdfManager;
  1944. class NetworkPdfManager extends BasePdfManager {
  1945. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  1946. super();
  1947. this._docId = docId;
  1948. this._password = args.password;
  1949. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1950. this.msgHandler = args.msgHandler;
  1951. this.evaluatorOptions = evaluatorOptions;
  1952. this.enableXfa = enableXfa;
  1953. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1954. msgHandler: args.msgHandler,
  1955. length: args.length,
  1956. disableAutoFetch: args.disableAutoFetch,
  1957. rangeChunkSize: args.rangeChunkSize
  1958. });
  1959. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1960. }
  1961. async ensure(obj, prop, args) {
  1962. try {
  1963. const value = obj[prop];
  1964. if (typeof value === "function") {
  1965. return value.apply(obj, args);
  1966. }
  1967. return value;
  1968. } catch (ex) {
  1969. if (!(ex instanceof _core_utils.MissingDataException)) {
  1970. throw ex;
  1971. }
  1972. await this.requestRange(ex.begin, ex.end);
  1973. return this.ensure(obj, prop, args);
  1974. }
  1975. }
  1976. requestRange(begin, end) {
  1977. return this.streamManager.requestRange(begin, end);
  1978. }
  1979. requestLoadedStream() {
  1980. this.streamManager.requestAllChunks();
  1981. }
  1982. sendProgressiveData(chunk) {
  1983. this.streamManager.onReceiveData({
  1984. chunk
  1985. });
  1986. }
  1987. onLoadedStream() {
  1988. return this.streamManager.onLoadedStream();
  1989. }
  1990. terminate(reason) {
  1991. this.streamManager.abort(reason);
  1992. }
  1993. }
  1994. exports.NetworkPdfManager = NetworkPdfManager;
  1995. /***/ }),
  1996. /* 8 */
  1997. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1998. Object.defineProperty(exports, "__esModule", ({
  1999. value: true
  2000. }));
  2001. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  2002. var _util = __w_pdfjs_require__(2);
  2003. var _core_utils = __w_pdfjs_require__(9);
  2004. var _stream = __w_pdfjs_require__(10);
  2005. class ChunkedStream extends _stream.Stream {
  2006. constructor(length, chunkSize, manager) {
  2007. super(new Uint8Array(length), 0, length, null);
  2008. this.chunkSize = chunkSize;
  2009. this._loadedChunks = new Set();
  2010. this.numChunks = Math.ceil(length / chunkSize);
  2011. this.manager = manager;
  2012. this.progressiveDataLength = 0;
  2013. this.lastSuccessfulEnsureByteChunk = -1;
  2014. }
  2015. getMissingChunks() {
  2016. const chunks = [];
  2017. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  2018. if (!this._loadedChunks.has(chunk)) {
  2019. chunks.push(chunk);
  2020. }
  2021. }
  2022. return chunks;
  2023. }
  2024. get numChunksLoaded() {
  2025. return this._loadedChunks.size;
  2026. }
  2027. get isDataLoaded() {
  2028. return this.numChunksLoaded === this.numChunks;
  2029. }
  2030. onReceiveData(begin, chunk) {
  2031. const chunkSize = this.chunkSize;
  2032. if (begin % chunkSize !== 0) {
  2033. throw new Error(`Bad begin offset: ${begin}`);
  2034. }
  2035. const end = begin + chunk.byteLength;
  2036. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  2037. throw new Error(`Bad end offset: ${end}`);
  2038. }
  2039. this.bytes.set(new Uint8Array(chunk), begin);
  2040. const beginChunk = Math.floor(begin / chunkSize);
  2041. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2042. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2043. this._loadedChunks.add(curChunk);
  2044. }
  2045. }
  2046. onReceiveProgressiveData(data) {
  2047. let position = this.progressiveDataLength;
  2048. const beginChunk = Math.floor(position / this.chunkSize);
  2049. this.bytes.set(new Uint8Array(data), position);
  2050. position += data.byteLength;
  2051. this.progressiveDataLength = position;
  2052. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2053. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2054. this._loadedChunks.add(curChunk);
  2055. }
  2056. }
  2057. ensureByte(pos) {
  2058. if (pos < this.progressiveDataLength) {
  2059. return;
  2060. }
  2061. const chunk = Math.floor(pos / this.chunkSize);
  2062. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2063. return;
  2064. }
  2065. if (!this._loadedChunks.has(chunk)) {
  2066. throw new _core_utils.MissingDataException(pos, pos + 1);
  2067. }
  2068. this.lastSuccessfulEnsureByteChunk = chunk;
  2069. }
  2070. ensureRange(begin, end) {
  2071. if (begin >= end) {
  2072. return;
  2073. }
  2074. if (end <= this.progressiveDataLength) {
  2075. return;
  2076. }
  2077. const chunkSize = this.chunkSize;
  2078. const beginChunk = Math.floor(begin / chunkSize);
  2079. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  2080. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2081. if (!this._loadedChunks.has(chunk)) {
  2082. throw new _core_utils.MissingDataException(begin, end);
  2083. }
  2084. }
  2085. }
  2086. nextEmptyChunk(beginChunk) {
  2087. const numChunks = this.numChunks;
  2088. for (let i = 0; i < numChunks; ++i) {
  2089. const chunk = (beginChunk + i) % numChunks;
  2090. if (!this._loadedChunks.has(chunk)) {
  2091. return chunk;
  2092. }
  2093. }
  2094. return null;
  2095. }
  2096. hasChunk(chunk) {
  2097. return this._loadedChunks.has(chunk);
  2098. }
  2099. getByte() {
  2100. const pos = this.pos;
  2101. if (pos >= this.end) {
  2102. return -1;
  2103. }
  2104. if (pos >= this.progressiveDataLength) {
  2105. this.ensureByte(pos);
  2106. }
  2107. return this.bytes[this.pos++];
  2108. }
  2109. getBytes(length, forceClamped = false) {
  2110. const bytes = this.bytes;
  2111. const pos = this.pos;
  2112. const strEnd = this.end;
  2113. if (!length) {
  2114. if (strEnd > this.progressiveDataLength) {
  2115. this.ensureRange(pos, strEnd);
  2116. }
  2117. const subarray = bytes.subarray(pos, strEnd);
  2118. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2119. }
  2120. let end = pos + length;
  2121. if (end > strEnd) {
  2122. end = strEnd;
  2123. }
  2124. if (end > this.progressiveDataLength) {
  2125. this.ensureRange(pos, end);
  2126. }
  2127. this.pos = end;
  2128. const subarray = bytes.subarray(pos, end);
  2129. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2130. }
  2131. getByteRange(begin, end) {
  2132. if (begin < 0) {
  2133. begin = 0;
  2134. }
  2135. if (end > this.end) {
  2136. end = this.end;
  2137. }
  2138. if (end > this.progressiveDataLength) {
  2139. this.ensureRange(begin, end);
  2140. }
  2141. return this.bytes.subarray(begin, end);
  2142. }
  2143. makeSubStream(start, length, dict = null) {
  2144. if (length) {
  2145. if (start + length > this.progressiveDataLength) {
  2146. this.ensureRange(start, start + length);
  2147. }
  2148. } else {
  2149. if (start >= this.progressiveDataLength) {
  2150. this.ensureByte(start);
  2151. }
  2152. }
  2153. function ChunkedStreamSubstream() {}
  2154. ChunkedStreamSubstream.prototype = Object.create(this);
  2155. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2156. const chunkSize = this.chunkSize;
  2157. const beginChunk = Math.floor(this.start / chunkSize);
  2158. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2159. const missingChunks = [];
  2160. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2161. if (!this._loadedChunks.has(chunk)) {
  2162. missingChunks.push(chunk);
  2163. }
  2164. }
  2165. return missingChunks;
  2166. };
  2167. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2168. get() {
  2169. if (this.numChunksLoaded === this.numChunks) {
  2170. return true;
  2171. }
  2172. return this.getMissingChunks().length === 0;
  2173. },
  2174. configurable: true
  2175. });
  2176. const subStream = new ChunkedStreamSubstream();
  2177. subStream.pos = subStream.start = start;
  2178. subStream.end = start + length || this.end;
  2179. subStream.dict = dict;
  2180. return subStream;
  2181. }
  2182. getBaseStreams() {
  2183. return [this];
  2184. }
  2185. }
  2186. exports.ChunkedStream = ChunkedStream;
  2187. class ChunkedStreamManager {
  2188. constructor(pdfNetworkStream, args) {
  2189. this.length = args.length;
  2190. this.chunkSize = args.rangeChunkSize;
  2191. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2192. this.pdfNetworkStream = pdfNetworkStream;
  2193. this.disableAutoFetch = args.disableAutoFetch;
  2194. this.msgHandler = args.msgHandler;
  2195. this.currRequestId = 0;
  2196. this._chunksNeededByRequest = new Map();
  2197. this._requestsByChunk = new Map();
  2198. this._promisesByRequest = new Map();
  2199. this.progressiveDataLength = 0;
  2200. this.aborted = false;
  2201. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2202. }
  2203. onLoadedStream() {
  2204. return this._loadedStreamCapability.promise;
  2205. }
  2206. sendRequest(begin, end) {
  2207. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2208. if (!rangeReader.isStreamingSupported) {
  2209. rangeReader.onProgress = this.onProgress.bind(this);
  2210. }
  2211. let chunks = [],
  2212. loaded = 0;
  2213. return new Promise((resolve, reject) => {
  2214. const readChunk = chunk => {
  2215. try {
  2216. if (!chunk.done) {
  2217. const data = chunk.value;
  2218. chunks.push(data);
  2219. loaded += (0, _util.arrayByteLength)(data);
  2220. if (rangeReader.isStreamingSupported) {
  2221. this.onProgress({
  2222. loaded
  2223. });
  2224. }
  2225. rangeReader.read().then(readChunk, reject);
  2226. return;
  2227. }
  2228. const chunkData = (0, _util.arraysToBytes)(chunks);
  2229. chunks = null;
  2230. resolve(chunkData);
  2231. } catch (e) {
  2232. reject(e);
  2233. }
  2234. };
  2235. rangeReader.read().then(readChunk, reject);
  2236. }).then(data => {
  2237. if (this.aborted) {
  2238. return;
  2239. }
  2240. this.onReceiveData({
  2241. chunk: data,
  2242. begin
  2243. });
  2244. });
  2245. }
  2246. requestAllChunks() {
  2247. const missingChunks = this.stream.getMissingChunks();
  2248. this._requestChunks(missingChunks);
  2249. return this._loadedStreamCapability.promise;
  2250. }
  2251. _requestChunks(chunks) {
  2252. const requestId = this.currRequestId++;
  2253. const chunksNeeded = new Set();
  2254. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2255. for (const chunk of chunks) {
  2256. if (!this.stream.hasChunk(chunk)) {
  2257. chunksNeeded.add(chunk);
  2258. }
  2259. }
  2260. if (chunksNeeded.size === 0) {
  2261. return Promise.resolve();
  2262. }
  2263. const capability = (0, _util.createPromiseCapability)();
  2264. this._promisesByRequest.set(requestId, capability);
  2265. const chunksToRequest = [];
  2266. for (const chunk of chunksNeeded) {
  2267. let requestIds = this._requestsByChunk.get(chunk);
  2268. if (!requestIds) {
  2269. requestIds = [];
  2270. this._requestsByChunk.set(chunk, requestIds);
  2271. chunksToRequest.push(chunk);
  2272. }
  2273. requestIds.push(requestId);
  2274. }
  2275. if (chunksToRequest.length > 0) {
  2276. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2277. for (const groupedChunk of groupedChunksToRequest) {
  2278. const begin = groupedChunk.beginChunk * this.chunkSize;
  2279. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2280. this.sendRequest(begin, end).catch(capability.reject);
  2281. }
  2282. }
  2283. return capability.promise.catch(reason => {
  2284. if (this.aborted) {
  2285. return;
  2286. }
  2287. throw reason;
  2288. });
  2289. }
  2290. getStream() {
  2291. return this.stream;
  2292. }
  2293. requestRange(begin, end) {
  2294. end = Math.min(end, this.length);
  2295. const beginChunk = this.getBeginChunk(begin);
  2296. const endChunk = this.getEndChunk(end);
  2297. const chunks = [];
  2298. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2299. chunks.push(chunk);
  2300. }
  2301. return this._requestChunks(chunks);
  2302. }
  2303. requestRanges(ranges = []) {
  2304. const chunksToRequest = [];
  2305. for (const range of ranges) {
  2306. const beginChunk = this.getBeginChunk(range.begin);
  2307. const endChunk = this.getEndChunk(range.end);
  2308. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2309. if (!chunksToRequest.includes(chunk)) {
  2310. chunksToRequest.push(chunk);
  2311. }
  2312. }
  2313. }
  2314. chunksToRequest.sort(function (a, b) {
  2315. return a - b;
  2316. });
  2317. return this._requestChunks(chunksToRequest);
  2318. }
  2319. groupChunks(chunks) {
  2320. const groupedChunks = [];
  2321. let beginChunk = -1;
  2322. let prevChunk = -1;
  2323. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2324. const chunk = chunks[i];
  2325. if (beginChunk < 0) {
  2326. beginChunk = chunk;
  2327. }
  2328. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2329. groupedChunks.push({
  2330. beginChunk,
  2331. endChunk: prevChunk + 1
  2332. });
  2333. beginChunk = chunk;
  2334. }
  2335. if (i + 1 === chunks.length) {
  2336. groupedChunks.push({
  2337. beginChunk,
  2338. endChunk: chunk + 1
  2339. });
  2340. }
  2341. prevChunk = chunk;
  2342. }
  2343. return groupedChunks;
  2344. }
  2345. onProgress(args) {
  2346. this.msgHandler.send("DocProgress", {
  2347. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2348. total: this.length
  2349. });
  2350. }
  2351. onReceiveData(args) {
  2352. const chunk = args.chunk;
  2353. const isProgressive = args.begin === undefined;
  2354. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2355. const end = begin + chunk.byteLength;
  2356. const beginChunk = Math.floor(begin / this.chunkSize);
  2357. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2358. if (isProgressive) {
  2359. this.stream.onReceiveProgressiveData(chunk);
  2360. this.progressiveDataLength = end;
  2361. } else {
  2362. this.stream.onReceiveData(begin, chunk);
  2363. }
  2364. if (this.stream.isDataLoaded) {
  2365. this._loadedStreamCapability.resolve(this.stream);
  2366. }
  2367. const loadedRequests = [];
  2368. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2369. const requestIds = this._requestsByChunk.get(curChunk);
  2370. if (!requestIds) {
  2371. continue;
  2372. }
  2373. this._requestsByChunk.delete(curChunk);
  2374. for (const requestId of requestIds) {
  2375. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2376. if (chunksNeeded.has(curChunk)) {
  2377. chunksNeeded.delete(curChunk);
  2378. }
  2379. if (chunksNeeded.size > 0) {
  2380. continue;
  2381. }
  2382. loadedRequests.push(requestId);
  2383. }
  2384. }
  2385. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2386. let nextEmptyChunk;
  2387. if (this.stream.numChunksLoaded === 1) {
  2388. const lastChunk = this.stream.numChunks - 1;
  2389. if (!this.stream.hasChunk(lastChunk)) {
  2390. nextEmptyChunk = lastChunk;
  2391. }
  2392. } else {
  2393. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2394. }
  2395. if (Number.isInteger(nextEmptyChunk)) {
  2396. this._requestChunks([nextEmptyChunk]);
  2397. }
  2398. }
  2399. for (const requestId of loadedRequests) {
  2400. const capability = this._promisesByRequest.get(requestId);
  2401. this._promisesByRequest.delete(requestId);
  2402. capability.resolve();
  2403. }
  2404. this.msgHandler.send("DocProgress", {
  2405. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2406. total: this.length
  2407. });
  2408. }
  2409. onError(err) {
  2410. this._loadedStreamCapability.reject(err);
  2411. }
  2412. getBeginChunk(begin) {
  2413. return Math.floor(begin / this.chunkSize);
  2414. }
  2415. getEndChunk(end) {
  2416. return Math.floor((end - 1) / this.chunkSize) + 1;
  2417. }
  2418. abort(reason) {
  2419. this.aborted = true;
  2420. if (this.pdfNetworkStream) {
  2421. this.pdfNetworkStream.cancelAllRequests(reason);
  2422. }
  2423. for (const capability of this._promisesByRequest.values()) {
  2424. capability.reject(reason);
  2425. }
  2426. }
  2427. }
  2428. exports.ChunkedStreamManager = ChunkedStreamManager;
  2429. /***/ }),
  2430. /* 9 */
  2431. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2432. Object.defineProperty(exports, "__esModule", ({
  2433. value: true
  2434. }));
  2435. exports.collectActions = collectActions;
  2436. exports.encodeToXmlString = encodeToXmlString;
  2437. exports.escapePDFName = escapePDFName;
  2438. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2439. exports.getInheritableProperty = getInheritableProperty;
  2440. exports.getLookupTableFactory = getLookupTableFactory;
  2441. exports.isWhiteSpace = isWhiteSpace;
  2442. exports.log2 = log2;
  2443. exports.parseXFAPath = parseXFAPath;
  2444. exports.readInt8 = readInt8;
  2445. exports.readUint16 = readUint16;
  2446. exports.readUint32 = readUint32;
  2447. exports.recoverJsURL = recoverJsURL;
  2448. exports.toRomanNumerals = toRomanNumerals;
  2449. exports.validateCSSFont = validateCSSFont;
  2450. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = void 0;
  2451. var _util = __w_pdfjs_require__(2);
  2452. var _primitives = __w_pdfjs_require__(5);
  2453. function getLookupTableFactory(initializer) {
  2454. let lookup;
  2455. return function () {
  2456. if (initializer) {
  2457. lookup = Object.create(null);
  2458. initializer(lookup);
  2459. initializer = null;
  2460. }
  2461. return lookup;
  2462. };
  2463. }
  2464. function getArrayLookupTableFactory(initializer) {
  2465. let lookup;
  2466. return function () {
  2467. if (initializer) {
  2468. let arr = initializer();
  2469. initializer = null;
  2470. lookup = Object.create(null);
  2471. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2472. lookup[arr[i]] = arr[i + 1];
  2473. }
  2474. arr = null;
  2475. }
  2476. return lookup;
  2477. };
  2478. }
  2479. class MissingDataException extends _util.BaseException {
  2480. constructor(begin, end) {
  2481. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  2482. this.begin = begin;
  2483. this.end = end;
  2484. }
  2485. }
  2486. exports.MissingDataException = MissingDataException;
  2487. class ParserEOFException extends _util.BaseException {
  2488. constructor(msg) {
  2489. super(msg, "ParserEOFException");
  2490. }
  2491. }
  2492. exports.ParserEOFException = ParserEOFException;
  2493. class XRefEntryException extends _util.BaseException {
  2494. constructor(msg) {
  2495. super(msg, "XRefEntryException");
  2496. }
  2497. }
  2498. exports.XRefEntryException = XRefEntryException;
  2499. class XRefParseException extends _util.BaseException {
  2500. constructor(msg) {
  2501. super(msg, "XRefParseException");
  2502. }
  2503. }
  2504. exports.XRefParseException = XRefParseException;
  2505. function getInheritableProperty({
  2506. dict,
  2507. key,
  2508. getArray = false,
  2509. stopWhenFound = true
  2510. }) {
  2511. let values;
  2512. const visited = new _primitives.RefSet();
  2513. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  2514. if (dict.objId) {
  2515. visited.put(dict.objId);
  2516. }
  2517. const value = getArray ? dict.getArray(key) : dict.get(key);
  2518. if (value !== undefined) {
  2519. if (stopWhenFound) {
  2520. return value;
  2521. }
  2522. if (!values) {
  2523. values = [];
  2524. }
  2525. values.push(value);
  2526. }
  2527. dict = dict.get("Parent");
  2528. }
  2529. return values;
  2530. }
  2531. 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"];
  2532. function toRomanNumerals(number, lowerCase = false) {
  2533. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2534. const romanBuf = [];
  2535. let pos;
  2536. while (number >= 1000) {
  2537. number -= 1000;
  2538. romanBuf.push("M");
  2539. }
  2540. pos = number / 100 | 0;
  2541. number %= 100;
  2542. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2543. pos = number / 10 | 0;
  2544. number %= 10;
  2545. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2546. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2547. const romanStr = romanBuf.join("");
  2548. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2549. }
  2550. function log2(x) {
  2551. if (x <= 0) {
  2552. return 0;
  2553. }
  2554. return Math.ceil(Math.log2(x));
  2555. }
  2556. function readInt8(data, offset) {
  2557. return data[offset] << 24 >> 24;
  2558. }
  2559. function readUint16(data, offset) {
  2560. return data[offset] << 8 | data[offset + 1];
  2561. }
  2562. function readUint32(data, offset) {
  2563. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2564. }
  2565. function isWhiteSpace(ch) {
  2566. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2567. }
  2568. function parseXFAPath(path) {
  2569. const positionPattern = /(.+)\[(\d+)\]$/;
  2570. return path.split(".").map(component => {
  2571. const m = component.match(positionPattern);
  2572. if (m) {
  2573. return {
  2574. name: m[1],
  2575. pos: parseInt(m[2], 10)
  2576. };
  2577. }
  2578. return {
  2579. name: component,
  2580. pos: 0
  2581. };
  2582. });
  2583. }
  2584. function escapePDFName(str) {
  2585. const buffer = [];
  2586. let start = 0;
  2587. for (let i = 0, ii = str.length; i < ii; i++) {
  2588. const char = str.charCodeAt(i);
  2589. 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) {
  2590. if (start < i) {
  2591. buffer.push(str.substring(start, i));
  2592. }
  2593. buffer.push(`#${char.toString(16)}`);
  2594. start = i + 1;
  2595. }
  2596. }
  2597. if (buffer.length === 0) {
  2598. return str;
  2599. }
  2600. if (start < str.length) {
  2601. buffer.push(str.substring(start, str.length));
  2602. }
  2603. return buffer.join("");
  2604. }
  2605. function _collectJS(entry, xref, list, parents) {
  2606. if (!entry) {
  2607. return;
  2608. }
  2609. let parent = null;
  2610. if ((0, _primitives.isRef)(entry)) {
  2611. if (parents.has(entry)) {
  2612. return;
  2613. }
  2614. parent = entry;
  2615. parents.put(parent);
  2616. entry = xref.fetch(entry);
  2617. }
  2618. if (Array.isArray(entry)) {
  2619. for (const element of entry) {
  2620. _collectJS(element, xref, list, parents);
  2621. }
  2622. } else if (entry instanceof _primitives.Dict) {
  2623. if ((0, _primitives.isName)(entry.get("S"), "JavaScript") && entry.has("JS")) {
  2624. const js = entry.get("JS");
  2625. let code;
  2626. if ((0, _primitives.isStream)(js)) {
  2627. code = js.getString();
  2628. } else {
  2629. code = js;
  2630. }
  2631. code = (0, _util.stringToPDFString)(code);
  2632. if (code) {
  2633. list.push(code);
  2634. }
  2635. }
  2636. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2637. }
  2638. if (parent) {
  2639. parents.remove(parent);
  2640. }
  2641. }
  2642. function collectActions(xref, dict, eventType) {
  2643. const actions = Object.create(null);
  2644. const additionalActionsDicts = getInheritableProperty({
  2645. dict,
  2646. key: "AA",
  2647. stopWhenFound: false
  2648. });
  2649. if (additionalActionsDicts) {
  2650. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2651. const additionalActions = additionalActionsDicts[i];
  2652. if (!(additionalActions instanceof _primitives.Dict)) {
  2653. continue;
  2654. }
  2655. for (const key of additionalActions.getKeys()) {
  2656. const action = eventType[key];
  2657. if (!action) {
  2658. continue;
  2659. }
  2660. const actionDict = additionalActions.getRaw(key);
  2661. const parents = new _primitives.RefSet();
  2662. const list = [];
  2663. _collectJS(actionDict, xref, list, parents);
  2664. if (list.length > 0) {
  2665. actions[action] = list;
  2666. }
  2667. }
  2668. }
  2669. }
  2670. if (dict.has("A")) {
  2671. const actionDict = dict.get("A");
  2672. const parents = new _primitives.RefSet();
  2673. const list = [];
  2674. _collectJS(actionDict, xref, list, parents);
  2675. if (list.length > 0) {
  2676. actions.Action = list;
  2677. }
  2678. }
  2679. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2680. }
  2681. const XMLEntities = {
  2682. 0x3c: "&lt;",
  2683. 0x3e: "&gt;",
  2684. 0x26: "&amp;",
  2685. 0x22: "&quot;",
  2686. 0x27: "&apos;"
  2687. };
  2688. function encodeToXmlString(str) {
  2689. const buffer = [];
  2690. let start = 0;
  2691. for (let i = 0, ii = str.length; i < ii; i++) {
  2692. const char = str.codePointAt(i);
  2693. if (0x20 <= char && char <= 0x7e) {
  2694. const entity = XMLEntities[char];
  2695. if (entity) {
  2696. if (start < i) {
  2697. buffer.push(str.substring(start, i));
  2698. }
  2699. buffer.push(entity);
  2700. start = i + 1;
  2701. }
  2702. } else {
  2703. if (start < i) {
  2704. buffer.push(str.substring(start, i));
  2705. }
  2706. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2707. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2708. i++;
  2709. }
  2710. start = i + 1;
  2711. }
  2712. }
  2713. if (buffer.length === 0) {
  2714. return str;
  2715. }
  2716. if (start < str.length) {
  2717. buffer.push(str.substring(start, str.length));
  2718. }
  2719. return buffer.join("");
  2720. }
  2721. function validateCSSFont(cssFontInfo) {
  2722. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2723. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2724. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2725. const {
  2726. fontFamily,
  2727. fontWeight,
  2728. italicAngle
  2729. } = cssFontInfo;
  2730. if (/^".*"$/.test(fontFamily)) {
  2731. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2732. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2733. return false;
  2734. }
  2735. } else if (/^'.*'$/.test(fontFamily)) {
  2736. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2737. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2738. return false;
  2739. }
  2740. } else {
  2741. for (const ident of fontFamily.split(/[ \t]+/)) {
  2742. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2743. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2744. return false;
  2745. }
  2746. }
  2747. }
  2748. const weight = fontWeight ? fontWeight.toString() : "";
  2749. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2750. const angle = parseFloat(italicAngle);
  2751. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2752. return true;
  2753. }
  2754. function recoverJsURL(str) {
  2755. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2756. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2757. const jsUrl = regex.exec(str);
  2758. if (jsUrl && jsUrl[2]) {
  2759. const url = jsUrl[2];
  2760. let newWindow = false;
  2761. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2762. newWindow = true;
  2763. }
  2764. return {
  2765. url,
  2766. newWindow
  2767. };
  2768. }
  2769. return null;
  2770. }
  2771. /***/ }),
  2772. /* 10 */
  2773. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2774. Object.defineProperty(exports, "__esModule", ({
  2775. value: true
  2776. }));
  2777. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2778. var _base_stream = __w_pdfjs_require__(6);
  2779. var _util = __w_pdfjs_require__(2);
  2780. class Stream extends _base_stream.BaseStream {
  2781. constructor(arrayBuffer, start, length, dict) {
  2782. super();
  2783. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2784. this.start = start || 0;
  2785. this.pos = this.start;
  2786. this.end = start + length || this.bytes.length;
  2787. this.dict = dict;
  2788. }
  2789. get length() {
  2790. return this.end - this.start;
  2791. }
  2792. get isEmpty() {
  2793. return this.length === 0;
  2794. }
  2795. getByte() {
  2796. if (this.pos >= this.end) {
  2797. return -1;
  2798. }
  2799. return this.bytes[this.pos++];
  2800. }
  2801. getBytes(length, forceClamped = false) {
  2802. const bytes = this.bytes;
  2803. const pos = this.pos;
  2804. const strEnd = this.end;
  2805. if (!length) {
  2806. const subarray = bytes.subarray(pos, strEnd);
  2807. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2808. }
  2809. let end = pos + length;
  2810. if (end > strEnd) {
  2811. end = strEnd;
  2812. }
  2813. this.pos = end;
  2814. const subarray = bytes.subarray(pos, end);
  2815. return forceClamped ? new Uint8ClampedArray(subarray) : subarray;
  2816. }
  2817. getByteRange(begin, end) {
  2818. if (begin < 0) {
  2819. begin = 0;
  2820. }
  2821. if (end > this.end) {
  2822. end = this.end;
  2823. }
  2824. return this.bytes.subarray(begin, end);
  2825. }
  2826. reset() {
  2827. this.pos = this.start;
  2828. }
  2829. moveStart() {
  2830. this.start = this.pos;
  2831. }
  2832. makeSubStream(start, length, dict = null) {
  2833. return new Stream(this.bytes.buffer, start, length, dict);
  2834. }
  2835. }
  2836. exports.Stream = Stream;
  2837. class StringStream extends Stream {
  2838. constructor(str) {
  2839. super((0, _util.stringToBytes)(str));
  2840. }
  2841. }
  2842. exports.StringStream = StringStream;
  2843. class NullStream extends Stream {
  2844. constructor() {
  2845. super(new Uint8Array(0));
  2846. }
  2847. }
  2848. exports.NullStream = NullStream;
  2849. /***/ }),
  2850. /* 11 */
  2851. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2852. Object.defineProperty(exports, "__esModule", ({
  2853. value: true
  2854. }));
  2855. exports.PDFDocument = exports.Page = void 0;
  2856. var _util = __w_pdfjs_require__(2);
  2857. var _primitives = __w_pdfjs_require__(5);
  2858. var _core_utils = __w_pdfjs_require__(9);
  2859. var _xfa_fonts = __w_pdfjs_require__(12);
  2860. var _stream = __w_pdfjs_require__(10);
  2861. var _annotation = __w_pdfjs_require__(22);
  2862. var _base_stream = __w_pdfjs_require__(6);
  2863. var _crypto = __w_pdfjs_require__(72);
  2864. var _catalog = __w_pdfjs_require__(64);
  2865. var _parser = __w_pdfjs_require__(27);
  2866. var _object_loader = __w_pdfjs_require__(70);
  2867. var _operator_list = __w_pdfjs_require__(62);
  2868. var _evaluator = __w_pdfjs_require__(25);
  2869. var _decode_stream = __w_pdfjs_require__(29);
  2870. var _struct_tree = __w_pdfjs_require__(69);
  2871. var _factory = __w_pdfjs_require__(74);
  2872. var _xref = __w_pdfjs_require__(98);
  2873. const DEFAULT_USER_UNIT = 1.0;
  2874. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2875. class Page {
  2876. constructor({
  2877. pdfManager,
  2878. xref,
  2879. pageIndex,
  2880. pageDict,
  2881. ref,
  2882. globalIdFactory,
  2883. fontCache,
  2884. builtInCMapCache,
  2885. standardFontDataCache,
  2886. globalImageCache,
  2887. nonBlendModesSet,
  2888. xfaFactory
  2889. }) {
  2890. this.pdfManager = pdfManager;
  2891. this.pageIndex = pageIndex;
  2892. this.pageDict = pageDict;
  2893. this.xref = xref;
  2894. this.ref = ref;
  2895. this.fontCache = fontCache;
  2896. this.builtInCMapCache = builtInCMapCache;
  2897. this.standardFontDataCache = standardFontDataCache;
  2898. this.globalImageCache = globalImageCache;
  2899. this.nonBlendModesSet = nonBlendModesSet;
  2900. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2901. this.resourcesPromise = null;
  2902. this.xfaFactory = xfaFactory;
  2903. const idCounters = {
  2904. obj: 0
  2905. };
  2906. this._localIdFactory = class extends globalIdFactory {
  2907. static createObjId() {
  2908. return `p${pageIndex}_${++idCounters.obj}`;
  2909. }
  2910. static getPageObjId() {
  2911. return `page${ref.toString()}`;
  2912. }
  2913. };
  2914. }
  2915. _getInheritableProperty(key, getArray = false) {
  2916. const value = (0, _core_utils.getInheritableProperty)({
  2917. dict: this.pageDict,
  2918. key,
  2919. getArray,
  2920. stopWhenFound: false
  2921. });
  2922. if (!Array.isArray(value)) {
  2923. return value;
  2924. }
  2925. if (value.length === 1 || !(0, _primitives.isDict)(value[0])) {
  2926. return value[0];
  2927. }
  2928. return _primitives.Dict.merge({
  2929. xref: this.xref,
  2930. dictArray: value
  2931. });
  2932. }
  2933. get content() {
  2934. return this.pageDict.getArray("Contents");
  2935. }
  2936. get resources() {
  2937. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  2938. }
  2939. _getBoundingBox(name) {
  2940. if (this.xfaData) {
  2941. return this.xfaData.bbox;
  2942. }
  2943. const box = this._getInheritableProperty(name, true);
  2944. if (Array.isArray(box) && box.length === 4) {
  2945. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2946. return box;
  2947. }
  2948. (0, _util.warn)(`Empty /${name} entry.`);
  2949. }
  2950. return null;
  2951. }
  2952. get mediaBox() {
  2953. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  2954. }
  2955. get cropBox() {
  2956. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  2957. }
  2958. get userUnit() {
  2959. let obj = this.pageDict.get("UserUnit");
  2960. if (!(0, _util.isNum)(obj) || obj <= 0) {
  2961. obj = DEFAULT_USER_UNIT;
  2962. }
  2963. return (0, _util.shadow)(this, "userUnit", obj);
  2964. }
  2965. get view() {
  2966. const {
  2967. cropBox,
  2968. mediaBox
  2969. } = this;
  2970. let view;
  2971. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  2972. view = mediaBox;
  2973. } else {
  2974. const box = _util.Util.intersect(cropBox, mediaBox);
  2975. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  2976. view = box;
  2977. } else {
  2978. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  2979. }
  2980. }
  2981. return (0, _util.shadow)(this, "view", view || mediaBox);
  2982. }
  2983. get rotate() {
  2984. let rotate = this._getInheritableProperty("Rotate") || 0;
  2985. if (rotate % 90 !== 0) {
  2986. rotate = 0;
  2987. } else if (rotate >= 360) {
  2988. rotate %= 360;
  2989. } else if (rotate < 0) {
  2990. rotate = (rotate % 360 + 360) % 360;
  2991. }
  2992. return (0, _util.shadow)(this, "rotate", rotate);
  2993. }
  2994. _onSubStreamError(handler, reason, objId) {
  2995. if (this.evaluatorOptions.ignoreErrors) {
  2996. handler.send("UnsupportedFeature", {
  2997. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  2998. });
  2999. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3000. return;
  3001. }
  3002. throw reason;
  3003. }
  3004. getContentStream(handler) {
  3005. return this.pdfManager.ensure(this, "content").then(content => {
  3006. if (content instanceof _base_stream.BaseStream) {
  3007. return content;
  3008. }
  3009. if (Array.isArray(content)) {
  3010. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3011. }
  3012. return new _stream.NullStream();
  3013. });
  3014. }
  3015. get xfaData() {
  3016. if (this.xfaFactory) {
  3017. return (0, _util.shadow)(this, "xfaData", {
  3018. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3019. });
  3020. }
  3021. return (0, _util.shadow)(this, "xfaData", null);
  3022. }
  3023. save(handler, task, annotationStorage) {
  3024. const partialEvaluator = new _evaluator.PartialEvaluator({
  3025. xref: this.xref,
  3026. handler,
  3027. pageIndex: this.pageIndex,
  3028. idFactory: this._localIdFactory,
  3029. fontCache: this.fontCache,
  3030. builtInCMapCache: this.builtInCMapCache,
  3031. standardFontDataCache: this.standardFontDataCache,
  3032. globalImageCache: this.globalImageCache,
  3033. options: this.evaluatorOptions
  3034. });
  3035. return this._parsedAnnotations.then(function (annotations) {
  3036. const newRefsPromises = [];
  3037. for (const annotation of annotations) {
  3038. if (!annotation.mustBePrinted(annotationStorage)) {
  3039. continue;
  3040. }
  3041. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3042. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3043. return null;
  3044. }));
  3045. }
  3046. return Promise.all(newRefsPromises);
  3047. });
  3048. }
  3049. loadResources(keys) {
  3050. if (!this.resourcesPromise) {
  3051. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3052. }
  3053. return this.resourcesPromise.then(() => {
  3054. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3055. return objectLoader.load();
  3056. });
  3057. }
  3058. getOperatorList({
  3059. handler,
  3060. sink,
  3061. task,
  3062. intent,
  3063. cacheKey,
  3064. annotationStorage = null
  3065. }) {
  3066. const contentStreamPromise = this.getContentStream(handler);
  3067. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3068. const partialEvaluator = new _evaluator.PartialEvaluator({
  3069. xref: this.xref,
  3070. handler,
  3071. pageIndex: this.pageIndex,
  3072. idFactory: this._localIdFactory,
  3073. fontCache: this.fontCache,
  3074. builtInCMapCache: this.builtInCMapCache,
  3075. standardFontDataCache: this.standardFontDataCache,
  3076. globalImageCache: this.globalImageCache,
  3077. options: this.evaluatorOptions
  3078. });
  3079. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3080. const pageListPromise = dataPromises.then(([contentStream]) => {
  3081. const opList = new _operator_list.OperatorList(intent, sink);
  3082. handler.send("StartRenderPage", {
  3083. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3084. pageIndex: this.pageIndex,
  3085. cacheKey
  3086. });
  3087. return partialEvaluator.getOperatorList({
  3088. stream: contentStream,
  3089. task,
  3090. resources: this.resources,
  3091. operatorList: opList
  3092. }).then(function () {
  3093. return opList;
  3094. });
  3095. });
  3096. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  3097. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3098. pageOpList.flush(true);
  3099. return {
  3100. length: pageOpList.totalLength
  3101. };
  3102. }
  3103. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3104. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3105. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3106. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3107. const opListPromises = [];
  3108. for (const annotation of annotations) {
  3109. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3110. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, renderForms, annotationStorage).catch(function (reason) {
  3111. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3112. return null;
  3113. }));
  3114. }
  3115. }
  3116. return Promise.all(opListPromises).then(function (opLists) {
  3117. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  3118. for (const opList of opLists) {
  3119. pageOpList.addOpList(opList);
  3120. }
  3121. pageOpList.addOp(_util.OPS.endAnnotations, []);
  3122. pageOpList.flush(true);
  3123. return {
  3124. length: pageOpList.totalLength
  3125. };
  3126. });
  3127. });
  3128. }
  3129. extractTextContent({
  3130. handler,
  3131. task,
  3132. normalizeWhitespace,
  3133. includeMarkedContent,
  3134. sink,
  3135. combineTextItems
  3136. }) {
  3137. const contentStreamPromise = this.getContentStream(handler);
  3138. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3139. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3140. return dataPromises.then(([contentStream]) => {
  3141. const partialEvaluator = new _evaluator.PartialEvaluator({
  3142. xref: this.xref,
  3143. handler,
  3144. pageIndex: this.pageIndex,
  3145. idFactory: this._localIdFactory,
  3146. fontCache: this.fontCache,
  3147. builtInCMapCache: this.builtInCMapCache,
  3148. standardFontDataCache: this.standardFontDataCache,
  3149. globalImageCache: this.globalImageCache,
  3150. options: this.evaluatorOptions
  3151. });
  3152. return partialEvaluator.getTextContent({
  3153. stream: contentStream,
  3154. task,
  3155. resources: this.resources,
  3156. normalizeWhitespace,
  3157. includeMarkedContent,
  3158. combineTextItems,
  3159. sink
  3160. });
  3161. });
  3162. }
  3163. async getStructTree() {
  3164. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3165. if (!structTreeRoot) {
  3166. return null;
  3167. }
  3168. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3169. return structTree.serializable;
  3170. }
  3171. _parseStructTree(structTreeRoot) {
  3172. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3173. tree.parse();
  3174. return tree;
  3175. }
  3176. getAnnotationsData(intent) {
  3177. return this._parsedAnnotations.then(function (annotations) {
  3178. const annotationsData = [];
  3179. if (annotations.length === 0) {
  3180. return annotationsData;
  3181. }
  3182. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3183. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3184. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3185. for (const annotation of annotations) {
  3186. if (intentAny || intentDisplay && annotation.viewable || intentPrint && annotation.printable) {
  3187. annotationsData.push(annotation.data);
  3188. }
  3189. }
  3190. return annotationsData;
  3191. });
  3192. }
  3193. get annotations() {
  3194. const annots = this._getInheritableProperty("Annots");
  3195. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3196. }
  3197. get _parsedAnnotations() {
  3198. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3199. const annotationPromises = [];
  3200. for (const annotationRef of this.annotations) {
  3201. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3202. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3203. return null;
  3204. }));
  3205. }
  3206. return Promise.all(annotationPromises).then(function (annotations) {
  3207. return annotations.filter(annotation => !!annotation);
  3208. });
  3209. });
  3210. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3211. }
  3212. get jsActions() {
  3213. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3214. return (0, _util.shadow)(this, "jsActions", actions);
  3215. }
  3216. }
  3217. exports.Page = Page;
  3218. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3219. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3220. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3221. const FINGERPRINT_FIRST_BYTES = 1024;
  3222. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3223. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/;
  3224. function find(stream, signature, limit = 1024, backwards = false) {
  3225. const signatureLength = signature.length;
  3226. const scanBytes = stream.peekBytes(limit);
  3227. const scanLength = scanBytes.length - signatureLength;
  3228. if (scanLength <= 0) {
  3229. return false;
  3230. }
  3231. if (backwards) {
  3232. const signatureEnd = signatureLength - 1;
  3233. let pos = scanBytes.length - 1;
  3234. while (pos >= signatureEnd) {
  3235. let j = 0;
  3236. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3237. j++;
  3238. }
  3239. if (j >= signatureLength) {
  3240. stream.pos += pos - signatureEnd;
  3241. return true;
  3242. }
  3243. pos--;
  3244. }
  3245. } else {
  3246. let pos = 0;
  3247. while (pos <= scanLength) {
  3248. let j = 0;
  3249. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3250. j++;
  3251. }
  3252. if (j >= signatureLength) {
  3253. stream.pos += pos;
  3254. return true;
  3255. }
  3256. pos++;
  3257. }
  3258. }
  3259. return false;
  3260. }
  3261. class PDFDocument {
  3262. constructor(pdfManager, arg) {
  3263. let stream;
  3264. if ((0, _primitives.isStream)(arg)) {
  3265. stream = arg;
  3266. } else if ((0, _util.isArrayBuffer)(arg)) {
  3267. stream = new _stream.Stream(arg);
  3268. } else {
  3269. throw new Error("PDFDocument: Unknown argument type");
  3270. }
  3271. if (stream.length <= 0) {
  3272. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3273. }
  3274. this.pdfManager = pdfManager;
  3275. this.stream = stream;
  3276. this.xref = new _xref.XRef(stream, pdfManager);
  3277. this._pagePromises = [];
  3278. this._version = null;
  3279. const idCounters = {
  3280. font: 0
  3281. };
  3282. this._globalIdFactory = class {
  3283. static getDocId() {
  3284. return `g_${pdfManager.docId}`;
  3285. }
  3286. static createFontId() {
  3287. return `f${++idCounters.font}`;
  3288. }
  3289. static createObjId() {
  3290. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3291. }
  3292. static getPageObjId() {
  3293. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3294. }
  3295. };
  3296. }
  3297. parse(recoveryMode) {
  3298. this.xref.parse(recoveryMode);
  3299. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3300. if (this.catalog.version) {
  3301. this._version = this.catalog.version;
  3302. }
  3303. }
  3304. get linearization() {
  3305. let linearization = null;
  3306. try {
  3307. linearization = _parser.Linearization.create(this.stream);
  3308. } catch (err) {
  3309. if (err instanceof _core_utils.MissingDataException) {
  3310. throw err;
  3311. }
  3312. (0, _util.info)(err);
  3313. }
  3314. return (0, _util.shadow)(this, "linearization", linearization);
  3315. }
  3316. get startXRef() {
  3317. const stream = this.stream;
  3318. let startXRef = 0;
  3319. if (this.linearization) {
  3320. stream.reset();
  3321. if (find(stream, ENDOBJ_SIGNATURE)) {
  3322. startXRef = stream.pos + 6 - stream.start;
  3323. }
  3324. } else {
  3325. const step = 1024;
  3326. const startXRefLength = STARTXREF_SIGNATURE.length;
  3327. let found = false,
  3328. pos = stream.end;
  3329. while (!found && pos > 0) {
  3330. pos -= step - startXRefLength;
  3331. if (pos < 0) {
  3332. pos = 0;
  3333. }
  3334. stream.pos = pos;
  3335. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3336. }
  3337. if (found) {
  3338. stream.skip(9);
  3339. let ch;
  3340. do {
  3341. ch = stream.getByte();
  3342. } while ((0, _core_utils.isWhiteSpace)(ch));
  3343. let str = "";
  3344. while (ch >= 0x20 && ch <= 0x39) {
  3345. str += String.fromCharCode(ch);
  3346. ch = stream.getByte();
  3347. }
  3348. startXRef = parseInt(str, 10);
  3349. if (isNaN(startXRef)) {
  3350. startXRef = 0;
  3351. }
  3352. }
  3353. }
  3354. return (0, _util.shadow)(this, "startXRef", startXRef);
  3355. }
  3356. checkHeader() {
  3357. const stream = this.stream;
  3358. stream.reset();
  3359. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3360. return;
  3361. }
  3362. stream.moveStart();
  3363. const MAX_PDF_VERSION_LENGTH = 12;
  3364. let version = "",
  3365. ch;
  3366. while ((ch = stream.getByte()) > 0x20) {
  3367. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3368. break;
  3369. }
  3370. version += String.fromCharCode(ch);
  3371. }
  3372. if (!this._version) {
  3373. this._version = version.substring(5);
  3374. }
  3375. }
  3376. parseStartXRef() {
  3377. this.xref.setStartXRef(this.startXRef);
  3378. }
  3379. get numPages() {
  3380. if (this.xfaFactory) {
  3381. return (0, _util.shadow)(this, "numPages", this.xfaFactory.numberPages);
  3382. }
  3383. const linearization = this.linearization;
  3384. const num = linearization ? linearization.numPages : this.catalog.numPages;
  3385. return (0, _util.shadow)(this, "numPages", num);
  3386. }
  3387. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3388. const RECURSION_LIMIT = 10;
  3389. if (!Array.isArray(fields)) {
  3390. return false;
  3391. }
  3392. return fields.every(field => {
  3393. field = this.xref.fetchIfRef(field);
  3394. if (!(field instanceof _primitives.Dict)) {
  3395. return false;
  3396. }
  3397. if (field.has("Kids")) {
  3398. if (++recursionDepth > RECURSION_LIMIT) {
  3399. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3400. return false;
  3401. }
  3402. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3403. }
  3404. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3405. const rectangle = field.get("Rect");
  3406. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3407. return isSignature && isInvisible;
  3408. });
  3409. }
  3410. get xfaData() {
  3411. const acroForm = this.catalog.acroForm;
  3412. if (!acroForm) {
  3413. return null;
  3414. }
  3415. const xfa = acroForm.get("XFA");
  3416. const entries = {
  3417. "xdp:xdp": "",
  3418. template: "",
  3419. datasets: "",
  3420. config: "",
  3421. connectionSet: "",
  3422. localeSet: "",
  3423. stylesheet: "",
  3424. "/xdp:xdp": ""
  3425. };
  3426. if ((0, _primitives.isStream)(xfa) && !xfa.isEmpty) {
  3427. try {
  3428. entries["xdp:xdp"] = (0, _util.stringToUTF8String)(xfa.getString());
  3429. return entries;
  3430. } catch (_) {
  3431. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3432. return null;
  3433. }
  3434. }
  3435. if (!Array.isArray(xfa) || xfa.length === 0) {
  3436. return null;
  3437. }
  3438. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3439. let name;
  3440. if (i === 0) {
  3441. name = "xdp:xdp";
  3442. } else if (i === ii - 2) {
  3443. name = "/xdp:xdp";
  3444. } else {
  3445. name = xfa[i];
  3446. }
  3447. if (!entries.hasOwnProperty(name)) {
  3448. continue;
  3449. }
  3450. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3451. if (!(0, _primitives.isStream)(data) || data.isEmpty) {
  3452. continue;
  3453. }
  3454. try {
  3455. entries[name] = (0, _util.stringToUTF8String)(data.getString());
  3456. } catch (_) {
  3457. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3458. return null;
  3459. }
  3460. }
  3461. return entries;
  3462. }
  3463. get xfaFactory() {
  3464. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3465. const data = this.xfaData;
  3466. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3467. }
  3468. return (0, _util.shadow)(this, "xfaFaxtory", null);
  3469. }
  3470. get isPureXfa() {
  3471. return this.xfaFactory && this.xfaFactory.isValid();
  3472. }
  3473. get htmlForXfa() {
  3474. if (this.xfaFactory) {
  3475. return this.xfaFactory.getPages();
  3476. }
  3477. return null;
  3478. }
  3479. async loadXfaImages() {
  3480. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3481. if (!xfaImagesDict) {
  3482. return;
  3483. }
  3484. const keys = xfaImagesDict.getKeys();
  3485. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3486. await objectLoader.load();
  3487. const xfaImages = new Map();
  3488. for (const key of keys) {
  3489. const stream = xfaImagesDict.get(key);
  3490. if (!(0, _primitives.isStream)(stream)) {
  3491. continue;
  3492. }
  3493. xfaImages.set(key, stream.getBytes());
  3494. }
  3495. this.xfaFactory.setImages(xfaImages);
  3496. }
  3497. async loadXfaFonts(handler, task) {
  3498. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3499. if (!acroForm) {
  3500. return;
  3501. }
  3502. const resources = await acroForm.getAsync("DR");
  3503. if (!(resources instanceof _primitives.Dict)) {
  3504. return;
  3505. }
  3506. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3507. await objectLoader.load();
  3508. const fontRes = resources.get("Font");
  3509. if (!(fontRes instanceof _primitives.Dict)) {
  3510. return;
  3511. }
  3512. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3513. options.useSystemFonts = false;
  3514. const partialEvaluator = new _evaluator.PartialEvaluator({
  3515. xref: this.xref,
  3516. handler,
  3517. pageIndex: -1,
  3518. idFactory: this._globalIdFactory,
  3519. fontCache: this.catalog.fontCache,
  3520. builtInCMapCache: this.catalog.builtInCMapCache,
  3521. standardFontDataCache: this.catalog.standardFontDataCache,
  3522. options
  3523. });
  3524. const operatorList = new _operator_list.OperatorList();
  3525. const pdfFonts = [];
  3526. const initialState = {
  3527. get font() {
  3528. return pdfFonts[pdfFonts.length - 1];
  3529. },
  3530. set font(font) {
  3531. pdfFonts.push(font);
  3532. },
  3533. clone() {
  3534. return this;
  3535. }
  3536. };
  3537. const fonts = new Map();
  3538. fontRes.forEach((fontName, font) => {
  3539. fonts.set(fontName, font);
  3540. });
  3541. const promises = [];
  3542. for (const [fontName, font] of fonts) {
  3543. const descriptor = font.get("FontDescriptor");
  3544. if (!(descriptor instanceof _primitives.Dict)) {
  3545. continue;
  3546. }
  3547. let fontFamily = descriptor.get("FontFamily");
  3548. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3549. const fontWeight = descriptor.get("FontWeight");
  3550. const italicAngle = -descriptor.get("ItalicAngle");
  3551. const cssFontInfo = {
  3552. fontFamily,
  3553. fontWeight,
  3554. italicAngle
  3555. };
  3556. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3557. continue;
  3558. }
  3559. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3560. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3561. return null;
  3562. }));
  3563. }
  3564. await Promise.all(promises);
  3565. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3566. if (!missingFonts) {
  3567. return;
  3568. }
  3569. options.ignoreErrors = true;
  3570. promises.length = 0;
  3571. pdfFonts.length = 0;
  3572. const reallyMissingFonts = new Set();
  3573. for (const missing of missingFonts) {
  3574. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3575. reallyMissingFonts.add(missing);
  3576. }
  3577. }
  3578. if (reallyMissingFonts.size) {
  3579. missingFonts.push("PdfJS-Fallback");
  3580. }
  3581. for (const missing of missingFonts) {
  3582. if (reallyMissingFonts.has(missing)) {
  3583. continue;
  3584. }
  3585. for (const fontInfo of [{
  3586. name: "Regular",
  3587. fontWeight: 400,
  3588. italicAngle: 0
  3589. }, {
  3590. name: "Bold",
  3591. fontWeight: 700,
  3592. italicAngle: 0
  3593. }, {
  3594. name: "Italic",
  3595. fontWeight: 400,
  3596. italicAngle: 12
  3597. }, {
  3598. name: "BoldItalic",
  3599. fontWeight: 700,
  3600. italicAngle: 12
  3601. }]) {
  3602. const name = `${missing}-${fontInfo.name}`;
  3603. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3604. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3605. fontFamily: missing,
  3606. fontWeight: fontInfo.fontWeight,
  3607. italicAngle: fontInfo.italicAngle
  3608. }).catch(function (reason) {
  3609. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3610. return null;
  3611. }));
  3612. }
  3613. }
  3614. await Promise.all(promises);
  3615. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3616. }
  3617. async serializeXfaData(annotationStorage) {
  3618. if (this.xfaFactory) {
  3619. return this.xfaFactory.serializeData(annotationStorage);
  3620. }
  3621. return null;
  3622. }
  3623. get formInfo() {
  3624. const formInfo = {
  3625. hasFields: false,
  3626. hasAcroForm: false,
  3627. hasXfa: false,
  3628. hasSignatures: false
  3629. };
  3630. const acroForm = this.catalog.acroForm;
  3631. if (!acroForm) {
  3632. return (0, _util.shadow)(this, "formInfo", formInfo);
  3633. }
  3634. try {
  3635. const fields = acroForm.get("Fields");
  3636. const hasFields = Array.isArray(fields) && fields.length > 0;
  3637. formInfo.hasFields = hasFields;
  3638. const xfa = acroForm.get("XFA");
  3639. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || (0, _primitives.isStream)(xfa) && !xfa.isEmpty;
  3640. const sigFlags = acroForm.get("SigFlags");
  3641. const hasSignatures = !!(sigFlags & 0x1);
  3642. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3643. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3644. formInfo.hasSignatures = hasSignatures;
  3645. } catch (ex) {
  3646. if (ex instanceof _core_utils.MissingDataException) {
  3647. throw ex;
  3648. }
  3649. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3650. }
  3651. return (0, _util.shadow)(this, "formInfo", formInfo);
  3652. }
  3653. get documentInfo() {
  3654. const DocumentInfoValidators = {
  3655. Title: _util.isString,
  3656. Author: _util.isString,
  3657. Subject: _util.isString,
  3658. Keywords: _util.isString,
  3659. Creator: _util.isString,
  3660. Producer: _util.isString,
  3661. CreationDate: _util.isString,
  3662. ModDate: _util.isString,
  3663. Trapped: _primitives.isName
  3664. };
  3665. let version = this._version;
  3666. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3667. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3668. version = null;
  3669. }
  3670. const docInfo = {
  3671. PDFFormatVersion: version,
  3672. IsLinearized: !!this.linearization,
  3673. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3674. IsXFAPresent: this.formInfo.hasXfa,
  3675. IsCollectionPresent: !!this.catalog.collection,
  3676. IsSignaturesPresent: this.formInfo.hasSignatures
  3677. };
  3678. let infoDict;
  3679. try {
  3680. infoDict = this.xref.trailer.get("Info");
  3681. } catch (err) {
  3682. if (err instanceof _core_utils.MissingDataException) {
  3683. throw err;
  3684. }
  3685. (0, _util.info)("The document information dictionary is invalid.");
  3686. }
  3687. if ((0, _primitives.isDict)(infoDict)) {
  3688. for (const key of infoDict.getKeys()) {
  3689. const value = infoDict.get(key);
  3690. if (DocumentInfoValidators[key]) {
  3691. if (DocumentInfoValidators[key](value)) {
  3692. docInfo[key] = typeof value !== "string" ? value : (0, _util.stringToPDFString)(value);
  3693. } else {
  3694. (0, _util.info)(`Bad value in document info for "${key}".`);
  3695. }
  3696. } else if (typeof key === "string") {
  3697. let customValue;
  3698. if ((0, _util.isString)(value)) {
  3699. customValue = (0, _util.stringToPDFString)(value);
  3700. } else if ((0, _primitives.isName)(value) || (0, _util.isNum)(value) || (0, _util.isBool)(value)) {
  3701. customValue = value;
  3702. } else {
  3703. (0, _util.info)(`Unsupported value in document info for (custom) "${key}".`);
  3704. continue;
  3705. }
  3706. if (!docInfo.Custom) {
  3707. docInfo.Custom = Object.create(null);
  3708. }
  3709. docInfo.Custom[key] = customValue;
  3710. }
  3711. }
  3712. }
  3713. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3714. }
  3715. get fingerprints() {
  3716. function validate(data) {
  3717. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3718. }
  3719. function hexString(hash) {
  3720. const buf = [];
  3721. for (let i = 0, ii = hash.length; i < ii; i++) {
  3722. const hex = hash[i].toString(16);
  3723. buf.push(hex.padStart(2, "0"));
  3724. }
  3725. return buf.join("");
  3726. }
  3727. const idArray = this.xref.trailer.get("ID");
  3728. let hashOriginal, hashModified;
  3729. if (Array.isArray(idArray) && validate(idArray[0])) {
  3730. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  3731. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  3732. hashModified = (0, _util.stringToBytes)(idArray[1]);
  3733. }
  3734. } else {
  3735. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3736. }
  3737. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  3738. }
  3739. _getLinearizationPage(pageIndex) {
  3740. const {
  3741. catalog,
  3742. linearization
  3743. } = this;
  3744. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3745. return this.xref.fetchAsync(ref).then(obj => {
  3746. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Type") && obj.has("Contents")) {
  3747. if (ref && !catalog.pageKidsCountCache.has(ref)) {
  3748. catalog.pageKidsCountCache.put(ref, 1);
  3749. }
  3750. return [obj, ref];
  3751. }
  3752. throw new _util.FormatError("The Linearization dictionary doesn't point " + "to a valid Page dictionary.");
  3753. }).catch(reason => {
  3754. (0, _util.info)(reason);
  3755. return catalog.getPageDict(pageIndex);
  3756. });
  3757. }
  3758. getPage(pageIndex) {
  3759. if (this._pagePromises[pageIndex] !== undefined) {
  3760. return this._pagePromises[pageIndex];
  3761. }
  3762. const {
  3763. catalog,
  3764. linearization
  3765. } = this;
  3766. if (this.xfaFactory) {
  3767. return Promise.resolve(new Page({
  3768. pdfManager: this.pdfManager,
  3769. xref: this.xref,
  3770. pageIndex,
  3771. pageDict: _primitives.Dict.empty,
  3772. ref: null,
  3773. globalIdFactory: this._globalIdFactory,
  3774. fontCache: catalog.fontCache,
  3775. builtInCMapCache: catalog.builtInCMapCache,
  3776. standardFontDataCache: catalog.standardFontDataCache,
  3777. globalImageCache: catalog.globalImageCache,
  3778. nonBlendModesSet: catalog.nonBlendModesSet,
  3779. xfaFactory: this.xfaFactory
  3780. }));
  3781. }
  3782. const promise = linearization && linearization.pageFirst === pageIndex ? this._getLinearizationPage(pageIndex) : catalog.getPageDict(pageIndex);
  3783. return this._pagePromises[pageIndex] = promise.then(([pageDict, ref]) => {
  3784. return new Page({
  3785. pdfManager: this.pdfManager,
  3786. xref: this.xref,
  3787. pageIndex,
  3788. pageDict,
  3789. ref,
  3790. globalIdFactory: this._globalIdFactory,
  3791. fontCache: catalog.fontCache,
  3792. builtInCMapCache: catalog.builtInCMapCache,
  3793. standardFontDataCache: catalog.standardFontDataCache,
  3794. globalImageCache: catalog.globalImageCache,
  3795. nonBlendModesSet: catalog.nonBlendModesSet,
  3796. xfaFactory: null
  3797. });
  3798. });
  3799. }
  3800. checkFirstPage() {
  3801. return this.getPage(0).catch(async reason => {
  3802. if (reason instanceof _core_utils.XRefEntryException) {
  3803. this._pagePromises.length = 0;
  3804. await this.cleanup();
  3805. throw new _core_utils.XRefParseException();
  3806. }
  3807. });
  3808. }
  3809. fontFallback(id, handler) {
  3810. return this.catalog.fontFallback(id, handler);
  3811. }
  3812. async cleanup(manuallyTriggered = false) {
  3813. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _primitives.clearPrimitiveCaches)();
  3814. }
  3815. _collectFieldObjects(name, fieldRef, promises) {
  3816. const field = this.xref.fetchIfRef(fieldRef);
  3817. if (field.has("T")) {
  3818. const partName = (0, _util.stringToPDFString)(field.get("T"));
  3819. if (name === "") {
  3820. name = partName;
  3821. } else {
  3822. name = `${name}.${partName}`;
  3823. }
  3824. }
  3825. if (!promises.has(name)) {
  3826. promises.set(name, []);
  3827. }
  3828. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  3829. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  3830. return null;
  3831. }));
  3832. if (field.has("Kids")) {
  3833. const kids = field.get("Kids");
  3834. for (const kid of kids) {
  3835. this._collectFieldObjects(name, kid, promises);
  3836. }
  3837. }
  3838. }
  3839. get fieldObjects() {
  3840. if (!this.formInfo.hasFields) {
  3841. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  3842. }
  3843. const allFields = Object.create(null);
  3844. const fieldPromises = new Map();
  3845. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  3846. this._collectFieldObjects("", fieldRef, fieldPromises);
  3847. }
  3848. const allPromises = [];
  3849. for (const [name, promises] of fieldPromises) {
  3850. allPromises.push(Promise.all(promises).then(fields => {
  3851. fields = fields.filter(field => !!field);
  3852. if (fields.length > 0) {
  3853. allFields[name] = fields;
  3854. }
  3855. }));
  3856. }
  3857. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  3858. }
  3859. get hasJSActions() {
  3860. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  3861. return (0, _util.shadow)(this, "hasJSActions", promise);
  3862. }
  3863. async _parseHasJSActions() {
  3864. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  3865. if (catalogJsActions) {
  3866. return true;
  3867. }
  3868. if (fieldObjects) {
  3869. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  3870. }
  3871. return false;
  3872. }
  3873. get calculationOrderIds() {
  3874. const acroForm = this.catalog.acroForm;
  3875. if (!acroForm || !acroForm.has("CO")) {
  3876. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3877. }
  3878. const calculationOrder = acroForm.get("CO");
  3879. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  3880. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3881. }
  3882. const ids = calculationOrder.filter(_primitives.isRef).map(ref => ref.toString());
  3883. if (ids.length === 0) {
  3884. return (0, _util.shadow)(this, "calculationOrderIds", null);
  3885. }
  3886. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  3887. }
  3888. }
  3889. exports.PDFDocument = PDFDocument;
  3890. /***/ }),
  3891. /* 12 */
  3892. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  3893. Object.defineProperty(exports, "__esModule", ({
  3894. value: true
  3895. }));
  3896. exports.getXfaFontDict = getXfaFontDict;
  3897. exports.getXfaFontName = getXfaFontName;
  3898. var _calibri_factors = __w_pdfjs_require__(13);
  3899. var _primitives = __w_pdfjs_require__(5);
  3900. var _helvetica_factors = __w_pdfjs_require__(14);
  3901. var _liberationsans_widths = __w_pdfjs_require__(15);
  3902. var _myriadpro_factors = __w_pdfjs_require__(16);
  3903. var _segoeui_factors = __w_pdfjs_require__(17);
  3904. var _core_utils = __w_pdfjs_require__(9);
  3905. var _fonts_utils = __w_pdfjs_require__(18);
  3906. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  3907. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  3908. name: "LiberationSans-Regular",
  3909. factors: _myriadpro_factors.MyriadProRegularFactors,
  3910. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  3911. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  3912. metrics: _myriadpro_factors.MyriadProRegularMetrics
  3913. };
  3914. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  3915. name: "LiberationSans-Bold",
  3916. factors: _myriadpro_factors.MyriadProBoldFactors,
  3917. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  3918. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  3919. metrics: _myriadpro_factors.MyriadProBoldMetrics
  3920. };
  3921. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  3922. name: "LiberationSans-Italic",
  3923. factors: _myriadpro_factors.MyriadProItalicFactors,
  3924. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  3925. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  3926. metrics: _myriadpro_factors.MyriadProItalicMetrics
  3927. };
  3928. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  3929. name: "LiberationSans-BoldItalic",
  3930. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  3931. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  3932. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  3933. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  3934. };
  3935. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  3936. name: "LiberationSans-Regular",
  3937. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  3938. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  3939. };
  3940. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  3941. name: "LiberationSans-Bold",
  3942. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  3943. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  3944. };
  3945. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  3946. name: "LiberationSans-Italic",
  3947. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  3948. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  3949. };
  3950. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  3951. name: "LiberationSans-BoldItalic",
  3952. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  3953. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  3954. };
  3955. t["Calibri-Regular"] = {
  3956. name: "LiberationSans-Regular",
  3957. factors: _calibri_factors.CalibriRegularFactors,
  3958. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  3959. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  3960. metrics: _calibri_factors.CalibriRegularMetrics
  3961. };
  3962. t["Calibri-Bold"] = {
  3963. name: "LiberationSans-Bold",
  3964. factors: _calibri_factors.CalibriBoldFactors,
  3965. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  3966. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  3967. metrics: _calibri_factors.CalibriBoldMetrics
  3968. };
  3969. t["Calibri-Italic"] = {
  3970. name: "LiberationSans-Italic",
  3971. factors: _calibri_factors.CalibriItalicFactors,
  3972. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  3973. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  3974. metrics: _calibri_factors.CalibriItalicMetrics
  3975. };
  3976. t["Calibri-BoldItalic"] = {
  3977. name: "LiberationSans-BoldItalic",
  3978. factors: _calibri_factors.CalibriBoldItalicFactors,
  3979. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  3980. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  3981. metrics: _calibri_factors.CalibriBoldItalicMetrics
  3982. };
  3983. t["Segoeui-Regular"] = {
  3984. name: "LiberationSans-Regular",
  3985. factors: _segoeui_factors.SegoeuiRegularFactors,
  3986. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  3987. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  3988. metrics: _segoeui_factors.SegoeuiRegularMetrics
  3989. };
  3990. t["Segoeui-Bold"] = {
  3991. name: "LiberationSans-Bold",
  3992. factors: _segoeui_factors.SegoeuiBoldFactors,
  3993. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  3994. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  3995. metrics: _segoeui_factors.SegoeuiBoldMetrics
  3996. };
  3997. t["Segoeui-Italic"] = {
  3998. name: "LiberationSans-Italic",
  3999. factors: _segoeui_factors.SegoeuiItalicFactors,
  4000. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4001. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4002. metrics: _segoeui_factors.SegoeuiItalicMetrics
  4003. };
  4004. t["Segoeui-BoldItalic"] = {
  4005. name: "LiberationSans-BoldItalic",
  4006. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  4007. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4008. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4009. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  4010. };
  4011. t["Helvetica-Regular"] = t.Helvetica = {
  4012. name: "LiberationSans-Regular",
  4013. factors: _helvetica_factors.HelveticaRegularFactors,
  4014. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4015. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4016. metrics: _helvetica_factors.HelveticaRegularMetrics
  4017. };
  4018. t["Helvetica-Bold"] = {
  4019. name: "LiberationSans-Bold",
  4020. factors: _helvetica_factors.HelveticaBoldFactors,
  4021. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4022. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4023. metrics: _helvetica_factors.HelveticaBoldMetrics
  4024. };
  4025. t["Helvetica-Italic"] = {
  4026. name: "LiberationSans-Italic",
  4027. factors: _helvetica_factors.HelveticaItalicFactors,
  4028. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4029. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4030. metrics: _helvetica_factors.HelveticaItalicMetrics
  4031. };
  4032. t["Helvetica-BoldItalic"] = {
  4033. name: "LiberationSans-BoldItalic",
  4034. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  4035. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4036. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4037. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  4038. };
  4039. });
  4040. function getXfaFontName(name) {
  4041. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  4042. const fontMap = getXFAFontMap();
  4043. return fontMap[fontName];
  4044. }
  4045. function getXfaFontWidths(name) {
  4046. const info = getXfaFontName(name);
  4047. if (!info) {
  4048. return null;
  4049. }
  4050. const {
  4051. baseWidths,
  4052. baseMapping,
  4053. factors
  4054. } = info;
  4055. let rescaledBaseWidths;
  4056. if (!factors) {
  4057. rescaledBaseWidths = baseWidths;
  4058. } else {
  4059. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  4060. }
  4061. let currentCode = -2;
  4062. let currentArray;
  4063. const newWidths = [];
  4064. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  4065. if (unicode === -1) {
  4066. continue;
  4067. }
  4068. if (unicode === currentCode + 1) {
  4069. currentArray.push(rescaledBaseWidths[glyphIndex]);
  4070. currentCode += 1;
  4071. } else {
  4072. currentCode = unicode;
  4073. currentArray = [rescaledBaseWidths[glyphIndex]];
  4074. newWidths.push(unicode, currentArray);
  4075. }
  4076. }
  4077. return newWidths;
  4078. }
  4079. function getXfaFontDict(name) {
  4080. const widths = getXfaFontWidths(name);
  4081. const dict = new _primitives.Dict(null);
  4082. dict.set("BaseFont", _primitives.Name.get(name));
  4083. dict.set("Type", _primitives.Name.get("Font"));
  4084. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  4085. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  4086. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  4087. dict.set("W", widths);
  4088. dict.set("FirstChar", widths[0]);
  4089. dict.set("LastChar", widths[widths.length - 2] + widths[widths.length - 1].length - 1);
  4090. const descriptor = new _primitives.Dict(null);
  4091. dict.set("FontDescriptor", descriptor);
  4092. const systemInfo = new _primitives.Dict(null);
  4093. systemInfo.set("Ordering", "Identity");
  4094. systemInfo.set("Registry", "Adobe");
  4095. systemInfo.set("Supplement", 0);
  4096. dict.set("CIDSystemInfo", systemInfo);
  4097. return dict;
  4098. }
  4099. /***/ }),
  4100. /* 13 */
  4101. /***/ ((__unused_webpack_module, exports) => {
  4102. Object.defineProperty(exports, "__esModule", ({
  4103. value: true
  4104. }));
  4105. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  4106. const CalibriBoldFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.54657, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.73293, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.9121, 0.86943, 0.79795, 0.88198, 0.77958, 0.70864, 0.81055, 0.90399, 0.88653, 0.96017, 0.82577, 0.77892, 0.78257, 0.97507, 1.54657, 0.97507, 0.85284, 0.89552, 0.90176, 0.88762, 0.8785, 0.75241, 0.8785, 0.90518, 0.95015, 0.77618, 0.8785, 0.88401, 0.91916, 0.86304, 0.88401, 0.91488, 0.8785, 0.8801, 0.8785, 0.8785, 0.91343, 0.7173, 1.04106, 0.8785, 0.85075, 0.95794, 0.82616, 0.85162, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.12401, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.73293, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.9121, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.85284, 0.87508, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.8715, 0.75241, 0.90518, 0.90518, 0.90518, 0.90518, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.8785, 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.90747, 0.89049, 0.8785, 0.8785, 0.8785, 0.8785, 0.85162, 0.8785, 0.85162, 0.83908, 0.88762, 0.83908, 0.88762, 0.83908, 0.88762, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.87289, 0.83016, 0.88506, 0.93125, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.81921, 0.77618, 0.81921, 0.77618, 0.81921, 0.77618, 1, 1, 0.87356, 0.8785, 0.91075, 0.89608, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76229, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.79468, 0.91926, 0.88175, 0.70823, 0.94903, 0.9121, 0.8785, 1, 1, 0.9121, 0.8785, 0.87802, 0.88656, 0.8785, 0.86943, 0.8801, 0.86943, 0.8801, 0.86943, 0.8801, 0.87402, 0.89291, 0.77958, 0.91343, 1, 1, 0.77958, 0.91343, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.96017, 0.95794, 0.77892, 0.85162, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.88762, 0.77539, 0.8715, 0.87508, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70674, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.06303, 0.83908, 0.80352, 0.57184, 0.6965, 0.56289, 0.82001, 0.56029, 0.81235, 1.02988, 0.83908, 0.7762, 0.68156, 0.80367, 0.73133, 0.78257, 0.87356, 0.86943, 0.95958, 0.75727, 0.89019, 1.04924, 0.9121, 0.7648, 0.86943, 0.87356, 0.79795, 0.78275, 0.81055, 0.77892, 0.9762, 0.82577, 0.99819, 0.84896, 0.95958, 0.77892, 0.96108, 1.01407, 0.89049, 1.02988, 0.94211, 0.96108, 0.8936, 0.84021, 0.87842, 0.96399, 0.79109, 0.89049, 1.00813, 1.02988, 0.86077, 0.87445, 0.92099, 0.84723, 0.86513, 0.8801, 0.75638, 0.85714, 0.78216, 0.79586, 0.87965, 0.94211, 0.97747, 0.78287, 0.97926, 0.84971, 1.02988, 0.94211, 0.8801, 0.94211, 0.84971, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90264, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90518, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90548, 1, 1, 1, 1, 1, 1, 0.96017, 0.95794, 0.96017, 0.95794, 0.96017, 0.95794, 0.77892, 0.85162, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.92794, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71143, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.93835, 0.83406, 0.91133, 0.84107, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90527, 1.81055, 0.90527, 1.81055, 1.31006, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 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, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4107. exports.CalibriBoldFactors = CalibriBoldFactors;
  4108. const CalibriBoldMetrics = {
  4109. lineHeight: 1.2207,
  4110. lineGap: 0.2207
  4111. };
  4112. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  4113. const CalibriBoldItalicFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.56239, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.71805, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.90872, 0.85938, 0.79795, 0.87068, 0.77958, 0.69766, 0.81055, 0.90399, 0.88653, 0.96068, 0.82577, 0.77892, 0.78257, 0.97507, 1.529, 0.97507, 0.85284, 0.89552, 0.90176, 0.94908, 0.86411, 0.74012, 0.86411, 0.88323, 0.95015, 0.86411, 0.86331, 0.88401, 0.91916, 0.86304, 0.88401, 0.9039, 0.86331, 0.86331, 0.86411, 0.86411, 0.90464, 0.70852, 1.04106, 0.86331, 0.84372, 0.95794, 0.82616, 0.84548, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.19129, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.71805, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.90872, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85284, 0.87068, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.85887, 0.74012, 0.88323, 0.88323, 0.88323, 0.88323, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.90747, 0.89049, 0.86331, 0.86331, 0.86331, 0.86331, 0.84548, 0.86411, 0.84548, 0.83908, 0.94908, 0.83908, 0.94908, 0.83908, 0.94908, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.87289, 0.79538, 0.88506, 0.92726, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.81921, 0.86411, 0.81921, 0.86411, 0.81921, 0.86411, 1, 1, 0.87356, 0.86331, 0.91075, 0.8777, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76467, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.77312, 0.91926, 0.88175, 0.70823, 0.94903, 0.90872, 0.86331, 1, 1, 0.90872, 0.86331, 0.86906, 0.88116, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.87402, 0.86549, 0.77958, 0.90464, 1, 1, 0.77958, 0.90464, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.96068, 0.95794, 0.77892, 0.84548, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.94908, 0.77539, 0.85887, 0.87068, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70088, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.48387, 0.83908, 0.80352, 0.57118, 0.6965, 0.56347, 0.79179, 0.55853, 0.80346, 1.02988, 0.83908, 0.7762, 0.67174, 0.86036, 0.73133, 0.78257, 0.87356, 0.86441, 0.95958, 0.75727, 0.89019, 1.04924, 0.90872, 0.74889, 0.85938, 0.87891, 0.79795, 0.7957, 0.81055, 0.77892, 0.97447, 0.82577, 0.97466, 0.87179, 0.95958, 0.77892, 0.94252, 0.95612, 0.8753, 1.02988, 0.92733, 0.94252, 0.87411, 0.84021, 0.8728, 0.95612, 0.74081, 0.8753, 1.02189, 1.02988, 0.84814, 0.87445, 0.91822, 0.84723, 0.85668, 0.86331, 0.81344, 0.87581, 0.76422, 0.82046, 0.96057, 0.92733, 0.99375, 0.78022, 0.95452, 0.86015, 1.02988, 0.92733, 0.86331, 0.92733, 0.86015, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90631, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88323, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85174, 1, 1, 1, 1, 1, 1, 0.96068, 0.95794, 0.96068, 0.95794, 0.96068, 0.95794, 0.77892, 0.84548, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.89807, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71094, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.92972, 0.83406, 0.91133, 0.83326, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90616, 1.81055, 0.90527, 1.81055, 1.3107, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 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, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4114. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  4115. const CalibriBoldItalicMetrics = {
  4116. lineHeight: 1.2207,
  4117. lineGap: 0.2207
  4118. };
  4119. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  4120. const CalibriItalicFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39543, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.72346, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593, 1.02638, 0.89249, 0.84118, 0.77452, 0.85374, 0.75186, 0.67789, 0.79776, 0.88844, 0.85066, 0.94309, 0.77818, 0.7306, 0.76659, 1.10369, 1.38313, 1.10369, 1.06139, 0.89552, 0.8739, 0.9245, 0.9245, 0.83203, 0.9245, 0.85865, 1.09842, 0.9245, 0.9245, 1.03297, 1.07692, 0.90918, 1.03297, 0.94959, 0.9245, 0.92274, 0.9245, 0.9245, 1.02933, 0.77832, 1.20562, 0.9245, 0.8916, 0.98986, 0.86621, 0.89453, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.16359, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.72346, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89249, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.85284, 0.84557, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.84843, 0.83203, 0.85865, 0.85865, 0.85865, 0.85865, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.9245, 0.92274, 0.92274, 0.92274, 0.92274, 0.92274, 0.90747, 0.86651, 0.9245, 0.9245, 0.9245, 0.9245, 0.89453, 0.9245, 0.89453, 0.8675, 0.9245, 0.8675, 0.9245, 0.8675, 0.9245, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.85193, 0.8875, 0.86477, 0.99034, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.81105, 0.9245, 0.81105, 0.9245, 0.81105, 0.9245, 1, 1, 0.86275, 0.9245, 0.90872, 0.93591, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77896, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.9375, 0.98156, 0.93407, 0.77261, 1.11429, 0.89249, 0.9245, 1, 1, 0.89249, 0.9245, 0.92534, 0.86698, 0.9245, 0.84118, 0.92274, 0.84118, 0.92274, 0.84118, 0.92274, 0.8667, 0.86291, 0.75186, 1.02933, 1, 1, 0.75186, 1.02933, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 1, 1, 0.79776, 0.97655, 0.79776, 1.23023, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.94309, 0.98986, 0.7306, 0.89453, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.9245, 0.76318, 0.84843, 0.84557, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67009, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.8675, 0.90861, 0.6192, 0.7363, 0.64824, 0.82411, 0.56321, 0.85696, 1.23516, 0.8675, 0.81552, 0.7286, 0.84134, 0.73206, 0.76659, 0.86275, 0.84369, 0.90685, 0.77892, 0.85871, 1.02638, 0.89249, 0.75828, 0.84118, 0.85984, 0.77452, 0.76466, 0.79776, 0.7306, 0.90782, 0.77818, 0.903, 0.87291, 0.90685, 0.7306, 0.99058, 1.03667, 0.94635, 1.23516, 0.9849, 0.99058, 0.92393, 0.8916, 0.942, 1.03667, 0.75026, 0.94635, 1.0297, 1.23516, 0.90918, 0.94048, 0.98217, 0.89746, 0.84153, 0.92274, 0.82507, 0.88832, 0.84438, 0.88178, 1.03525, 0.9849, 1.00225, 0.78086, 0.97248, 0.89404, 1.23516, 0.9849, 0.92274, 0.9849, 0.89404, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89693, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85865, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90933, 1, 1, 1, 1, 1, 1, 0.94309, 0.98986, 0.94309, 0.98986, 0.94309, 0.98986, 0.7306, 0.89453, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.68994, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462, 0.97858, 0.82616, 0.91133, 0.83437, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90572, 1.81055, 0.90749, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85284, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 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, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4121. exports.CalibriItalicFactors = CalibriItalicFactors;
  4122. const CalibriItalicMetrics = {
  4123. lineHeight: 1.2207,
  4124. lineGap: 0.2207
  4125. };
  4126. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  4127. const CalibriRegularFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39016, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.73834, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593, 1.02638, 0.89385, 0.85122, 0.77452, 0.86503, 0.75186, 0.68887, 0.79776, 0.88844, 0.85066, 0.94258, 0.77818, 0.7306, 0.76659, 1.10369, 1.39016, 1.10369, 1.06139, 0.89552, 0.8739, 0.86128, 0.94469, 0.8457, 0.94469, 0.89464, 1.09842, 0.84636, 0.94469, 1.03297, 1.07692, 0.90918, 1.03297, 0.95897, 0.94469, 0.9482, 0.94469, 0.94469, 1.04692, 0.78223, 1.20562, 0.94469, 0.90332, 0.98986, 0.86621, 0.90527, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.08707, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.73834, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89385, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85284, 0.85311, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.8693, 0.8457, 0.89464, 0.89464, 0.89464, 0.89464, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.94469, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90747, 0.86651, 0.94469, 0.94469, 0.94469, 0.94469, 0.90527, 0.94469, 0.90527, 0.8675, 0.86128, 0.8675, 0.86128, 0.8675, 0.86128, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.85193, 0.92454, 0.86477, 0.9921, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.81105, 0.84636, 0.81105, 0.84636, 0.81105, 0.84636, 1, 1, 0.86275, 0.94469, 0.90872, 0.95786, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77741, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.90452, 0.98156, 1.11842, 0.77261, 1.11429, 0.89385, 0.94469, 1, 1, 0.89385, 0.94469, 0.95877, 0.86901, 0.94469, 0.85122, 0.9482, 0.85122, 0.9482, 0.85122, 0.9482, 0.8667, 0.90016, 0.75186, 1.04692, 1, 1, 0.75186, 1.04692, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 1, 1, 0.79776, 0.92188, 0.79776, 1.23023, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.94258, 0.98986, 0.7306, 0.90527, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.86128, 0.76318, 0.8693, 0.85311, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67742, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.86686, 0.90861, 0.62267, 0.74359, 0.65649, 0.85498, 0.56963, 0.88254, 1.23516, 0.8675, 0.81552, 0.75443, 0.84503, 0.73206, 0.76659, 0.86275, 0.85122, 0.90685, 0.77892, 0.85746, 1.02638, 0.89385, 0.75657, 0.85122, 0.86275, 0.77452, 0.74171, 0.79776, 0.7306, 0.95165, 0.77818, 0.89772, 0.88831, 0.90685, 0.7306, 0.98142, 1.02191, 0.96576, 1.23516, 0.99018, 0.98142, 0.9236, 0.89258, 0.94035, 1.02191, 0.78848, 0.96576, 0.9561, 1.23516, 0.90918, 0.92578, 0.95424, 0.89746, 0.83969, 0.9482, 0.80113, 0.89442, 0.85208, 0.86155, 0.98022, 0.99018, 1.00452, 0.81209, 0.99247, 0.89181, 1.23516, 0.99018, 0.9482, 0.99018, 0.89181, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88844, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89464, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96766, 1, 1, 1, 1, 1, 1, 0.94258, 0.98986, 0.94258, 0.98986, 0.94258, 0.98986, 0.7306, 0.90527, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.69043, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462, 0.99331, 0.82616, 0.91133, 0.84286, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90527, 1.81055, 0.90527, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 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, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1.07185, 0.99413, 0.96334, 1.08065, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4128. exports.CalibriRegularFactors = CalibriRegularFactors;
  4129. const CalibriRegularMetrics = {
  4130. lineHeight: 1.2207,
  4131. lineGap: 0.2207
  4132. };
  4133. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  4134. /***/ }),
  4135. /* 14 */
  4136. /***/ ((__unused_webpack_module, exports) => {
  4137. Object.defineProperty(exports, "__esModule", ({
  4138. value: true
  4139. }));
  4140. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  4141. const HelveticaBoldFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.03374, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00042, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.03828, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00034, 0.99977, 1, 0.99997, 1.00026, 1.00078, 1.00036, 0.99973, 1.00013, 1.0006, 0.99977, 0.99977, 0.99988, 0.85148, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 1.00069, 1.00022, 0.99977, 1.00001, 0.99984, 1.00026, 1.00001, 1.00024, 1.00001, 0.9999, 1, 1.0006, 1.00001, 1.00041, 0.99962, 1.00026, 1.0006, 0.99995, 1.00041, 0.99942, 0.99973, 0.99927, 1.00082, 0.99902, 1.00026, 1.00087, 1.0006, 1.00069, 0.99973, 0.99867, 0.99973, 0.9993, 1.00026, 1.00049, 1.00056, 1, 0.99988, 0.99935, 0.99995, 0.99954, 1.00055, 0.99945, 1.00032, 1.0006, 0.99995, 1.00026, 0.99995, 1.00032, 1.00001, 1.00008, 0.99971, 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047, 1, 0.99942, 0.99561, 0.99989, 1.00035, 0.99977, 1.00035, 0.99977, 1.00019, 0.99944, 1.00001, 1.00021, 0.99926, 1.00035, 1.00035, 0.99942, 1.00048, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.99989, 1.00057, 1.00001, 0.99936, 1.00052, 1.00012, 0.99996, 1.00043, 1, 1.00035, 0.9994, 0.99976, 1.00035, 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 1.00002, 0.99986, 1.00041, 1.00041, 0.99902, 0.9996, 1.00034, 0.99999, 1.00026, 0.99999, 1.00026, 0.99973, 1.00052, 0.99973, 1, 0.99973, 1.00041, 1.00075, 0.9994, 1.0003, 0.99999, 1, 1.00041, 0.99955, 1, 0.99915, 0.99973, 0.99973, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911, 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 1.00041, 0.99973, 0.99999, 1, 1, 1.00038, 1.0005, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 1.00047, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4142. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  4143. const HelveticaBoldMetrics = {
  4144. lineHeight: 1.2,
  4145. lineGap: 0.2
  4146. };
  4147. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  4148. const HelveticaBoldItalicFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.0044, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99971, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.01011, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99977, 1, 1, 1.00026, 0.99969, 0.99972, 0.99981, 0.9998, 1.0006, 0.99977, 0.99977, 1.00022, 0.91155, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 0.99966, 1.00022, 1.00032, 1.00001, 0.99944, 1.00026, 1.00001, 0.99968, 1.00001, 1.00047, 1, 1.0006, 1.00001, 0.99981, 1.00101, 1.00026, 1.0006, 0.99948, 0.99981, 1.00064, 0.99973, 0.99942, 1.00101, 1.00061, 1.00026, 1.00069, 1.0006, 1.00014, 0.99973, 1.01322, 0.99973, 1.00065, 1.00026, 1.00012, 0.99923, 1, 1.00064, 1.00076, 0.99948, 1.00055, 1.00063, 1.00007, 0.99943, 1.0006, 0.99948, 1.00026, 0.99948, 0.99943, 1.00001, 1.00001, 1.00029, 1.00038, 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057, 0.99989, 0.99967, 0.99964, 0.99967, 0.99977, 0.99999, 0.99977, 1.00038, 0.99977, 1.00001, 0.99973, 1.00066, 0.99967, 0.99967, 1.00041, 0.99998, 0.99999, 0.99977, 1.00022, 0.99967, 1.00001, 0.99977, 1.00026, 0.99964, 1.00031, 1.00001, 0.99999, 0.99999, 1, 1.00023, 1, 1, 0.99999, 1.00035, 1.00001, 0.99999, 0.99973, 0.99977, 0.99999, 1.00058, 0.99973, 0.99973, 0.99955, 0.9995, 1.00026, 1.00026, 1.00032, 0.99989, 1.00034, 0.99999, 1.00026, 1.00026, 1.00026, 0.99973, 0.45998, 0.99973, 1.00026, 0.99973, 1.00001, 0.99999, 0.99982, 0.99994, 0.99996, 1, 1.00042, 1.00044, 1.00029, 1.00023, 0.99973, 0.99973, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006, 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.98685, 0.99973, 1.00026, 1, 1, 0.99966, 1.00044, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1, 0.99973, 0.99971, 0.99978, 1, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00098, 1, 1, 1, 1.00049, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4149. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  4150. const HelveticaBoldItalicMetrics = {
  4151. lineHeight: 1.35,
  4152. lineGap: 0.2
  4153. };
  4154. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  4155. const HelveticaItalicFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.0288, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 0.99946, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.06311, 0.99973, 1.00024, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00041, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.89547, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00001, 1, 1.00054, 0.99977, 1.00084, 1.00007, 0.99973, 1.00013, 0.99924, 1.00001, 1.00001, 0.99945, 0.91221, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00001, 0.99999, 0.99977, 0.99933, 1.00022, 1.00054, 1.00001, 1.00065, 1.00026, 1.00001, 1.0001, 1.00001, 1.00052, 1, 1.0006, 1.00001, 0.99945, 0.99897, 0.99968, 0.99924, 1.00036, 0.99945, 0.99949, 1, 1.0006, 0.99897, 0.99918, 0.99968, 0.99911, 0.99924, 1, 0.99962, 1.01487, 1, 1.0005, 0.99973, 1.00012, 1.00043, 1, 0.99995, 0.99994, 1.00036, 0.99947, 1.00019, 1.00063, 1.00025, 0.99924, 1.00036, 0.99973, 1.00036, 1.00025, 1.00001, 1.00001, 1.00027, 1.0001, 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972, 0.9994, 0.99954, 0.99975, 1.00051, 1.00001, 1.00019, 1.00001, 1.0001, 0.99986, 1.00001, 1.00001, 1.00038, 0.99954, 0.99954, 0.9994, 1.00066, 0.99999, 0.99977, 1.00022, 1.00054, 1.00001, 0.99977, 1.00026, 0.99975, 1.0001, 1.00001, 0.99993, 0.9995, 0.99955, 1.00016, 0.99978, 0.99974, 1.00019, 1.00022, 0.99955, 1.00053, 0.99973, 1.00089, 1.00005, 0.99967, 1.00048, 0.99973, 1.00002, 1.00034, 0.99973, 0.99973, 0.99964, 1.00006, 1.00066, 0.99947, 0.99973, 0.98894, 0.99973, 1, 0.44898, 1, 0.99946, 1, 1.00039, 1.00082, 0.99991, 0.99991, 0.99985, 1.00022, 1.00023, 1.00061, 1.00006, 0.99966, 0.99973, 0.99973, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924, 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 0.98332, 1, 0.99973, 1, 1, 0.99962, 0.99895, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 1.00423, 0.99925, 0.99999, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00049, 1, 1.00245, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 1.00003, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4156. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  4157. const HelveticaItalicMetrics = {
  4158. lineHeight: 1.35,
  4159. lineGap: 0.2
  4160. };
  4161. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  4162. const HelveticaRegularFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.04596, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 1.00019, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.02572, 0.99973, 1.00005, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99999, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.84533, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99928, 1, 0.99977, 1.00013, 1.00055, 0.99947, 0.99945, 0.99941, 0.99924, 1.00001, 1.00001, 1.0004, 0.91621, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00005, 0.99999, 0.99977, 1.00015, 1.00022, 0.99977, 1.00001, 0.99973, 1.00026, 1.00001, 1.00019, 1.00001, 0.99946, 1, 1.0006, 1.00001, 0.99978, 1.00045, 0.99973, 0.99924, 1.00023, 0.99978, 0.99966, 1, 1.00065, 1.00045, 1.00019, 0.99973, 0.99973, 0.99924, 1, 1, 0.96499, 1, 1.00055, 0.99973, 1.00008, 1.00027, 1, 0.9997, 0.99995, 1.00023, 0.99933, 1.00019, 1.00015, 1.00031, 0.99924, 1.00023, 0.99973, 1.00023, 1.00031, 1.00001, 0.99928, 1.00029, 1.00092, 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082, 0.99561, 0.9996, 1.00035, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964, 1.00001, 0.99963, 0.99999, 1.00035, 1.00035, 1.00082, 0.99962, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.9996, 0.99967, 1.00001, 1.00034, 1.00074, 1.00054, 1.00053, 1.00063, 0.99971, 0.99962, 1.00035, 0.99975, 0.99977, 0.99973, 1.00043, 0.99953, 1.0007, 0.99915, 0.99973, 1.00008, 0.99892, 1.00073, 1.00073, 1.00114, 0.99915, 1.00073, 0.99955, 0.99973, 1.00092, 0.99973, 1, 0.99998, 1, 1.0003, 1, 1.00043, 1.00001, 0.99969, 1.0003, 1, 1.00035, 1.00001, 0.9995, 1, 1.00092, 0.99973, 0.99973, 0.99973, 1.0007, 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973, 1.00114, 1.00073, 1, 0.99955, 1, 1, 1.00047, 0.99968, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 0.99925, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4163. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  4164. const HelveticaRegularMetrics = {
  4165. lineHeight: 1.2,
  4166. lineGap: 0.2
  4167. };
  4168. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  4169. /***/ }),
  4170. /* 15 */
  4171. /***/ ((__unused_webpack_module, exports) => {
  4172. Object.defineProperty(exports, "__esModule", ({
  4173. value: true
  4174. }));
  4175. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  4176. const LiberationSansBoldWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 719, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 785, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 385, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 465, 722, 333, 853, 906, 474, 825, 927, 838, 278, 722, 722, 601, 719, 667, 611, 722, 778, 278, 722, 667, 833, 722, 644, 778, 722, 667, 600, 611, 667, 821, 667, 809, 802, 278, 667, 615, 451, 611, 278, 582, 615, 610, 556, 606, 475, 460, 611, 541, 278, 558, 556, 612, 556, 445, 611, 766, 619, 520, 684, 446, 582, 715, 576, 753, 845, 278, 582, 611, 582, 845, 667, 669, 885, 567, 711, 667, 278, 276, 556, 1094, 1062, 875, 610, 722, 622, 719, 722, 719, 722, 567, 712, 667, 904, 626, 719, 719, 610, 702, 833, 722, 778, 719, 667, 722, 611, 622, 854, 667, 730, 703, 1005, 1019, 870, 979, 719, 711, 1031, 719, 556, 618, 615, 417, 635, 556, 709, 497, 615, 615, 500, 635, 740, 604, 611, 604, 611, 556, 490, 556, 875, 556, 615, 581, 833, 844, 729, 854, 615, 552, 854, 583, 556, 556, 611, 417, 552, 556, 278, 281, 278, 969, 906, 611, 500, 615, 556, 604, 778, 611, 487, 447, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1094, 556, 885, 489, 1115, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
  4177. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  4178. const LiberationSansBoldMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  4179. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  4180. const LiberationSansBoldItalicWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 740, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 782, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 396, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 722, 333, 854, 906, 473, 844, 930, 847, 278, 722, 722, 610, 671, 667, 611, 722, 778, 278, 722, 667, 833, 722, 657, 778, 718, 667, 590, 611, 667, 822, 667, 829, 781, 278, 667, 620, 479, 611, 278, 591, 620, 621, 556, 610, 479, 492, 611, 558, 278, 566, 556, 603, 556, 450, 611, 712, 605, 532, 664, 409, 591, 704, 578, 773, 834, 278, 591, 611, 591, 834, 667, 667, 886, 614, 719, 667, 278, 278, 556, 1094, 1042, 854, 622, 719, 677, 719, 722, 708, 722, 614, 722, 667, 927, 643, 719, 719, 615, 687, 833, 722, 778, 719, 667, 722, 611, 677, 781, 667, 729, 708, 979, 989, 854, 1000, 708, 719, 1042, 729, 556, 619, 604, 534, 618, 556, 736, 510, 611, 611, 507, 622, 740, 604, 611, 611, 611, 556, 889, 556, 885, 556, 646, 583, 889, 935, 707, 854, 594, 552, 865, 589, 556, 556, 611, 469, 563, 556, 278, 278, 278, 969, 906, 611, 507, 619, 556, 611, 778, 611, 575, 467, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1104, 556, 885, 516, 1146, 1000, 768, 600, 834, 834, 834, 834, 999, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
  4181. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  4182. const LiberationSansBoldItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  4183. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  4184. const LiberationSansItalicWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 625, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 733, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 281, 556, 400, 556, 222, 722, 556, 722, 556, 722, 556, 615, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 354, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 789, 846, 389, 794, 865, 775, 222, 667, 667, 570, 671, 667, 611, 722, 778, 278, 667, 667, 833, 722, 648, 778, 725, 667, 600, 611, 667, 837, 667, 831, 761, 278, 667, 570, 439, 555, 222, 550, 570, 571, 500, 556, 439, 463, 555, 542, 222, 500, 492, 548, 500, 447, 556, 670, 573, 486, 603, 374, 550, 652, 546, 728, 779, 222, 550, 556, 550, 779, 667, 667, 843, 544, 708, 667, 278, 278, 500, 1066, 982, 844, 589, 715, 639, 724, 667, 651, 667, 544, 704, 667, 917, 614, 715, 715, 589, 686, 833, 722, 778, 725, 667, 722, 611, 639, 795, 667, 727, 673, 920, 923, 805, 886, 651, 694, 1022, 682, 556, 562, 522, 493, 553, 556, 688, 465, 556, 556, 472, 564, 686, 550, 556, 556, 556, 500, 833, 500, 835, 500, 572, 518, 830, 851, 621, 736, 526, 492, 752, 534, 556, 556, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556, 472, 565, 500, 556, 778, 556, 492, 339, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1083, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 998, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 584, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
  4185. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  4186. const LiberationSansItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  4187. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  4188. const LiberationSansRegularWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 615, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 735, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 292, 556, 334, 556, 222, 722, 556, 722, 556, 722, 556, 604, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 375, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 784, 838, 384, 774, 855, 752, 222, 667, 667, 551, 668, 667, 611, 722, 778, 278, 667, 668, 833, 722, 650, 778, 722, 667, 618, 611, 667, 798, 667, 835, 748, 278, 667, 578, 446, 556, 222, 547, 578, 575, 500, 557, 446, 441, 556, 556, 222, 500, 500, 576, 500, 448, 556, 690, 569, 482, 617, 395, 547, 648, 525, 713, 781, 222, 547, 556, 547, 781, 667, 667, 865, 542, 719, 667, 278, 278, 500, 1057, 1010, 854, 583, 722, 635, 719, 667, 656, 667, 542, 677, 667, 923, 604, 719, 719, 583, 656, 833, 722, 778, 719, 667, 722, 611, 635, 760, 667, 740, 667, 917, 938, 792, 885, 656, 719, 1010, 722, 556, 573, 531, 365, 583, 556, 669, 458, 559, 559, 438, 583, 688, 552, 556, 542, 556, 500, 458, 500, 823, 500, 573, 521, 802, 823, 625, 719, 521, 510, 750, 542, 556, 556, 556, 365, 510, 500, 222, 278, 222, 906, 812, 556, 438, 559, 500, 552, 778, 556, 489, 411, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1073, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
  4189. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  4190. const LiberationSansRegularMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  4191. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  4192. /***/ }),
  4193. /* 16 */
  4194. /***/ ((__unused_webpack_module, exports) => {
  4195. Object.defineProperty(exports, "__esModule", ({
  4196. value: true
  4197. }));
  4198. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  4199. const MyriadProBoldFactors = [1.36898, 1, 1, 0.72706, 0.80479, 0.83734, 0.98894, 0.99793, 0.9897, 0.93884, 0.86209, 0.94292, 0.94292, 1.16661, 1.02058, 0.93582, 0.96694, 0.93582, 1.19137, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.72851, 0.78966, 0.90838, 0.83637, 0.82391, 0.96376, 0.80061, 0.86275, 0.8768, 0.95407, 1.0258, 0.73901, 0.85022, 0.83655, 1.0156, 0.95546, 0.92179, 0.87107, 0.92179, 0.82114, 0.8096, 0.89713, 0.94438, 0.95353, 0.94083, 0.91905, 0.90406, 0.9446, 0.94292, 1.18777, 0.94292, 1.02058, 0.89903, 0.90088, 0.94938, 0.97898, 0.81093, 0.97571, 0.94938, 1.024, 0.9577, 0.95933, 0.98621, 1.0474, 0.97455, 0.98981, 0.9672, 0.95933, 0.9446, 0.97898, 0.97407, 0.97646, 0.78036, 1.10208, 0.95442, 0.95298, 0.97579, 0.9332, 0.94039, 0.938, 0.80687, 1.01149, 0.80687, 1.02058, 0.80479, 0.99793, 0.99793, 0.99793, 0.99793, 1.01149, 1.00872, 0.90088, 0.91882, 1.0213, 0.8361, 1.02058, 0.62295, 0.54324, 0.89022, 1.08595, 1, 1, 0.90088, 1, 0.97455, 0.93582, 0.90088, 1, 1.05686, 0.8361, 0.99642, 0.99642, 0.99642, 0.72851, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.868, 0.82391, 0.80061, 0.80061, 0.80061, 0.80061, 1.0258, 1.0258, 1.0258, 1.0258, 0.97484, 0.95546, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 1.02058, 0.92179, 0.94438, 0.94438, 0.94438, 0.94438, 0.90406, 0.86958, 0.98225, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.9031, 0.81093, 0.94938, 0.94938, 0.94938, 0.94938, 0.98621, 0.98621, 0.98621, 0.98621, 0.93969, 0.95933, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 1.08595, 0.9446, 0.95442, 0.95442, 0.95442, 0.95442, 0.94039, 0.97898, 0.94039, 0.90838, 0.94938, 0.90838, 0.94938, 0.90838, 0.94938, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.96376, 0.84313, 0.97484, 0.97571, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.8768, 0.9577, 0.8768, 0.9577, 0.8768, 0.9577, 1, 1, 0.95407, 0.95933, 0.97069, 0.95933, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 0.887, 1.01591, 0.73901, 1.0474, 1, 1, 0.97455, 0.83655, 0.98981, 1, 1, 0.83655, 0.73977, 0.83655, 0.73903, 0.84638, 1.033, 0.95546, 0.95933, 1, 1, 0.95546, 0.95933, 0.8271, 0.95417, 0.95933, 0.92179, 0.9446, 0.92179, 0.9446, 0.92179, 0.9446, 0.936, 0.91964, 0.82114, 0.97646, 1, 1, 0.82114, 0.97646, 0.8096, 0.78036, 0.8096, 0.78036, 1, 1, 0.8096, 0.78036, 1, 1, 0.89713, 0.77452, 0.89713, 1.10208, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94083, 0.97579, 0.90406, 0.94039, 0.90406, 0.9446, 0.938, 0.9446, 0.938, 0.9446, 0.938, 1, 0.99793, 0.90838, 0.94938, 0.868, 0.9031, 0.92179, 0.9446, 1, 1, 0.89713, 1.10208, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90989, 0.9358, 0.91945, 0.83181, 0.75261, 0.87992, 0.82976, 0.96034, 0.83689, 0.97268, 1.0078, 0.90838, 0.83637, 0.8019, 0.90157, 0.80061, 0.9446, 0.95407, 0.92436, 1.0258, 0.85022, 0.97153, 1.0156, 0.95546, 0.89192, 0.92179, 0.92361, 0.87107, 0.96318, 0.89713, 0.93704, 0.95638, 0.91905, 0.91709, 0.92796, 1.0258, 0.93704, 0.94836, 1.0373, 0.95933, 1.0078, 0.95871, 0.94836, 0.96174, 0.92601, 0.9498, 0.98607, 0.95776, 0.95933, 1.05453, 1.0078, 0.98275, 0.9314, 0.95617, 0.91701, 1.05993, 0.9446, 0.78367, 0.9553, 1, 0.86832, 1.0128, 0.95871, 0.99394, 0.87548, 0.96361, 0.86774, 1.0078, 0.95871, 0.9446, 0.95871, 0.86774, 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, 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, 0.94083, 0.97579, 0.94083, 0.97579, 0.94083, 0.97579, 0.90406, 0.94039, 0.96694, 1, 0.89903, 1, 1, 1, 0.93582, 0.93582, 0.93582, 1, 0.908, 0.908, 0.918, 0.94219, 0.94219, 0.96544, 1, 1.285, 1, 1, 0.81079, 0.81079, 1, 1, 0.74854, 1, 1, 1, 1, 0.99793, 1, 1, 1, 0.65, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.17173, 1, 0.80535, 0.76169, 1.02058, 1.0732, 1.05486, 1, 1, 1.30692, 1.08595, 1.08595, 1, 1.08595, 1.08595, 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, 1, 1, 1, 1, 1, 1.16161, 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];
  4200. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  4201. const MyriadProBoldMetrics = {
  4202. lineHeight: 1.2,
  4203. lineGap: 0.2
  4204. };
  4205. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  4206. const MyriadProBoldItalicFactors = [1.36898, 1, 1, 0.66227, 0.80779, 0.81625, 0.97276, 0.97276, 0.97733, 0.92222, 0.83266, 0.94292, 0.94292, 1.16148, 1.02058, 0.93582, 0.96694, 0.93582, 1.17337, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.71541, 0.76813, 0.85576, 0.80591, 0.80729, 0.94299, 0.77512, 0.83655, 0.86523, 0.92222, 0.98621, 0.71743, 0.81698, 0.79726, 0.98558, 0.92222, 0.90637, 0.83809, 0.90637, 0.80729, 0.76463, 0.86275, 0.90699, 0.91605, 0.9154, 0.85308, 0.85458, 0.90531, 0.94292, 1.21296, 0.94292, 1.02058, 0.89903, 1.18616, 0.99613, 0.91677, 0.78216, 0.91677, 0.90083, 0.98796, 0.9135, 0.92168, 0.95381, 0.98981, 0.95298, 0.95381, 0.93459, 0.92168, 0.91513, 0.92004, 0.91677, 0.95077, 0.748, 1.04502, 0.91677, 0.92061, 0.94236, 0.89544, 0.89364, 0.9, 0.80687, 0.8578, 0.80687, 1.02058, 0.80779, 0.97276, 0.97276, 0.97276, 0.97276, 0.8578, 0.99973, 1.18616, 0.91339, 1.08074, 0.82891, 1.02058, 0.55509, 0.71526, 0.89022, 1.08595, 1, 1, 1.18616, 1, 0.96736, 0.93582, 1.18616, 1, 1.04864, 0.82711, 0.99043, 0.99043, 0.99043, 0.71541, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.845, 0.80729, 0.77512, 0.77512, 0.77512, 0.77512, 0.98621, 0.98621, 0.98621, 0.98621, 0.95961, 0.92222, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 1.02058, 0.90251, 0.90699, 0.90699, 0.90699, 0.90699, 0.85458, 0.83659, 0.94951, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.85811, 0.78216, 0.90083, 0.90083, 0.90083, 0.90083, 0.95381, 0.95381, 0.95381, 0.95381, 0.9135, 0.92168, 0.91513, 0.91513, 0.91513, 0.91513, 0.91513, 1.08595, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.89364, 0.92332, 0.89364, 0.85576, 0.99613, 0.85576, 0.99613, 0.85576, 0.99613, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.94299, 0.76783, 0.95961, 0.91677, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.86523, 0.9135, 0.86523, 0.9135, 0.86523, 0.9135, 1, 1, 0.92222, 0.92168, 0.92222, 0.92168, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.86036, 0.97096, 0.71743, 0.98981, 1, 1, 0.95298, 0.79726, 0.95381, 1, 1, 0.79726, 0.6894, 0.79726, 0.74321, 0.81691, 1.0006, 0.92222, 0.92168, 1, 1, 0.92222, 0.92168, 0.79464, 0.92098, 0.92168, 0.90637, 0.91513, 0.90637, 0.91513, 0.90637, 0.91513, 0.909, 0.87514, 0.80729, 0.95077, 1, 1, 0.80729, 0.95077, 0.76463, 0.748, 0.76463, 0.748, 1, 1, 0.76463, 0.748, 1, 1, 0.86275, 0.72651, 0.86275, 1.04502, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.9154, 0.94236, 0.85458, 0.89364, 0.85458, 0.90531, 0.9, 0.90531, 0.9, 0.90531, 0.9, 1, 0.97276, 0.85576, 0.99613, 0.845, 0.85811, 0.90251, 0.91677, 1, 1, 0.86275, 1.04502, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.00899, 1.30628, 0.85576, 0.80178, 0.66862, 0.7927, 0.69323, 0.88127, 0.72459, 0.89711, 0.95381, 0.85576, 0.80591, 0.7805, 0.94729, 0.77512, 0.90531, 0.92222, 0.90637, 0.98621, 0.81698, 0.92655, 0.98558, 0.92222, 0.85359, 0.90637, 0.90976, 0.83809, 0.94523, 0.86275, 0.83509, 0.93157, 0.85308, 0.83392, 0.92346, 0.98621, 0.83509, 0.92886, 0.91324, 0.92168, 0.95381, 0.90646, 0.92886, 0.90557, 0.86847, 0.90276, 0.91324, 0.86842, 0.92168, 0.99531, 0.95381, 0.9224, 0.85408, 0.92699, 0.86847, 1.0051, 0.91513, 0.80487, 0.93481, 1, 0.88159, 1.05214, 0.90646, 0.97355, 0.81539, 0.89398, 0.85923, 0.95381, 0.90646, 0.91513, 0.90646, 0.85923, 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, 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, 0.9154, 0.94236, 0.9154, 0.94236, 0.9154, 0.94236, 0.85458, 0.89364, 0.96694, 1, 0.89903, 1, 1, 1, 0.91782, 0.91782, 0.91782, 1, 0.896, 0.896, 0.896, 0.9332, 0.9332, 0.95973, 1, 1.26, 1, 1, 0.80479, 0.80178, 1, 1, 0.85633, 1, 1, 1, 1, 0.97276, 1, 1, 1, 0.698, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.14542, 1, 0.79199, 0.78694, 1.02058, 1.03493, 1.05486, 1, 1, 1.23026, 1.08595, 1.08595, 1, 1.08595, 1.08595, 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, 1, 1, 1, 1, 1, 1.20006, 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];
  4207. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  4208. const MyriadProBoldItalicMetrics = {
  4209. lineHeight: 1.2,
  4210. lineGap: 0.2
  4211. };
  4212. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  4213. const MyriadProItalicFactors = [1.36898, 1, 1, 0.65507, 0.84943, 0.85639, 0.88465, 0.88465, 0.86936, 0.88307, 0.86948, 0.85283, 0.85283, 1.06383, 1.02058, 0.75945, 0.9219, 0.75945, 1.17337, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.75945, 0.75945, 1.02058, 1.02058, 1.02058, 0.69046, 0.70926, 0.85158, 0.77812, 0.76852, 0.89591, 0.70466, 0.76125, 0.80094, 0.86822, 0.83864, 0.728, 0.77212, 0.79475, 0.93637, 0.87514, 0.8588, 0.76013, 0.8588, 0.72421, 0.69866, 0.77598, 0.85991, 0.80811, 0.87832, 0.78112, 0.77512, 0.8562, 1.0222, 1.18417, 1.0222, 1.27014, 0.89903, 1.15012, 0.93859, 0.94399, 0.846, 0.94399, 0.81453, 1.0186, 0.94219, 0.96017, 1.03075, 1.02175, 0.912, 1.03075, 0.96998, 0.96017, 0.93859, 0.94399, 0.94399, 0.95493, 0.746, 1.12658, 0.94578, 0.91, 0.979, 0.882, 0.882, 0.83, 0.85034, 0.83537, 0.85034, 1.02058, 0.70869, 0.88465, 0.88465, 0.88465, 0.88465, 0.83537, 0.90083, 1.15012, 0.9161, 0.94565, 0.73541, 1.02058, 0.53609, 0.69353, 0.79519, 1.08595, 1, 1, 1.15012, 1, 0.91974, 0.75945, 1.15012, 1, 0.9446, 0.73361, 0.9005, 0.9005, 0.9005, 0.62864, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.773, 0.76852, 0.70466, 0.70466, 0.70466, 0.70466, 0.83864, 0.83864, 0.83864, 0.83864, 0.90561, 0.87514, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 1.02058, 0.85751, 0.85991, 0.85991, 0.85991, 0.85991, 0.77512, 0.76013, 0.88075, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.8075, 0.846, 0.81453, 0.81453, 0.81453, 0.81453, 0.82424, 0.82424, 0.82424, 0.82424, 0.9278, 0.96017, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 1.08595, 0.8562, 0.94578, 0.94578, 0.94578, 0.94578, 0.882, 0.94578, 0.882, 0.85158, 0.93859, 0.85158, 0.93859, 0.85158, 0.93859, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.89591, 0.8544, 0.90561, 0.94399, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.80094, 0.94219, 0.80094, 0.94219, 0.80094, 0.94219, 1, 1, 0.86822, 0.96017, 0.86822, 0.96017, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 1.03075, 0.83864, 0.82424, 0.81402, 1.02738, 0.728, 1.02175, 1, 1, 0.912, 0.79475, 1.03075, 1, 1, 0.79475, 0.83911, 0.79475, 0.66266, 0.80553, 1.06676, 0.87514, 0.96017, 1, 1, 0.87514, 0.96017, 0.86865, 0.87396, 0.96017, 0.8588, 0.93859, 0.8588, 0.93859, 0.8588, 0.93859, 0.867, 0.84759, 0.72421, 0.95493, 1, 1, 0.72421, 0.95493, 0.69866, 0.746, 0.69866, 0.746, 1, 1, 0.69866, 0.746, 1, 1, 0.77598, 0.88417, 0.77598, 1.12658, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.87832, 0.979, 0.77512, 0.882, 0.77512, 0.8562, 0.83, 0.8562, 0.83, 0.8562, 0.83, 1, 0.88465, 0.85158, 0.93859, 0.773, 0.8075, 0.85751, 0.8562, 1, 1, 0.77598, 1.12658, 1.15012, 1.15012, 1.15012, 1.15012, 1.15012, 1.15313, 1.15012, 1.15012, 1.15012, 1.08106, 1.03901, 0.85158, 0.77025, 0.62264, 0.7646, 0.65351, 0.86026, 0.69461, 0.89947, 1.03075, 0.85158, 0.77812, 0.76449, 0.88836, 0.70466, 0.8562, 0.86822, 0.8588, 0.83864, 0.77212, 0.85308, 0.93637, 0.87514, 0.82352, 0.8588, 0.85701, 0.76013, 0.89058, 0.77598, 0.8156, 0.82565, 0.78112, 0.77899, 0.89386, 0.83864, 0.8156, 0.9486, 0.92388, 0.96186, 1.03075, 0.91123, 0.9486, 0.93298, 0.878, 0.93942, 0.92388, 0.84596, 0.96186, 0.95119, 1.03075, 0.922, 0.88787, 0.95829, 0.88, 0.93559, 0.93859, 0.78815, 0.93758, 1, 0.89217, 1.03737, 0.91123, 0.93969, 0.77487, 0.85769, 0.86799, 1.03075, 0.91123, 0.93859, 0.91123, 0.86799, 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, 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, 0.87832, 0.979, 0.87832, 0.979, 0.87832, 0.979, 0.77512, 0.882, 0.9219, 1, 0.89903, 1, 1, 1, 0.87321, 0.87321, 0.87321, 1, 1.027, 1.027, 1.027, 0.86847, 0.86847, 0.79121, 1, 1.124, 1, 1, 0.73572, 0.73572, 1, 1, 0.85034, 1, 1, 1, 1, 0.88465, 1, 1, 1, 0.669, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04828, 1, 0.74948, 0.75187, 1.02058, 0.98391, 1.02119, 1, 1, 1.06233, 1.08595, 1.08595, 1, 1.08595, 1.08595, 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, 1, 1, 1, 1, 1, 1.05233, 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];
  4214. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  4215. const MyriadProItalicMetrics = {
  4216. lineHeight: 1.2,
  4217. lineGap: 0.2
  4218. };
  4219. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  4220. const MyriadProRegularFactors = [1.36898, 1, 1, 0.76305, 0.82784, 0.94935, 0.89364, 0.92241, 0.89073, 0.90706, 0.98472, 0.85283, 0.85283, 1.0664, 1.02058, 0.74505, 0.9219, 0.74505, 1.23456, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.74505, 0.74505, 1.02058, 1.02058, 1.02058, 0.73002, 0.72601, 0.91755, 0.8126, 0.80314, 0.92222, 0.73764, 0.79726, 0.83051, 0.90284, 0.86023, 0.74, 0.8126, 0.84869, 0.96518, 0.91115, 0.8858, 0.79761, 0.8858, 0.74498, 0.73914, 0.81363, 0.89591, 0.83659, 0.89633, 0.85608, 0.8111, 0.90531, 1.0222, 1.22736, 1.0222, 1.27014, 0.89903, 0.90088, 0.86667, 1.0231, 0.896, 1.01411, 0.90083, 1.05099, 1.00512, 0.99793, 1.05326, 1.09377, 0.938, 1.06226, 1.00119, 0.99793, 0.98714, 1.0231, 1.01231, 0.98196, 0.792, 1.19137, 0.99074, 0.962, 1.01915, 0.926, 0.942, 0.856, 0.85034, 0.92006, 0.85034, 1.02058, 0.69067, 0.92241, 0.92241, 0.92241, 0.92241, 0.92006, 0.9332, 0.90088, 0.91882, 0.93484, 0.75339, 1.02058, 0.56866, 0.54324, 0.79519, 1.08595, 1, 1, 0.90088, 1, 0.95325, 0.74505, 0.90088, 1, 0.97198, 0.75339, 0.91009, 0.91009, 0.91009, 0.66466, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.788, 0.80314, 0.73764, 0.73764, 0.73764, 0.73764, 0.86023, 0.86023, 0.86023, 0.86023, 0.92915, 0.91115, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 1.02058, 0.8858, 0.89591, 0.89591, 0.89591, 0.89591, 0.8111, 0.79611, 0.89713, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86936, 0.896, 0.90083, 0.90083, 0.90083, 0.90083, 0.84224, 0.84224, 0.84224, 0.84224, 0.97276, 0.99793, 0.98714, 0.98714, 0.98714, 0.98714, 0.98714, 1.08595, 0.89876, 0.99074, 0.99074, 0.99074, 0.99074, 0.942, 1.0231, 0.942, 0.91755, 0.86667, 0.91755, 0.86667, 0.91755, 0.86667, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.92222, 0.93372, 0.92915, 1.01411, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.83051, 1.00512, 0.83051, 1.00512, 0.83051, 1.00512, 1, 1, 0.90284, 0.99793, 0.90976, 0.99793, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 1.05326, 0.86023, 0.84224, 0.82873, 1.07469, 0.74, 1.09377, 1, 1, 0.938, 0.84869, 1.06226, 1, 1, 0.84869, 0.83704, 0.84869, 0.81441, 0.85588, 1.08927, 0.91115, 0.99793, 1, 1, 0.91115, 0.99793, 0.91887, 0.90991, 0.99793, 0.8858, 0.98714, 0.8858, 0.98714, 0.8858, 0.98714, 0.894, 0.91434, 0.74498, 0.98196, 1, 1, 0.74498, 0.98196, 0.73914, 0.792, 0.73914, 0.792, 1, 1, 0.73914, 0.792, 1, 1, 0.81363, 0.904, 0.81363, 1.19137, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89633, 1.01915, 0.8111, 0.942, 0.8111, 0.90531, 0.856, 0.90531, 0.856, 0.90531, 0.856, 1, 0.92241, 0.91755, 0.86667, 0.788, 0.86936, 0.8858, 0.89876, 1, 1, 0.81363, 1.19137, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90388, 1.03901, 0.92138, 0.78105, 0.7154, 0.86169, 0.80513, 0.94007, 0.82528, 0.98612, 1.06226, 0.91755, 0.8126, 0.81884, 0.92819, 0.73764, 0.90531, 0.90284, 0.8858, 0.86023, 0.8126, 0.91172, 0.96518, 0.91115, 0.83089, 0.8858, 0.87791, 0.79761, 0.89297, 0.81363, 0.88157, 0.89992, 0.85608, 0.81992, 0.94307, 0.86023, 0.88157, 0.95308, 0.98699, 0.99793, 1.06226, 0.95817, 0.95308, 0.97358, 0.928, 0.98088, 0.98699, 0.92761, 0.99793, 0.96017, 1.06226, 0.986, 0.944, 0.95978, 0.938, 0.96705, 0.98714, 0.80442, 0.98972, 1, 0.89762, 1.04552, 0.95817, 0.99007, 0.87064, 0.91879, 0.88888, 1.06226, 0.95817, 0.98714, 0.95817, 0.88888, 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, 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, 0.89633, 1.01915, 0.89633, 1.01915, 0.89633, 1.01915, 0.8111, 0.942, 0.9219, 1, 0.89903, 1, 1, 1, 0.93173, 0.93173, 0.93173, 1, 1.06304, 1.06304, 1.06904, 0.89903, 0.89903, 0.80549, 1, 1.156, 1, 1, 0.76575, 0.76575, 1, 1, 0.72458, 1, 1, 1, 1, 0.92241, 1, 1, 1, 0.619, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.07257, 1, 0.74705, 0.71119, 1.02058, 1.024, 1.02119, 1, 1, 1.1536, 1.08595, 1.08595, 1, 1.08595, 1.08595, 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, 1, 1, 1, 1, 1, 1.05638, 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];
  4221. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  4222. const MyriadProRegularMetrics = {
  4223. lineHeight: 1.2,
  4224. lineGap: 0.2
  4225. };
  4226. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  4227. /***/ }),
  4228. /* 17 */
  4229. /***/ ((__unused_webpack_module, exports) => {
  4230. Object.defineProperty(exports, "__esModule", ({
  4231. value: true
  4232. }));
  4233. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  4234. const SegoeuiBoldFactors = [1.76738, 1, 1, 0.99297, 0.9824, 1.04016, 1.06497, 1.03424, 0.97529, 1.17647, 1.23203, 1.1085, 1.1085, 1.16939, 1.2107, 0.9754, 1.21408, 0.9754, 1.59578, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 0.81378, 0.81378, 1.2107, 1.2107, 1.2107, 0.71703, 0.97847, 0.97363, 0.88776, 0.8641, 1.02096, 0.79795, 0.85132, 0.914, 1.06085, 1.1406, 0.8007, 0.89858, 0.83693, 1.14889, 1.09398, 0.97489, 0.92094, 0.97489, 0.90399, 0.84041, 0.95923, 1.00135, 1, 1.06467, 0.98243, 0.90996, 0.99361, 1.1085, 1.56942, 1.1085, 1.2107, 0.74627, 0.94282, 0.96752, 1.01519, 0.86304, 1.01359, 0.97278, 1.15103, 1.01359, 0.98561, 1.02285, 1.02285, 1.00527, 1.02285, 1.0302, 0.99041, 1.0008, 1.01519, 1.01359, 1.02258, 0.79104, 1.16862, 0.99041, 0.97454, 1.02511, 0.99298, 0.96752, 0.95801, 0.94856, 1.16579, 0.94856, 1.2107, 0.9824, 1.03424, 1.03424, 1, 1.03424, 1.16579, 0.8727, 1.3871, 1.18622, 1.10818, 1.04478, 1.2107, 1.18622, 0.75155, 0.94994, 1.28826, 1.21408, 1.21408, 0.91056, 1, 0.91572, 0.9754, 0.64663, 1.18328, 1.24866, 1.04478, 1.14169, 1.15749, 1.17389, 0.71703, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.93506, 0.8641, 0.79795, 0.79795, 0.79795, 0.79795, 1.1406, 1.1406, 1.1406, 1.1406, 1.02096, 1.09398, 0.97426, 0.97426, 0.97426, 0.97426, 0.97426, 1.2107, 0.97489, 1.00135, 1.00135, 1.00135, 1.00135, 0.90996, 0.92094, 1.02798, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.93136, 0.86304, 0.97278, 0.97278, 0.97278, 0.97278, 1.02285, 1.02285, 1.02285, 1.02285, 0.97122, 0.99041, 1, 1, 1, 1, 1, 1.28826, 1.0008, 0.99041, 0.99041, 0.99041, 0.99041, 0.96752, 1.01519, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 1.02096, 1.03057, 1.02096, 1.03517, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.914, 1.01359, 0.914, 1.01359, 0.914, 1.01359, 1, 1, 1.06085, 0.98561, 1.06085, 1.00879, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 0.97138, 1.08692, 0.8007, 1.02285, 1, 1, 1.00527, 0.83693, 1.02285, 1, 1, 0.83693, 0.9455, 0.83693, 0.90418, 0.83693, 1.13005, 1.09398, 0.99041, 1, 1, 1.09398, 0.99041, 0.96692, 1.09251, 0.99041, 0.97489, 1.0008, 0.97489, 1.0008, 0.97489, 1.0008, 0.93994, 0.97931, 0.90399, 1.02258, 1, 1, 0.90399, 1.02258, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 1, 1, 0.95923, 1.07034, 0.95923, 1.16862, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.06467, 1.02511, 0.90996, 0.96752, 0.90996, 0.99361, 0.95801, 0.99361, 0.95801, 0.99361, 0.95801, 1.07733, 1.03424, 0.97363, 0.96752, 0.93506, 0.93136, 0.97489, 1.0008, 1, 1, 0.95923, 1.16862, 1.15103, 1.15103, 1.01173, 1.03959, 0.75953, 0.81378, 0.79912, 1.15103, 1.21994, 0.95161, 0.87815, 1.01149, 0.81525, 0.7676, 0.98167, 1.01134, 1.02546, 0.84097, 1.03089, 1.18102, 0.97363, 0.88776, 0.85134, 0.97826, 0.79795, 0.99361, 1.06085, 0.97489, 1.1406, 0.89858, 1.0388, 1.14889, 1.09398, 0.86039, 0.97489, 1.0595, 0.92094, 0.94793, 0.95923, 0.90996, 0.99346, 0.98243, 1.02112, 0.95493, 1.1406, 0.90996, 1.03574, 1.02597, 1.0008, 1.18102, 1.06628, 1.03574, 1.0192, 1.01932, 1.00886, 0.97531, 1.0106, 1.0008, 1.13189, 1.18102, 1.02277, 0.98683, 1.0016, 0.99561, 1.07237, 1.0008, 0.90434, 0.99921, 0.93803, 0.8965, 1.23085, 1.06628, 1.04983, 0.96268, 1.0499, 0.98439, 1.18102, 1.06628, 1.0008, 1.06628, 0.98439, 0.79795, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09466, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.97278, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.02065, 1, 1, 1, 1, 1, 1, 1.06467, 1.02511, 1.06467, 1.02511, 1.06467, 1.02511, 0.90996, 0.96752, 1, 1.21408, 0.89903, 1, 1, 0.75155, 1.04394, 1.04394, 1.04394, 1.04394, 0.98633, 0.98633, 0.98633, 0.73047, 0.73047, 1.20642, 0.91211, 1.25635, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.12454, 0.93503, 1.03424, 1.19687, 1.03424, 1, 1, 1, 0.771, 1, 1, 1.15749, 1.15749, 1.15749, 1.10948, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.16897, 1, 0.96085, 0.90137, 1.2107, 1.18416, 1.13973, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21172, 1.29004, 1.29004, 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.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18874, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.09193, 1.09193, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4235. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  4236. const SegoeuiBoldMetrics = {
  4237. lineHeight: 1.33008,
  4238. lineGap: 0
  4239. };
  4240. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  4241. const SegoeuiBoldItalicFactors = [1.76738, 1, 1, 0.98946, 1.03959, 1.04016, 1.02809, 1.036, 0.97639, 1.10953, 1.23203, 1.11144, 1.11144, 1.16939, 1.21237, 0.9754, 1.21261, 0.9754, 1.59754, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 0.81378, 0.81378, 1.21237, 1.21237, 1.21237, 0.73541, 0.97847, 0.97363, 0.89723, 0.87897, 1.0426, 0.79429, 0.85292, 0.91149, 1.05815, 1.1406, 0.79631, 0.90128, 0.83853, 1.04396, 1.10615, 0.97552, 0.94436, 0.97552, 0.88641, 0.80527, 0.96083, 1.00135, 1, 1.06777, 0.9817, 0.91142, 0.99361, 1.11144, 1.57293, 1.11144, 1.21237, 0.74627, 1.31818, 1.06585, 0.97042, 0.83055, 0.97042, 0.93503, 1.1261, 0.97042, 0.97922, 1.14236, 0.94552, 1.01054, 1.14236, 1.02471, 0.97922, 0.94165, 0.97042, 0.97042, 1.0276, 0.78929, 1.1261, 0.97922, 0.95874, 1.02197, 0.98507, 0.96752, 0.97168, 0.95107, 1.16579, 0.95107, 1.21237, 1.03959, 1.036, 1.036, 1, 1.036, 1.16579, 0.87357, 1.31818, 1.18754, 1.26781, 1.05356, 1.21237, 1.18622, 0.79487, 0.94994, 1.29004, 1.24047, 1.24047, 1.31818, 1, 0.91484, 0.9754, 1.31818, 1.1349, 1.24866, 1.05356, 1.13934, 1.15574, 1.17389, 0.73541, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.94385, 0.87897, 0.79429, 0.79429, 0.79429, 0.79429, 1.1406, 1.1406, 1.1406, 1.1406, 1.0426, 1.10615, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 1.21237, 0.97552, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142, 0.94436, 0.98721, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 0.96705, 0.83055, 0.93503, 0.93503, 0.93503, 0.93503, 1.14236, 1.14236, 1.14236, 1.14236, 0.93125, 0.97922, 0.94165, 0.94165, 0.94165, 0.94165, 0.94165, 1.29004, 0.94165, 0.97922, 0.97922, 0.97922, 0.97922, 0.96752, 0.97042, 0.96752, 0.97363, 1.06585, 0.97363, 1.06585, 0.97363, 1.06585, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 1.0426, 1.0033, 1.0426, 0.97042, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.91149, 0.97042, 0.91149, 0.97042, 0.91149, 0.97042, 1, 1, 1.05815, 0.97922, 1.05815, 0.97922, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 0.97441, 1.04302, 0.79631, 1.01582, 1, 1, 1.01054, 0.83853, 1.14236, 1, 1, 0.83853, 1.09125, 0.83853, 0.90418, 0.83853, 1.19508, 1.10615, 0.97922, 1, 1, 1.10615, 0.97922, 1.01034, 1.10466, 0.97922, 0.97552, 0.94165, 0.97552, 0.94165, 0.97552, 0.94165, 0.91602, 0.91981, 0.88641, 1.0276, 1, 1, 0.88641, 1.0276, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 1, 1, 0.96083, 1.05403, 0.95923, 1.16862, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.06777, 1.02197, 0.91142, 0.96752, 0.91142, 0.99361, 0.97168, 0.99361, 0.97168, 0.99361, 0.97168, 1.23199, 1.036, 0.97363, 1.06585, 0.94385, 0.96705, 0.97552, 0.94165, 1, 1, 0.96083, 1.1261, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 0.95161, 1.27126, 1.00811, 0.83284, 0.77702, 0.99137, 0.95253, 1.0347, 0.86142, 1.07205, 1.14236, 0.97363, 0.89723, 0.86869, 1.09818, 0.79429, 0.99361, 1.05815, 0.97552, 1.1406, 0.90128, 1.06662, 1.04396, 1.10615, 0.84918, 0.97552, 1.04694, 0.94436, 0.98015, 0.96083, 0.91142, 1.00356, 0.9817, 1.01945, 0.98999, 1.1406, 0.91142, 1.04961, 0.9898, 1.00639, 1.14236, 1.07514, 1.04961, 0.99607, 1.02897, 1.008, 0.9898, 0.95134, 1.00639, 1.11121, 1.14236, 1.00518, 0.97981, 1.02186, 1, 1.08578, 0.94165, 0.99314, 0.98387, 0.93028, 0.93377, 1.35125, 1.07514, 1.10687, 0.93491, 1.04232, 1.00351, 1.14236, 1.07514, 0.94165, 1.07514, 1.00351, 0.79429, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09097, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.93503, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96609, 1, 1, 1, 1, 1, 1, 1.06777, 1.02197, 1.06777, 1.02197, 1.06777, 1.02197, 0.91142, 0.96752, 1, 1.21261, 0.89903, 1, 1, 0.75155, 1.04745, 1.04745, 1.04745, 1.04394, 0.98633, 0.98633, 0.98633, 0.72959, 0.72959, 1.20502, 0.91406, 1.26514, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.09125, 0.93327, 1.03336, 1.16541, 1.036, 1, 1, 1, 0.771, 1, 1, 1.15574, 1.15574, 1.15574, 1.15574, 0.86364, 0.94434, 0.86279, 0.94434, 0.86224, 1, 1, 1.16798, 1, 0.96085, 0.90068, 1.21237, 1.18416, 1.13904, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21339, 1.29004, 1.29004, 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.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18775, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.13269, 1.13269, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4242. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  4243. const SegoeuiBoldItalicMetrics = {
  4244. lineHeight: 1.33008,
  4245. lineGap: 0
  4246. };
  4247. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  4248. const SegoeuiItalicFactors = [1.76738, 1, 1, 0.98946, 1.14763, 1.05365, 1.06234, 0.96927, 0.92586, 1.15373, 1.18414, 0.91349, 0.91349, 1.07403, 1.17308, 0.78383, 1.20088, 0.78383, 1.42531, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78383, 0.78383, 1.17308, 1.17308, 1.17308, 0.77349, 0.94565, 0.94729, 0.85944, 0.88506, 0.9858, 0.74817, 0.80016, 0.88449, 0.98039, 0.95782, 0.69238, 0.89898, 0.83231, 0.98183, 1.03989, 0.96924, 0.86237, 0.96924, 0.80595, 0.74524, 0.86091, 0.95402, 0.94143, 0.98448, 0.8858, 0.83089, 0.93285, 1.0949, 1.39016, 1.0949, 1.45994, 0.74627, 1.04839, 0.97454, 0.97454, 0.87207, 0.97454, 0.87533, 1.06151, 0.97454, 1.00176, 1.16484, 1.08132, 0.98047, 1.16484, 1.02989, 1.01054, 0.96225, 0.97454, 0.97454, 1.06598, 0.79004, 1.16344, 1.00351, 0.94629, 0.9973, 0.91016, 0.96777, 0.9043, 0.91082, 0.92481, 0.91082, 1.17308, 0.95748, 0.96927, 0.96927, 1, 0.96927, 0.92481, 0.80597, 1.04839, 1.23393, 1.1781, 0.9245, 1.17308, 1.20808, 0.63218, 0.94261, 1.24822, 1.09971, 1.09971, 1.04839, 1, 0.85273, 0.78032, 1.04839, 1.09971, 1.22326, 0.9245, 1.09836, 1.13525, 1.15222, 0.70424, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85498, 0.88506, 0.74817, 0.74817, 0.74817, 0.74817, 0.95782, 0.95782, 0.95782, 0.95782, 0.9858, 1.03989, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.17308, 0.96924, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089, 0.86237, 0.88409, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.92916, 0.87207, 0.87533, 0.87533, 0.87533, 0.87533, 0.93146, 0.93146, 0.93146, 0.93146, 0.93854, 1.01054, 0.96225, 0.96225, 0.96225, 0.96225, 0.96225, 1.24822, 0.8761, 1.00351, 1.00351, 1.00351, 1.00351, 0.96777, 0.97454, 0.96777, 0.94729, 0.97454, 0.94729, 0.97454, 0.94729, 0.97454, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.9858, 0.95391, 0.9858, 0.97454, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.88449, 0.97454, 0.88449, 0.97454, 0.88449, 0.97454, 1, 1, 0.98039, 1.00176, 0.98039, 1.00176, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 1.16484, 0.95782, 0.93146, 0.84421, 1.12761, 0.69238, 1.08132, 1, 1, 0.98047, 0.83231, 1.16484, 1, 1, 0.84723, 1.04861, 0.84723, 0.78755, 0.83231, 1.23736, 1.03989, 1.01054, 1, 1, 1.03989, 1.01054, 0.9857, 1.03849, 1.01054, 0.96924, 0.96225, 0.96924, 0.96225, 0.96924, 0.96225, 0.92383, 0.90171, 0.80595, 1.06598, 1, 1, 0.80595, 1.06598, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 1, 1, 0.86091, 1.02759, 0.85771, 1.16344, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.98448, 0.9973, 0.83089, 0.96777, 0.83089, 0.93285, 0.9043, 0.93285, 0.9043, 0.93285, 0.9043, 1.31868, 0.96927, 0.94729, 0.97454, 0.85498, 0.92916, 0.96924, 0.8761, 1, 1, 0.86091, 1.16344, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 0.81965, 0.81965, 0.94729, 0.78032, 0.71022, 0.90883, 0.84171, 0.99877, 0.77596, 1.05734, 1.2, 0.94729, 0.85944, 0.82791, 0.9607, 0.74817, 0.93285, 0.98039, 0.96924, 0.95782, 0.89898, 0.98316, 0.98183, 1.03989, 0.78614, 0.96924, 0.97642, 0.86237, 0.86075, 0.86091, 0.83089, 0.90082, 0.8858, 0.97296, 1.01284, 0.95782, 0.83089, 1.0976, 1.04, 1.03342, 1.2, 1.0675, 1.0976, 0.98205, 1.03809, 1.05097, 1.04, 0.95364, 1.03342, 1.05401, 1.2, 1.02148, 1.0119, 1.04724, 1.0127, 1.02732, 0.96225, 0.8965, 0.97783, 0.93574, 0.94818, 1.30679, 1.0675, 1.11826, 0.99821, 1.0557, 1.0326, 1.2, 1.0675, 0.96225, 1.0675, 1.0326, 0.74817, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03754, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87533, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.98705, 1, 1, 1, 1, 1, 1, 0.98448, 0.9973, 0.98448, 0.9973, 0.98448, 0.9973, 0.83089, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 0.94945, 0.94945, 0.94945, 0.94945, 1.12317, 1.12317, 1.12317, 0.67603, 0.67603, 1.15621, 0.73584, 1.21191, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87709, 0.96927, 1.01473, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.09836, 1.09836, 1.09836, 1.01522, 0.86321, 0.94434, 0.8649, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86438, 1.17308, 1.18416, 1.14589, 0.69825, 0.97622, 1.96791, 1.24822, 1.24822, 1.17308, 1.24822, 1.24822, 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.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.17984, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10742, 1.10742, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4249. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  4250. const SegoeuiItalicMetrics = {
  4251. lineHeight: 1.33008,
  4252. lineGap: 0
  4253. };
  4254. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  4255. const SegoeuiRegularFactors = [1.76738, 1, 1, 0.98594, 1.02285, 1.10454, 1.06234, 0.96927, 0.92037, 1.19985, 1.2046, 0.90616, 0.90616, 1.07152, 1.1714, 0.78032, 1.20088, 0.78032, 1.40246, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78032, 0.78032, 1.1714, 1.1714, 1.1714, 0.80597, 0.94084, 0.96706, 0.85944, 0.85734, 0.97093, 0.75842, 0.79936, 0.88198, 0.9831, 0.95782, 0.71387, 0.86969, 0.84636, 1.07796, 1.03584, 0.96924, 0.83968, 0.96924, 0.82826, 0.79649, 0.85771, 0.95132, 0.93119, 0.98965, 0.88433, 0.8287, 0.93365, 1.08612, 1.3638, 1.08612, 1.45786, 0.74627, 0.80499, 0.91484, 1.05707, 0.92383, 1.05882, 0.9403, 1.12654, 1.05882, 1.01756, 1.09011, 1.09011, 0.99414, 1.09011, 1.034, 1.01756, 1.05356, 1.05707, 1.05882, 1.04399, 0.84863, 1.21968, 1.01756, 0.95801, 1.00068, 0.91797, 0.96777, 0.9043, 0.90351, 0.92105, 0.90351, 1.1714, 0.85337, 0.96927, 0.96927, 0.99912, 0.96927, 0.92105, 0.80597, 1.2434, 1.20808, 1.05937, 0.90957, 1.1714, 1.20808, 0.75155, 0.94261, 1.24644, 1.09971, 1.09971, 0.84751, 1, 0.85273, 0.78032, 0.61584, 1.05425, 1.17914, 0.90957, 1.08665, 1.11593, 1.14169, 0.73381, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.86035, 0.85734, 0.75842, 0.75842, 0.75842, 0.75842, 0.95782, 0.95782, 0.95782, 0.95782, 0.97093, 1.03584, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.1714, 0.96924, 0.95132, 0.95132, 0.95132, 0.95132, 0.8287, 0.83968, 0.89049, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.93575, 0.92383, 0.9403, 0.9403, 0.9403, 0.9403, 0.8717, 0.8717, 0.8717, 0.8717, 1.00527, 1.01756, 1.05356, 1.05356, 1.05356, 1.05356, 1.05356, 1.24644, 0.95923, 1.01756, 1.01756, 1.01756, 1.01756, 0.96777, 1.05707, 0.96777, 0.96706, 0.91484, 0.96706, 0.91484, 0.96706, 0.91484, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.97093, 1.0969, 0.97093, 1.05882, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.88198, 1.05882, 0.88198, 1.05882, 0.88198, 1.05882, 1, 1, 0.9831, 1.01756, 0.9831, 1.01756, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 1.09011, 0.95782, 0.8717, 0.84784, 1.11551, 0.71387, 1.09011, 1, 1, 0.99414, 0.84636, 1.09011, 1, 1, 0.84636, 1.0536, 0.84636, 0.94298, 0.84636, 1.23297, 1.03584, 1.01756, 1, 1, 1.03584, 1.01756, 1.00323, 1.03444, 1.01756, 0.96924, 1.05356, 0.96924, 1.05356, 0.96924, 1.05356, 0.93066, 0.98293, 0.82826, 1.04399, 1, 1, 0.82826, 1.04399, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 1, 1, 0.85771, 1.17318, 0.85771, 1.21968, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.98965, 1.00068, 0.8287, 0.96777, 0.8287, 0.93365, 0.9043, 0.93365, 0.9043, 0.93365, 0.9043, 1.08571, 0.96927, 0.96706, 0.91484, 0.86035, 0.93575, 0.96924, 0.95923, 1, 1, 0.85771, 1.21968, 1.11437, 1.11437, 0.93109, 0.91202, 0.60411, 0.84164, 0.55572, 1.01173, 0.97361, 0.81818, 0.81818, 0.96635, 0.78032, 0.72727, 0.92366, 0.98601, 1.03405, 0.77968, 1.09799, 1.2, 0.96706, 0.85944, 0.85638, 0.96491, 0.75842, 0.93365, 0.9831, 0.96924, 0.95782, 0.86969, 0.94152, 1.07796, 1.03584, 0.78437, 0.96924, 0.98715, 0.83968, 0.83491, 0.85771, 0.8287, 0.94492, 0.88433, 0.9287, 1.0098, 0.95782, 0.8287, 1.0625, 0.98248, 1.03424, 1.2, 1.01071, 1.0625, 0.95246, 1.03809, 1.04912, 0.98248, 1.00221, 1.03424, 1.05443, 1.2, 1.04785, 0.99609, 1.00169, 1.05176, 0.99346, 1.05356, 0.9087, 1.03004, 0.95542, 0.93117, 1.23362, 1.01071, 1.07831, 1.02512, 1.05205, 1.03502, 1.2, 1.01071, 1.05356, 1.01071, 1.03502, 0.75842, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03719, 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, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9403, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04021, 1, 1, 1, 1, 1, 1, 0.98965, 1.00068, 0.98965, 1.00068, 0.98965, 1.00068, 0.8287, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 1.03077, 1.03077, 1.03077, 1.03077, 1.13196, 1.13196, 1.13196, 0.67428, 0.67428, 1.16039, 0.73291, 1.20996, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87796, 0.96927, 1.01518, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.10539, 1.10539, 1.11358, 1.06967, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86507, 1.1714, 1.18416, 1.14589, 0.69825, 0.97622, 1.9697, 1.24822, 1.24822, 1.17238, 1.24822, 1.24822, 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.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18083, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10938, 1.10938, 1, 1, 1, 1.05425, 1.09971, 1.09971, 1.09971, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  4256. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  4257. const SegoeuiRegularMetrics = {
  4258. lineHeight: 1.33008,
  4259. lineGap: 0
  4260. };
  4261. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  4262. /***/ }),
  4263. /* 18 */
  4264. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4265. Object.defineProperty(exports, "__esModule", ({
  4266. value: true
  4267. }));
  4268. exports.getFontType = getFontType;
  4269. exports.normalizeFontName = normalizeFontName;
  4270. exports.recoverGlyphName = recoverGlyphName;
  4271. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  4272. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  4273. var _util = __w_pdfjs_require__(2);
  4274. var _encodings = __w_pdfjs_require__(19);
  4275. var _glyphlist = __w_pdfjs_require__(20);
  4276. var _unicode = __w_pdfjs_require__(21);
  4277. const SEAC_ANALYSIS_ENABLED = true;
  4278. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  4279. const FontFlags = {
  4280. FixedPitch: 1,
  4281. Serif: 2,
  4282. Symbolic: 4,
  4283. Script: 8,
  4284. Nonsymbolic: 32,
  4285. Italic: 64,
  4286. AllCap: 65536,
  4287. SmallCap: 131072,
  4288. ForceBold: 262144
  4289. };
  4290. exports.FontFlags = FontFlags;
  4291. const 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"];
  4292. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  4293. function getFontType(type, subtype, isStandardFont = false) {
  4294. switch (type) {
  4295. case "Type1":
  4296. if (isStandardFont) {
  4297. return _util.FontType.TYPE1STANDARD;
  4298. }
  4299. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  4300. case "CIDFontType0":
  4301. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  4302. case "OpenType":
  4303. return _util.FontType.OPENTYPE;
  4304. case "TrueType":
  4305. return _util.FontType.TRUETYPE;
  4306. case "CIDFontType2":
  4307. return _util.FontType.CIDFONTTYPE2;
  4308. case "MMType1":
  4309. return _util.FontType.MMTYPE1;
  4310. case "Type0":
  4311. return _util.FontType.TYPE0;
  4312. default:
  4313. return _util.FontType.UNKNOWN;
  4314. }
  4315. }
  4316. function recoverGlyphName(name, glyphsUnicodeMap) {
  4317. if (glyphsUnicodeMap[name] !== undefined) {
  4318. return name;
  4319. }
  4320. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  4321. if (unicode !== -1) {
  4322. for (const key in glyphsUnicodeMap) {
  4323. if (glyphsUnicodeMap[key] === unicode) {
  4324. return key;
  4325. }
  4326. }
  4327. }
  4328. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  4329. return name;
  4330. }
  4331. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  4332. const charCodeToGlyphId = Object.create(null);
  4333. let glyphId, charCode, baseEncoding;
  4334. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  4335. if (properties.isInternalFont) {
  4336. baseEncoding = builtInEncoding;
  4337. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4338. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4339. if (glyphId >= 0) {
  4340. charCodeToGlyphId[charCode] = glyphId;
  4341. } else {
  4342. charCodeToGlyphId[charCode] = 0;
  4343. }
  4344. }
  4345. } else if (properties.baseEncodingName) {
  4346. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  4347. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4348. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4349. if (glyphId >= 0) {
  4350. charCodeToGlyphId[charCode] = glyphId;
  4351. } else {
  4352. charCodeToGlyphId[charCode] = 0;
  4353. }
  4354. }
  4355. } else if (isSymbolicFont) {
  4356. for (charCode in builtInEncoding) {
  4357. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  4358. }
  4359. } else {
  4360. baseEncoding = _encodings.StandardEncoding;
  4361. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4362. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4363. if (glyphId >= 0) {
  4364. charCodeToGlyphId[charCode] = glyphId;
  4365. } else {
  4366. charCodeToGlyphId[charCode] = 0;
  4367. }
  4368. }
  4369. }
  4370. const differences = properties.differences;
  4371. let glyphsUnicodeMap;
  4372. if (differences) {
  4373. for (charCode in differences) {
  4374. const glyphName = differences[charCode];
  4375. glyphId = glyphNames.indexOf(glyphName);
  4376. if (glyphId === -1) {
  4377. if (!glyphsUnicodeMap) {
  4378. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  4379. }
  4380. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  4381. if (standardGlyphName !== glyphName) {
  4382. glyphId = glyphNames.indexOf(standardGlyphName);
  4383. }
  4384. }
  4385. if (glyphId >= 0) {
  4386. charCodeToGlyphId[charCode] = glyphId;
  4387. } else {
  4388. charCodeToGlyphId[charCode] = 0;
  4389. }
  4390. }
  4391. }
  4392. return charCodeToGlyphId;
  4393. }
  4394. function normalizeFontName(name) {
  4395. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  4396. }
  4397. /***/ }),
  4398. /* 19 */
  4399. /***/ ((__unused_webpack_module, exports) => {
  4400. Object.defineProperty(exports, "__esModule", ({
  4401. value: true
  4402. }));
  4403. exports.getEncoding = getEncoding;
  4404. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  4405. 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"];
  4406. exports.ExpertEncoding = ExpertEncoding;
  4407. 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", "", "", "", ""];
  4408. 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"];
  4409. exports.MacRomanEncoding = MacRomanEncoding;
  4410. 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", "", "", "", ""];
  4411. exports.StandardEncoding = StandardEncoding;
  4412. 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"];
  4413. exports.WinAnsiEncoding = WinAnsiEncoding;
  4414. 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", ""];
  4415. exports.SymbolSetEncoding = SymbolSetEncoding;
  4416. 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", ""];
  4417. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  4418. function getEncoding(encodingName) {
  4419. switch (encodingName) {
  4420. case "WinAnsiEncoding":
  4421. return WinAnsiEncoding;
  4422. case "StandardEncoding":
  4423. return StandardEncoding;
  4424. case "MacRomanEncoding":
  4425. return MacRomanEncoding;
  4426. case "SymbolSetEncoding":
  4427. return SymbolSetEncoding;
  4428. case "ZapfDingbatsEncoding":
  4429. return ZapfDingbatsEncoding;
  4430. case "ExpertEncoding":
  4431. return ExpertEncoding;
  4432. case "MacExpertEncoding":
  4433. return MacExpertEncoding;
  4434. default:
  4435. return null;
  4436. }
  4437. }
  4438. /***/ }),
  4439. /* 20 */
  4440. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  4441. __w_pdfjs_require__.r(__webpack_exports__);
  4442. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  4443. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  4444. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  4445. /* harmony export */ });
  4446. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9);
  4447. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  4448. return [
  4449. "A",
  4450. 0x0041,
  4451. "AE",
  4452. 0x00c6,
  4453. "AEacute",
  4454. 0x01fc,
  4455. "AEmacron",
  4456. 0x01e2,
  4457. "AEsmall",
  4458. 0xf7e6,
  4459. "Aacute",
  4460. 0x00c1,
  4461. "Aacutesmall",
  4462. 0xf7e1,
  4463. "Abreve",
  4464. 0x0102,
  4465. "Abreveacute",
  4466. 0x1eae,
  4467. "Abrevecyrillic",
  4468. 0x04d0,
  4469. "Abrevedotbelow",
  4470. 0x1eb6,
  4471. "Abrevegrave",
  4472. 0x1eb0,
  4473. "Abrevehookabove",
  4474. 0x1eb2,
  4475. "Abrevetilde",
  4476. 0x1eb4,
  4477. "Acaron",
  4478. 0x01cd,
  4479. "Acircle",
  4480. 0x24b6,
  4481. "Acircumflex",
  4482. 0x00c2,
  4483. "Acircumflexacute",
  4484. 0x1ea4,
  4485. "Acircumflexdotbelow",
  4486. 0x1eac,
  4487. "Acircumflexgrave",
  4488. 0x1ea6,
  4489. "Acircumflexhookabove",
  4490. 0x1ea8,
  4491. "Acircumflexsmall",
  4492. 0xf7e2,
  4493. "Acircumflextilde",
  4494. 0x1eaa,
  4495. "Acute",
  4496. 0xf6c9,
  4497. "Acutesmall",
  4498. 0xf7b4,
  4499. "Acyrillic",
  4500. 0x0410,
  4501. "Adblgrave",
  4502. 0x0200,
  4503. "Adieresis",
  4504. 0x00c4,
  4505. "Adieresiscyrillic",
  4506. 0x04d2,
  4507. "Adieresismacron",
  4508. 0x01de,
  4509. "Adieresissmall",
  4510. 0xf7e4,
  4511. "Adotbelow",
  4512. 0x1ea0,
  4513. "Adotmacron",
  4514. 0x01e0,
  4515. "Agrave",
  4516. 0x00c0,
  4517. "Agravesmall",
  4518. 0xf7e0,
  4519. "Ahookabove",
  4520. 0x1ea2,
  4521. "Aiecyrillic",
  4522. 0x04d4,
  4523. "Ainvertedbreve",
  4524. 0x0202,
  4525. "Alpha",
  4526. 0x0391,
  4527. "Alphatonos",
  4528. 0x0386,
  4529. "Amacron",
  4530. 0x0100,
  4531. "Amonospace",
  4532. 0xff21,
  4533. "Aogonek",
  4534. 0x0104,
  4535. "Aring",
  4536. 0x00c5,
  4537. "Aringacute",
  4538. 0x01fa,
  4539. "Aringbelow",
  4540. 0x1e00,
  4541. "Aringsmall",
  4542. 0xf7e5,
  4543. "Asmall",
  4544. 0xf761,
  4545. "Atilde",
  4546. 0x00c3,
  4547. "Atildesmall",
  4548. 0xf7e3,
  4549. "Aybarmenian",
  4550. 0x0531,
  4551. "B",
  4552. 0x0042,
  4553. "Bcircle",
  4554. 0x24b7,
  4555. "Bdotaccent",
  4556. 0x1e02,
  4557. "Bdotbelow",
  4558. 0x1e04,
  4559. "Becyrillic",
  4560. 0x0411,
  4561. "Benarmenian",
  4562. 0x0532,
  4563. "Beta",
  4564. 0x0392,
  4565. "Bhook",
  4566. 0x0181,
  4567. "Blinebelow",
  4568. 0x1e06,
  4569. "Bmonospace",
  4570. 0xff22,
  4571. "Brevesmall",
  4572. 0xf6f4,
  4573. "Bsmall",
  4574. 0xf762,
  4575. "Btopbar",
  4576. 0x0182,
  4577. "C",
  4578. 0x0043,
  4579. "Caarmenian",
  4580. 0x053e,
  4581. "Cacute",
  4582. 0x0106,
  4583. "Caron",
  4584. 0xf6ca,
  4585. "Caronsmall",
  4586. 0xf6f5,
  4587. "Ccaron",
  4588. 0x010c,
  4589. "Ccedilla",
  4590. 0x00c7,
  4591. "Ccedillaacute",
  4592. 0x1e08,
  4593. "Ccedillasmall",
  4594. 0xf7e7,
  4595. "Ccircle",
  4596. 0x24b8,
  4597. "Ccircumflex",
  4598. 0x0108,
  4599. "Cdot",
  4600. 0x010a,
  4601. "Cdotaccent",
  4602. 0x010a,
  4603. "Cedillasmall",
  4604. 0xf7b8,
  4605. "Chaarmenian",
  4606. 0x0549,
  4607. "Cheabkhasiancyrillic",
  4608. 0x04bc,
  4609. "Checyrillic",
  4610. 0x0427,
  4611. "Chedescenderabkhasiancyrillic",
  4612. 0x04be,
  4613. "Chedescendercyrillic",
  4614. 0x04b6,
  4615. "Chedieresiscyrillic",
  4616. 0x04f4,
  4617. "Cheharmenian",
  4618. 0x0543,
  4619. "Chekhakassiancyrillic",
  4620. 0x04cb,
  4621. "Cheverticalstrokecyrillic",
  4622. 0x04b8,
  4623. "Chi",
  4624. 0x03a7,
  4625. "Chook",
  4626. 0x0187,
  4627. "Circumflexsmall",
  4628. 0xf6f6,
  4629. "Cmonospace",
  4630. 0xff23,
  4631. "Coarmenian",
  4632. 0x0551,
  4633. "Csmall",
  4634. 0xf763,
  4635. "D",
  4636. 0x0044,
  4637. "DZ",
  4638. 0x01f1,
  4639. "DZcaron",
  4640. 0x01c4,
  4641. "Daarmenian",
  4642. 0x0534,
  4643. "Dafrican",
  4644. 0x0189,
  4645. "Dcaron",
  4646. 0x010e,
  4647. "Dcedilla",
  4648. 0x1e10,
  4649. "Dcircle",
  4650. 0x24b9,
  4651. "Dcircumflexbelow",
  4652. 0x1e12,
  4653. "Dcroat",
  4654. 0x0110,
  4655. "Ddotaccent",
  4656. 0x1e0a,
  4657. "Ddotbelow",
  4658. 0x1e0c,
  4659. "Decyrillic",
  4660. 0x0414,
  4661. "Deicoptic",
  4662. 0x03ee,
  4663. "Delta",
  4664. 0x2206,
  4665. "Deltagreek",
  4666. 0x0394,
  4667. "Dhook",
  4668. 0x018a,
  4669. "Dieresis",
  4670. 0xf6cb,
  4671. "DieresisAcute",
  4672. 0xf6cc,
  4673. "DieresisGrave",
  4674. 0xf6cd,
  4675. "Dieresissmall",
  4676. 0xf7a8,
  4677. "Digammagreek",
  4678. 0x03dc,
  4679. "Djecyrillic",
  4680. 0x0402,
  4681. "Dlinebelow",
  4682. 0x1e0e,
  4683. "Dmonospace",
  4684. 0xff24,
  4685. "Dotaccentsmall",
  4686. 0xf6f7,
  4687. "Dslash",
  4688. 0x0110,
  4689. "Dsmall",
  4690. 0xf764,
  4691. "Dtopbar",
  4692. 0x018b,
  4693. "Dz",
  4694. 0x01f2,
  4695. "Dzcaron",
  4696. 0x01c5,
  4697. "Dzeabkhasiancyrillic",
  4698. 0x04e0,
  4699. "Dzecyrillic",
  4700. 0x0405,
  4701. "Dzhecyrillic",
  4702. 0x040f,
  4703. "E",
  4704. 0x0045,
  4705. "Eacute",
  4706. 0x00c9,
  4707. "Eacutesmall",
  4708. 0xf7e9,
  4709. "Ebreve",
  4710. 0x0114,
  4711. "Ecaron",
  4712. 0x011a,
  4713. "Ecedillabreve",
  4714. 0x1e1c,
  4715. "Echarmenian",
  4716. 0x0535,
  4717. "Ecircle",
  4718. 0x24ba,
  4719. "Ecircumflex",
  4720. 0x00ca,
  4721. "Ecircumflexacute",
  4722. 0x1ebe,
  4723. "Ecircumflexbelow",
  4724. 0x1e18,
  4725. "Ecircumflexdotbelow",
  4726. 0x1ec6,
  4727. "Ecircumflexgrave",
  4728. 0x1ec0,
  4729. "Ecircumflexhookabove",
  4730. 0x1ec2,
  4731. "Ecircumflexsmall",
  4732. 0xf7ea,
  4733. "Ecircumflextilde",
  4734. 0x1ec4,
  4735. "Ecyrillic",
  4736. 0x0404,
  4737. "Edblgrave",
  4738. 0x0204,
  4739. "Edieresis",
  4740. 0x00cb,
  4741. "Edieresissmall",
  4742. 0xf7eb,
  4743. "Edot",
  4744. 0x0116,
  4745. "Edotaccent",
  4746. 0x0116,
  4747. "Edotbelow",
  4748. 0x1eb8,
  4749. "Efcyrillic",
  4750. 0x0424,
  4751. "Egrave",
  4752. 0x00c8,
  4753. "Egravesmall",
  4754. 0xf7e8,
  4755. "Eharmenian",
  4756. 0x0537,
  4757. "Ehookabove",
  4758. 0x1eba,
  4759. "Eightroman",
  4760. 0x2167,
  4761. "Einvertedbreve",
  4762. 0x0206,
  4763. "Eiotifiedcyrillic",
  4764. 0x0464,
  4765. "Elcyrillic",
  4766. 0x041b,
  4767. "Elevenroman",
  4768. 0x216a,
  4769. "Emacron",
  4770. 0x0112,
  4771. "Emacronacute",
  4772. 0x1e16,
  4773. "Emacrongrave",
  4774. 0x1e14,
  4775. "Emcyrillic",
  4776. 0x041c,
  4777. "Emonospace",
  4778. 0xff25,
  4779. "Encyrillic",
  4780. 0x041d,
  4781. "Endescendercyrillic",
  4782. 0x04a2,
  4783. "Eng",
  4784. 0x014a,
  4785. "Enghecyrillic",
  4786. 0x04a4,
  4787. "Enhookcyrillic",
  4788. 0x04c7,
  4789. "Eogonek",
  4790. 0x0118,
  4791. "Eopen",
  4792. 0x0190,
  4793. "Epsilon",
  4794. 0x0395,
  4795. "Epsilontonos",
  4796. 0x0388,
  4797. "Ercyrillic",
  4798. 0x0420,
  4799. "Ereversed",
  4800. 0x018e,
  4801. "Ereversedcyrillic",
  4802. 0x042d,
  4803. "Escyrillic",
  4804. 0x0421,
  4805. "Esdescendercyrillic",
  4806. 0x04aa,
  4807. "Esh",
  4808. 0x01a9,
  4809. "Esmall",
  4810. 0xf765,
  4811. "Eta",
  4812. 0x0397,
  4813. "Etarmenian",
  4814. 0x0538,
  4815. "Etatonos",
  4816. 0x0389,
  4817. "Eth",
  4818. 0x00d0,
  4819. "Ethsmall",
  4820. 0xf7f0,
  4821. "Etilde",
  4822. 0x1ebc,
  4823. "Etildebelow",
  4824. 0x1e1a,
  4825. "Euro",
  4826. 0x20ac,
  4827. "Ezh",
  4828. 0x01b7,
  4829. "Ezhcaron",
  4830. 0x01ee,
  4831. "Ezhreversed",
  4832. 0x01b8,
  4833. "F",
  4834. 0x0046,
  4835. "Fcircle",
  4836. 0x24bb,
  4837. "Fdotaccent",
  4838. 0x1e1e,
  4839. "Feharmenian",
  4840. 0x0556,
  4841. "Feicoptic",
  4842. 0x03e4,
  4843. "Fhook",
  4844. 0x0191,
  4845. "Fitacyrillic",
  4846. 0x0472,
  4847. "Fiveroman",
  4848. 0x2164,
  4849. "Fmonospace",
  4850. 0xff26,
  4851. "Fourroman",
  4852. 0x2163,
  4853. "Fsmall",
  4854. 0xf766,
  4855. "G",
  4856. 0x0047,
  4857. "GBsquare",
  4858. 0x3387,
  4859. "Gacute",
  4860. 0x01f4,
  4861. "Gamma",
  4862. 0x0393,
  4863. "Gammaafrican",
  4864. 0x0194,
  4865. "Gangiacoptic",
  4866. 0x03ea,
  4867. "Gbreve",
  4868. 0x011e,
  4869. "Gcaron",
  4870. 0x01e6,
  4871. "Gcedilla",
  4872. 0x0122,
  4873. "Gcircle",
  4874. 0x24bc,
  4875. "Gcircumflex",
  4876. 0x011c,
  4877. "Gcommaaccent",
  4878. 0x0122,
  4879. "Gdot",
  4880. 0x0120,
  4881. "Gdotaccent",
  4882. 0x0120,
  4883. "Gecyrillic",
  4884. 0x0413,
  4885. "Ghadarmenian",
  4886. 0x0542,
  4887. "Ghemiddlehookcyrillic",
  4888. 0x0494,
  4889. "Ghestrokecyrillic",
  4890. 0x0492,
  4891. "Gheupturncyrillic",
  4892. 0x0490,
  4893. "Ghook",
  4894. 0x0193,
  4895. "Gimarmenian",
  4896. 0x0533,
  4897. "Gjecyrillic",
  4898. 0x0403,
  4899. "Gmacron",
  4900. 0x1e20,
  4901. "Gmonospace",
  4902. 0xff27,
  4903. "Grave",
  4904. 0xf6ce,
  4905. "Gravesmall",
  4906. 0xf760,
  4907. "Gsmall",
  4908. 0xf767,
  4909. "Gsmallhook",
  4910. 0x029b,
  4911. "Gstroke",
  4912. 0x01e4,
  4913. "H",
  4914. 0x0048,
  4915. "H18533",
  4916. 0x25cf,
  4917. "H18543",
  4918. 0x25aa,
  4919. "H18551",
  4920. 0x25ab,
  4921. "H22073",
  4922. 0x25a1,
  4923. "HPsquare",
  4924. 0x33cb,
  4925. "Haabkhasiancyrillic",
  4926. 0x04a8,
  4927. "Hadescendercyrillic",
  4928. 0x04b2,
  4929. "Hardsigncyrillic",
  4930. 0x042a,
  4931. "Hbar",
  4932. 0x0126,
  4933. "Hbrevebelow",
  4934. 0x1e2a,
  4935. "Hcedilla",
  4936. 0x1e28,
  4937. "Hcircle",
  4938. 0x24bd,
  4939. "Hcircumflex",
  4940. 0x0124,
  4941. "Hdieresis",
  4942. 0x1e26,
  4943. "Hdotaccent",
  4944. 0x1e22,
  4945. "Hdotbelow",
  4946. 0x1e24,
  4947. "Hmonospace",
  4948. 0xff28,
  4949. "Hoarmenian",
  4950. 0x0540,
  4951. "Horicoptic",
  4952. 0x03e8,
  4953. "Hsmall",
  4954. 0xf768,
  4955. "Hungarumlaut",
  4956. 0xf6cf,
  4957. "Hungarumlautsmall",
  4958. 0xf6f8,
  4959. "Hzsquare",
  4960. 0x3390,
  4961. "I",
  4962. 0x0049,
  4963. "IAcyrillic",
  4964. 0x042f,
  4965. "IJ",
  4966. 0x0132,
  4967. "IUcyrillic",
  4968. 0x042e,
  4969. "Iacute",
  4970. 0x00cd,
  4971. "Iacutesmall",
  4972. 0xf7ed,
  4973. "Ibreve",
  4974. 0x012c,
  4975. "Icaron",
  4976. 0x01cf,
  4977. "Icircle",
  4978. 0x24be,
  4979. "Icircumflex",
  4980. 0x00ce,
  4981. "Icircumflexsmall",
  4982. 0xf7ee,
  4983. "Icyrillic",
  4984. 0x0406,
  4985. "Idblgrave",
  4986. 0x0208,
  4987. "Idieresis",
  4988. 0x00cf,
  4989. "Idieresisacute",
  4990. 0x1e2e,
  4991. "Idieresiscyrillic",
  4992. 0x04e4,
  4993. "Idieresissmall",
  4994. 0xf7ef,
  4995. "Idot",
  4996. 0x0130,
  4997. "Idotaccent",
  4998. 0x0130,
  4999. "Idotbelow",
  5000. 0x1eca,
  5001. "Iebrevecyrillic",
  5002. 0x04d6,
  5003. "Iecyrillic",
  5004. 0x0415,
  5005. "Ifraktur",
  5006. 0x2111,
  5007. "Igrave",
  5008. 0x00cc,
  5009. "Igravesmall",
  5010. 0xf7ec,
  5011. "Ihookabove",
  5012. 0x1ec8,
  5013. "Iicyrillic",
  5014. 0x0418,
  5015. "Iinvertedbreve",
  5016. 0x020a,
  5017. "Iishortcyrillic",
  5018. 0x0419,
  5019. "Imacron",
  5020. 0x012a,
  5021. "Imacroncyrillic",
  5022. 0x04e2,
  5023. "Imonospace",
  5024. 0xff29,
  5025. "Iniarmenian",
  5026. 0x053b,
  5027. "Iocyrillic",
  5028. 0x0401,
  5029. "Iogonek",
  5030. 0x012e,
  5031. "Iota",
  5032. 0x0399,
  5033. "Iotaafrican",
  5034. 0x0196,
  5035. "Iotadieresis",
  5036. 0x03aa,
  5037. "Iotatonos",
  5038. 0x038a,
  5039. "Ismall",
  5040. 0xf769,
  5041. "Istroke",
  5042. 0x0197,
  5043. "Itilde",
  5044. 0x0128,
  5045. "Itildebelow",
  5046. 0x1e2c,
  5047. "Izhitsacyrillic",
  5048. 0x0474,
  5049. "Izhitsadblgravecyrillic",
  5050. 0x0476,
  5051. "J",
  5052. 0x004a,
  5053. "Jaarmenian",
  5054. 0x0541,
  5055. "Jcircle",
  5056. 0x24bf,
  5057. "Jcircumflex",
  5058. 0x0134,
  5059. "Jecyrillic",
  5060. 0x0408,
  5061. "Jheharmenian",
  5062. 0x054b,
  5063. "Jmonospace",
  5064. 0xff2a,
  5065. "Jsmall",
  5066. 0xf76a,
  5067. "K",
  5068. 0x004b,
  5069. "KBsquare",
  5070. 0x3385,
  5071. "KKsquare",
  5072. 0x33cd,
  5073. "Kabashkircyrillic",
  5074. 0x04a0,
  5075. "Kacute",
  5076. 0x1e30,
  5077. "Kacyrillic",
  5078. 0x041a,
  5079. "Kadescendercyrillic",
  5080. 0x049a,
  5081. "Kahookcyrillic",
  5082. 0x04c3,
  5083. "Kappa",
  5084. 0x039a,
  5085. "Kastrokecyrillic",
  5086. 0x049e,
  5087. "Kaverticalstrokecyrillic",
  5088. 0x049c,
  5089. "Kcaron",
  5090. 0x01e8,
  5091. "Kcedilla",
  5092. 0x0136,
  5093. "Kcircle",
  5094. 0x24c0,
  5095. "Kcommaaccent",
  5096. 0x0136,
  5097. "Kdotbelow",
  5098. 0x1e32,
  5099. "Keharmenian",
  5100. 0x0554,
  5101. "Kenarmenian",
  5102. 0x053f,
  5103. "Khacyrillic",
  5104. 0x0425,
  5105. "Kheicoptic",
  5106. 0x03e6,
  5107. "Khook",
  5108. 0x0198,
  5109. "Kjecyrillic",
  5110. 0x040c,
  5111. "Klinebelow",
  5112. 0x1e34,
  5113. "Kmonospace",
  5114. 0xff2b,
  5115. "Koppacyrillic",
  5116. 0x0480,
  5117. "Koppagreek",
  5118. 0x03de,
  5119. "Ksicyrillic",
  5120. 0x046e,
  5121. "Ksmall",
  5122. 0xf76b,
  5123. "L",
  5124. 0x004c,
  5125. "LJ",
  5126. 0x01c7,
  5127. "LL",
  5128. 0xf6bf,
  5129. "Lacute",
  5130. 0x0139,
  5131. "Lambda",
  5132. 0x039b,
  5133. "Lcaron",
  5134. 0x013d,
  5135. "Lcedilla",
  5136. 0x013b,
  5137. "Lcircle",
  5138. 0x24c1,
  5139. "Lcircumflexbelow",
  5140. 0x1e3c,
  5141. "Lcommaaccent",
  5142. 0x013b,
  5143. "Ldot",
  5144. 0x013f,
  5145. "Ldotaccent",
  5146. 0x013f,
  5147. "Ldotbelow",
  5148. 0x1e36,
  5149. "Ldotbelowmacron",
  5150. 0x1e38,
  5151. "Liwnarmenian",
  5152. 0x053c,
  5153. "Lj",
  5154. 0x01c8,
  5155. "Ljecyrillic",
  5156. 0x0409,
  5157. "Llinebelow",
  5158. 0x1e3a,
  5159. "Lmonospace",
  5160. 0xff2c,
  5161. "Lslash",
  5162. 0x0141,
  5163. "Lslashsmall",
  5164. 0xf6f9,
  5165. "Lsmall",
  5166. 0xf76c,
  5167. "M",
  5168. 0x004d,
  5169. "MBsquare",
  5170. 0x3386,
  5171. "Macron",
  5172. 0xf6d0,
  5173. "Macronsmall",
  5174. 0xf7af,
  5175. "Macute",
  5176. 0x1e3e,
  5177. "Mcircle",
  5178. 0x24c2,
  5179. "Mdotaccent",
  5180. 0x1e40,
  5181. "Mdotbelow",
  5182. 0x1e42,
  5183. "Menarmenian",
  5184. 0x0544,
  5185. "Mmonospace",
  5186. 0xff2d,
  5187. "Msmall",
  5188. 0xf76d,
  5189. "Mturned",
  5190. 0x019c,
  5191. "Mu",
  5192. 0x039c,
  5193. "N",
  5194. 0x004e,
  5195. "NJ",
  5196. 0x01ca,
  5197. "Nacute",
  5198. 0x0143,
  5199. "Ncaron",
  5200. 0x0147,
  5201. "Ncedilla",
  5202. 0x0145,
  5203. "Ncircle",
  5204. 0x24c3,
  5205. "Ncircumflexbelow",
  5206. 0x1e4a,
  5207. "Ncommaaccent",
  5208. 0x0145,
  5209. "Ndotaccent",
  5210. 0x1e44,
  5211. "Ndotbelow",
  5212. 0x1e46,
  5213. "Nhookleft",
  5214. 0x019d,
  5215. "Nineroman",
  5216. 0x2168,
  5217. "Nj",
  5218. 0x01cb,
  5219. "Njecyrillic",
  5220. 0x040a,
  5221. "Nlinebelow",
  5222. 0x1e48,
  5223. "Nmonospace",
  5224. 0xff2e,
  5225. "Nowarmenian",
  5226. 0x0546,
  5227. "Nsmall",
  5228. 0xf76e,
  5229. "Ntilde",
  5230. 0x00d1,
  5231. "Ntildesmall",
  5232. 0xf7f1,
  5233. "Nu",
  5234. 0x039d,
  5235. "O",
  5236. 0x004f,
  5237. "OE",
  5238. 0x0152,
  5239. "OEsmall",
  5240. 0xf6fa,
  5241. "Oacute",
  5242. 0x00d3,
  5243. "Oacutesmall",
  5244. 0xf7f3,
  5245. "Obarredcyrillic",
  5246. 0x04e8,
  5247. "Obarreddieresiscyrillic",
  5248. 0x04ea,
  5249. "Obreve",
  5250. 0x014e,
  5251. "Ocaron",
  5252. 0x01d1,
  5253. "Ocenteredtilde",
  5254. 0x019f,
  5255. "Ocircle",
  5256. 0x24c4,
  5257. "Ocircumflex",
  5258. 0x00d4,
  5259. "Ocircumflexacute",
  5260. 0x1ed0,
  5261. "Ocircumflexdotbelow",
  5262. 0x1ed8,
  5263. "Ocircumflexgrave",
  5264. 0x1ed2,
  5265. "Ocircumflexhookabove",
  5266. 0x1ed4,
  5267. "Ocircumflexsmall",
  5268. 0xf7f4,
  5269. "Ocircumflextilde",
  5270. 0x1ed6,
  5271. "Ocyrillic",
  5272. 0x041e,
  5273. "Odblacute",
  5274. 0x0150,
  5275. "Odblgrave",
  5276. 0x020c,
  5277. "Odieresis",
  5278. 0x00d6,
  5279. "Odieresiscyrillic",
  5280. 0x04e6,
  5281. "Odieresissmall",
  5282. 0xf7f6,
  5283. "Odotbelow",
  5284. 0x1ecc,
  5285. "Ogoneksmall",
  5286. 0xf6fb,
  5287. "Ograve",
  5288. 0x00d2,
  5289. "Ogravesmall",
  5290. 0xf7f2,
  5291. "Oharmenian",
  5292. 0x0555,
  5293. "Ohm",
  5294. 0x2126,
  5295. "Ohookabove",
  5296. 0x1ece,
  5297. "Ohorn",
  5298. 0x01a0,
  5299. "Ohornacute",
  5300. 0x1eda,
  5301. "Ohorndotbelow",
  5302. 0x1ee2,
  5303. "Ohorngrave",
  5304. 0x1edc,
  5305. "Ohornhookabove",
  5306. 0x1ede,
  5307. "Ohorntilde",
  5308. 0x1ee0,
  5309. "Ohungarumlaut",
  5310. 0x0150,
  5311. "Oi",
  5312. 0x01a2,
  5313. "Oinvertedbreve",
  5314. 0x020e,
  5315. "Omacron",
  5316. 0x014c,
  5317. "Omacronacute",
  5318. 0x1e52,
  5319. "Omacrongrave",
  5320. 0x1e50,
  5321. "Omega",
  5322. 0x2126,
  5323. "Omegacyrillic",
  5324. 0x0460,
  5325. "Omegagreek",
  5326. 0x03a9,
  5327. "Omegaroundcyrillic",
  5328. 0x047a,
  5329. "Omegatitlocyrillic",
  5330. 0x047c,
  5331. "Omegatonos",
  5332. 0x038f,
  5333. "Omicron",
  5334. 0x039f,
  5335. "Omicrontonos",
  5336. 0x038c,
  5337. "Omonospace",
  5338. 0xff2f,
  5339. "Oneroman",
  5340. 0x2160,
  5341. "Oogonek",
  5342. 0x01ea,
  5343. "Oogonekmacron",
  5344. 0x01ec,
  5345. "Oopen",
  5346. 0x0186,
  5347. "Oslash",
  5348. 0x00d8,
  5349. "Oslashacute",
  5350. 0x01fe,
  5351. "Oslashsmall",
  5352. 0xf7f8,
  5353. "Osmall",
  5354. 0xf76f,
  5355. "Ostrokeacute",
  5356. 0x01fe,
  5357. "Otcyrillic",
  5358. 0x047e,
  5359. "Otilde",
  5360. 0x00d5,
  5361. "Otildeacute",
  5362. 0x1e4c,
  5363. "Otildedieresis",
  5364. 0x1e4e,
  5365. "Otildesmall",
  5366. 0xf7f5,
  5367. "P",
  5368. 0x0050,
  5369. "Pacute",
  5370. 0x1e54,
  5371. "Pcircle",
  5372. 0x24c5,
  5373. "Pdotaccent",
  5374. 0x1e56,
  5375. "Pecyrillic",
  5376. 0x041f,
  5377. "Peharmenian",
  5378. 0x054a,
  5379. "Pemiddlehookcyrillic",
  5380. 0x04a6,
  5381. "Phi",
  5382. 0x03a6,
  5383. "Phook",
  5384. 0x01a4,
  5385. "Pi",
  5386. 0x03a0,
  5387. "Piwrarmenian",
  5388. 0x0553,
  5389. "Pmonospace",
  5390. 0xff30,
  5391. "Psi",
  5392. 0x03a8,
  5393. "Psicyrillic",
  5394. 0x0470,
  5395. "Psmall",
  5396. 0xf770,
  5397. "Q",
  5398. 0x0051,
  5399. "Qcircle",
  5400. 0x24c6,
  5401. "Qmonospace",
  5402. 0xff31,
  5403. "Qsmall",
  5404. 0xf771,
  5405. "R",
  5406. 0x0052,
  5407. "Raarmenian",
  5408. 0x054c,
  5409. "Racute",
  5410. 0x0154,
  5411. "Rcaron",
  5412. 0x0158,
  5413. "Rcedilla",
  5414. 0x0156,
  5415. "Rcircle",
  5416. 0x24c7,
  5417. "Rcommaaccent",
  5418. 0x0156,
  5419. "Rdblgrave",
  5420. 0x0210,
  5421. "Rdotaccent",
  5422. 0x1e58,
  5423. "Rdotbelow",
  5424. 0x1e5a,
  5425. "Rdotbelowmacron",
  5426. 0x1e5c,
  5427. "Reharmenian",
  5428. 0x0550,
  5429. "Rfraktur",
  5430. 0x211c,
  5431. "Rho",
  5432. 0x03a1,
  5433. "Ringsmall",
  5434. 0xf6fc,
  5435. "Rinvertedbreve",
  5436. 0x0212,
  5437. "Rlinebelow",
  5438. 0x1e5e,
  5439. "Rmonospace",
  5440. 0xff32,
  5441. "Rsmall",
  5442. 0xf772,
  5443. "Rsmallinverted",
  5444. 0x0281,
  5445. "Rsmallinvertedsuperior",
  5446. 0x02b6,
  5447. "S",
  5448. 0x0053,
  5449. "SF010000",
  5450. 0x250c,
  5451. "SF020000",
  5452. 0x2514,
  5453. "SF030000",
  5454. 0x2510,
  5455. "SF040000",
  5456. 0x2518,
  5457. "SF050000",
  5458. 0x253c,
  5459. "SF060000",
  5460. 0x252c,
  5461. "SF070000",
  5462. 0x2534,
  5463. "SF080000",
  5464. 0x251c,
  5465. "SF090000",
  5466. 0x2524,
  5467. "SF100000",
  5468. 0x2500,
  5469. "SF110000",
  5470. 0x2502,
  5471. "SF190000",
  5472. 0x2561,
  5473. "SF200000",
  5474. 0x2562,
  5475. "SF210000",
  5476. 0x2556,
  5477. "SF220000",
  5478. 0x2555,
  5479. "SF230000",
  5480. 0x2563,
  5481. "SF240000",
  5482. 0x2551,
  5483. "SF250000",
  5484. 0x2557,
  5485. "SF260000",
  5486. 0x255d,
  5487. "SF270000",
  5488. 0x255c,
  5489. "SF280000",
  5490. 0x255b,
  5491. "SF360000",
  5492. 0x255e,
  5493. "SF370000",
  5494. 0x255f,
  5495. "SF380000",
  5496. 0x255a,
  5497. "SF390000",
  5498. 0x2554,
  5499. "SF400000",
  5500. 0x2569,
  5501. "SF410000",
  5502. 0x2566,
  5503. "SF420000",
  5504. 0x2560,
  5505. "SF430000",
  5506. 0x2550,
  5507. "SF440000",
  5508. 0x256c,
  5509. "SF450000",
  5510. 0x2567,
  5511. "SF460000",
  5512. 0x2568,
  5513. "SF470000",
  5514. 0x2564,
  5515. "SF480000",
  5516. 0x2565,
  5517. "SF490000",
  5518. 0x2559,
  5519. "SF500000",
  5520. 0x2558,
  5521. "SF510000",
  5522. 0x2552,
  5523. "SF520000",
  5524. 0x2553,
  5525. "SF530000",
  5526. 0x256b,
  5527. "SF540000",
  5528. 0x256a,
  5529. "Sacute",
  5530. 0x015a,
  5531. "Sacutedotaccent",
  5532. 0x1e64,
  5533. "Sampigreek",
  5534. 0x03e0,
  5535. "Scaron",
  5536. 0x0160,
  5537. "Scarondotaccent",
  5538. 0x1e66,
  5539. "Scaronsmall",
  5540. 0xf6fd,
  5541. "Scedilla",
  5542. 0x015e,
  5543. "Schwa",
  5544. 0x018f,
  5545. "Schwacyrillic",
  5546. 0x04d8,
  5547. "Schwadieresiscyrillic",
  5548. 0x04da,
  5549. "Scircle",
  5550. 0x24c8,
  5551. "Scircumflex",
  5552. 0x015c,
  5553. "Scommaaccent",
  5554. 0x0218,
  5555. "Sdotaccent",
  5556. 0x1e60,
  5557. "Sdotbelow",
  5558. 0x1e62,
  5559. "Sdotbelowdotaccent",
  5560. 0x1e68,
  5561. "Seharmenian",
  5562. 0x054d,
  5563. "Sevenroman",
  5564. 0x2166,
  5565. "Shaarmenian",
  5566. 0x0547,
  5567. "Shacyrillic",
  5568. 0x0428,
  5569. "Shchacyrillic",
  5570. 0x0429,
  5571. "Sheicoptic",
  5572. 0x03e2,
  5573. "Shhacyrillic",
  5574. 0x04ba,
  5575. "Shimacoptic",
  5576. 0x03ec,
  5577. "Sigma",
  5578. 0x03a3,
  5579. "Sixroman",
  5580. 0x2165,
  5581. "Smonospace",
  5582. 0xff33,
  5583. "Softsigncyrillic",
  5584. 0x042c,
  5585. "Ssmall",
  5586. 0xf773,
  5587. "Stigmagreek",
  5588. 0x03da,
  5589. "T",
  5590. 0x0054,
  5591. "Tau",
  5592. 0x03a4,
  5593. "Tbar",
  5594. 0x0166,
  5595. "Tcaron",
  5596. 0x0164,
  5597. "Tcedilla",
  5598. 0x0162,
  5599. "Tcircle",
  5600. 0x24c9,
  5601. "Tcircumflexbelow",
  5602. 0x1e70,
  5603. "Tcommaaccent",
  5604. 0x0162,
  5605. "Tdotaccent",
  5606. 0x1e6a,
  5607. "Tdotbelow",
  5608. 0x1e6c,
  5609. "Tecyrillic",
  5610. 0x0422,
  5611. "Tedescendercyrillic",
  5612. 0x04ac,
  5613. "Tenroman",
  5614. 0x2169,
  5615. "Tetsecyrillic",
  5616. 0x04b4,
  5617. "Theta",
  5618. 0x0398,
  5619. "Thook",
  5620. 0x01ac,
  5621. "Thorn",
  5622. 0x00de,
  5623. "Thornsmall",
  5624. 0xf7fe,
  5625. "Threeroman",
  5626. 0x2162,
  5627. "Tildesmall",
  5628. 0xf6fe,
  5629. "Tiwnarmenian",
  5630. 0x054f,
  5631. "Tlinebelow",
  5632. 0x1e6e,
  5633. "Tmonospace",
  5634. 0xff34,
  5635. "Toarmenian",
  5636. 0x0539,
  5637. "Tonefive",
  5638. 0x01bc,
  5639. "Tonesix",
  5640. 0x0184,
  5641. "Tonetwo",
  5642. 0x01a7,
  5643. "Tretroflexhook",
  5644. 0x01ae,
  5645. "Tsecyrillic",
  5646. 0x0426,
  5647. "Tshecyrillic",
  5648. 0x040b,
  5649. "Tsmall",
  5650. 0xf774,
  5651. "Twelveroman",
  5652. 0x216b,
  5653. "Tworoman",
  5654. 0x2161,
  5655. "U",
  5656. 0x0055,
  5657. "Uacute",
  5658. 0x00da,
  5659. "Uacutesmall",
  5660. 0xf7fa,
  5661. "Ubreve",
  5662. 0x016c,
  5663. "Ucaron",
  5664. 0x01d3,
  5665. "Ucircle",
  5666. 0x24ca,
  5667. "Ucircumflex",
  5668. 0x00db,
  5669. "Ucircumflexbelow",
  5670. 0x1e76,
  5671. "Ucircumflexsmall",
  5672. 0xf7fb,
  5673. "Ucyrillic",
  5674. 0x0423,
  5675. "Udblacute",
  5676. 0x0170,
  5677. "Udblgrave",
  5678. 0x0214,
  5679. "Udieresis",
  5680. 0x00dc,
  5681. "Udieresisacute",
  5682. 0x01d7,
  5683. "Udieresisbelow",
  5684. 0x1e72,
  5685. "Udieresiscaron",
  5686. 0x01d9,
  5687. "Udieresiscyrillic",
  5688. 0x04f0,
  5689. "Udieresisgrave",
  5690. 0x01db,
  5691. "Udieresismacron",
  5692. 0x01d5,
  5693. "Udieresissmall",
  5694. 0xf7fc,
  5695. "Udotbelow",
  5696. 0x1ee4,
  5697. "Ugrave",
  5698. 0x00d9,
  5699. "Ugravesmall",
  5700. 0xf7f9,
  5701. "Uhookabove",
  5702. 0x1ee6,
  5703. "Uhorn",
  5704. 0x01af,
  5705. "Uhornacute",
  5706. 0x1ee8,
  5707. "Uhorndotbelow",
  5708. 0x1ef0,
  5709. "Uhorngrave",
  5710. 0x1eea,
  5711. "Uhornhookabove",
  5712. 0x1eec,
  5713. "Uhorntilde",
  5714. 0x1eee,
  5715. "Uhungarumlaut",
  5716. 0x0170,
  5717. "Uhungarumlautcyrillic",
  5718. 0x04f2,
  5719. "Uinvertedbreve",
  5720. 0x0216,
  5721. "Ukcyrillic",
  5722. 0x0478,
  5723. "Umacron",
  5724. 0x016a,
  5725. "Umacroncyrillic",
  5726. 0x04ee,
  5727. "Umacrondieresis",
  5728. 0x1e7a,
  5729. "Umonospace",
  5730. 0xff35,
  5731. "Uogonek",
  5732. 0x0172,
  5733. "Upsilon",
  5734. 0x03a5,
  5735. "Upsilon1",
  5736. 0x03d2,
  5737. "Upsilonacutehooksymbolgreek",
  5738. 0x03d3,
  5739. "Upsilonafrican",
  5740. 0x01b1,
  5741. "Upsilondieresis",
  5742. 0x03ab,
  5743. "Upsilondieresishooksymbolgreek",
  5744. 0x03d4,
  5745. "Upsilonhooksymbol",
  5746. 0x03d2,
  5747. "Upsilontonos",
  5748. 0x038e,
  5749. "Uring",
  5750. 0x016e,
  5751. "Ushortcyrillic",
  5752. 0x040e,
  5753. "Usmall",
  5754. 0xf775,
  5755. "Ustraightcyrillic",
  5756. 0x04ae,
  5757. "Ustraightstrokecyrillic",
  5758. 0x04b0,
  5759. "Utilde",
  5760. 0x0168,
  5761. "Utildeacute",
  5762. 0x1e78,
  5763. "Utildebelow",
  5764. 0x1e74,
  5765. "V",
  5766. 0x0056,
  5767. "Vcircle",
  5768. 0x24cb,
  5769. "Vdotbelow",
  5770. 0x1e7e,
  5771. "Vecyrillic",
  5772. 0x0412,
  5773. "Vewarmenian",
  5774. 0x054e,
  5775. "Vhook",
  5776. 0x01b2,
  5777. "Vmonospace",
  5778. 0xff36,
  5779. "Voarmenian",
  5780. 0x0548,
  5781. "Vsmall",
  5782. 0xf776,
  5783. "Vtilde",
  5784. 0x1e7c,
  5785. "W",
  5786. 0x0057,
  5787. "Wacute",
  5788. 0x1e82,
  5789. "Wcircle",
  5790. 0x24cc,
  5791. "Wcircumflex",
  5792. 0x0174,
  5793. "Wdieresis",
  5794. 0x1e84,
  5795. "Wdotaccent",
  5796. 0x1e86,
  5797. "Wdotbelow",
  5798. 0x1e88,
  5799. "Wgrave",
  5800. 0x1e80,
  5801. "Wmonospace",
  5802. 0xff37,
  5803. "Wsmall",
  5804. 0xf777,
  5805. "X",
  5806. 0x0058,
  5807. "Xcircle",
  5808. 0x24cd,
  5809. "Xdieresis",
  5810. 0x1e8c,
  5811. "Xdotaccent",
  5812. 0x1e8a,
  5813. "Xeharmenian",
  5814. 0x053d,
  5815. "Xi",
  5816. 0x039e,
  5817. "Xmonospace",
  5818. 0xff38,
  5819. "Xsmall",
  5820. 0xf778,
  5821. "Y",
  5822. 0x0059,
  5823. "Yacute",
  5824. 0x00dd,
  5825. "Yacutesmall",
  5826. 0xf7fd,
  5827. "Yatcyrillic",
  5828. 0x0462,
  5829. "Ycircle",
  5830. 0x24ce,
  5831. "Ycircumflex",
  5832. 0x0176,
  5833. "Ydieresis",
  5834. 0x0178,
  5835. "Ydieresissmall",
  5836. 0xf7ff,
  5837. "Ydotaccent",
  5838. 0x1e8e,
  5839. "Ydotbelow",
  5840. 0x1ef4,
  5841. "Yericyrillic",
  5842. 0x042b,
  5843. "Yerudieresiscyrillic",
  5844. 0x04f8,
  5845. "Ygrave",
  5846. 0x1ef2,
  5847. "Yhook",
  5848. 0x01b3,
  5849. "Yhookabove",
  5850. 0x1ef6,
  5851. "Yiarmenian",
  5852. 0x0545,
  5853. "Yicyrillic",
  5854. 0x0407,
  5855. "Yiwnarmenian",
  5856. 0x0552,
  5857. "Ymonospace",
  5858. 0xff39,
  5859. "Ysmall",
  5860. 0xf779,
  5861. "Ytilde",
  5862. 0x1ef8,
  5863. "Yusbigcyrillic",
  5864. 0x046a,
  5865. "Yusbigiotifiedcyrillic",
  5866. 0x046c,
  5867. "Yuslittlecyrillic",
  5868. 0x0466,
  5869. "Yuslittleiotifiedcyrillic",
  5870. 0x0468,
  5871. "Z",
  5872. 0x005a,
  5873. "Zaarmenian",
  5874. 0x0536,
  5875. "Zacute",
  5876. 0x0179,
  5877. "Zcaron",
  5878. 0x017d,
  5879. "Zcaronsmall",
  5880. 0xf6ff,
  5881. "Zcircle",
  5882. 0x24cf,
  5883. "Zcircumflex",
  5884. 0x1e90,
  5885. "Zdot",
  5886. 0x017b,
  5887. "Zdotaccent",
  5888. 0x017b,
  5889. "Zdotbelow",
  5890. 0x1e92,
  5891. "Zecyrillic",
  5892. 0x0417,
  5893. "Zedescendercyrillic",
  5894. 0x0498,
  5895. "Zedieresiscyrillic",
  5896. 0x04de,
  5897. "Zeta",
  5898. 0x0396,
  5899. "Zhearmenian",
  5900. 0x053a,
  5901. "Zhebrevecyrillic",
  5902. 0x04c1,
  5903. "Zhecyrillic",
  5904. 0x0416,
  5905. "Zhedescendercyrillic",
  5906. 0x0496,
  5907. "Zhedieresiscyrillic",
  5908. 0x04dc,
  5909. "Zlinebelow",
  5910. 0x1e94,
  5911. "Zmonospace",
  5912. 0xff3a,
  5913. "Zsmall",
  5914. 0xf77a,
  5915. "Zstroke",
  5916. 0x01b5,
  5917. "a",
  5918. 0x0061,
  5919. "aabengali",
  5920. 0x0986,
  5921. "aacute",
  5922. 0x00e1,
  5923. "aadeva",
  5924. 0x0906,
  5925. "aagujarati",
  5926. 0x0a86,
  5927. "aagurmukhi",
  5928. 0x0a06,
  5929. "aamatragurmukhi",
  5930. 0x0a3e,
  5931. "aarusquare",
  5932. 0x3303,
  5933. "aavowelsignbengali",
  5934. 0x09be,
  5935. "aavowelsigndeva",
  5936. 0x093e,
  5937. "aavowelsigngujarati",
  5938. 0x0abe,
  5939. "abbreviationmarkarmenian",
  5940. 0x055f,
  5941. "abbreviationsigndeva",
  5942. 0x0970,
  5943. "abengali",
  5944. 0x0985,
  5945. "abopomofo",
  5946. 0x311a,
  5947. "abreve",
  5948. 0x0103,
  5949. "abreveacute",
  5950. 0x1eaf,
  5951. "abrevecyrillic",
  5952. 0x04d1,
  5953. "abrevedotbelow",
  5954. 0x1eb7,
  5955. "abrevegrave",
  5956. 0x1eb1,
  5957. "abrevehookabove",
  5958. 0x1eb3,
  5959. "abrevetilde",
  5960. 0x1eb5,
  5961. "acaron",
  5962. 0x01ce,
  5963. "acircle",
  5964. 0x24d0,
  5965. "acircumflex",
  5966. 0x00e2,
  5967. "acircumflexacute",
  5968. 0x1ea5,
  5969. "acircumflexdotbelow",
  5970. 0x1ead,
  5971. "acircumflexgrave",
  5972. 0x1ea7,
  5973. "acircumflexhookabove",
  5974. 0x1ea9,
  5975. "acircumflextilde",
  5976. 0x1eab,
  5977. "acute",
  5978. 0x00b4,
  5979. "acutebelowcmb",
  5980. 0x0317,
  5981. "acutecmb",
  5982. 0x0301,
  5983. "acutecomb",
  5984. 0x0301,
  5985. "acutedeva",
  5986. 0x0954,
  5987. "acutelowmod",
  5988. 0x02cf,
  5989. "acutetonecmb",
  5990. 0x0341,
  5991. "acyrillic",
  5992. 0x0430,
  5993. "adblgrave",
  5994. 0x0201,
  5995. "addakgurmukhi",
  5996. 0x0a71,
  5997. "adeva",
  5998. 0x0905,
  5999. "adieresis",
  6000. 0x00e4,
  6001. "adieresiscyrillic",
  6002. 0x04d3,
  6003. "adieresismacron",
  6004. 0x01df,
  6005. "adotbelow",
  6006. 0x1ea1,
  6007. "adotmacron",
  6008. 0x01e1,
  6009. "ae",
  6010. 0x00e6,
  6011. "aeacute",
  6012. 0x01fd,
  6013. "aekorean",
  6014. 0x3150,
  6015. "aemacron",
  6016. 0x01e3,
  6017. "afii00208",
  6018. 0x2015,
  6019. "afii08941",
  6020. 0x20a4,
  6021. "afii10017",
  6022. 0x0410,
  6023. "afii10018",
  6024. 0x0411,
  6025. "afii10019",
  6026. 0x0412,
  6027. "afii10020",
  6028. 0x0413,
  6029. "afii10021",
  6030. 0x0414,
  6031. "afii10022",
  6032. 0x0415,
  6033. "afii10023",
  6034. 0x0401,
  6035. "afii10024",
  6036. 0x0416,
  6037. "afii10025",
  6038. 0x0417,
  6039. "afii10026",
  6040. 0x0418,
  6041. "afii10027",
  6042. 0x0419,
  6043. "afii10028",
  6044. 0x041a,
  6045. "afii10029",
  6046. 0x041b,
  6047. "afii10030",
  6048. 0x041c,
  6049. "afii10031",
  6050. 0x041d,
  6051. "afii10032",
  6052. 0x041e,
  6053. "afii10033",
  6054. 0x041f,
  6055. "afii10034",
  6056. 0x0420,
  6057. "afii10035",
  6058. 0x0421,
  6059. "afii10036",
  6060. 0x0422,
  6061. "afii10037",
  6062. 0x0423,
  6063. "afii10038",
  6064. 0x0424,
  6065. "afii10039",
  6066. 0x0425,
  6067. "afii10040",
  6068. 0x0426,
  6069. "afii10041",
  6070. 0x0427,
  6071. "afii10042",
  6072. 0x0428,
  6073. "afii10043",
  6074. 0x0429,
  6075. "afii10044",
  6076. 0x042a,
  6077. "afii10045",
  6078. 0x042b,
  6079. "afii10046",
  6080. 0x042c,
  6081. "afii10047",
  6082. 0x042d,
  6083. "afii10048",
  6084. 0x042e,
  6085. "afii10049",
  6086. 0x042f,
  6087. "afii10050",
  6088. 0x0490,
  6089. "afii10051",
  6090. 0x0402,
  6091. "afii10052",
  6092. 0x0403,
  6093. "afii10053",
  6094. 0x0404,
  6095. "afii10054",
  6096. 0x0405,
  6097. "afii10055",
  6098. 0x0406,
  6099. "afii10056",
  6100. 0x0407,
  6101. "afii10057",
  6102. 0x0408,
  6103. "afii10058",
  6104. 0x0409,
  6105. "afii10059",
  6106. 0x040a,
  6107. "afii10060",
  6108. 0x040b,
  6109. "afii10061",
  6110. 0x040c,
  6111. "afii10062",
  6112. 0x040e,
  6113. "afii10063",
  6114. 0xf6c4,
  6115. "afii10064",
  6116. 0xf6c5,
  6117. "afii10065",
  6118. 0x0430,
  6119. "afii10066",
  6120. 0x0431,
  6121. "afii10067",
  6122. 0x0432,
  6123. "afii10068",
  6124. 0x0433,
  6125. "afii10069",
  6126. 0x0434,
  6127. "afii10070",
  6128. 0x0435,
  6129. "afii10071",
  6130. 0x0451,
  6131. "afii10072",
  6132. 0x0436,
  6133. "afii10073",
  6134. 0x0437,
  6135. "afii10074",
  6136. 0x0438,
  6137. "afii10075",
  6138. 0x0439,
  6139. "afii10076",
  6140. 0x043a,
  6141. "afii10077",
  6142. 0x043b,
  6143. "afii10078",
  6144. 0x043c,
  6145. "afii10079",
  6146. 0x043d,
  6147. "afii10080",
  6148. 0x043e,
  6149. "afii10081",
  6150. 0x043f,
  6151. "afii10082",
  6152. 0x0440,
  6153. "afii10083",
  6154. 0x0441,
  6155. "afii10084",
  6156. 0x0442,
  6157. "afii10085",
  6158. 0x0443,
  6159. "afii10086",
  6160. 0x0444,
  6161. "afii10087",
  6162. 0x0445,
  6163. "afii10088",
  6164. 0x0446,
  6165. "afii10089",
  6166. 0x0447,
  6167. "afii10090",
  6168. 0x0448,
  6169. "afii10091",
  6170. 0x0449,
  6171. "afii10092",
  6172. 0x044a,
  6173. "afii10093",
  6174. 0x044b,
  6175. "afii10094",
  6176. 0x044c,
  6177. "afii10095",
  6178. 0x044d,
  6179. "afii10096",
  6180. 0x044e,
  6181. "afii10097",
  6182. 0x044f,
  6183. "afii10098",
  6184. 0x0491,
  6185. "afii10099",
  6186. 0x0452,
  6187. "afii10100",
  6188. 0x0453,
  6189. "afii10101",
  6190. 0x0454,
  6191. "afii10102",
  6192. 0x0455,
  6193. "afii10103",
  6194. 0x0456,
  6195. "afii10104",
  6196. 0x0457,
  6197. "afii10105",
  6198. 0x0458,
  6199. "afii10106",
  6200. 0x0459,
  6201. "afii10107",
  6202. 0x045a,
  6203. "afii10108",
  6204. 0x045b,
  6205. "afii10109",
  6206. 0x045c,
  6207. "afii10110",
  6208. 0x045e,
  6209. "afii10145",
  6210. 0x040f,
  6211. "afii10146",
  6212. 0x0462,
  6213. "afii10147",
  6214. 0x0472,
  6215. "afii10148",
  6216. 0x0474,
  6217. "afii10192",
  6218. 0xf6c6,
  6219. "afii10193",
  6220. 0x045f,
  6221. "afii10194",
  6222. 0x0463,
  6223. "afii10195",
  6224. 0x0473,
  6225. "afii10196",
  6226. 0x0475,
  6227. "afii10831",
  6228. 0xf6c7,
  6229. "afii10832",
  6230. 0xf6c8,
  6231. "afii10846",
  6232. 0x04d9,
  6233. "afii299",
  6234. 0x200e,
  6235. "afii300",
  6236. 0x200f,
  6237. "afii301",
  6238. 0x200d,
  6239. "afii57381",
  6240. 0x066a,
  6241. "afii57388",
  6242. 0x060c,
  6243. "afii57392",
  6244. 0x0660,
  6245. "afii57393",
  6246. 0x0661,
  6247. "afii57394",
  6248. 0x0662,
  6249. "afii57395",
  6250. 0x0663,
  6251. "afii57396",
  6252. 0x0664,
  6253. "afii57397",
  6254. 0x0665,
  6255. "afii57398",
  6256. 0x0666,
  6257. "afii57399",
  6258. 0x0667,
  6259. "afii57400",
  6260. 0x0668,
  6261. "afii57401",
  6262. 0x0669,
  6263. "afii57403",
  6264. 0x061b,
  6265. "afii57407",
  6266. 0x061f,
  6267. "afii57409",
  6268. 0x0621,
  6269. "afii57410",
  6270. 0x0622,
  6271. "afii57411",
  6272. 0x0623,
  6273. "afii57412",
  6274. 0x0624,
  6275. "afii57413",
  6276. 0x0625,
  6277. "afii57414",
  6278. 0x0626,
  6279. "afii57415",
  6280. 0x0627,
  6281. "afii57416",
  6282. 0x0628,
  6283. "afii57417",
  6284. 0x0629,
  6285. "afii57418",
  6286. 0x062a,
  6287. "afii57419",
  6288. 0x062b,
  6289. "afii57420",
  6290. 0x062c,
  6291. "afii57421",
  6292. 0x062d,
  6293. "afii57422",
  6294. 0x062e,
  6295. "afii57423",
  6296. 0x062f,
  6297. "afii57424",
  6298. 0x0630,
  6299. "afii57425",
  6300. 0x0631,
  6301. "afii57426",
  6302. 0x0632,
  6303. "afii57427",
  6304. 0x0633,
  6305. "afii57428",
  6306. 0x0634,
  6307. "afii57429",
  6308. 0x0635,
  6309. "afii57430",
  6310. 0x0636,
  6311. "afii57431",
  6312. 0x0637,
  6313. "afii57432",
  6314. 0x0638,
  6315. "afii57433",
  6316. 0x0639,
  6317. "afii57434",
  6318. 0x063a,
  6319. "afii57440",
  6320. 0x0640,
  6321. "afii57441",
  6322. 0x0641,
  6323. "afii57442",
  6324. 0x0642,
  6325. "afii57443",
  6326. 0x0643,
  6327. "afii57444",
  6328. 0x0644,
  6329. "afii57445",
  6330. 0x0645,
  6331. "afii57446",
  6332. 0x0646,
  6333. "afii57448",
  6334. 0x0648,
  6335. "afii57449",
  6336. 0x0649,
  6337. "afii57450",
  6338. 0x064a,
  6339. "afii57451",
  6340. 0x064b,
  6341. "afii57452",
  6342. 0x064c,
  6343. "afii57453",
  6344. 0x064d,
  6345. "afii57454",
  6346. 0x064e,
  6347. "afii57455",
  6348. 0x064f,
  6349. "afii57456",
  6350. 0x0650,
  6351. "afii57457",
  6352. 0x0651,
  6353. "afii57458",
  6354. 0x0652,
  6355. "afii57470",
  6356. 0x0647,
  6357. "afii57505",
  6358. 0x06a4,
  6359. "afii57506",
  6360. 0x067e,
  6361. "afii57507",
  6362. 0x0686,
  6363. "afii57508",
  6364. 0x0698,
  6365. "afii57509",
  6366. 0x06af,
  6367. "afii57511",
  6368. 0x0679,
  6369. "afii57512",
  6370. 0x0688,
  6371. "afii57513",
  6372. 0x0691,
  6373. "afii57514",
  6374. 0x06ba,
  6375. "afii57519",
  6376. 0x06d2,
  6377. "afii57534",
  6378. 0x06d5,
  6379. "afii57636",
  6380. 0x20aa,
  6381. "afii57645",
  6382. 0x05be,
  6383. "afii57658",
  6384. 0x05c3,
  6385. "afii57664",
  6386. 0x05d0,
  6387. "afii57665",
  6388. 0x05d1,
  6389. "afii57666",
  6390. 0x05d2,
  6391. "afii57667",
  6392. 0x05d3,
  6393. "afii57668",
  6394. 0x05d4,
  6395. "afii57669",
  6396. 0x05d5,
  6397. "afii57670",
  6398. 0x05d6,
  6399. "afii57671",
  6400. 0x05d7,
  6401. "afii57672",
  6402. 0x05d8,
  6403. "afii57673",
  6404. 0x05d9,
  6405. "afii57674",
  6406. 0x05da,
  6407. "afii57675",
  6408. 0x05db,
  6409. "afii57676",
  6410. 0x05dc,
  6411. "afii57677",
  6412. 0x05dd,
  6413. "afii57678",
  6414. 0x05de,
  6415. "afii57679",
  6416. 0x05df,
  6417. "afii57680",
  6418. 0x05e0,
  6419. "afii57681",
  6420. 0x05e1,
  6421. "afii57682",
  6422. 0x05e2,
  6423. "afii57683",
  6424. 0x05e3,
  6425. "afii57684",
  6426. 0x05e4,
  6427. "afii57685",
  6428. 0x05e5,
  6429. "afii57686",
  6430. 0x05e6,
  6431. "afii57687",
  6432. 0x05e7,
  6433. "afii57688",
  6434. 0x05e8,
  6435. "afii57689",
  6436. 0x05e9,
  6437. "afii57690",
  6438. 0x05ea,
  6439. "afii57694",
  6440. 0xfb2a,
  6441. "afii57695",
  6442. 0xfb2b,
  6443. "afii57700",
  6444. 0xfb4b,
  6445. "afii57705",
  6446. 0xfb1f,
  6447. "afii57716",
  6448. 0x05f0,
  6449. "afii57717",
  6450. 0x05f1,
  6451. "afii57718",
  6452. 0x05f2,
  6453. "afii57723",
  6454. 0xfb35,
  6455. "afii57793",
  6456. 0x05b4,
  6457. "afii57794",
  6458. 0x05b5,
  6459. "afii57795",
  6460. 0x05b6,
  6461. "afii57796",
  6462. 0x05bb,
  6463. "afii57797",
  6464. 0x05b8,
  6465. "afii57798",
  6466. 0x05b7,
  6467. "afii57799",
  6468. 0x05b0,
  6469. "afii57800",
  6470. 0x05b2,
  6471. "afii57801",
  6472. 0x05b1,
  6473. "afii57802",
  6474. 0x05b3,
  6475. "afii57803",
  6476. 0x05c2,
  6477. "afii57804",
  6478. 0x05c1,
  6479. "afii57806",
  6480. 0x05b9,
  6481. "afii57807",
  6482. 0x05bc,
  6483. "afii57839",
  6484. 0x05bd,
  6485. "afii57841",
  6486. 0x05bf,
  6487. "afii57842",
  6488. 0x05c0,
  6489. "afii57929",
  6490. 0x02bc,
  6491. "afii61248",
  6492. 0x2105,
  6493. "afii61289",
  6494. 0x2113,
  6495. "afii61352",
  6496. 0x2116,
  6497. "afii61573",
  6498. 0x202c,
  6499. "afii61574",
  6500. 0x202d,
  6501. "afii61575",
  6502. 0x202e,
  6503. "afii61664",
  6504. 0x200c,
  6505. "afii63167",
  6506. 0x066d,
  6507. "afii64937",
  6508. 0x02bd,
  6509. "agrave",
  6510. 0x00e0,
  6511. "agujarati",
  6512. 0x0a85,
  6513. "agurmukhi",
  6514. 0x0a05,
  6515. "ahiragana",
  6516. 0x3042,
  6517. "ahookabove",
  6518. 0x1ea3,
  6519. "aibengali",
  6520. 0x0990,
  6521. "aibopomofo",
  6522. 0x311e,
  6523. "aideva",
  6524. 0x0910,
  6525. "aiecyrillic",
  6526. 0x04d5,
  6527. "aigujarati",
  6528. 0x0a90,
  6529. "aigurmukhi",
  6530. 0x0a10,
  6531. "aimatragurmukhi",
  6532. 0x0a48,
  6533. "ainarabic",
  6534. 0x0639,
  6535. "ainfinalarabic",
  6536. 0xfeca,
  6537. "aininitialarabic",
  6538. 0xfecb,
  6539. "ainmedialarabic",
  6540. 0xfecc,
  6541. "ainvertedbreve",
  6542. 0x0203,
  6543. "aivowelsignbengali",
  6544. 0x09c8,
  6545. "aivowelsigndeva",
  6546. 0x0948,
  6547. "aivowelsigngujarati",
  6548. 0x0ac8,
  6549. "akatakana",
  6550. 0x30a2,
  6551. "akatakanahalfwidth",
  6552. 0xff71,
  6553. "akorean",
  6554. 0x314f,
  6555. "alef",
  6556. 0x05d0,
  6557. "alefarabic",
  6558. 0x0627,
  6559. "alefdageshhebrew",
  6560. 0xfb30,
  6561. "aleffinalarabic",
  6562. 0xfe8e,
  6563. "alefhamzaabovearabic",
  6564. 0x0623,
  6565. "alefhamzaabovefinalarabic",
  6566. 0xfe84,
  6567. "alefhamzabelowarabic",
  6568. 0x0625,
  6569. "alefhamzabelowfinalarabic",
  6570. 0xfe88,
  6571. "alefhebrew",
  6572. 0x05d0,
  6573. "aleflamedhebrew",
  6574. 0xfb4f,
  6575. "alefmaddaabovearabic",
  6576. 0x0622,
  6577. "alefmaddaabovefinalarabic",
  6578. 0xfe82,
  6579. "alefmaksuraarabic",
  6580. 0x0649,
  6581. "alefmaksurafinalarabic",
  6582. 0xfef0,
  6583. "alefmaksurainitialarabic",
  6584. 0xfef3,
  6585. "alefmaksuramedialarabic",
  6586. 0xfef4,
  6587. "alefpatahhebrew",
  6588. 0xfb2e,
  6589. "alefqamatshebrew",
  6590. 0xfb2f,
  6591. "aleph",
  6592. 0x2135,
  6593. "allequal",
  6594. 0x224c,
  6595. "alpha",
  6596. 0x03b1,
  6597. "alphatonos",
  6598. 0x03ac,
  6599. "amacron",
  6600. 0x0101,
  6601. "amonospace",
  6602. 0xff41,
  6603. "ampersand",
  6604. 0x0026,
  6605. "ampersandmonospace",
  6606. 0xff06,
  6607. "ampersandsmall",
  6608. 0xf726,
  6609. "amsquare",
  6610. 0x33c2,
  6611. "anbopomofo",
  6612. 0x3122,
  6613. "angbopomofo",
  6614. 0x3124,
  6615. "angbracketleft",
  6616. 0x3008,
  6617. "angbracketright",
  6618. 0x3009,
  6619. "angkhankhuthai",
  6620. 0x0e5a,
  6621. "angle",
  6622. 0x2220,
  6623. "anglebracketleft",
  6624. 0x3008,
  6625. "anglebracketleftvertical",
  6626. 0xfe3f,
  6627. "anglebracketright",
  6628. 0x3009,
  6629. "anglebracketrightvertical",
  6630. 0xfe40,
  6631. "angleleft",
  6632. 0x2329,
  6633. "angleright",
  6634. 0x232a,
  6635. "angstrom",
  6636. 0x212b,
  6637. "anoteleia",
  6638. 0x0387,
  6639. "anudattadeva",
  6640. 0x0952,
  6641. "anusvarabengali",
  6642. 0x0982,
  6643. "anusvaradeva",
  6644. 0x0902,
  6645. "anusvaragujarati",
  6646. 0x0a82,
  6647. "aogonek",
  6648. 0x0105,
  6649. "apaatosquare",
  6650. 0x3300,
  6651. "aparen",
  6652. 0x249c,
  6653. "apostrophearmenian",
  6654. 0x055a,
  6655. "apostrophemod",
  6656. 0x02bc,
  6657. "apple",
  6658. 0xf8ff,
  6659. "approaches",
  6660. 0x2250,
  6661. "approxequal",
  6662. 0x2248,
  6663. "approxequalorimage",
  6664. 0x2252,
  6665. "approximatelyequal",
  6666. 0x2245,
  6667. "araeaekorean",
  6668. 0x318e,
  6669. "araeakorean",
  6670. 0x318d,
  6671. "arc",
  6672. 0x2312,
  6673. "arighthalfring",
  6674. 0x1e9a,
  6675. "aring",
  6676. 0x00e5,
  6677. "aringacute",
  6678. 0x01fb,
  6679. "aringbelow",
  6680. 0x1e01,
  6681. "arrowboth",
  6682. 0x2194,
  6683. "arrowdashdown",
  6684. 0x21e3,
  6685. "arrowdashleft",
  6686. 0x21e0,
  6687. "arrowdashright",
  6688. 0x21e2,
  6689. "arrowdashup",
  6690. 0x21e1,
  6691. "arrowdblboth",
  6692. 0x21d4,
  6693. "arrowdbldown",
  6694. 0x21d3,
  6695. "arrowdblleft",
  6696. 0x21d0,
  6697. "arrowdblright",
  6698. 0x21d2,
  6699. "arrowdblup",
  6700. 0x21d1,
  6701. "arrowdown",
  6702. 0x2193,
  6703. "arrowdownleft",
  6704. 0x2199,
  6705. "arrowdownright",
  6706. 0x2198,
  6707. "arrowdownwhite",
  6708. 0x21e9,
  6709. "arrowheaddownmod",
  6710. 0x02c5,
  6711. "arrowheadleftmod",
  6712. 0x02c2,
  6713. "arrowheadrightmod",
  6714. 0x02c3,
  6715. "arrowheadupmod",
  6716. 0x02c4,
  6717. "arrowhorizex",
  6718. 0xf8e7,
  6719. "arrowleft",
  6720. 0x2190,
  6721. "arrowleftdbl",
  6722. 0x21d0,
  6723. "arrowleftdblstroke",
  6724. 0x21cd,
  6725. "arrowleftoverright",
  6726. 0x21c6,
  6727. "arrowleftwhite",
  6728. 0x21e6,
  6729. "arrowright",
  6730. 0x2192,
  6731. "arrowrightdblstroke",
  6732. 0x21cf,
  6733. "arrowrightheavy",
  6734. 0x279e,
  6735. "arrowrightoverleft",
  6736. 0x21c4,
  6737. "arrowrightwhite",
  6738. 0x21e8,
  6739. "arrowtableft",
  6740. 0x21e4,
  6741. "arrowtabright",
  6742. 0x21e5,
  6743. "arrowup",
  6744. 0x2191,
  6745. "arrowupdn",
  6746. 0x2195,
  6747. "arrowupdnbse",
  6748. 0x21a8,
  6749. "arrowupdownbase",
  6750. 0x21a8,
  6751. "arrowupleft",
  6752. 0x2196,
  6753. "arrowupleftofdown",
  6754. 0x21c5,
  6755. "arrowupright",
  6756. 0x2197,
  6757. "arrowupwhite",
  6758. 0x21e7,
  6759. "arrowvertex",
  6760. 0xf8e6,
  6761. "asciicircum",
  6762. 0x005e,
  6763. "asciicircummonospace",
  6764. 0xff3e,
  6765. "asciitilde",
  6766. 0x007e,
  6767. "asciitildemonospace",
  6768. 0xff5e,
  6769. "ascript",
  6770. 0x0251,
  6771. "ascriptturned",
  6772. 0x0252,
  6773. "asmallhiragana",
  6774. 0x3041,
  6775. "asmallkatakana",
  6776. 0x30a1,
  6777. "asmallkatakanahalfwidth",
  6778. 0xff67,
  6779. "asterisk",
  6780. 0x002a,
  6781. "asteriskaltonearabic",
  6782. 0x066d,
  6783. "asteriskarabic",
  6784. 0x066d,
  6785. "asteriskmath",
  6786. 0x2217,
  6787. "asteriskmonospace",
  6788. 0xff0a,
  6789. "asterisksmall",
  6790. 0xfe61,
  6791. "asterism",
  6792. 0x2042,
  6793. "asuperior",
  6794. 0xf6e9,
  6795. "asymptoticallyequal",
  6796. 0x2243,
  6797. "at",
  6798. 0x0040,
  6799. "atilde",
  6800. 0x00e3,
  6801. "atmonospace",
  6802. 0xff20,
  6803. "atsmall",
  6804. 0xfe6b,
  6805. "aturned",
  6806. 0x0250,
  6807. "aubengali",
  6808. 0x0994,
  6809. "aubopomofo",
  6810. 0x3120,
  6811. "audeva",
  6812. 0x0914,
  6813. "augujarati",
  6814. 0x0a94,
  6815. "augurmukhi",
  6816. 0x0a14,
  6817. "aulengthmarkbengali",
  6818. 0x09d7,
  6819. "aumatragurmukhi",
  6820. 0x0a4c,
  6821. "auvowelsignbengali",
  6822. 0x09cc,
  6823. "auvowelsigndeva",
  6824. 0x094c,
  6825. "auvowelsigngujarati",
  6826. 0x0acc,
  6827. "avagrahadeva",
  6828. 0x093d,
  6829. "aybarmenian",
  6830. 0x0561,
  6831. "ayin",
  6832. 0x05e2,
  6833. "ayinaltonehebrew",
  6834. 0xfb20,
  6835. "ayinhebrew",
  6836. 0x05e2,
  6837. "b",
  6838. 0x0062,
  6839. "babengali",
  6840. 0x09ac,
  6841. "backslash",
  6842. 0x005c,
  6843. "backslashmonospace",
  6844. 0xff3c,
  6845. "badeva",
  6846. 0x092c,
  6847. "bagujarati",
  6848. 0x0aac,
  6849. "bagurmukhi",
  6850. 0x0a2c,
  6851. "bahiragana",
  6852. 0x3070,
  6853. "bahtthai",
  6854. 0x0e3f,
  6855. "bakatakana",
  6856. 0x30d0,
  6857. "bar",
  6858. 0x007c,
  6859. "barmonospace",
  6860. 0xff5c,
  6861. "bbopomofo",
  6862. 0x3105,
  6863. "bcircle",
  6864. 0x24d1,
  6865. "bdotaccent",
  6866. 0x1e03,
  6867. "bdotbelow",
  6868. 0x1e05,
  6869. "beamedsixteenthnotes",
  6870. 0x266c,
  6871. "because",
  6872. 0x2235,
  6873. "becyrillic",
  6874. 0x0431,
  6875. "beharabic",
  6876. 0x0628,
  6877. "behfinalarabic",
  6878. 0xfe90,
  6879. "behinitialarabic",
  6880. 0xfe91,
  6881. "behiragana",
  6882. 0x3079,
  6883. "behmedialarabic",
  6884. 0xfe92,
  6885. "behmeeminitialarabic",
  6886. 0xfc9f,
  6887. "behmeemisolatedarabic",
  6888. 0xfc08,
  6889. "behnoonfinalarabic",
  6890. 0xfc6d,
  6891. "bekatakana",
  6892. 0x30d9,
  6893. "benarmenian",
  6894. 0x0562,
  6895. "bet",
  6896. 0x05d1,
  6897. "beta",
  6898. 0x03b2,
  6899. "betasymbolgreek",
  6900. 0x03d0,
  6901. "betdagesh",
  6902. 0xfb31,
  6903. "betdageshhebrew",
  6904. 0xfb31,
  6905. "bethebrew",
  6906. 0x05d1,
  6907. "betrafehebrew",
  6908. 0xfb4c,
  6909. "bhabengali",
  6910. 0x09ad,
  6911. "bhadeva",
  6912. 0x092d,
  6913. "bhagujarati",
  6914. 0x0aad,
  6915. "bhagurmukhi",
  6916. 0x0a2d,
  6917. "bhook",
  6918. 0x0253,
  6919. "bihiragana",
  6920. 0x3073,
  6921. "bikatakana",
  6922. 0x30d3,
  6923. "bilabialclick",
  6924. 0x0298,
  6925. "bindigurmukhi",
  6926. 0x0a02,
  6927. "birusquare",
  6928. 0x3331,
  6929. "blackcircle",
  6930. 0x25cf,
  6931. "blackdiamond",
  6932. 0x25c6,
  6933. "blackdownpointingtriangle",
  6934. 0x25bc,
  6935. "blackleftpointingpointer",
  6936. 0x25c4,
  6937. "blackleftpointingtriangle",
  6938. 0x25c0,
  6939. "blacklenticularbracketleft",
  6940. 0x3010,
  6941. "blacklenticularbracketleftvertical",
  6942. 0xfe3b,
  6943. "blacklenticularbracketright",
  6944. 0x3011,
  6945. "blacklenticularbracketrightvertical",
  6946. 0xfe3c,
  6947. "blacklowerlefttriangle",
  6948. 0x25e3,
  6949. "blacklowerrighttriangle",
  6950. 0x25e2,
  6951. "blackrectangle",
  6952. 0x25ac,
  6953. "blackrightpointingpointer",
  6954. 0x25ba,
  6955. "blackrightpointingtriangle",
  6956. 0x25b6,
  6957. "blacksmallsquare",
  6958. 0x25aa,
  6959. "blacksmilingface",
  6960. 0x263b,
  6961. "blacksquare",
  6962. 0x25a0,
  6963. "blackstar",
  6964. 0x2605,
  6965. "blackupperlefttriangle",
  6966. 0x25e4,
  6967. "blackupperrighttriangle",
  6968. 0x25e5,
  6969. "blackuppointingsmalltriangle",
  6970. 0x25b4,
  6971. "blackuppointingtriangle",
  6972. 0x25b2,
  6973. "blank",
  6974. 0x2423,
  6975. "blinebelow",
  6976. 0x1e07,
  6977. "block",
  6978. 0x2588,
  6979. "bmonospace",
  6980. 0xff42,
  6981. "bobaimaithai",
  6982. 0x0e1a,
  6983. "bohiragana",
  6984. 0x307c,
  6985. "bokatakana",
  6986. 0x30dc,
  6987. "bparen",
  6988. 0x249d,
  6989. "bqsquare",
  6990. 0x33c3,
  6991. "braceex",
  6992. 0xf8f4,
  6993. "braceleft",
  6994. 0x007b,
  6995. "braceleftbt",
  6996. 0xf8f3,
  6997. "braceleftmid",
  6998. 0xf8f2,
  6999. "braceleftmonospace",
  7000. 0xff5b,
  7001. "braceleftsmall",
  7002. 0xfe5b,
  7003. "bracelefttp",
  7004. 0xf8f1,
  7005. "braceleftvertical",
  7006. 0xfe37,
  7007. "braceright",
  7008. 0x007d,
  7009. "bracerightbt",
  7010. 0xf8fe,
  7011. "bracerightmid",
  7012. 0xf8fd,
  7013. "bracerightmonospace",
  7014. 0xff5d,
  7015. "bracerightsmall",
  7016. 0xfe5c,
  7017. "bracerighttp",
  7018. 0xf8fc,
  7019. "bracerightvertical",
  7020. 0xfe38,
  7021. "bracketleft",
  7022. 0x005b,
  7023. "bracketleftbt",
  7024. 0xf8f0,
  7025. "bracketleftex",
  7026. 0xf8ef,
  7027. "bracketleftmonospace",
  7028. 0xff3b,
  7029. "bracketlefttp",
  7030. 0xf8ee,
  7031. "bracketright",
  7032. 0x005d,
  7033. "bracketrightbt",
  7034. 0xf8fb,
  7035. "bracketrightex",
  7036. 0xf8fa,
  7037. "bracketrightmonospace",
  7038. 0xff3d,
  7039. "bracketrighttp",
  7040. 0xf8f9,
  7041. "breve",
  7042. 0x02d8,
  7043. "brevebelowcmb",
  7044. 0x032e,
  7045. "brevecmb",
  7046. 0x0306,
  7047. "breveinvertedbelowcmb",
  7048. 0x032f,
  7049. "breveinvertedcmb",
  7050. 0x0311,
  7051. "breveinverteddoublecmb",
  7052. 0x0361,
  7053. "bridgebelowcmb",
  7054. 0x032a,
  7055. "bridgeinvertedbelowcmb",
  7056. 0x033a,
  7057. "brokenbar",
  7058. 0x00a6,
  7059. "bstroke",
  7060. 0x0180,
  7061. "bsuperior",
  7062. 0xf6ea,
  7063. "btopbar",
  7064. 0x0183,
  7065. "buhiragana",
  7066. 0x3076,
  7067. "bukatakana",
  7068. 0x30d6,
  7069. "bullet",
  7070. 0x2022,
  7071. "bulletinverse",
  7072. 0x25d8,
  7073. "bulletoperator",
  7074. 0x2219,
  7075. "bullseye",
  7076. 0x25ce,
  7077. "c",
  7078. 0x0063,
  7079. "caarmenian",
  7080. 0x056e,
  7081. "cabengali",
  7082. 0x099a,
  7083. "cacute",
  7084. 0x0107,
  7085. "cadeva",
  7086. 0x091a,
  7087. "cagujarati",
  7088. 0x0a9a,
  7089. "cagurmukhi",
  7090. 0x0a1a,
  7091. "calsquare",
  7092. 0x3388,
  7093. "candrabindubengali",
  7094. 0x0981,
  7095. "candrabinducmb",
  7096. 0x0310,
  7097. "candrabindudeva",
  7098. 0x0901,
  7099. "candrabindugujarati",
  7100. 0x0a81,
  7101. "capslock",
  7102. 0x21ea,
  7103. "careof",
  7104. 0x2105,
  7105. "caron",
  7106. 0x02c7,
  7107. "caronbelowcmb",
  7108. 0x032c,
  7109. "caroncmb",
  7110. 0x030c,
  7111. "carriagereturn",
  7112. 0x21b5,
  7113. "cbopomofo",
  7114. 0x3118,
  7115. "ccaron",
  7116. 0x010d,
  7117. "ccedilla",
  7118. 0x00e7,
  7119. "ccedillaacute",
  7120. 0x1e09,
  7121. "ccircle",
  7122. 0x24d2,
  7123. "ccircumflex",
  7124. 0x0109,
  7125. "ccurl",
  7126. 0x0255,
  7127. "cdot",
  7128. 0x010b,
  7129. "cdotaccent",
  7130. 0x010b,
  7131. "cdsquare",
  7132. 0x33c5,
  7133. "cedilla",
  7134. 0x00b8,
  7135. "cedillacmb",
  7136. 0x0327,
  7137. "cent",
  7138. 0x00a2,
  7139. "centigrade",
  7140. 0x2103,
  7141. "centinferior",
  7142. 0xf6df,
  7143. "centmonospace",
  7144. 0xffe0,
  7145. "centoldstyle",
  7146. 0xf7a2,
  7147. "centsuperior",
  7148. 0xf6e0,
  7149. "chaarmenian",
  7150. 0x0579,
  7151. "chabengali",
  7152. 0x099b,
  7153. "chadeva",
  7154. 0x091b,
  7155. "chagujarati",
  7156. 0x0a9b,
  7157. "chagurmukhi",
  7158. 0x0a1b,
  7159. "chbopomofo",
  7160. 0x3114,
  7161. "cheabkhasiancyrillic",
  7162. 0x04bd,
  7163. "checkmark",
  7164. 0x2713,
  7165. "checyrillic",
  7166. 0x0447,
  7167. "chedescenderabkhasiancyrillic",
  7168. 0x04bf,
  7169. "chedescendercyrillic",
  7170. 0x04b7,
  7171. "chedieresiscyrillic",
  7172. 0x04f5,
  7173. "cheharmenian",
  7174. 0x0573,
  7175. "chekhakassiancyrillic",
  7176. 0x04cc,
  7177. "cheverticalstrokecyrillic",
  7178. 0x04b9,
  7179. "chi",
  7180. 0x03c7,
  7181. "chieuchacirclekorean",
  7182. 0x3277,
  7183. "chieuchaparenkorean",
  7184. 0x3217,
  7185. "chieuchcirclekorean",
  7186. 0x3269,
  7187. "chieuchkorean",
  7188. 0x314a,
  7189. "chieuchparenkorean",
  7190. 0x3209,
  7191. "chochangthai",
  7192. 0x0e0a,
  7193. "chochanthai",
  7194. 0x0e08,
  7195. "chochingthai",
  7196. 0x0e09,
  7197. "chochoethai",
  7198. 0x0e0c,
  7199. "chook",
  7200. 0x0188,
  7201. "cieucacirclekorean",
  7202. 0x3276,
  7203. "cieucaparenkorean",
  7204. 0x3216,
  7205. "cieuccirclekorean",
  7206. 0x3268,
  7207. "cieuckorean",
  7208. 0x3148,
  7209. "cieucparenkorean",
  7210. 0x3208,
  7211. "cieucuparenkorean",
  7212. 0x321c,
  7213. "circle",
  7214. 0x25cb,
  7215. "circlecopyrt",
  7216. 0x00a9,
  7217. "circlemultiply",
  7218. 0x2297,
  7219. "circleot",
  7220. 0x2299,
  7221. "circleplus",
  7222. 0x2295,
  7223. "circlepostalmark",
  7224. 0x3036,
  7225. "circlewithlefthalfblack",
  7226. 0x25d0,
  7227. "circlewithrighthalfblack",
  7228. 0x25d1,
  7229. "circumflex",
  7230. 0x02c6,
  7231. "circumflexbelowcmb",
  7232. 0x032d,
  7233. "circumflexcmb",
  7234. 0x0302,
  7235. "clear",
  7236. 0x2327,
  7237. "clickalveolar",
  7238. 0x01c2,
  7239. "clickdental",
  7240. 0x01c0,
  7241. "clicklateral",
  7242. 0x01c1,
  7243. "clickretroflex",
  7244. 0x01c3,
  7245. "club",
  7246. 0x2663,
  7247. "clubsuitblack",
  7248. 0x2663,
  7249. "clubsuitwhite",
  7250. 0x2667,
  7251. "cmcubedsquare",
  7252. 0x33a4,
  7253. "cmonospace",
  7254. 0xff43,
  7255. "cmsquaredsquare",
  7256. 0x33a0,
  7257. "coarmenian",
  7258. 0x0581,
  7259. "colon",
  7260. 0x003a,
  7261. "colonmonetary",
  7262. 0x20a1,
  7263. "colonmonospace",
  7264. 0xff1a,
  7265. "colonsign",
  7266. 0x20a1,
  7267. "colonsmall",
  7268. 0xfe55,
  7269. "colontriangularhalfmod",
  7270. 0x02d1,
  7271. "colontriangularmod",
  7272. 0x02d0,
  7273. "comma",
  7274. 0x002c,
  7275. "commaabovecmb",
  7276. 0x0313,
  7277. "commaaboverightcmb",
  7278. 0x0315,
  7279. "commaaccent",
  7280. 0xf6c3,
  7281. "commaarabic",
  7282. 0x060c,
  7283. "commaarmenian",
  7284. 0x055d,
  7285. "commainferior",
  7286. 0xf6e1,
  7287. "commamonospace",
  7288. 0xff0c,
  7289. "commareversedabovecmb",
  7290. 0x0314,
  7291. "commareversedmod",
  7292. 0x02bd,
  7293. "commasmall",
  7294. 0xfe50,
  7295. "commasuperior",
  7296. 0xf6e2,
  7297. "commaturnedabovecmb",
  7298. 0x0312,
  7299. "commaturnedmod",
  7300. 0x02bb,
  7301. "compass",
  7302. 0x263c,
  7303. "congruent",
  7304. 0x2245,
  7305. "contourintegral",
  7306. 0x222e,
  7307. "control",
  7308. 0x2303,
  7309. "controlACK",
  7310. 0x0006,
  7311. "controlBEL",
  7312. 0x0007,
  7313. "controlBS",
  7314. 0x0008,
  7315. "controlCAN",
  7316. 0x0018,
  7317. "controlCR",
  7318. 0x000d,
  7319. "controlDC1",
  7320. 0x0011,
  7321. "controlDC2",
  7322. 0x0012,
  7323. "controlDC3",
  7324. 0x0013,
  7325. "controlDC4",
  7326. 0x0014,
  7327. "controlDEL",
  7328. 0x007f,
  7329. "controlDLE",
  7330. 0x0010,
  7331. "controlEM",
  7332. 0x0019,
  7333. "controlENQ",
  7334. 0x0005,
  7335. "controlEOT",
  7336. 0x0004,
  7337. "controlESC",
  7338. 0x001b,
  7339. "controlETB",
  7340. 0x0017,
  7341. "controlETX",
  7342. 0x0003,
  7343. "controlFF",
  7344. 0x000c,
  7345. "controlFS",
  7346. 0x001c,
  7347. "controlGS",
  7348. 0x001d,
  7349. "controlHT",
  7350. 0x0009,
  7351. "controlLF",
  7352. 0x000a,
  7353. "controlNAK",
  7354. 0x0015,
  7355. "controlNULL",
  7356. 0x0000,
  7357. "controlRS",
  7358. 0x001e,
  7359. "controlSI",
  7360. 0x000f,
  7361. "controlSO",
  7362. 0x000e,
  7363. "controlSOT",
  7364. 0x0002,
  7365. "controlSTX",
  7366. 0x0001,
  7367. "controlSUB",
  7368. 0x001a,
  7369. "controlSYN",
  7370. 0x0016,
  7371. "controlUS",
  7372. 0x001f,
  7373. "controlVT",
  7374. 0x000b,
  7375. "copyright",
  7376. 0x00a9,
  7377. "copyrightsans",
  7378. 0xf8e9,
  7379. "copyrightserif",
  7380. 0xf6d9,
  7381. "cornerbracketleft",
  7382. 0x300c,
  7383. "cornerbracketlefthalfwidth",
  7384. 0xff62,
  7385. "cornerbracketleftvertical",
  7386. 0xfe41,
  7387. "cornerbracketright",
  7388. 0x300d,
  7389. "cornerbracketrighthalfwidth",
  7390. 0xff63,
  7391. "cornerbracketrightvertical",
  7392. 0xfe42,
  7393. "corporationsquare",
  7394. 0x337f,
  7395. "cosquare",
  7396. 0x33c7,
  7397. "coverkgsquare",
  7398. 0x33c6,
  7399. "cparen",
  7400. 0x249e,
  7401. "cruzeiro",
  7402. 0x20a2,
  7403. "cstretched",
  7404. 0x0297,
  7405. "curlyand",
  7406. 0x22cf,
  7407. "curlyor",
  7408. 0x22ce,
  7409. "currency",
  7410. 0x00a4,
  7411. "cyrBreve",
  7412. 0xf6d1,
  7413. "cyrFlex",
  7414. 0xf6d2,
  7415. "cyrbreve",
  7416. 0xf6d4,
  7417. "cyrflex",
  7418. 0xf6d5,
  7419. "d",
  7420. 0x0064,
  7421. "daarmenian",
  7422. 0x0564,
  7423. "dabengali",
  7424. 0x09a6,
  7425. "dadarabic",
  7426. 0x0636,
  7427. "dadeva",
  7428. 0x0926,
  7429. "dadfinalarabic",
  7430. 0xfebe,
  7431. "dadinitialarabic",
  7432. 0xfebf,
  7433. "dadmedialarabic",
  7434. 0xfec0,
  7435. "dagesh",
  7436. 0x05bc,
  7437. "dageshhebrew",
  7438. 0x05bc,
  7439. "dagger",
  7440. 0x2020,
  7441. "daggerdbl",
  7442. 0x2021,
  7443. "dagujarati",
  7444. 0x0aa6,
  7445. "dagurmukhi",
  7446. 0x0a26,
  7447. "dahiragana",
  7448. 0x3060,
  7449. "dakatakana",
  7450. 0x30c0,
  7451. "dalarabic",
  7452. 0x062f,
  7453. "dalet",
  7454. 0x05d3,
  7455. "daletdagesh",
  7456. 0xfb33,
  7457. "daletdageshhebrew",
  7458. 0xfb33,
  7459. "dalethebrew",
  7460. 0x05d3,
  7461. "dalfinalarabic",
  7462. 0xfeaa,
  7463. "dammaarabic",
  7464. 0x064f,
  7465. "dammalowarabic",
  7466. 0x064f,
  7467. "dammatanaltonearabic",
  7468. 0x064c,
  7469. "dammatanarabic",
  7470. 0x064c,
  7471. "danda",
  7472. 0x0964,
  7473. "dargahebrew",
  7474. 0x05a7,
  7475. "dargalefthebrew",
  7476. 0x05a7,
  7477. "dasiapneumatacyrilliccmb",
  7478. 0x0485,
  7479. "dblGrave",
  7480. 0xf6d3,
  7481. "dblanglebracketleft",
  7482. 0x300a,
  7483. "dblanglebracketleftvertical",
  7484. 0xfe3d,
  7485. "dblanglebracketright",
  7486. 0x300b,
  7487. "dblanglebracketrightvertical",
  7488. 0xfe3e,
  7489. "dblarchinvertedbelowcmb",
  7490. 0x032b,
  7491. "dblarrowleft",
  7492. 0x21d4,
  7493. "dblarrowright",
  7494. 0x21d2,
  7495. "dbldanda",
  7496. 0x0965,
  7497. "dblgrave",
  7498. 0xf6d6,
  7499. "dblgravecmb",
  7500. 0x030f,
  7501. "dblintegral",
  7502. 0x222c,
  7503. "dbllowline",
  7504. 0x2017,
  7505. "dbllowlinecmb",
  7506. 0x0333,
  7507. "dbloverlinecmb",
  7508. 0x033f,
  7509. "dblprimemod",
  7510. 0x02ba,
  7511. "dblverticalbar",
  7512. 0x2016,
  7513. "dblverticallineabovecmb",
  7514. 0x030e,
  7515. "dbopomofo",
  7516. 0x3109,
  7517. "dbsquare",
  7518. 0x33c8,
  7519. "dcaron",
  7520. 0x010f,
  7521. "dcedilla",
  7522. 0x1e11,
  7523. "dcircle",
  7524. 0x24d3,
  7525. "dcircumflexbelow",
  7526. 0x1e13,
  7527. "dcroat",
  7528. 0x0111,
  7529. "ddabengali",
  7530. 0x09a1,
  7531. "ddadeva",
  7532. 0x0921,
  7533. "ddagujarati",
  7534. 0x0aa1,
  7535. "ddagurmukhi",
  7536. 0x0a21,
  7537. "ddalarabic",
  7538. 0x0688,
  7539. "ddalfinalarabic",
  7540. 0xfb89,
  7541. "dddhadeva",
  7542. 0x095c,
  7543. "ddhabengali",
  7544. 0x09a2,
  7545. "ddhadeva",
  7546. 0x0922,
  7547. "ddhagujarati",
  7548. 0x0aa2,
  7549. "ddhagurmukhi",
  7550. 0x0a22,
  7551. "ddotaccent",
  7552. 0x1e0b,
  7553. "ddotbelow",
  7554. 0x1e0d,
  7555. "decimalseparatorarabic",
  7556. 0x066b,
  7557. "decimalseparatorpersian",
  7558. 0x066b,
  7559. "decyrillic",
  7560. 0x0434,
  7561. "degree",
  7562. 0x00b0,
  7563. "dehihebrew",
  7564. 0x05ad,
  7565. "dehiragana",
  7566. 0x3067,
  7567. "deicoptic",
  7568. 0x03ef,
  7569. "dekatakana",
  7570. 0x30c7,
  7571. "deleteleft",
  7572. 0x232b,
  7573. "deleteright",
  7574. 0x2326,
  7575. "delta",
  7576. 0x03b4,
  7577. "deltaturned",
  7578. 0x018d,
  7579. "denominatorminusonenumeratorbengali",
  7580. 0x09f8,
  7581. "dezh",
  7582. 0x02a4,
  7583. "dhabengali",
  7584. 0x09a7,
  7585. "dhadeva",
  7586. 0x0927,
  7587. "dhagujarati",
  7588. 0x0aa7,
  7589. "dhagurmukhi",
  7590. 0x0a27,
  7591. "dhook",
  7592. 0x0257,
  7593. "dialytikatonos",
  7594. 0x0385,
  7595. "dialytikatonoscmb",
  7596. 0x0344,
  7597. "diamond",
  7598. 0x2666,
  7599. "diamondsuitwhite",
  7600. 0x2662,
  7601. "dieresis",
  7602. 0x00a8,
  7603. "dieresisacute",
  7604. 0xf6d7,
  7605. "dieresisbelowcmb",
  7606. 0x0324,
  7607. "dieresiscmb",
  7608. 0x0308,
  7609. "dieresisgrave",
  7610. 0xf6d8,
  7611. "dieresistonos",
  7612. 0x0385,
  7613. "dihiragana",
  7614. 0x3062,
  7615. "dikatakana",
  7616. 0x30c2,
  7617. "dittomark",
  7618. 0x3003,
  7619. "divide",
  7620. 0x00f7,
  7621. "divides",
  7622. 0x2223,
  7623. "divisionslash",
  7624. 0x2215,
  7625. "djecyrillic",
  7626. 0x0452,
  7627. "dkshade",
  7628. 0x2593,
  7629. "dlinebelow",
  7630. 0x1e0f,
  7631. "dlsquare",
  7632. 0x3397,
  7633. "dmacron",
  7634. 0x0111,
  7635. "dmonospace",
  7636. 0xff44,
  7637. "dnblock",
  7638. 0x2584,
  7639. "dochadathai",
  7640. 0x0e0e,
  7641. "dodekthai",
  7642. 0x0e14,
  7643. "dohiragana",
  7644. 0x3069,
  7645. "dokatakana",
  7646. 0x30c9,
  7647. "dollar",
  7648. 0x0024,
  7649. "dollarinferior",
  7650. 0xf6e3,
  7651. "dollarmonospace",
  7652. 0xff04,
  7653. "dollaroldstyle",
  7654. 0xf724,
  7655. "dollarsmall",
  7656. 0xfe69,
  7657. "dollarsuperior",
  7658. 0xf6e4,
  7659. "dong",
  7660. 0x20ab,
  7661. "dorusquare",
  7662. 0x3326,
  7663. "dotaccent",
  7664. 0x02d9,
  7665. "dotaccentcmb",
  7666. 0x0307,
  7667. "dotbelowcmb",
  7668. 0x0323,
  7669. "dotbelowcomb",
  7670. 0x0323,
  7671. "dotkatakana",
  7672. 0x30fb,
  7673. "dotlessi",
  7674. 0x0131,
  7675. "dotlessj",
  7676. 0xf6be,
  7677. "dotlessjstrokehook",
  7678. 0x0284,
  7679. "dotmath",
  7680. 0x22c5,
  7681. "dottedcircle",
  7682. 0x25cc,
  7683. "doubleyodpatah",
  7684. 0xfb1f,
  7685. "doubleyodpatahhebrew",
  7686. 0xfb1f,
  7687. "downtackbelowcmb",
  7688. 0x031e,
  7689. "downtackmod",
  7690. 0x02d5,
  7691. "dparen",
  7692. 0x249f,
  7693. "dsuperior",
  7694. 0xf6eb,
  7695. "dtail",
  7696. 0x0256,
  7697. "dtopbar",
  7698. 0x018c,
  7699. "duhiragana",
  7700. 0x3065,
  7701. "dukatakana",
  7702. 0x30c5,
  7703. "dz",
  7704. 0x01f3,
  7705. "dzaltone",
  7706. 0x02a3,
  7707. "dzcaron",
  7708. 0x01c6,
  7709. "dzcurl",
  7710. 0x02a5,
  7711. "dzeabkhasiancyrillic",
  7712. 0x04e1,
  7713. "dzecyrillic",
  7714. 0x0455,
  7715. "dzhecyrillic",
  7716. 0x045f,
  7717. "e",
  7718. 0x0065,
  7719. "eacute",
  7720. 0x00e9,
  7721. "earth",
  7722. 0x2641,
  7723. "ebengali",
  7724. 0x098f,
  7725. "ebopomofo",
  7726. 0x311c,
  7727. "ebreve",
  7728. 0x0115,
  7729. "ecandradeva",
  7730. 0x090d,
  7731. "ecandragujarati",
  7732. 0x0a8d,
  7733. "ecandravowelsigndeva",
  7734. 0x0945,
  7735. "ecandravowelsigngujarati",
  7736. 0x0ac5,
  7737. "ecaron",
  7738. 0x011b,
  7739. "ecedillabreve",
  7740. 0x1e1d,
  7741. "echarmenian",
  7742. 0x0565,
  7743. "echyiwnarmenian",
  7744. 0x0587,
  7745. "ecircle",
  7746. 0x24d4,
  7747. "ecircumflex",
  7748. 0x00ea,
  7749. "ecircumflexacute",
  7750. 0x1ebf,
  7751. "ecircumflexbelow",
  7752. 0x1e19,
  7753. "ecircumflexdotbelow",
  7754. 0x1ec7,
  7755. "ecircumflexgrave",
  7756. 0x1ec1,
  7757. "ecircumflexhookabove",
  7758. 0x1ec3,
  7759. "ecircumflextilde",
  7760. 0x1ec5,
  7761. "ecyrillic",
  7762. 0x0454,
  7763. "edblgrave",
  7764. 0x0205,
  7765. "edeva",
  7766. 0x090f,
  7767. "edieresis",
  7768. 0x00eb,
  7769. "edot",
  7770. 0x0117,
  7771. "edotaccent",
  7772. 0x0117,
  7773. "edotbelow",
  7774. 0x1eb9,
  7775. "eegurmukhi",
  7776. 0x0a0f,
  7777. "eematragurmukhi",
  7778. 0x0a47,
  7779. "efcyrillic",
  7780. 0x0444,
  7781. "egrave",
  7782. 0x00e8,
  7783. "egujarati",
  7784. 0x0a8f,
  7785. "eharmenian",
  7786. 0x0567,
  7787. "ehbopomofo",
  7788. 0x311d,
  7789. "ehiragana",
  7790. 0x3048,
  7791. "ehookabove",
  7792. 0x1ebb,
  7793. "eibopomofo",
  7794. 0x311f,
  7795. "eight",
  7796. 0x0038,
  7797. "eightarabic",
  7798. 0x0668,
  7799. "eightbengali",
  7800. 0x09ee,
  7801. "eightcircle",
  7802. 0x2467,
  7803. "eightcircleinversesansserif",
  7804. 0x2791,
  7805. "eightdeva",
  7806. 0x096e,
  7807. "eighteencircle",
  7808. 0x2471,
  7809. "eighteenparen",
  7810. 0x2485,
  7811. "eighteenperiod",
  7812. 0x2499,
  7813. "eightgujarati",
  7814. 0x0aee,
  7815. "eightgurmukhi",
  7816. 0x0a6e,
  7817. "eighthackarabic",
  7818. 0x0668,
  7819. "eighthangzhou",
  7820. 0x3028,
  7821. "eighthnotebeamed",
  7822. 0x266b,
  7823. "eightideographicparen",
  7824. 0x3227,
  7825. "eightinferior",
  7826. 0x2088,
  7827. "eightmonospace",
  7828. 0xff18,
  7829. "eightoldstyle",
  7830. 0xf738,
  7831. "eightparen",
  7832. 0x247b,
  7833. "eightperiod",
  7834. 0x248f,
  7835. "eightpersian",
  7836. 0x06f8,
  7837. "eightroman",
  7838. 0x2177,
  7839. "eightsuperior",
  7840. 0x2078,
  7841. "eightthai",
  7842. 0x0e58,
  7843. "einvertedbreve",
  7844. 0x0207,
  7845. "eiotifiedcyrillic",
  7846. 0x0465,
  7847. "ekatakana",
  7848. 0x30a8,
  7849. "ekatakanahalfwidth",
  7850. 0xff74,
  7851. "ekonkargurmukhi",
  7852. 0x0a74,
  7853. "ekorean",
  7854. 0x3154,
  7855. "elcyrillic",
  7856. 0x043b,
  7857. "element",
  7858. 0x2208,
  7859. "elevencircle",
  7860. 0x246a,
  7861. "elevenparen",
  7862. 0x247e,
  7863. "elevenperiod",
  7864. 0x2492,
  7865. "elevenroman",
  7866. 0x217a,
  7867. "ellipsis",
  7868. 0x2026,
  7869. "ellipsisvertical",
  7870. 0x22ee,
  7871. "emacron",
  7872. 0x0113,
  7873. "emacronacute",
  7874. 0x1e17,
  7875. "emacrongrave",
  7876. 0x1e15,
  7877. "emcyrillic",
  7878. 0x043c,
  7879. "emdash",
  7880. 0x2014,
  7881. "emdashvertical",
  7882. 0xfe31,
  7883. "emonospace",
  7884. 0xff45,
  7885. "emphasismarkarmenian",
  7886. 0x055b,
  7887. "emptyset",
  7888. 0x2205,
  7889. "enbopomofo",
  7890. 0x3123,
  7891. "encyrillic",
  7892. 0x043d,
  7893. "endash",
  7894. 0x2013,
  7895. "endashvertical",
  7896. 0xfe32,
  7897. "endescendercyrillic",
  7898. 0x04a3,
  7899. "eng",
  7900. 0x014b,
  7901. "engbopomofo",
  7902. 0x3125,
  7903. "enghecyrillic",
  7904. 0x04a5,
  7905. "enhookcyrillic",
  7906. 0x04c8,
  7907. "enspace",
  7908. 0x2002,
  7909. "eogonek",
  7910. 0x0119,
  7911. "eokorean",
  7912. 0x3153,
  7913. "eopen",
  7914. 0x025b,
  7915. "eopenclosed",
  7916. 0x029a,
  7917. "eopenreversed",
  7918. 0x025c,
  7919. "eopenreversedclosed",
  7920. 0x025e,
  7921. "eopenreversedhook",
  7922. 0x025d,
  7923. "eparen",
  7924. 0x24a0,
  7925. "epsilon",
  7926. 0x03b5,
  7927. "epsilontonos",
  7928. 0x03ad,
  7929. "equal",
  7930. 0x003d,
  7931. "equalmonospace",
  7932. 0xff1d,
  7933. "equalsmall",
  7934. 0xfe66,
  7935. "equalsuperior",
  7936. 0x207c,
  7937. "equivalence",
  7938. 0x2261,
  7939. "erbopomofo",
  7940. 0x3126,
  7941. "ercyrillic",
  7942. 0x0440,
  7943. "ereversed",
  7944. 0x0258,
  7945. "ereversedcyrillic",
  7946. 0x044d,
  7947. "escyrillic",
  7948. 0x0441,
  7949. "esdescendercyrillic",
  7950. 0x04ab,
  7951. "esh",
  7952. 0x0283,
  7953. "eshcurl",
  7954. 0x0286,
  7955. "eshortdeva",
  7956. 0x090e,
  7957. "eshortvowelsigndeva",
  7958. 0x0946,
  7959. "eshreversedloop",
  7960. 0x01aa,
  7961. "eshsquatreversed",
  7962. 0x0285,
  7963. "esmallhiragana",
  7964. 0x3047,
  7965. "esmallkatakana",
  7966. 0x30a7,
  7967. "esmallkatakanahalfwidth",
  7968. 0xff6a,
  7969. "estimated",
  7970. 0x212e,
  7971. "esuperior",
  7972. 0xf6ec,
  7973. "eta",
  7974. 0x03b7,
  7975. "etarmenian",
  7976. 0x0568,
  7977. "etatonos",
  7978. 0x03ae,
  7979. "eth",
  7980. 0x00f0,
  7981. "etilde",
  7982. 0x1ebd,
  7983. "etildebelow",
  7984. 0x1e1b,
  7985. "etnahtafoukhhebrew",
  7986. 0x0591,
  7987. "etnahtafoukhlefthebrew",
  7988. 0x0591,
  7989. "etnahtahebrew",
  7990. 0x0591,
  7991. "etnahtalefthebrew",
  7992. 0x0591,
  7993. "eturned",
  7994. 0x01dd,
  7995. "eukorean",
  7996. 0x3161,
  7997. "euro",
  7998. 0x20ac,
  7999. "evowelsignbengali",
  8000. 0x09c7,
  8001. "evowelsigndeva",
  8002. 0x0947,
  8003. "evowelsigngujarati",
  8004. 0x0ac7,
  8005. "exclam",
  8006. 0x0021,
  8007. "exclamarmenian",
  8008. 0x055c,
  8009. "exclamdbl",
  8010. 0x203c,
  8011. "exclamdown",
  8012. 0x00a1,
  8013. "exclamdownsmall",
  8014. 0xf7a1,
  8015. "exclammonospace",
  8016. 0xff01,
  8017. "exclamsmall",
  8018. 0xf721,
  8019. "existential",
  8020. 0x2203,
  8021. "ezh",
  8022. 0x0292,
  8023. "ezhcaron",
  8024. 0x01ef,
  8025. "ezhcurl",
  8026. 0x0293,
  8027. "ezhreversed",
  8028. 0x01b9,
  8029. "ezhtail",
  8030. 0x01ba,
  8031. "f",
  8032. 0x0066,
  8033. "fadeva",
  8034. 0x095e,
  8035. "fagurmukhi",
  8036. 0x0a5e,
  8037. "fahrenheit",
  8038. 0x2109,
  8039. "fathaarabic",
  8040. 0x064e,
  8041. "fathalowarabic",
  8042. 0x064e,
  8043. "fathatanarabic",
  8044. 0x064b,
  8045. "fbopomofo",
  8046. 0x3108,
  8047. "fcircle",
  8048. 0x24d5,
  8049. "fdotaccent",
  8050. 0x1e1f,
  8051. "feharabic",
  8052. 0x0641,
  8053. "feharmenian",
  8054. 0x0586,
  8055. "fehfinalarabic",
  8056. 0xfed2,
  8057. "fehinitialarabic",
  8058. 0xfed3,
  8059. "fehmedialarabic",
  8060. 0xfed4,
  8061. "feicoptic",
  8062. 0x03e5,
  8063. "female",
  8064. 0x2640,
  8065. "ff",
  8066. 0xfb00,
  8067. "f_f",
  8068. 0xfb00,
  8069. "ffi",
  8070. 0xfb03,
  8071. "ffl",
  8072. 0xfb04,
  8073. "fi",
  8074. 0xfb01,
  8075. "fifteencircle",
  8076. 0x246e,
  8077. "fifteenparen",
  8078. 0x2482,
  8079. "fifteenperiod",
  8080. 0x2496,
  8081. "figuredash",
  8082. 0x2012,
  8083. "filledbox",
  8084. 0x25a0,
  8085. "filledrect",
  8086. 0x25ac,
  8087. "finalkaf",
  8088. 0x05da,
  8089. "finalkafdagesh",
  8090. 0xfb3a,
  8091. "finalkafdageshhebrew",
  8092. 0xfb3a,
  8093. "finalkafhebrew",
  8094. 0x05da,
  8095. "finalmem",
  8096. 0x05dd,
  8097. "finalmemhebrew",
  8098. 0x05dd,
  8099. "finalnun",
  8100. 0x05df,
  8101. "finalnunhebrew",
  8102. 0x05df,
  8103. "finalpe",
  8104. 0x05e3,
  8105. "finalpehebrew",
  8106. 0x05e3,
  8107. "finaltsadi",
  8108. 0x05e5,
  8109. "finaltsadihebrew",
  8110. 0x05e5,
  8111. "firsttonechinese",
  8112. 0x02c9,
  8113. "fisheye",
  8114. 0x25c9,
  8115. "fitacyrillic",
  8116. 0x0473,
  8117. "five",
  8118. 0x0035,
  8119. "fivearabic",
  8120. 0x0665,
  8121. "fivebengali",
  8122. 0x09eb,
  8123. "fivecircle",
  8124. 0x2464,
  8125. "fivecircleinversesansserif",
  8126. 0x278e,
  8127. "fivedeva",
  8128. 0x096b,
  8129. "fiveeighths",
  8130. 0x215d,
  8131. "fivegujarati",
  8132. 0x0aeb,
  8133. "fivegurmukhi",
  8134. 0x0a6b,
  8135. "fivehackarabic",
  8136. 0x0665,
  8137. "fivehangzhou",
  8138. 0x3025,
  8139. "fiveideographicparen",
  8140. 0x3224,
  8141. "fiveinferior",
  8142. 0x2085,
  8143. "fivemonospace",
  8144. 0xff15,
  8145. "fiveoldstyle",
  8146. 0xf735,
  8147. "fiveparen",
  8148. 0x2478,
  8149. "fiveperiod",
  8150. 0x248c,
  8151. "fivepersian",
  8152. 0x06f5,
  8153. "fiveroman",
  8154. 0x2174,
  8155. "fivesuperior",
  8156. 0x2075,
  8157. "fivethai",
  8158. 0x0e55,
  8159. "fl",
  8160. 0xfb02,
  8161. "florin",
  8162. 0x0192,
  8163. "fmonospace",
  8164. 0xff46,
  8165. "fmsquare",
  8166. 0x3399,
  8167. "fofanthai",
  8168. 0x0e1f,
  8169. "fofathai",
  8170. 0x0e1d,
  8171. "fongmanthai",
  8172. 0x0e4f,
  8173. "forall",
  8174. 0x2200,
  8175. "four",
  8176. 0x0034,
  8177. "fourarabic",
  8178. 0x0664,
  8179. "fourbengali",
  8180. 0x09ea,
  8181. "fourcircle",
  8182. 0x2463,
  8183. "fourcircleinversesansserif",
  8184. 0x278d,
  8185. "fourdeva",
  8186. 0x096a,
  8187. "fourgujarati",
  8188. 0x0aea,
  8189. "fourgurmukhi",
  8190. 0x0a6a,
  8191. "fourhackarabic",
  8192. 0x0664,
  8193. "fourhangzhou",
  8194. 0x3024,
  8195. "fourideographicparen",
  8196. 0x3223,
  8197. "fourinferior",
  8198. 0x2084,
  8199. "fourmonospace",
  8200. 0xff14,
  8201. "fournumeratorbengali",
  8202. 0x09f7,
  8203. "fouroldstyle",
  8204. 0xf734,
  8205. "fourparen",
  8206. 0x2477,
  8207. "fourperiod",
  8208. 0x248b,
  8209. "fourpersian",
  8210. 0x06f4,
  8211. "fourroman",
  8212. 0x2173,
  8213. "foursuperior",
  8214. 0x2074,
  8215. "fourteencircle",
  8216. 0x246d,
  8217. "fourteenparen",
  8218. 0x2481,
  8219. "fourteenperiod",
  8220. 0x2495,
  8221. "fourthai",
  8222. 0x0e54,
  8223. "fourthtonechinese",
  8224. 0x02cb,
  8225. "fparen",
  8226. 0x24a1,
  8227. "fraction",
  8228. 0x2044,
  8229. "franc",
  8230. 0x20a3,
  8231. "g",
  8232. 0x0067,
  8233. "gabengali",
  8234. 0x0997,
  8235. "gacute",
  8236. 0x01f5,
  8237. "gadeva",
  8238. 0x0917,
  8239. "gafarabic",
  8240. 0x06af,
  8241. "gaffinalarabic",
  8242. 0xfb93,
  8243. "gafinitialarabic",
  8244. 0xfb94,
  8245. "gafmedialarabic",
  8246. 0xfb95,
  8247. "gagujarati",
  8248. 0x0a97,
  8249. "gagurmukhi",
  8250. 0x0a17,
  8251. "gahiragana",
  8252. 0x304c,
  8253. "gakatakana",
  8254. 0x30ac,
  8255. "gamma",
  8256. 0x03b3,
  8257. "gammalatinsmall",
  8258. 0x0263,
  8259. "gammasuperior",
  8260. 0x02e0,
  8261. "gangiacoptic",
  8262. 0x03eb,
  8263. "gbopomofo",
  8264. 0x310d,
  8265. "gbreve",
  8266. 0x011f,
  8267. "gcaron",
  8268. 0x01e7,
  8269. "gcedilla",
  8270. 0x0123,
  8271. "gcircle",
  8272. 0x24d6,
  8273. "gcircumflex",
  8274. 0x011d,
  8275. "gcommaaccent",
  8276. 0x0123,
  8277. "gdot",
  8278. 0x0121,
  8279. "gdotaccent",
  8280. 0x0121,
  8281. "gecyrillic",
  8282. 0x0433,
  8283. "gehiragana",
  8284. 0x3052,
  8285. "gekatakana",
  8286. 0x30b2,
  8287. "geometricallyequal",
  8288. 0x2251,
  8289. "gereshaccenthebrew",
  8290. 0x059c,
  8291. "gereshhebrew",
  8292. 0x05f3,
  8293. "gereshmuqdamhebrew",
  8294. 0x059d,
  8295. "germandbls",
  8296. 0x00df,
  8297. "gershayimaccenthebrew",
  8298. 0x059e,
  8299. "gershayimhebrew",
  8300. 0x05f4,
  8301. "getamark",
  8302. 0x3013,
  8303. "ghabengali",
  8304. 0x0998,
  8305. "ghadarmenian",
  8306. 0x0572,
  8307. "ghadeva",
  8308. 0x0918,
  8309. "ghagujarati",
  8310. 0x0a98,
  8311. "ghagurmukhi",
  8312. 0x0a18,
  8313. "ghainarabic",
  8314. 0x063a,
  8315. "ghainfinalarabic",
  8316. 0xfece,
  8317. "ghaininitialarabic",
  8318. 0xfecf,
  8319. "ghainmedialarabic",
  8320. 0xfed0,
  8321. "ghemiddlehookcyrillic",
  8322. 0x0495,
  8323. "ghestrokecyrillic",
  8324. 0x0493,
  8325. "gheupturncyrillic",
  8326. 0x0491,
  8327. "ghhadeva",
  8328. 0x095a,
  8329. "ghhagurmukhi",
  8330. 0x0a5a,
  8331. "ghook",
  8332. 0x0260,
  8333. "ghzsquare",
  8334. 0x3393,
  8335. "gihiragana",
  8336. 0x304e,
  8337. "gikatakana",
  8338. 0x30ae,
  8339. "gimarmenian",
  8340. 0x0563,
  8341. "gimel",
  8342. 0x05d2,
  8343. "gimeldagesh",
  8344. 0xfb32,
  8345. "gimeldageshhebrew",
  8346. 0xfb32,
  8347. "gimelhebrew",
  8348. 0x05d2,
  8349. "gjecyrillic",
  8350. 0x0453,
  8351. "glottalinvertedstroke",
  8352. 0x01be,
  8353. "glottalstop",
  8354. 0x0294,
  8355. "glottalstopinverted",
  8356. 0x0296,
  8357. "glottalstopmod",
  8358. 0x02c0,
  8359. "glottalstopreversed",
  8360. 0x0295,
  8361. "glottalstopreversedmod",
  8362. 0x02c1,
  8363. "glottalstopreversedsuperior",
  8364. 0x02e4,
  8365. "glottalstopstroke",
  8366. 0x02a1,
  8367. "glottalstopstrokereversed",
  8368. 0x02a2,
  8369. "gmacron",
  8370. 0x1e21,
  8371. "gmonospace",
  8372. 0xff47,
  8373. "gohiragana",
  8374. 0x3054,
  8375. "gokatakana",
  8376. 0x30b4,
  8377. "gparen",
  8378. 0x24a2,
  8379. "gpasquare",
  8380. 0x33ac,
  8381. "gradient",
  8382. 0x2207,
  8383. "grave",
  8384. 0x0060,
  8385. "gravebelowcmb",
  8386. 0x0316,
  8387. "gravecmb",
  8388. 0x0300,
  8389. "gravecomb",
  8390. 0x0300,
  8391. "gravedeva",
  8392. 0x0953,
  8393. "gravelowmod",
  8394. 0x02ce,
  8395. "gravemonospace",
  8396. 0xff40,
  8397. "gravetonecmb",
  8398. 0x0340,
  8399. "greater",
  8400. 0x003e,
  8401. "greaterequal",
  8402. 0x2265,
  8403. "greaterequalorless",
  8404. 0x22db,
  8405. "greatermonospace",
  8406. 0xff1e,
  8407. "greaterorequivalent",
  8408. 0x2273,
  8409. "greaterorless",
  8410. 0x2277,
  8411. "greateroverequal",
  8412. 0x2267,
  8413. "greatersmall",
  8414. 0xfe65,
  8415. "gscript",
  8416. 0x0261,
  8417. "gstroke",
  8418. 0x01e5,
  8419. "guhiragana",
  8420. 0x3050,
  8421. "guillemotleft",
  8422. 0x00ab,
  8423. "guillemotright",
  8424. 0x00bb,
  8425. "guilsinglleft",
  8426. 0x2039,
  8427. "guilsinglright",
  8428. 0x203a,
  8429. "gukatakana",
  8430. 0x30b0,
  8431. "guramusquare",
  8432. 0x3318,
  8433. "gysquare",
  8434. 0x33c9,
  8435. "h",
  8436. 0x0068,
  8437. "haabkhasiancyrillic",
  8438. 0x04a9,
  8439. "haaltonearabic",
  8440. 0x06c1,
  8441. "habengali",
  8442. 0x09b9,
  8443. "hadescendercyrillic",
  8444. 0x04b3,
  8445. "hadeva",
  8446. 0x0939,
  8447. "hagujarati",
  8448. 0x0ab9,
  8449. "hagurmukhi",
  8450. 0x0a39,
  8451. "haharabic",
  8452. 0x062d,
  8453. "hahfinalarabic",
  8454. 0xfea2,
  8455. "hahinitialarabic",
  8456. 0xfea3,
  8457. "hahiragana",
  8458. 0x306f,
  8459. "hahmedialarabic",
  8460. 0xfea4,
  8461. "haitusquare",
  8462. 0x332a,
  8463. "hakatakana",
  8464. 0x30cf,
  8465. "hakatakanahalfwidth",
  8466. 0xff8a,
  8467. "halantgurmukhi",
  8468. 0x0a4d,
  8469. "hamzaarabic",
  8470. 0x0621,
  8471. "hamzalowarabic",
  8472. 0x0621,
  8473. "hangulfiller",
  8474. 0x3164,
  8475. "hardsigncyrillic",
  8476. 0x044a,
  8477. "harpoonleftbarbup",
  8478. 0x21bc,
  8479. "harpoonrightbarbup",
  8480. 0x21c0,
  8481. "hasquare",
  8482. 0x33ca,
  8483. "hatafpatah",
  8484. 0x05b2,
  8485. "hatafpatah16",
  8486. 0x05b2,
  8487. "hatafpatah23",
  8488. 0x05b2,
  8489. "hatafpatah2f",
  8490. 0x05b2,
  8491. "hatafpatahhebrew",
  8492. 0x05b2,
  8493. "hatafpatahnarrowhebrew",
  8494. 0x05b2,
  8495. "hatafpatahquarterhebrew",
  8496. 0x05b2,
  8497. "hatafpatahwidehebrew",
  8498. 0x05b2,
  8499. "hatafqamats",
  8500. 0x05b3,
  8501. "hatafqamats1b",
  8502. 0x05b3,
  8503. "hatafqamats28",
  8504. 0x05b3,
  8505. "hatafqamats34",
  8506. 0x05b3,
  8507. "hatafqamatshebrew",
  8508. 0x05b3,
  8509. "hatafqamatsnarrowhebrew",
  8510. 0x05b3,
  8511. "hatafqamatsquarterhebrew",
  8512. 0x05b3,
  8513. "hatafqamatswidehebrew",
  8514. 0x05b3,
  8515. "hatafsegol",
  8516. 0x05b1,
  8517. "hatafsegol17",
  8518. 0x05b1,
  8519. "hatafsegol24",
  8520. 0x05b1,
  8521. "hatafsegol30",
  8522. 0x05b1,
  8523. "hatafsegolhebrew",
  8524. 0x05b1,
  8525. "hatafsegolnarrowhebrew",
  8526. 0x05b1,
  8527. "hatafsegolquarterhebrew",
  8528. 0x05b1,
  8529. "hatafsegolwidehebrew",
  8530. 0x05b1,
  8531. "hbar",
  8532. 0x0127,
  8533. "hbopomofo",
  8534. 0x310f,
  8535. "hbrevebelow",
  8536. 0x1e2b,
  8537. "hcedilla",
  8538. 0x1e29,
  8539. "hcircle",
  8540. 0x24d7,
  8541. "hcircumflex",
  8542. 0x0125,
  8543. "hdieresis",
  8544. 0x1e27,
  8545. "hdotaccent",
  8546. 0x1e23,
  8547. "hdotbelow",
  8548. 0x1e25,
  8549. "he",
  8550. 0x05d4,
  8551. "heart",
  8552. 0x2665,
  8553. "heartsuitblack",
  8554. 0x2665,
  8555. "heartsuitwhite",
  8556. 0x2661,
  8557. "hedagesh",
  8558. 0xfb34,
  8559. "hedageshhebrew",
  8560. 0xfb34,
  8561. "hehaltonearabic",
  8562. 0x06c1,
  8563. "heharabic",
  8564. 0x0647,
  8565. "hehebrew",
  8566. 0x05d4,
  8567. "hehfinalaltonearabic",
  8568. 0xfba7,
  8569. "hehfinalalttwoarabic",
  8570. 0xfeea,
  8571. "hehfinalarabic",
  8572. 0xfeea,
  8573. "hehhamzaabovefinalarabic",
  8574. 0xfba5,
  8575. "hehhamzaaboveisolatedarabic",
  8576. 0xfba4,
  8577. "hehinitialaltonearabic",
  8578. 0xfba8,
  8579. "hehinitialarabic",
  8580. 0xfeeb,
  8581. "hehiragana",
  8582. 0x3078,
  8583. "hehmedialaltonearabic",
  8584. 0xfba9,
  8585. "hehmedialarabic",
  8586. 0xfeec,
  8587. "heiseierasquare",
  8588. 0x337b,
  8589. "hekatakana",
  8590. 0x30d8,
  8591. "hekatakanahalfwidth",
  8592. 0xff8d,
  8593. "hekutaarusquare",
  8594. 0x3336,
  8595. "henghook",
  8596. 0x0267,
  8597. "herutusquare",
  8598. 0x3339,
  8599. "het",
  8600. 0x05d7,
  8601. "hethebrew",
  8602. 0x05d7,
  8603. "hhook",
  8604. 0x0266,
  8605. "hhooksuperior",
  8606. 0x02b1,
  8607. "hieuhacirclekorean",
  8608. 0x327b,
  8609. "hieuhaparenkorean",
  8610. 0x321b,
  8611. "hieuhcirclekorean",
  8612. 0x326d,
  8613. "hieuhkorean",
  8614. 0x314e,
  8615. "hieuhparenkorean",
  8616. 0x320d,
  8617. "hihiragana",
  8618. 0x3072,
  8619. "hikatakana",
  8620. 0x30d2,
  8621. "hikatakanahalfwidth",
  8622. 0xff8b,
  8623. "hiriq",
  8624. 0x05b4,
  8625. "hiriq14",
  8626. 0x05b4,
  8627. "hiriq21",
  8628. 0x05b4,
  8629. "hiriq2d",
  8630. 0x05b4,
  8631. "hiriqhebrew",
  8632. 0x05b4,
  8633. "hiriqnarrowhebrew",
  8634. 0x05b4,
  8635. "hiriqquarterhebrew",
  8636. 0x05b4,
  8637. "hiriqwidehebrew",
  8638. 0x05b4,
  8639. "hlinebelow",
  8640. 0x1e96,
  8641. "hmonospace",
  8642. 0xff48,
  8643. "hoarmenian",
  8644. 0x0570,
  8645. "hohipthai",
  8646. 0x0e2b,
  8647. "hohiragana",
  8648. 0x307b,
  8649. "hokatakana",
  8650. 0x30db,
  8651. "hokatakanahalfwidth",
  8652. 0xff8e,
  8653. "holam",
  8654. 0x05b9,
  8655. "holam19",
  8656. 0x05b9,
  8657. "holam26",
  8658. 0x05b9,
  8659. "holam32",
  8660. 0x05b9,
  8661. "holamhebrew",
  8662. 0x05b9,
  8663. "holamnarrowhebrew",
  8664. 0x05b9,
  8665. "holamquarterhebrew",
  8666. 0x05b9,
  8667. "holamwidehebrew",
  8668. 0x05b9,
  8669. "honokhukthai",
  8670. 0x0e2e,
  8671. "hookabovecomb",
  8672. 0x0309,
  8673. "hookcmb",
  8674. 0x0309,
  8675. "hookpalatalizedbelowcmb",
  8676. 0x0321,
  8677. "hookretroflexbelowcmb",
  8678. 0x0322,
  8679. "hoonsquare",
  8680. 0x3342,
  8681. "horicoptic",
  8682. 0x03e9,
  8683. "horizontalbar",
  8684. 0x2015,
  8685. "horncmb",
  8686. 0x031b,
  8687. "hotsprings",
  8688. 0x2668,
  8689. "house",
  8690. 0x2302,
  8691. "hparen",
  8692. 0x24a3,
  8693. "hsuperior",
  8694. 0x02b0,
  8695. "hturned",
  8696. 0x0265,
  8697. "huhiragana",
  8698. 0x3075,
  8699. "huiitosquare",
  8700. 0x3333,
  8701. "hukatakana",
  8702. 0x30d5,
  8703. "hukatakanahalfwidth",
  8704. 0xff8c,
  8705. "hungarumlaut",
  8706. 0x02dd,
  8707. "hungarumlautcmb",
  8708. 0x030b,
  8709. "hv",
  8710. 0x0195,
  8711. "hyphen",
  8712. 0x002d,
  8713. "hypheninferior",
  8714. 0xf6e5,
  8715. "hyphenmonospace",
  8716. 0xff0d,
  8717. "hyphensmall",
  8718. 0xfe63,
  8719. "hyphensuperior",
  8720. 0xf6e6,
  8721. "hyphentwo",
  8722. 0x2010,
  8723. "i",
  8724. 0x0069,
  8725. "iacute",
  8726. 0x00ed,
  8727. "iacyrillic",
  8728. 0x044f,
  8729. "ibengali",
  8730. 0x0987,
  8731. "ibopomofo",
  8732. 0x3127,
  8733. "ibreve",
  8734. 0x012d,
  8735. "icaron",
  8736. 0x01d0,
  8737. "icircle",
  8738. 0x24d8,
  8739. "icircumflex",
  8740. 0x00ee,
  8741. "icyrillic",
  8742. 0x0456,
  8743. "idblgrave",
  8744. 0x0209,
  8745. "ideographearthcircle",
  8746. 0x328f,
  8747. "ideographfirecircle",
  8748. 0x328b,
  8749. "ideographicallianceparen",
  8750. 0x323f,
  8751. "ideographiccallparen",
  8752. 0x323a,
  8753. "ideographiccentrecircle",
  8754. 0x32a5,
  8755. "ideographicclose",
  8756. 0x3006,
  8757. "ideographiccomma",
  8758. 0x3001,
  8759. "ideographiccommaleft",
  8760. 0xff64,
  8761. "ideographiccongratulationparen",
  8762. 0x3237,
  8763. "ideographiccorrectcircle",
  8764. 0x32a3,
  8765. "ideographicearthparen",
  8766. 0x322f,
  8767. "ideographicenterpriseparen",
  8768. 0x323d,
  8769. "ideographicexcellentcircle",
  8770. 0x329d,
  8771. "ideographicfestivalparen",
  8772. 0x3240,
  8773. "ideographicfinancialcircle",
  8774. 0x3296,
  8775. "ideographicfinancialparen",
  8776. 0x3236,
  8777. "ideographicfireparen",
  8778. 0x322b,
  8779. "ideographichaveparen",
  8780. 0x3232,
  8781. "ideographichighcircle",
  8782. 0x32a4,
  8783. "ideographiciterationmark",
  8784. 0x3005,
  8785. "ideographiclaborcircle",
  8786. 0x3298,
  8787. "ideographiclaborparen",
  8788. 0x3238,
  8789. "ideographicleftcircle",
  8790. 0x32a7,
  8791. "ideographiclowcircle",
  8792. 0x32a6,
  8793. "ideographicmedicinecircle",
  8794. 0x32a9,
  8795. "ideographicmetalparen",
  8796. 0x322e,
  8797. "ideographicmoonparen",
  8798. 0x322a,
  8799. "ideographicnameparen",
  8800. 0x3234,
  8801. "ideographicperiod",
  8802. 0x3002,
  8803. "ideographicprintcircle",
  8804. 0x329e,
  8805. "ideographicreachparen",
  8806. 0x3243,
  8807. "ideographicrepresentparen",
  8808. 0x3239,
  8809. "ideographicresourceparen",
  8810. 0x323e,
  8811. "ideographicrightcircle",
  8812. 0x32a8,
  8813. "ideographicsecretcircle",
  8814. 0x3299,
  8815. "ideographicselfparen",
  8816. 0x3242,
  8817. "ideographicsocietyparen",
  8818. 0x3233,
  8819. "ideographicspace",
  8820. 0x3000,
  8821. "ideographicspecialparen",
  8822. 0x3235,
  8823. "ideographicstockparen",
  8824. 0x3231,
  8825. "ideographicstudyparen",
  8826. 0x323b,
  8827. "ideographicsunparen",
  8828. 0x3230,
  8829. "ideographicsuperviseparen",
  8830. 0x323c,
  8831. "ideographicwaterparen",
  8832. 0x322c,
  8833. "ideographicwoodparen",
  8834. 0x322d,
  8835. "ideographiczero",
  8836. 0x3007,
  8837. "ideographmetalcircle",
  8838. 0x328e,
  8839. "ideographmooncircle",
  8840. 0x328a,
  8841. "ideographnamecircle",
  8842. 0x3294,
  8843. "ideographsuncircle",
  8844. 0x3290,
  8845. "ideographwatercircle",
  8846. 0x328c,
  8847. "ideographwoodcircle",
  8848. 0x328d,
  8849. "ideva",
  8850. 0x0907,
  8851. "idieresis",
  8852. 0x00ef,
  8853. "idieresisacute",
  8854. 0x1e2f,
  8855. "idieresiscyrillic",
  8856. 0x04e5,
  8857. "idotbelow",
  8858. 0x1ecb,
  8859. "iebrevecyrillic",
  8860. 0x04d7,
  8861. "iecyrillic",
  8862. 0x0435,
  8863. "ieungacirclekorean",
  8864. 0x3275,
  8865. "ieungaparenkorean",
  8866. 0x3215,
  8867. "ieungcirclekorean",
  8868. 0x3267,
  8869. "ieungkorean",
  8870. 0x3147,
  8871. "ieungparenkorean",
  8872. 0x3207,
  8873. "igrave",
  8874. 0x00ec,
  8875. "igujarati",
  8876. 0x0a87,
  8877. "igurmukhi",
  8878. 0x0a07,
  8879. "ihiragana",
  8880. 0x3044,
  8881. "ihookabove",
  8882. 0x1ec9,
  8883. "iibengali",
  8884. 0x0988,
  8885. "iicyrillic",
  8886. 0x0438,
  8887. "iideva",
  8888. 0x0908,
  8889. "iigujarati",
  8890. 0x0a88,
  8891. "iigurmukhi",
  8892. 0x0a08,
  8893. "iimatragurmukhi",
  8894. 0x0a40,
  8895. "iinvertedbreve",
  8896. 0x020b,
  8897. "iishortcyrillic",
  8898. 0x0439,
  8899. "iivowelsignbengali",
  8900. 0x09c0,
  8901. "iivowelsigndeva",
  8902. 0x0940,
  8903. "iivowelsigngujarati",
  8904. 0x0ac0,
  8905. "ij",
  8906. 0x0133,
  8907. "ikatakana",
  8908. 0x30a4,
  8909. "ikatakanahalfwidth",
  8910. 0xff72,
  8911. "ikorean",
  8912. 0x3163,
  8913. "ilde",
  8914. 0x02dc,
  8915. "iluyhebrew",
  8916. 0x05ac,
  8917. "imacron",
  8918. 0x012b,
  8919. "imacroncyrillic",
  8920. 0x04e3,
  8921. "imageorapproximatelyequal",
  8922. 0x2253,
  8923. "imatragurmukhi",
  8924. 0x0a3f,
  8925. "imonospace",
  8926. 0xff49,
  8927. "increment",
  8928. 0x2206,
  8929. "infinity",
  8930. 0x221e,
  8931. "iniarmenian",
  8932. 0x056b,
  8933. "integral",
  8934. 0x222b,
  8935. "integralbottom",
  8936. 0x2321,
  8937. "integralbt",
  8938. 0x2321,
  8939. "integralex",
  8940. 0xf8f5,
  8941. "integraltop",
  8942. 0x2320,
  8943. "integraltp",
  8944. 0x2320,
  8945. "intersection",
  8946. 0x2229,
  8947. "intisquare",
  8948. 0x3305,
  8949. "invbullet",
  8950. 0x25d8,
  8951. "invcircle",
  8952. 0x25d9,
  8953. "invsmileface",
  8954. 0x263b,
  8955. "iocyrillic",
  8956. 0x0451,
  8957. "iogonek",
  8958. 0x012f,
  8959. "iota",
  8960. 0x03b9,
  8961. "iotadieresis",
  8962. 0x03ca,
  8963. "iotadieresistonos",
  8964. 0x0390,
  8965. "iotalatin",
  8966. 0x0269,
  8967. "iotatonos",
  8968. 0x03af,
  8969. "iparen",
  8970. 0x24a4,
  8971. "irigurmukhi",
  8972. 0x0a72,
  8973. "ismallhiragana",
  8974. 0x3043,
  8975. "ismallkatakana",
  8976. 0x30a3,
  8977. "ismallkatakanahalfwidth",
  8978. 0xff68,
  8979. "issharbengali",
  8980. 0x09fa,
  8981. "istroke",
  8982. 0x0268,
  8983. "isuperior",
  8984. 0xf6ed,
  8985. "iterationhiragana",
  8986. 0x309d,
  8987. "iterationkatakana",
  8988. 0x30fd,
  8989. "itilde",
  8990. 0x0129,
  8991. "itildebelow",
  8992. 0x1e2d,
  8993. "iubopomofo",
  8994. 0x3129,
  8995. "iucyrillic",
  8996. 0x044e,
  8997. "ivowelsignbengali",
  8998. 0x09bf,
  8999. "ivowelsigndeva",
  9000. 0x093f,
  9001. "ivowelsigngujarati",
  9002. 0x0abf,
  9003. "izhitsacyrillic",
  9004. 0x0475,
  9005. "izhitsadblgravecyrillic",
  9006. 0x0477,
  9007. "j",
  9008. 0x006a,
  9009. "jaarmenian",
  9010. 0x0571,
  9011. "jabengali",
  9012. 0x099c,
  9013. "jadeva",
  9014. 0x091c,
  9015. "jagujarati",
  9016. 0x0a9c,
  9017. "jagurmukhi",
  9018. 0x0a1c,
  9019. "jbopomofo",
  9020. 0x3110,
  9021. "jcaron",
  9022. 0x01f0,
  9023. "jcircle",
  9024. 0x24d9,
  9025. "jcircumflex",
  9026. 0x0135,
  9027. "jcrossedtail",
  9028. 0x029d,
  9029. "jdotlessstroke",
  9030. 0x025f,
  9031. "jecyrillic",
  9032. 0x0458,
  9033. "jeemarabic",
  9034. 0x062c,
  9035. "jeemfinalarabic",
  9036. 0xfe9e,
  9037. "jeeminitialarabic",
  9038. 0xfe9f,
  9039. "jeemmedialarabic",
  9040. 0xfea0,
  9041. "jeharabic",
  9042. 0x0698,
  9043. "jehfinalarabic",
  9044. 0xfb8b,
  9045. "jhabengali",
  9046. 0x099d,
  9047. "jhadeva",
  9048. 0x091d,
  9049. "jhagujarati",
  9050. 0x0a9d,
  9051. "jhagurmukhi",
  9052. 0x0a1d,
  9053. "jheharmenian",
  9054. 0x057b,
  9055. "jis",
  9056. 0x3004,
  9057. "jmonospace",
  9058. 0xff4a,
  9059. "jparen",
  9060. 0x24a5,
  9061. "jsuperior",
  9062. 0x02b2,
  9063. "k",
  9064. 0x006b,
  9065. "kabashkircyrillic",
  9066. 0x04a1,
  9067. "kabengali",
  9068. 0x0995,
  9069. "kacute",
  9070. 0x1e31,
  9071. "kacyrillic",
  9072. 0x043a,
  9073. "kadescendercyrillic",
  9074. 0x049b,
  9075. "kadeva",
  9076. 0x0915,
  9077. "kaf",
  9078. 0x05db,
  9079. "kafarabic",
  9080. 0x0643,
  9081. "kafdagesh",
  9082. 0xfb3b,
  9083. "kafdageshhebrew",
  9084. 0xfb3b,
  9085. "kaffinalarabic",
  9086. 0xfeda,
  9087. "kafhebrew",
  9088. 0x05db,
  9089. "kafinitialarabic",
  9090. 0xfedb,
  9091. "kafmedialarabic",
  9092. 0xfedc,
  9093. "kafrafehebrew",
  9094. 0xfb4d,
  9095. "kagujarati",
  9096. 0x0a95,
  9097. "kagurmukhi",
  9098. 0x0a15,
  9099. "kahiragana",
  9100. 0x304b,
  9101. "kahookcyrillic",
  9102. 0x04c4,
  9103. "kakatakana",
  9104. 0x30ab,
  9105. "kakatakanahalfwidth",
  9106. 0xff76,
  9107. "kappa",
  9108. 0x03ba,
  9109. "kappasymbolgreek",
  9110. 0x03f0,
  9111. "kapyeounmieumkorean",
  9112. 0x3171,
  9113. "kapyeounphieuphkorean",
  9114. 0x3184,
  9115. "kapyeounpieupkorean",
  9116. 0x3178,
  9117. "kapyeounssangpieupkorean",
  9118. 0x3179,
  9119. "karoriisquare",
  9120. 0x330d,
  9121. "kashidaautoarabic",
  9122. 0x0640,
  9123. "kashidaautonosidebearingarabic",
  9124. 0x0640,
  9125. "kasmallkatakana",
  9126. 0x30f5,
  9127. "kasquare",
  9128. 0x3384,
  9129. "kasraarabic",
  9130. 0x0650,
  9131. "kasratanarabic",
  9132. 0x064d,
  9133. "kastrokecyrillic",
  9134. 0x049f,
  9135. "katahiraprolongmarkhalfwidth",
  9136. 0xff70,
  9137. "kaverticalstrokecyrillic",
  9138. 0x049d,
  9139. "kbopomofo",
  9140. 0x310e,
  9141. "kcalsquare",
  9142. 0x3389,
  9143. "kcaron",
  9144. 0x01e9,
  9145. "kcedilla",
  9146. 0x0137,
  9147. "kcircle",
  9148. 0x24da,
  9149. "kcommaaccent",
  9150. 0x0137,
  9151. "kdotbelow",
  9152. 0x1e33,
  9153. "keharmenian",
  9154. 0x0584,
  9155. "kehiragana",
  9156. 0x3051,
  9157. "kekatakana",
  9158. 0x30b1,
  9159. "kekatakanahalfwidth",
  9160. 0xff79,
  9161. "kenarmenian",
  9162. 0x056f,
  9163. "kesmallkatakana",
  9164. 0x30f6,
  9165. "kgreenlandic",
  9166. 0x0138,
  9167. "khabengali",
  9168. 0x0996,
  9169. "khacyrillic",
  9170. 0x0445,
  9171. "khadeva",
  9172. 0x0916,
  9173. "khagujarati",
  9174. 0x0a96,
  9175. "khagurmukhi",
  9176. 0x0a16,
  9177. "khaharabic",
  9178. 0x062e,
  9179. "khahfinalarabic",
  9180. 0xfea6,
  9181. "khahinitialarabic",
  9182. 0xfea7,
  9183. "khahmedialarabic",
  9184. 0xfea8,
  9185. "kheicoptic",
  9186. 0x03e7,
  9187. "khhadeva",
  9188. 0x0959,
  9189. "khhagurmukhi",
  9190. 0x0a59,
  9191. "khieukhacirclekorean",
  9192. 0x3278,
  9193. "khieukhaparenkorean",
  9194. 0x3218,
  9195. "khieukhcirclekorean",
  9196. 0x326a,
  9197. "khieukhkorean",
  9198. 0x314b,
  9199. "khieukhparenkorean",
  9200. 0x320a,
  9201. "khokhaithai",
  9202. 0x0e02,
  9203. "khokhonthai",
  9204. 0x0e05,
  9205. "khokhuatthai",
  9206. 0x0e03,
  9207. "khokhwaithai",
  9208. 0x0e04,
  9209. "khomutthai",
  9210. 0x0e5b,
  9211. "khook",
  9212. 0x0199,
  9213. "khorakhangthai",
  9214. 0x0e06,
  9215. "khzsquare",
  9216. 0x3391,
  9217. "kihiragana",
  9218. 0x304d,
  9219. "kikatakana",
  9220. 0x30ad,
  9221. "kikatakanahalfwidth",
  9222. 0xff77,
  9223. "kiroguramusquare",
  9224. 0x3315,
  9225. "kiromeetorusquare",
  9226. 0x3316,
  9227. "kirosquare",
  9228. 0x3314,
  9229. "kiyeokacirclekorean",
  9230. 0x326e,
  9231. "kiyeokaparenkorean",
  9232. 0x320e,
  9233. "kiyeokcirclekorean",
  9234. 0x3260,
  9235. "kiyeokkorean",
  9236. 0x3131,
  9237. "kiyeokparenkorean",
  9238. 0x3200,
  9239. "kiyeoksioskorean",
  9240. 0x3133,
  9241. "kjecyrillic",
  9242. 0x045c,
  9243. "klinebelow",
  9244. 0x1e35,
  9245. "klsquare",
  9246. 0x3398,
  9247. "kmcubedsquare",
  9248. 0x33a6,
  9249. "kmonospace",
  9250. 0xff4b,
  9251. "kmsquaredsquare",
  9252. 0x33a2,
  9253. "kohiragana",
  9254. 0x3053,
  9255. "kohmsquare",
  9256. 0x33c0,
  9257. "kokaithai",
  9258. 0x0e01,
  9259. "kokatakana",
  9260. 0x30b3,
  9261. "kokatakanahalfwidth",
  9262. 0xff7a,
  9263. "kooposquare",
  9264. 0x331e,
  9265. "koppacyrillic",
  9266. 0x0481,
  9267. "koreanstandardsymbol",
  9268. 0x327f,
  9269. "koroniscmb",
  9270. 0x0343,
  9271. "kparen",
  9272. 0x24a6,
  9273. "kpasquare",
  9274. 0x33aa,
  9275. "ksicyrillic",
  9276. 0x046f,
  9277. "ktsquare",
  9278. 0x33cf,
  9279. "kturned",
  9280. 0x029e,
  9281. "kuhiragana",
  9282. 0x304f,
  9283. "kukatakana",
  9284. 0x30af,
  9285. "kukatakanahalfwidth",
  9286. 0xff78,
  9287. "kvsquare",
  9288. 0x33b8,
  9289. "kwsquare",
  9290. 0x33be,
  9291. "l",
  9292. 0x006c,
  9293. "labengali",
  9294. 0x09b2,
  9295. "lacute",
  9296. 0x013a,
  9297. "ladeva",
  9298. 0x0932,
  9299. "lagujarati",
  9300. 0x0ab2,
  9301. "lagurmukhi",
  9302. 0x0a32,
  9303. "lakkhangyaothai",
  9304. 0x0e45,
  9305. "lamaleffinalarabic",
  9306. 0xfefc,
  9307. "lamalefhamzaabovefinalarabic",
  9308. 0xfef8,
  9309. "lamalefhamzaaboveisolatedarabic",
  9310. 0xfef7,
  9311. "lamalefhamzabelowfinalarabic",
  9312. 0xfefa,
  9313. "lamalefhamzabelowisolatedarabic",
  9314. 0xfef9,
  9315. "lamalefisolatedarabic",
  9316. 0xfefb,
  9317. "lamalefmaddaabovefinalarabic",
  9318. 0xfef6,
  9319. "lamalefmaddaaboveisolatedarabic",
  9320. 0xfef5,
  9321. "lamarabic",
  9322. 0x0644,
  9323. "lambda",
  9324. 0x03bb,
  9325. "lambdastroke",
  9326. 0x019b,
  9327. "lamed",
  9328. 0x05dc,
  9329. "lameddagesh",
  9330. 0xfb3c,
  9331. "lameddageshhebrew",
  9332. 0xfb3c,
  9333. "lamedhebrew",
  9334. 0x05dc,
  9335. "lamfinalarabic",
  9336. 0xfede,
  9337. "lamhahinitialarabic",
  9338. 0xfcca,
  9339. "laminitialarabic",
  9340. 0xfedf,
  9341. "lamjeeminitialarabic",
  9342. 0xfcc9,
  9343. "lamkhahinitialarabic",
  9344. 0xfccb,
  9345. "lamlamhehisolatedarabic",
  9346. 0xfdf2,
  9347. "lammedialarabic",
  9348. 0xfee0,
  9349. "lammeemhahinitialarabic",
  9350. 0xfd88,
  9351. "lammeeminitialarabic",
  9352. 0xfccc,
  9353. "largecircle",
  9354. 0x25ef,
  9355. "lbar",
  9356. 0x019a,
  9357. "lbelt",
  9358. 0x026c,
  9359. "lbopomofo",
  9360. 0x310c,
  9361. "lcaron",
  9362. 0x013e,
  9363. "lcedilla",
  9364. 0x013c,
  9365. "lcircle",
  9366. 0x24db,
  9367. "lcircumflexbelow",
  9368. 0x1e3d,
  9369. "lcommaaccent",
  9370. 0x013c,
  9371. "ldot",
  9372. 0x0140,
  9373. "ldotaccent",
  9374. 0x0140,
  9375. "ldotbelow",
  9376. 0x1e37,
  9377. "ldotbelowmacron",
  9378. 0x1e39,
  9379. "leftangleabovecmb",
  9380. 0x031a,
  9381. "lefttackbelowcmb",
  9382. 0x0318,
  9383. "less",
  9384. 0x003c,
  9385. "lessequal",
  9386. 0x2264,
  9387. "lessequalorgreater",
  9388. 0x22da,
  9389. "lessmonospace",
  9390. 0xff1c,
  9391. "lessorequivalent",
  9392. 0x2272,
  9393. "lessorgreater",
  9394. 0x2276,
  9395. "lessoverequal",
  9396. 0x2266,
  9397. "lesssmall",
  9398. 0xfe64,
  9399. "lezh",
  9400. 0x026e,
  9401. "lfblock",
  9402. 0x258c,
  9403. "lhookretroflex",
  9404. 0x026d,
  9405. "lira",
  9406. 0x20a4,
  9407. "liwnarmenian",
  9408. 0x056c,
  9409. "lj",
  9410. 0x01c9,
  9411. "ljecyrillic",
  9412. 0x0459,
  9413. "ll",
  9414. 0xf6c0,
  9415. "lladeva",
  9416. 0x0933,
  9417. "llagujarati",
  9418. 0x0ab3,
  9419. "llinebelow",
  9420. 0x1e3b,
  9421. "llladeva",
  9422. 0x0934,
  9423. "llvocalicbengali",
  9424. 0x09e1,
  9425. "llvocalicdeva",
  9426. 0x0961,
  9427. "llvocalicvowelsignbengali",
  9428. 0x09e3,
  9429. "llvocalicvowelsigndeva",
  9430. 0x0963,
  9431. "lmiddletilde",
  9432. 0x026b,
  9433. "lmonospace",
  9434. 0xff4c,
  9435. "lmsquare",
  9436. 0x33d0,
  9437. "lochulathai",
  9438. 0x0e2c,
  9439. "logicaland",
  9440. 0x2227,
  9441. "logicalnot",
  9442. 0x00ac,
  9443. "logicalnotreversed",
  9444. 0x2310,
  9445. "logicalor",
  9446. 0x2228,
  9447. "lolingthai",
  9448. 0x0e25,
  9449. "longs",
  9450. 0x017f,
  9451. "lowlinecenterline",
  9452. 0xfe4e,
  9453. "lowlinecmb",
  9454. 0x0332,
  9455. "lowlinedashed",
  9456. 0xfe4d,
  9457. "lozenge",
  9458. 0x25ca,
  9459. "lparen",
  9460. 0x24a7,
  9461. "lslash",
  9462. 0x0142,
  9463. "lsquare",
  9464. 0x2113,
  9465. "lsuperior",
  9466. 0xf6ee,
  9467. "ltshade",
  9468. 0x2591,
  9469. "luthai",
  9470. 0x0e26,
  9471. "lvocalicbengali",
  9472. 0x098c,
  9473. "lvocalicdeva",
  9474. 0x090c,
  9475. "lvocalicvowelsignbengali",
  9476. 0x09e2,
  9477. "lvocalicvowelsigndeva",
  9478. 0x0962,
  9479. "lxsquare",
  9480. 0x33d3,
  9481. "m",
  9482. 0x006d,
  9483. "mabengali",
  9484. 0x09ae,
  9485. "macron",
  9486. 0x00af,
  9487. "macronbelowcmb",
  9488. 0x0331,
  9489. "macroncmb",
  9490. 0x0304,
  9491. "macronlowmod",
  9492. 0x02cd,
  9493. "macronmonospace",
  9494. 0xffe3,
  9495. "macute",
  9496. 0x1e3f,
  9497. "madeva",
  9498. 0x092e,
  9499. "magujarati",
  9500. 0x0aae,
  9501. "magurmukhi",
  9502. 0x0a2e,
  9503. "mahapakhhebrew",
  9504. 0x05a4,
  9505. "mahapakhlefthebrew",
  9506. 0x05a4,
  9507. "mahiragana",
  9508. 0x307e,
  9509. "maichattawalowleftthai",
  9510. 0xf895,
  9511. "maichattawalowrightthai",
  9512. 0xf894,
  9513. "maichattawathai",
  9514. 0x0e4b,
  9515. "maichattawaupperleftthai",
  9516. 0xf893,
  9517. "maieklowleftthai",
  9518. 0xf88c,
  9519. "maieklowrightthai",
  9520. 0xf88b,
  9521. "maiekthai",
  9522. 0x0e48,
  9523. "maiekupperleftthai",
  9524. 0xf88a,
  9525. "maihanakatleftthai",
  9526. 0xf884,
  9527. "maihanakatthai",
  9528. 0x0e31,
  9529. "maitaikhuleftthai",
  9530. 0xf889,
  9531. "maitaikhuthai",
  9532. 0x0e47,
  9533. "maitholowleftthai",
  9534. 0xf88f,
  9535. "maitholowrightthai",
  9536. 0xf88e,
  9537. "maithothai",
  9538. 0x0e49,
  9539. "maithoupperleftthai",
  9540. 0xf88d,
  9541. "maitrilowleftthai",
  9542. 0xf892,
  9543. "maitrilowrightthai",
  9544. 0xf891,
  9545. "maitrithai",
  9546. 0x0e4a,
  9547. "maitriupperleftthai",
  9548. 0xf890,
  9549. "maiyamokthai",
  9550. 0x0e46,
  9551. "makatakana",
  9552. 0x30de,
  9553. "makatakanahalfwidth",
  9554. 0xff8f,
  9555. "male",
  9556. 0x2642,
  9557. "mansyonsquare",
  9558. 0x3347,
  9559. "maqafhebrew",
  9560. 0x05be,
  9561. "mars",
  9562. 0x2642,
  9563. "masoracirclehebrew",
  9564. 0x05af,
  9565. "masquare",
  9566. 0x3383,
  9567. "mbopomofo",
  9568. 0x3107,
  9569. "mbsquare",
  9570. 0x33d4,
  9571. "mcircle",
  9572. 0x24dc,
  9573. "mcubedsquare",
  9574. 0x33a5,
  9575. "mdotaccent",
  9576. 0x1e41,
  9577. "mdotbelow",
  9578. 0x1e43,
  9579. "meemarabic",
  9580. 0x0645,
  9581. "meemfinalarabic",
  9582. 0xfee2,
  9583. "meeminitialarabic",
  9584. 0xfee3,
  9585. "meemmedialarabic",
  9586. 0xfee4,
  9587. "meemmeeminitialarabic",
  9588. 0xfcd1,
  9589. "meemmeemisolatedarabic",
  9590. 0xfc48,
  9591. "meetorusquare",
  9592. 0x334d,
  9593. "mehiragana",
  9594. 0x3081,
  9595. "meizierasquare",
  9596. 0x337e,
  9597. "mekatakana",
  9598. 0x30e1,
  9599. "mekatakanahalfwidth",
  9600. 0xff92,
  9601. "mem",
  9602. 0x05de,
  9603. "memdagesh",
  9604. 0xfb3e,
  9605. "memdageshhebrew",
  9606. 0xfb3e,
  9607. "memhebrew",
  9608. 0x05de,
  9609. "menarmenian",
  9610. 0x0574,
  9611. "merkhahebrew",
  9612. 0x05a5,
  9613. "merkhakefulahebrew",
  9614. 0x05a6,
  9615. "merkhakefulalefthebrew",
  9616. 0x05a6,
  9617. "merkhalefthebrew",
  9618. 0x05a5,
  9619. "mhook",
  9620. 0x0271,
  9621. "mhzsquare",
  9622. 0x3392,
  9623. "middledotkatakanahalfwidth",
  9624. 0xff65,
  9625. "middot",
  9626. 0x00b7,
  9627. "mieumacirclekorean",
  9628. 0x3272,
  9629. "mieumaparenkorean",
  9630. 0x3212,
  9631. "mieumcirclekorean",
  9632. 0x3264,
  9633. "mieumkorean",
  9634. 0x3141,
  9635. "mieumpansioskorean",
  9636. 0x3170,
  9637. "mieumparenkorean",
  9638. 0x3204,
  9639. "mieumpieupkorean",
  9640. 0x316e,
  9641. "mieumsioskorean",
  9642. 0x316f,
  9643. "mihiragana",
  9644. 0x307f,
  9645. "mikatakana",
  9646. 0x30df,
  9647. "mikatakanahalfwidth",
  9648. 0xff90,
  9649. "minus",
  9650. 0x2212,
  9651. "minusbelowcmb",
  9652. 0x0320,
  9653. "minuscircle",
  9654. 0x2296,
  9655. "minusmod",
  9656. 0x02d7,
  9657. "minusplus",
  9658. 0x2213,
  9659. "minute",
  9660. 0x2032,
  9661. "miribaarusquare",
  9662. 0x334a,
  9663. "mirisquare",
  9664. 0x3349,
  9665. "mlonglegturned",
  9666. 0x0270,
  9667. "mlsquare",
  9668. 0x3396,
  9669. "mmcubedsquare",
  9670. 0x33a3,
  9671. "mmonospace",
  9672. 0xff4d,
  9673. "mmsquaredsquare",
  9674. 0x339f,
  9675. "mohiragana",
  9676. 0x3082,
  9677. "mohmsquare",
  9678. 0x33c1,
  9679. "mokatakana",
  9680. 0x30e2,
  9681. "mokatakanahalfwidth",
  9682. 0xff93,
  9683. "molsquare",
  9684. 0x33d6,
  9685. "momathai",
  9686. 0x0e21,
  9687. "moverssquare",
  9688. 0x33a7,
  9689. "moverssquaredsquare",
  9690. 0x33a8,
  9691. "mparen",
  9692. 0x24a8,
  9693. "mpasquare",
  9694. 0x33ab,
  9695. "mssquare",
  9696. 0x33b3,
  9697. "msuperior",
  9698. 0xf6ef,
  9699. "mturned",
  9700. 0x026f,
  9701. "mu",
  9702. 0x00b5,
  9703. "mu1",
  9704. 0x00b5,
  9705. "muasquare",
  9706. 0x3382,
  9707. "muchgreater",
  9708. 0x226b,
  9709. "muchless",
  9710. 0x226a,
  9711. "mufsquare",
  9712. 0x338c,
  9713. "mugreek",
  9714. 0x03bc,
  9715. "mugsquare",
  9716. 0x338d,
  9717. "muhiragana",
  9718. 0x3080,
  9719. "mukatakana",
  9720. 0x30e0,
  9721. "mukatakanahalfwidth",
  9722. 0xff91,
  9723. "mulsquare",
  9724. 0x3395,
  9725. "multiply",
  9726. 0x00d7,
  9727. "mumsquare",
  9728. 0x339b,
  9729. "munahhebrew",
  9730. 0x05a3,
  9731. "munahlefthebrew",
  9732. 0x05a3,
  9733. "musicalnote",
  9734. 0x266a,
  9735. "musicalnotedbl",
  9736. 0x266b,
  9737. "musicflatsign",
  9738. 0x266d,
  9739. "musicsharpsign",
  9740. 0x266f,
  9741. "mussquare",
  9742. 0x33b2,
  9743. "muvsquare",
  9744. 0x33b6,
  9745. "muwsquare",
  9746. 0x33bc,
  9747. "mvmegasquare",
  9748. 0x33b9,
  9749. "mvsquare",
  9750. 0x33b7,
  9751. "mwmegasquare",
  9752. 0x33bf,
  9753. "mwsquare",
  9754. 0x33bd,
  9755. "n",
  9756. 0x006e,
  9757. "nabengali",
  9758. 0x09a8,
  9759. "nabla",
  9760. 0x2207,
  9761. "nacute",
  9762. 0x0144,
  9763. "nadeva",
  9764. 0x0928,
  9765. "nagujarati",
  9766. 0x0aa8,
  9767. "nagurmukhi",
  9768. 0x0a28,
  9769. "nahiragana",
  9770. 0x306a,
  9771. "nakatakana",
  9772. 0x30ca,
  9773. "nakatakanahalfwidth",
  9774. 0xff85,
  9775. "napostrophe",
  9776. 0x0149,
  9777. "nasquare",
  9778. 0x3381,
  9779. "nbopomofo",
  9780. 0x310b,
  9781. "nbspace",
  9782. 0x00a0,
  9783. "ncaron",
  9784. 0x0148,
  9785. "ncedilla",
  9786. 0x0146,
  9787. "ncircle",
  9788. 0x24dd,
  9789. "ncircumflexbelow",
  9790. 0x1e4b,
  9791. "ncommaaccent",
  9792. 0x0146,
  9793. "ndotaccent",
  9794. 0x1e45,
  9795. "ndotbelow",
  9796. 0x1e47,
  9797. "nehiragana",
  9798. 0x306d,
  9799. "nekatakana",
  9800. 0x30cd,
  9801. "nekatakanahalfwidth",
  9802. 0xff88,
  9803. "newsheqelsign",
  9804. 0x20aa,
  9805. "nfsquare",
  9806. 0x338b,
  9807. "ngabengali",
  9808. 0x0999,
  9809. "ngadeva",
  9810. 0x0919,
  9811. "ngagujarati",
  9812. 0x0a99,
  9813. "ngagurmukhi",
  9814. 0x0a19,
  9815. "ngonguthai",
  9816. 0x0e07,
  9817. "nhiragana",
  9818. 0x3093,
  9819. "nhookleft",
  9820. 0x0272,
  9821. "nhookretroflex",
  9822. 0x0273,
  9823. "nieunacirclekorean",
  9824. 0x326f,
  9825. "nieunaparenkorean",
  9826. 0x320f,
  9827. "nieuncieuckorean",
  9828. 0x3135,
  9829. "nieuncirclekorean",
  9830. 0x3261,
  9831. "nieunhieuhkorean",
  9832. 0x3136,
  9833. "nieunkorean",
  9834. 0x3134,
  9835. "nieunpansioskorean",
  9836. 0x3168,
  9837. "nieunparenkorean",
  9838. 0x3201,
  9839. "nieunsioskorean",
  9840. 0x3167,
  9841. "nieuntikeutkorean",
  9842. 0x3166,
  9843. "nihiragana",
  9844. 0x306b,
  9845. "nikatakana",
  9846. 0x30cb,
  9847. "nikatakanahalfwidth",
  9848. 0xff86,
  9849. "nikhahitleftthai",
  9850. 0xf899,
  9851. "nikhahitthai",
  9852. 0x0e4d,
  9853. "nine",
  9854. 0x0039,
  9855. "ninearabic",
  9856. 0x0669,
  9857. "ninebengali",
  9858. 0x09ef,
  9859. "ninecircle",
  9860. 0x2468,
  9861. "ninecircleinversesansserif",
  9862. 0x2792,
  9863. "ninedeva",
  9864. 0x096f,
  9865. "ninegujarati",
  9866. 0x0aef,
  9867. "ninegurmukhi",
  9868. 0x0a6f,
  9869. "ninehackarabic",
  9870. 0x0669,
  9871. "ninehangzhou",
  9872. 0x3029,
  9873. "nineideographicparen",
  9874. 0x3228,
  9875. "nineinferior",
  9876. 0x2089,
  9877. "ninemonospace",
  9878. 0xff19,
  9879. "nineoldstyle",
  9880. 0xf739,
  9881. "nineparen",
  9882. 0x247c,
  9883. "nineperiod",
  9884. 0x2490,
  9885. "ninepersian",
  9886. 0x06f9,
  9887. "nineroman",
  9888. 0x2178,
  9889. "ninesuperior",
  9890. 0x2079,
  9891. "nineteencircle",
  9892. 0x2472,
  9893. "nineteenparen",
  9894. 0x2486,
  9895. "nineteenperiod",
  9896. 0x249a,
  9897. "ninethai",
  9898. 0x0e59,
  9899. "nj",
  9900. 0x01cc,
  9901. "njecyrillic",
  9902. 0x045a,
  9903. "nkatakana",
  9904. 0x30f3,
  9905. "nkatakanahalfwidth",
  9906. 0xff9d,
  9907. "nlegrightlong",
  9908. 0x019e,
  9909. "nlinebelow",
  9910. 0x1e49,
  9911. "nmonospace",
  9912. 0xff4e,
  9913. "nmsquare",
  9914. 0x339a,
  9915. "nnabengali",
  9916. 0x09a3,
  9917. "nnadeva",
  9918. 0x0923,
  9919. "nnagujarati",
  9920. 0x0aa3,
  9921. "nnagurmukhi",
  9922. 0x0a23,
  9923. "nnnadeva",
  9924. 0x0929,
  9925. "nohiragana",
  9926. 0x306e,
  9927. "nokatakana",
  9928. 0x30ce,
  9929. "nokatakanahalfwidth",
  9930. 0xff89,
  9931. "nonbreakingspace",
  9932. 0x00a0,
  9933. "nonenthai",
  9934. 0x0e13,
  9935. "nonuthai",
  9936. 0x0e19,
  9937. "noonarabic",
  9938. 0x0646,
  9939. "noonfinalarabic",
  9940. 0xfee6,
  9941. "noonghunnaarabic",
  9942. 0x06ba,
  9943. "noonghunnafinalarabic",
  9944. 0xfb9f,
  9945. "nooninitialarabic",
  9946. 0xfee7,
  9947. "noonjeeminitialarabic",
  9948. 0xfcd2,
  9949. "noonjeemisolatedarabic",
  9950. 0xfc4b,
  9951. "noonmedialarabic",
  9952. 0xfee8,
  9953. "noonmeeminitialarabic",
  9954. 0xfcd5,
  9955. "noonmeemisolatedarabic",
  9956. 0xfc4e,
  9957. "noonnoonfinalarabic",
  9958. 0xfc8d,
  9959. "notcontains",
  9960. 0x220c,
  9961. "notelement",
  9962. 0x2209,
  9963. "notelementof",
  9964. 0x2209,
  9965. "notequal",
  9966. 0x2260,
  9967. "notgreater",
  9968. 0x226f,
  9969. "notgreaternorequal",
  9970. 0x2271,
  9971. "notgreaternorless",
  9972. 0x2279,
  9973. "notidentical",
  9974. 0x2262,
  9975. "notless",
  9976. 0x226e,
  9977. "notlessnorequal",
  9978. 0x2270,
  9979. "notparallel",
  9980. 0x2226,
  9981. "notprecedes",
  9982. 0x2280,
  9983. "notsubset",
  9984. 0x2284,
  9985. "notsucceeds",
  9986. 0x2281,
  9987. "notsuperset",
  9988. 0x2285,
  9989. "nowarmenian",
  9990. 0x0576,
  9991. "nparen",
  9992. 0x24a9,
  9993. "nssquare",
  9994. 0x33b1,
  9995. "nsuperior",
  9996. 0x207f,
  9997. "ntilde",
  9998. 0x00f1,
  9999. "nu",
  10000. 0x03bd,
  10001. "nuhiragana",
  10002. 0x306c,
  10003. "nukatakana",
  10004. 0x30cc,
  10005. "nukatakanahalfwidth",
  10006. 0xff87,
  10007. "nuktabengali",
  10008. 0x09bc,
  10009. "nuktadeva",
  10010. 0x093c,
  10011. "nuktagujarati",
  10012. 0x0abc,
  10013. "nuktagurmukhi",
  10014. 0x0a3c,
  10015. "numbersign",
  10016. 0x0023,
  10017. "numbersignmonospace",
  10018. 0xff03,
  10019. "numbersignsmall",
  10020. 0xfe5f,
  10021. "numeralsigngreek",
  10022. 0x0374,
  10023. "numeralsignlowergreek",
  10024. 0x0375,
  10025. "numero",
  10026. 0x2116,
  10027. "nun",
  10028. 0x05e0,
  10029. "nundagesh",
  10030. 0xfb40,
  10031. "nundageshhebrew",
  10032. 0xfb40,
  10033. "nunhebrew",
  10034. 0x05e0,
  10035. "nvsquare",
  10036. 0x33b5,
  10037. "nwsquare",
  10038. 0x33bb,
  10039. "nyabengali",
  10040. 0x099e,
  10041. "nyadeva",
  10042. 0x091e,
  10043. "nyagujarati",
  10044. 0x0a9e,
  10045. "nyagurmukhi",
  10046. 0x0a1e,
  10047. "o",
  10048. 0x006f,
  10049. "oacute",
  10050. 0x00f3,
  10051. "oangthai",
  10052. 0x0e2d,
  10053. "obarred",
  10054. 0x0275,
  10055. "obarredcyrillic",
  10056. 0x04e9,
  10057. "obarreddieresiscyrillic",
  10058. 0x04eb,
  10059. "obengali",
  10060. 0x0993,
  10061. "obopomofo",
  10062. 0x311b,
  10063. "obreve",
  10064. 0x014f,
  10065. "ocandradeva",
  10066. 0x0911,
  10067. "ocandragujarati",
  10068. 0x0a91,
  10069. "ocandravowelsigndeva",
  10070. 0x0949,
  10071. "ocandravowelsigngujarati",
  10072. 0x0ac9,
  10073. "ocaron",
  10074. 0x01d2,
  10075. "ocircle",
  10076. 0x24de,
  10077. "ocircumflex",
  10078. 0x00f4,
  10079. "ocircumflexacute",
  10080. 0x1ed1,
  10081. "ocircumflexdotbelow",
  10082. 0x1ed9,
  10083. "ocircumflexgrave",
  10084. 0x1ed3,
  10085. "ocircumflexhookabove",
  10086. 0x1ed5,
  10087. "ocircumflextilde",
  10088. 0x1ed7,
  10089. "ocyrillic",
  10090. 0x043e,
  10091. "odblacute",
  10092. 0x0151,
  10093. "odblgrave",
  10094. 0x020d,
  10095. "odeva",
  10096. 0x0913,
  10097. "odieresis",
  10098. 0x00f6,
  10099. "odieresiscyrillic",
  10100. 0x04e7,
  10101. "odotbelow",
  10102. 0x1ecd,
  10103. "oe",
  10104. 0x0153,
  10105. "oekorean",
  10106. 0x315a,
  10107. "ogonek",
  10108. 0x02db,
  10109. "ogonekcmb",
  10110. 0x0328,
  10111. "ograve",
  10112. 0x00f2,
  10113. "ogujarati",
  10114. 0x0a93,
  10115. "oharmenian",
  10116. 0x0585,
  10117. "ohiragana",
  10118. 0x304a,
  10119. "ohookabove",
  10120. 0x1ecf,
  10121. "ohorn",
  10122. 0x01a1,
  10123. "ohornacute",
  10124. 0x1edb,
  10125. "ohorndotbelow",
  10126. 0x1ee3,
  10127. "ohorngrave",
  10128. 0x1edd,
  10129. "ohornhookabove",
  10130. 0x1edf,
  10131. "ohorntilde",
  10132. 0x1ee1,
  10133. "ohungarumlaut",
  10134. 0x0151,
  10135. "oi",
  10136. 0x01a3,
  10137. "oinvertedbreve",
  10138. 0x020f,
  10139. "okatakana",
  10140. 0x30aa,
  10141. "okatakanahalfwidth",
  10142. 0xff75,
  10143. "okorean",
  10144. 0x3157,
  10145. "olehebrew",
  10146. 0x05ab,
  10147. "omacron",
  10148. 0x014d,
  10149. "omacronacute",
  10150. 0x1e53,
  10151. "omacrongrave",
  10152. 0x1e51,
  10153. "omdeva",
  10154. 0x0950,
  10155. "omega",
  10156. 0x03c9,
  10157. "omega1",
  10158. 0x03d6,
  10159. "omegacyrillic",
  10160. 0x0461,
  10161. "omegalatinclosed",
  10162. 0x0277,
  10163. "omegaroundcyrillic",
  10164. 0x047b,
  10165. "omegatitlocyrillic",
  10166. 0x047d,
  10167. "omegatonos",
  10168. 0x03ce,
  10169. "omgujarati",
  10170. 0x0ad0,
  10171. "omicron",
  10172. 0x03bf,
  10173. "omicrontonos",
  10174. 0x03cc,
  10175. "omonospace",
  10176. 0xff4f,
  10177. "one",
  10178. 0x0031,
  10179. "onearabic",
  10180. 0x0661,
  10181. "onebengali",
  10182. 0x09e7,
  10183. "onecircle",
  10184. 0x2460,
  10185. "onecircleinversesansserif",
  10186. 0x278a,
  10187. "onedeva",
  10188. 0x0967,
  10189. "onedotenleader",
  10190. 0x2024,
  10191. "oneeighth",
  10192. 0x215b,
  10193. "onefitted",
  10194. 0xf6dc,
  10195. "onegujarati",
  10196. 0x0ae7,
  10197. "onegurmukhi",
  10198. 0x0a67,
  10199. "onehackarabic",
  10200. 0x0661,
  10201. "onehalf",
  10202. 0x00bd,
  10203. "onehangzhou",
  10204. 0x3021,
  10205. "oneideographicparen",
  10206. 0x3220,
  10207. "oneinferior",
  10208. 0x2081,
  10209. "onemonospace",
  10210. 0xff11,
  10211. "onenumeratorbengali",
  10212. 0x09f4,
  10213. "oneoldstyle",
  10214. 0xf731,
  10215. "oneparen",
  10216. 0x2474,
  10217. "oneperiod",
  10218. 0x2488,
  10219. "onepersian",
  10220. 0x06f1,
  10221. "onequarter",
  10222. 0x00bc,
  10223. "oneroman",
  10224. 0x2170,
  10225. "onesuperior",
  10226. 0x00b9,
  10227. "onethai",
  10228. 0x0e51,
  10229. "onethird",
  10230. 0x2153,
  10231. "oogonek",
  10232. 0x01eb,
  10233. "oogonekmacron",
  10234. 0x01ed,
  10235. "oogurmukhi",
  10236. 0x0a13,
  10237. "oomatragurmukhi",
  10238. 0x0a4b,
  10239. "oopen",
  10240. 0x0254,
  10241. "oparen",
  10242. 0x24aa,
  10243. "openbullet",
  10244. 0x25e6,
  10245. "option",
  10246. 0x2325,
  10247. "ordfeminine",
  10248. 0x00aa,
  10249. "ordmasculine",
  10250. 0x00ba,
  10251. "orthogonal",
  10252. 0x221f,
  10253. "oshortdeva",
  10254. 0x0912,
  10255. "oshortvowelsigndeva",
  10256. 0x094a,
  10257. "oslash",
  10258. 0x00f8,
  10259. "oslashacute",
  10260. 0x01ff,
  10261. "osmallhiragana",
  10262. 0x3049,
  10263. "osmallkatakana",
  10264. 0x30a9,
  10265. "osmallkatakanahalfwidth",
  10266. 0xff6b,
  10267. "ostrokeacute",
  10268. 0x01ff,
  10269. "osuperior",
  10270. 0xf6f0,
  10271. "otcyrillic",
  10272. 0x047f,
  10273. "otilde",
  10274. 0x00f5,
  10275. "otildeacute",
  10276. 0x1e4d,
  10277. "otildedieresis",
  10278. 0x1e4f,
  10279. "oubopomofo",
  10280. 0x3121,
  10281. "overline",
  10282. 0x203e,
  10283. "overlinecenterline",
  10284. 0xfe4a,
  10285. "overlinecmb",
  10286. 0x0305,
  10287. "overlinedashed",
  10288. 0xfe49,
  10289. "overlinedblwavy",
  10290. 0xfe4c,
  10291. "overlinewavy",
  10292. 0xfe4b,
  10293. "overscore",
  10294. 0x00af,
  10295. "ovowelsignbengali",
  10296. 0x09cb,
  10297. "ovowelsigndeva",
  10298. 0x094b,
  10299. "ovowelsigngujarati",
  10300. 0x0acb,
  10301. "p",
  10302. 0x0070,
  10303. "paampssquare",
  10304. 0x3380,
  10305. "paasentosquare",
  10306. 0x332b,
  10307. "pabengali",
  10308. 0x09aa,
  10309. "pacute",
  10310. 0x1e55,
  10311. "padeva",
  10312. 0x092a,
  10313. "pagedown",
  10314. 0x21df,
  10315. "pageup",
  10316. 0x21de,
  10317. "pagujarati",
  10318. 0x0aaa,
  10319. "pagurmukhi",
  10320. 0x0a2a,
  10321. "pahiragana",
  10322. 0x3071,
  10323. "paiyannoithai",
  10324. 0x0e2f,
  10325. "pakatakana",
  10326. 0x30d1,
  10327. "palatalizationcyrilliccmb",
  10328. 0x0484,
  10329. "palochkacyrillic",
  10330. 0x04c0,
  10331. "pansioskorean",
  10332. 0x317f,
  10333. "paragraph",
  10334. 0x00b6,
  10335. "parallel",
  10336. 0x2225,
  10337. "parenleft",
  10338. 0x0028,
  10339. "parenleftaltonearabic",
  10340. 0xfd3e,
  10341. "parenleftbt",
  10342. 0xf8ed,
  10343. "parenleftex",
  10344. 0xf8ec,
  10345. "parenleftinferior",
  10346. 0x208d,
  10347. "parenleftmonospace",
  10348. 0xff08,
  10349. "parenleftsmall",
  10350. 0xfe59,
  10351. "parenleftsuperior",
  10352. 0x207d,
  10353. "parenlefttp",
  10354. 0xf8eb,
  10355. "parenleftvertical",
  10356. 0xfe35,
  10357. "parenright",
  10358. 0x0029,
  10359. "parenrightaltonearabic",
  10360. 0xfd3f,
  10361. "parenrightbt",
  10362. 0xf8f8,
  10363. "parenrightex",
  10364. 0xf8f7,
  10365. "parenrightinferior",
  10366. 0x208e,
  10367. "parenrightmonospace",
  10368. 0xff09,
  10369. "parenrightsmall",
  10370. 0xfe5a,
  10371. "parenrightsuperior",
  10372. 0x207e,
  10373. "parenrighttp",
  10374. 0xf8f6,
  10375. "parenrightvertical",
  10376. 0xfe36,
  10377. "partialdiff",
  10378. 0x2202,
  10379. "paseqhebrew",
  10380. 0x05c0,
  10381. "pashtahebrew",
  10382. 0x0599,
  10383. "pasquare",
  10384. 0x33a9,
  10385. "patah",
  10386. 0x05b7,
  10387. "patah11",
  10388. 0x05b7,
  10389. "patah1d",
  10390. 0x05b7,
  10391. "patah2a",
  10392. 0x05b7,
  10393. "patahhebrew",
  10394. 0x05b7,
  10395. "patahnarrowhebrew",
  10396. 0x05b7,
  10397. "patahquarterhebrew",
  10398. 0x05b7,
  10399. "patahwidehebrew",
  10400. 0x05b7,
  10401. "pazerhebrew",
  10402. 0x05a1,
  10403. "pbopomofo",
  10404. 0x3106,
  10405. "pcircle",
  10406. 0x24df,
  10407. "pdotaccent",
  10408. 0x1e57,
  10409. "pe",
  10410. 0x05e4,
  10411. "pecyrillic",
  10412. 0x043f,
  10413. "pedagesh",
  10414. 0xfb44,
  10415. "pedageshhebrew",
  10416. 0xfb44,
  10417. "peezisquare",
  10418. 0x333b,
  10419. "pefinaldageshhebrew",
  10420. 0xfb43,
  10421. "peharabic",
  10422. 0x067e,
  10423. "peharmenian",
  10424. 0x057a,
  10425. "pehebrew",
  10426. 0x05e4,
  10427. "pehfinalarabic",
  10428. 0xfb57,
  10429. "pehinitialarabic",
  10430. 0xfb58,
  10431. "pehiragana",
  10432. 0x307a,
  10433. "pehmedialarabic",
  10434. 0xfb59,
  10435. "pekatakana",
  10436. 0x30da,
  10437. "pemiddlehookcyrillic",
  10438. 0x04a7,
  10439. "perafehebrew",
  10440. 0xfb4e,
  10441. "percent",
  10442. 0x0025,
  10443. "percentarabic",
  10444. 0x066a,
  10445. "percentmonospace",
  10446. 0xff05,
  10447. "percentsmall",
  10448. 0xfe6a,
  10449. "period",
  10450. 0x002e,
  10451. "periodarmenian",
  10452. 0x0589,
  10453. "periodcentered",
  10454. 0x00b7,
  10455. "periodhalfwidth",
  10456. 0xff61,
  10457. "periodinferior",
  10458. 0xf6e7,
  10459. "periodmonospace",
  10460. 0xff0e,
  10461. "periodsmall",
  10462. 0xfe52,
  10463. "periodsuperior",
  10464. 0xf6e8,
  10465. "perispomenigreekcmb",
  10466. 0x0342,
  10467. "perpendicular",
  10468. 0x22a5,
  10469. "perthousand",
  10470. 0x2030,
  10471. "peseta",
  10472. 0x20a7,
  10473. "pfsquare",
  10474. 0x338a,
  10475. "phabengali",
  10476. 0x09ab,
  10477. "phadeva",
  10478. 0x092b,
  10479. "phagujarati",
  10480. 0x0aab,
  10481. "phagurmukhi",
  10482. 0x0a2b,
  10483. "phi",
  10484. 0x03c6,
  10485. "phi1",
  10486. 0x03d5,
  10487. "phieuphacirclekorean",
  10488. 0x327a,
  10489. "phieuphaparenkorean",
  10490. 0x321a,
  10491. "phieuphcirclekorean",
  10492. 0x326c,
  10493. "phieuphkorean",
  10494. 0x314d,
  10495. "phieuphparenkorean",
  10496. 0x320c,
  10497. "philatin",
  10498. 0x0278,
  10499. "phinthuthai",
  10500. 0x0e3a,
  10501. "phisymbolgreek",
  10502. 0x03d5,
  10503. "phook",
  10504. 0x01a5,
  10505. "phophanthai",
  10506. 0x0e1e,
  10507. "phophungthai",
  10508. 0x0e1c,
  10509. "phosamphaothai",
  10510. 0x0e20,
  10511. "pi",
  10512. 0x03c0,
  10513. "pieupacirclekorean",
  10514. 0x3273,
  10515. "pieupaparenkorean",
  10516. 0x3213,
  10517. "pieupcieuckorean",
  10518. 0x3176,
  10519. "pieupcirclekorean",
  10520. 0x3265,
  10521. "pieupkiyeokkorean",
  10522. 0x3172,
  10523. "pieupkorean",
  10524. 0x3142,
  10525. "pieupparenkorean",
  10526. 0x3205,
  10527. "pieupsioskiyeokkorean",
  10528. 0x3174,
  10529. "pieupsioskorean",
  10530. 0x3144,
  10531. "pieupsiostikeutkorean",
  10532. 0x3175,
  10533. "pieupthieuthkorean",
  10534. 0x3177,
  10535. "pieuptikeutkorean",
  10536. 0x3173,
  10537. "pihiragana",
  10538. 0x3074,
  10539. "pikatakana",
  10540. 0x30d4,
  10541. "pisymbolgreek",
  10542. 0x03d6,
  10543. "piwrarmenian",
  10544. 0x0583,
  10545. "plus",
  10546. 0x002b,
  10547. "plusbelowcmb",
  10548. 0x031f,
  10549. "pluscircle",
  10550. 0x2295,
  10551. "plusminus",
  10552. 0x00b1,
  10553. "plusmod",
  10554. 0x02d6,
  10555. "plusmonospace",
  10556. 0xff0b,
  10557. "plussmall",
  10558. 0xfe62,
  10559. "plussuperior",
  10560. 0x207a,
  10561. "pmonospace",
  10562. 0xff50,
  10563. "pmsquare",
  10564. 0x33d8,
  10565. "pohiragana",
  10566. 0x307d,
  10567. "pointingindexdownwhite",
  10568. 0x261f,
  10569. "pointingindexleftwhite",
  10570. 0x261c,
  10571. "pointingindexrightwhite",
  10572. 0x261e,
  10573. "pointingindexupwhite",
  10574. 0x261d,
  10575. "pokatakana",
  10576. 0x30dd,
  10577. "poplathai",
  10578. 0x0e1b,
  10579. "postalmark",
  10580. 0x3012,
  10581. "postalmarkface",
  10582. 0x3020,
  10583. "pparen",
  10584. 0x24ab,
  10585. "precedes",
  10586. 0x227a,
  10587. "prescription",
  10588. 0x211e,
  10589. "primemod",
  10590. 0x02b9,
  10591. "primereversed",
  10592. 0x2035,
  10593. "product",
  10594. 0x220f,
  10595. "projective",
  10596. 0x2305,
  10597. "prolongedkana",
  10598. 0x30fc,
  10599. "propellor",
  10600. 0x2318,
  10601. "propersubset",
  10602. 0x2282,
  10603. "propersuperset",
  10604. 0x2283,
  10605. "proportion",
  10606. 0x2237,
  10607. "proportional",
  10608. 0x221d,
  10609. "psi",
  10610. 0x03c8,
  10611. "psicyrillic",
  10612. 0x0471,
  10613. "psilipneumatacyrilliccmb",
  10614. 0x0486,
  10615. "pssquare",
  10616. 0x33b0,
  10617. "puhiragana",
  10618. 0x3077,
  10619. "pukatakana",
  10620. 0x30d7,
  10621. "pvsquare",
  10622. 0x33b4,
  10623. "pwsquare",
  10624. 0x33ba,
  10625. "q",
  10626. 0x0071,
  10627. "qadeva",
  10628. 0x0958,
  10629. "qadmahebrew",
  10630. 0x05a8,
  10631. "qafarabic",
  10632. 0x0642,
  10633. "qaffinalarabic",
  10634. 0xfed6,
  10635. "qafinitialarabic",
  10636. 0xfed7,
  10637. "qafmedialarabic",
  10638. 0xfed8,
  10639. "qamats",
  10640. 0x05b8,
  10641. "qamats10",
  10642. 0x05b8,
  10643. "qamats1a",
  10644. 0x05b8,
  10645. "qamats1c",
  10646. 0x05b8,
  10647. "qamats27",
  10648. 0x05b8,
  10649. "qamats29",
  10650. 0x05b8,
  10651. "qamats33",
  10652. 0x05b8,
  10653. "qamatsde",
  10654. 0x05b8,
  10655. "qamatshebrew",
  10656. 0x05b8,
  10657. "qamatsnarrowhebrew",
  10658. 0x05b8,
  10659. "qamatsqatanhebrew",
  10660. 0x05b8,
  10661. "qamatsqatannarrowhebrew",
  10662. 0x05b8,
  10663. "qamatsqatanquarterhebrew",
  10664. 0x05b8,
  10665. "qamatsqatanwidehebrew",
  10666. 0x05b8,
  10667. "qamatsquarterhebrew",
  10668. 0x05b8,
  10669. "qamatswidehebrew",
  10670. 0x05b8,
  10671. "qarneyparahebrew",
  10672. 0x059f,
  10673. "qbopomofo",
  10674. 0x3111,
  10675. "qcircle",
  10676. 0x24e0,
  10677. "qhook",
  10678. 0x02a0,
  10679. "qmonospace",
  10680. 0xff51,
  10681. "qof",
  10682. 0x05e7,
  10683. "qofdagesh",
  10684. 0xfb47,
  10685. "qofdageshhebrew",
  10686. 0xfb47,
  10687. "qofhebrew",
  10688. 0x05e7,
  10689. "qparen",
  10690. 0x24ac,
  10691. "quarternote",
  10692. 0x2669,
  10693. "qubuts",
  10694. 0x05bb,
  10695. "qubuts18",
  10696. 0x05bb,
  10697. "qubuts25",
  10698. 0x05bb,
  10699. "qubuts31",
  10700. 0x05bb,
  10701. "qubutshebrew",
  10702. 0x05bb,
  10703. "qubutsnarrowhebrew",
  10704. 0x05bb,
  10705. "qubutsquarterhebrew",
  10706. 0x05bb,
  10707. "qubutswidehebrew",
  10708. 0x05bb,
  10709. "question",
  10710. 0x003f,
  10711. "questionarabic",
  10712. 0x061f,
  10713. "questionarmenian",
  10714. 0x055e,
  10715. "questiondown",
  10716. 0x00bf,
  10717. "questiondownsmall",
  10718. 0xf7bf,
  10719. "questiongreek",
  10720. 0x037e,
  10721. "questionmonospace",
  10722. 0xff1f,
  10723. "questionsmall",
  10724. 0xf73f,
  10725. "quotedbl",
  10726. 0x0022,
  10727. "quotedblbase",
  10728. 0x201e,
  10729. "quotedblleft",
  10730. 0x201c,
  10731. "quotedblmonospace",
  10732. 0xff02,
  10733. "quotedblprime",
  10734. 0x301e,
  10735. "quotedblprimereversed",
  10736. 0x301d,
  10737. "quotedblright",
  10738. 0x201d,
  10739. "quoteleft",
  10740. 0x2018,
  10741. "quoteleftreversed",
  10742. 0x201b,
  10743. "quotereversed",
  10744. 0x201b,
  10745. "quoteright",
  10746. 0x2019,
  10747. "quoterightn",
  10748. 0x0149,
  10749. "quotesinglbase",
  10750. 0x201a,
  10751. "quotesingle",
  10752. 0x0027,
  10753. "quotesinglemonospace",
  10754. 0xff07,
  10755. "r",
  10756. 0x0072,
  10757. "raarmenian",
  10758. 0x057c,
  10759. "rabengali",
  10760. 0x09b0,
  10761. "racute",
  10762. 0x0155,
  10763. "radeva",
  10764. 0x0930,
  10765. "radical",
  10766. 0x221a,
  10767. "radicalex",
  10768. 0xf8e5,
  10769. "radoverssquare",
  10770. 0x33ae,
  10771. "radoverssquaredsquare",
  10772. 0x33af,
  10773. "radsquare",
  10774. 0x33ad,
  10775. "rafe",
  10776. 0x05bf,
  10777. "rafehebrew",
  10778. 0x05bf,
  10779. "ragujarati",
  10780. 0x0ab0,
  10781. "ragurmukhi",
  10782. 0x0a30,
  10783. "rahiragana",
  10784. 0x3089,
  10785. "rakatakana",
  10786. 0x30e9,
  10787. "rakatakanahalfwidth",
  10788. 0xff97,
  10789. "ralowerdiagonalbengali",
  10790. 0x09f1,
  10791. "ramiddlediagonalbengali",
  10792. 0x09f0,
  10793. "ramshorn",
  10794. 0x0264,
  10795. "ratio",
  10796. 0x2236,
  10797. "rbopomofo",
  10798. 0x3116,
  10799. "rcaron",
  10800. 0x0159,
  10801. "rcedilla",
  10802. 0x0157,
  10803. "rcircle",
  10804. 0x24e1,
  10805. "rcommaaccent",
  10806. 0x0157,
  10807. "rdblgrave",
  10808. 0x0211,
  10809. "rdotaccent",
  10810. 0x1e59,
  10811. "rdotbelow",
  10812. 0x1e5b,
  10813. "rdotbelowmacron",
  10814. 0x1e5d,
  10815. "referencemark",
  10816. 0x203b,
  10817. "reflexsubset",
  10818. 0x2286,
  10819. "reflexsuperset",
  10820. 0x2287,
  10821. "registered",
  10822. 0x00ae,
  10823. "registersans",
  10824. 0xf8e8,
  10825. "registerserif",
  10826. 0xf6da,
  10827. "reharabic",
  10828. 0x0631,
  10829. "reharmenian",
  10830. 0x0580,
  10831. "rehfinalarabic",
  10832. 0xfeae,
  10833. "rehiragana",
  10834. 0x308c,
  10835. "rekatakana",
  10836. 0x30ec,
  10837. "rekatakanahalfwidth",
  10838. 0xff9a,
  10839. "resh",
  10840. 0x05e8,
  10841. "reshdageshhebrew",
  10842. 0xfb48,
  10843. "reshhebrew",
  10844. 0x05e8,
  10845. "reversedtilde",
  10846. 0x223d,
  10847. "reviahebrew",
  10848. 0x0597,
  10849. "reviamugrashhebrew",
  10850. 0x0597,
  10851. "revlogicalnot",
  10852. 0x2310,
  10853. "rfishhook",
  10854. 0x027e,
  10855. "rfishhookreversed",
  10856. 0x027f,
  10857. "rhabengali",
  10858. 0x09dd,
  10859. "rhadeva",
  10860. 0x095d,
  10861. "rho",
  10862. 0x03c1,
  10863. "rhook",
  10864. 0x027d,
  10865. "rhookturned",
  10866. 0x027b,
  10867. "rhookturnedsuperior",
  10868. 0x02b5,
  10869. "rhosymbolgreek",
  10870. 0x03f1,
  10871. "rhotichookmod",
  10872. 0x02de,
  10873. "rieulacirclekorean",
  10874. 0x3271,
  10875. "rieulaparenkorean",
  10876. 0x3211,
  10877. "rieulcirclekorean",
  10878. 0x3263,
  10879. "rieulhieuhkorean",
  10880. 0x3140,
  10881. "rieulkiyeokkorean",
  10882. 0x313a,
  10883. "rieulkiyeoksioskorean",
  10884. 0x3169,
  10885. "rieulkorean",
  10886. 0x3139,
  10887. "rieulmieumkorean",
  10888. 0x313b,
  10889. "rieulpansioskorean",
  10890. 0x316c,
  10891. "rieulparenkorean",
  10892. 0x3203,
  10893. "rieulphieuphkorean",
  10894. 0x313f,
  10895. "rieulpieupkorean",
  10896. 0x313c,
  10897. "rieulpieupsioskorean",
  10898. 0x316b,
  10899. "rieulsioskorean",
  10900. 0x313d,
  10901. "rieulthieuthkorean",
  10902. 0x313e,
  10903. "rieultikeutkorean",
  10904. 0x316a,
  10905. "rieulyeorinhieuhkorean",
  10906. 0x316d,
  10907. "rightangle",
  10908. 0x221f,
  10909. "righttackbelowcmb",
  10910. 0x0319,
  10911. "righttriangle",
  10912. 0x22bf,
  10913. "rihiragana",
  10914. 0x308a,
  10915. "rikatakana",
  10916. 0x30ea,
  10917. "rikatakanahalfwidth",
  10918. 0xff98,
  10919. "ring",
  10920. 0x02da,
  10921. "ringbelowcmb",
  10922. 0x0325,
  10923. "ringcmb",
  10924. 0x030a,
  10925. "ringhalfleft",
  10926. 0x02bf,
  10927. "ringhalfleftarmenian",
  10928. 0x0559,
  10929. "ringhalfleftbelowcmb",
  10930. 0x031c,
  10931. "ringhalfleftcentered",
  10932. 0x02d3,
  10933. "ringhalfright",
  10934. 0x02be,
  10935. "ringhalfrightbelowcmb",
  10936. 0x0339,
  10937. "ringhalfrightcentered",
  10938. 0x02d2,
  10939. "rinvertedbreve",
  10940. 0x0213,
  10941. "rittorusquare",
  10942. 0x3351,
  10943. "rlinebelow",
  10944. 0x1e5f,
  10945. "rlongleg",
  10946. 0x027c,
  10947. "rlonglegturned",
  10948. 0x027a,
  10949. "rmonospace",
  10950. 0xff52,
  10951. "rohiragana",
  10952. 0x308d,
  10953. "rokatakana",
  10954. 0x30ed,
  10955. "rokatakanahalfwidth",
  10956. 0xff9b,
  10957. "roruathai",
  10958. 0x0e23,
  10959. "rparen",
  10960. 0x24ad,
  10961. "rrabengali",
  10962. 0x09dc,
  10963. "rradeva",
  10964. 0x0931,
  10965. "rragurmukhi",
  10966. 0x0a5c,
  10967. "rreharabic",
  10968. 0x0691,
  10969. "rrehfinalarabic",
  10970. 0xfb8d,
  10971. "rrvocalicbengali",
  10972. 0x09e0,
  10973. "rrvocalicdeva",
  10974. 0x0960,
  10975. "rrvocalicgujarati",
  10976. 0x0ae0,
  10977. "rrvocalicvowelsignbengali",
  10978. 0x09c4,
  10979. "rrvocalicvowelsigndeva",
  10980. 0x0944,
  10981. "rrvocalicvowelsigngujarati",
  10982. 0x0ac4,
  10983. "rsuperior",
  10984. 0xf6f1,
  10985. "rtblock",
  10986. 0x2590,
  10987. "rturned",
  10988. 0x0279,
  10989. "rturnedsuperior",
  10990. 0x02b4,
  10991. "ruhiragana",
  10992. 0x308b,
  10993. "rukatakana",
  10994. 0x30eb,
  10995. "rukatakanahalfwidth",
  10996. 0xff99,
  10997. "rupeemarkbengali",
  10998. 0x09f2,
  10999. "rupeesignbengali",
  11000. 0x09f3,
  11001. "rupiah",
  11002. 0xf6dd,
  11003. "ruthai",
  11004. 0x0e24,
  11005. "rvocalicbengali",
  11006. 0x098b,
  11007. "rvocalicdeva",
  11008. 0x090b,
  11009. "rvocalicgujarati",
  11010. 0x0a8b,
  11011. "rvocalicvowelsignbengali",
  11012. 0x09c3,
  11013. "rvocalicvowelsigndeva",
  11014. 0x0943,
  11015. "rvocalicvowelsigngujarati",
  11016. 0x0ac3,
  11017. "s",
  11018. 0x0073,
  11019. "sabengali",
  11020. 0x09b8,
  11021. "sacute",
  11022. 0x015b,
  11023. "sacutedotaccent",
  11024. 0x1e65,
  11025. "sadarabic",
  11026. 0x0635,
  11027. "sadeva",
  11028. 0x0938,
  11029. "sadfinalarabic",
  11030. 0xfeba,
  11031. "sadinitialarabic",
  11032. 0xfebb,
  11033. "sadmedialarabic",
  11034. 0xfebc,
  11035. "sagujarati",
  11036. 0x0ab8,
  11037. "sagurmukhi",
  11038. 0x0a38,
  11039. "sahiragana",
  11040. 0x3055,
  11041. "sakatakana",
  11042. 0x30b5,
  11043. "sakatakanahalfwidth",
  11044. 0xff7b,
  11045. "sallallahoualayhewasallamarabic",
  11046. 0xfdfa,
  11047. "samekh",
  11048. 0x05e1,
  11049. "samekhdagesh",
  11050. 0xfb41,
  11051. "samekhdageshhebrew",
  11052. 0xfb41,
  11053. "samekhhebrew",
  11054. 0x05e1,
  11055. "saraaathai",
  11056. 0x0e32,
  11057. "saraaethai",
  11058. 0x0e41,
  11059. "saraaimaimalaithai",
  11060. 0x0e44,
  11061. "saraaimaimuanthai",
  11062. 0x0e43,
  11063. "saraamthai",
  11064. 0x0e33,
  11065. "saraathai",
  11066. 0x0e30,
  11067. "saraethai",
  11068. 0x0e40,
  11069. "saraiileftthai",
  11070. 0xf886,
  11071. "saraiithai",
  11072. 0x0e35,
  11073. "saraileftthai",
  11074. 0xf885,
  11075. "saraithai",
  11076. 0x0e34,
  11077. "saraothai",
  11078. 0x0e42,
  11079. "saraueeleftthai",
  11080. 0xf888,
  11081. "saraueethai",
  11082. 0x0e37,
  11083. "saraueleftthai",
  11084. 0xf887,
  11085. "sarauethai",
  11086. 0x0e36,
  11087. "sarauthai",
  11088. 0x0e38,
  11089. "sarauuthai",
  11090. 0x0e39,
  11091. "sbopomofo",
  11092. 0x3119,
  11093. "scaron",
  11094. 0x0161,
  11095. "scarondotaccent",
  11096. 0x1e67,
  11097. "scedilla",
  11098. 0x015f,
  11099. "schwa",
  11100. 0x0259,
  11101. "schwacyrillic",
  11102. 0x04d9,
  11103. "schwadieresiscyrillic",
  11104. 0x04db,
  11105. "schwahook",
  11106. 0x025a,
  11107. "scircle",
  11108. 0x24e2,
  11109. "scircumflex",
  11110. 0x015d,
  11111. "scommaaccent",
  11112. 0x0219,
  11113. "sdotaccent",
  11114. 0x1e61,
  11115. "sdotbelow",
  11116. 0x1e63,
  11117. "sdotbelowdotaccent",
  11118. 0x1e69,
  11119. "seagullbelowcmb",
  11120. 0x033c,
  11121. "second",
  11122. 0x2033,
  11123. "secondtonechinese",
  11124. 0x02ca,
  11125. "section",
  11126. 0x00a7,
  11127. "seenarabic",
  11128. 0x0633,
  11129. "seenfinalarabic",
  11130. 0xfeb2,
  11131. "seeninitialarabic",
  11132. 0xfeb3,
  11133. "seenmedialarabic",
  11134. 0xfeb4,
  11135. "segol",
  11136. 0x05b6,
  11137. "segol13",
  11138. 0x05b6,
  11139. "segol1f",
  11140. 0x05b6,
  11141. "segol2c",
  11142. 0x05b6,
  11143. "segolhebrew",
  11144. 0x05b6,
  11145. "segolnarrowhebrew",
  11146. 0x05b6,
  11147. "segolquarterhebrew",
  11148. 0x05b6,
  11149. "segoltahebrew",
  11150. 0x0592,
  11151. "segolwidehebrew",
  11152. 0x05b6,
  11153. "seharmenian",
  11154. 0x057d,
  11155. "sehiragana",
  11156. 0x305b,
  11157. "sekatakana",
  11158. 0x30bb,
  11159. "sekatakanahalfwidth",
  11160. 0xff7e,
  11161. "semicolon",
  11162. 0x003b,
  11163. "semicolonarabic",
  11164. 0x061b,
  11165. "semicolonmonospace",
  11166. 0xff1b,
  11167. "semicolonsmall",
  11168. 0xfe54,
  11169. "semivoicedmarkkana",
  11170. 0x309c,
  11171. "semivoicedmarkkanahalfwidth",
  11172. 0xff9f,
  11173. "sentisquare",
  11174. 0x3322,
  11175. "sentosquare",
  11176. 0x3323,
  11177. "seven",
  11178. 0x0037,
  11179. "sevenarabic",
  11180. 0x0667,
  11181. "sevenbengali",
  11182. 0x09ed,
  11183. "sevencircle",
  11184. 0x2466,
  11185. "sevencircleinversesansserif",
  11186. 0x2790,
  11187. "sevendeva",
  11188. 0x096d,
  11189. "seveneighths",
  11190. 0x215e,
  11191. "sevengujarati",
  11192. 0x0aed,
  11193. "sevengurmukhi",
  11194. 0x0a6d,
  11195. "sevenhackarabic",
  11196. 0x0667,
  11197. "sevenhangzhou",
  11198. 0x3027,
  11199. "sevenideographicparen",
  11200. 0x3226,
  11201. "seveninferior",
  11202. 0x2087,
  11203. "sevenmonospace",
  11204. 0xff17,
  11205. "sevenoldstyle",
  11206. 0xf737,
  11207. "sevenparen",
  11208. 0x247a,
  11209. "sevenperiod",
  11210. 0x248e,
  11211. "sevenpersian",
  11212. 0x06f7,
  11213. "sevenroman",
  11214. 0x2176,
  11215. "sevensuperior",
  11216. 0x2077,
  11217. "seventeencircle",
  11218. 0x2470,
  11219. "seventeenparen",
  11220. 0x2484,
  11221. "seventeenperiod",
  11222. 0x2498,
  11223. "seventhai",
  11224. 0x0e57,
  11225. "sfthyphen",
  11226. 0x00ad,
  11227. "shaarmenian",
  11228. 0x0577,
  11229. "shabengali",
  11230. 0x09b6,
  11231. "shacyrillic",
  11232. 0x0448,
  11233. "shaddaarabic",
  11234. 0x0651,
  11235. "shaddadammaarabic",
  11236. 0xfc61,
  11237. "shaddadammatanarabic",
  11238. 0xfc5e,
  11239. "shaddafathaarabic",
  11240. 0xfc60,
  11241. "shaddakasraarabic",
  11242. 0xfc62,
  11243. "shaddakasratanarabic",
  11244. 0xfc5f,
  11245. "shade",
  11246. 0x2592,
  11247. "shadedark",
  11248. 0x2593,
  11249. "shadelight",
  11250. 0x2591,
  11251. "shademedium",
  11252. 0x2592,
  11253. "shadeva",
  11254. 0x0936,
  11255. "shagujarati",
  11256. 0x0ab6,
  11257. "shagurmukhi",
  11258. 0x0a36,
  11259. "shalshelethebrew",
  11260. 0x0593,
  11261. "shbopomofo",
  11262. 0x3115,
  11263. "shchacyrillic",
  11264. 0x0449,
  11265. "sheenarabic",
  11266. 0x0634,
  11267. "sheenfinalarabic",
  11268. 0xfeb6,
  11269. "sheeninitialarabic",
  11270. 0xfeb7,
  11271. "sheenmedialarabic",
  11272. 0xfeb8,
  11273. "sheicoptic",
  11274. 0x03e3,
  11275. "sheqel",
  11276. 0x20aa,
  11277. "sheqelhebrew",
  11278. 0x20aa,
  11279. "sheva",
  11280. 0x05b0,
  11281. "sheva115",
  11282. 0x05b0,
  11283. "sheva15",
  11284. 0x05b0,
  11285. "sheva22",
  11286. 0x05b0,
  11287. "sheva2e",
  11288. 0x05b0,
  11289. "shevahebrew",
  11290. 0x05b0,
  11291. "shevanarrowhebrew",
  11292. 0x05b0,
  11293. "shevaquarterhebrew",
  11294. 0x05b0,
  11295. "shevawidehebrew",
  11296. 0x05b0,
  11297. "shhacyrillic",
  11298. 0x04bb,
  11299. "shimacoptic",
  11300. 0x03ed,
  11301. "shin",
  11302. 0x05e9,
  11303. "shindagesh",
  11304. 0xfb49,
  11305. "shindageshhebrew",
  11306. 0xfb49,
  11307. "shindageshshindot",
  11308. 0xfb2c,
  11309. "shindageshshindothebrew",
  11310. 0xfb2c,
  11311. "shindageshsindot",
  11312. 0xfb2d,
  11313. "shindageshsindothebrew",
  11314. 0xfb2d,
  11315. "shindothebrew",
  11316. 0x05c1,
  11317. "shinhebrew",
  11318. 0x05e9,
  11319. "shinshindot",
  11320. 0xfb2a,
  11321. "shinshindothebrew",
  11322. 0xfb2a,
  11323. "shinsindot",
  11324. 0xfb2b,
  11325. "shinsindothebrew",
  11326. 0xfb2b,
  11327. "shook",
  11328. 0x0282,
  11329. "sigma",
  11330. 0x03c3,
  11331. "sigma1",
  11332. 0x03c2,
  11333. "sigmafinal",
  11334. 0x03c2,
  11335. "sigmalunatesymbolgreek",
  11336. 0x03f2,
  11337. "sihiragana",
  11338. 0x3057,
  11339. "sikatakana",
  11340. 0x30b7,
  11341. "sikatakanahalfwidth",
  11342. 0xff7c,
  11343. "siluqhebrew",
  11344. 0x05bd,
  11345. "siluqlefthebrew",
  11346. 0x05bd,
  11347. "similar",
  11348. 0x223c,
  11349. "sindothebrew",
  11350. 0x05c2,
  11351. "siosacirclekorean",
  11352. 0x3274,
  11353. "siosaparenkorean",
  11354. 0x3214,
  11355. "sioscieuckorean",
  11356. 0x317e,
  11357. "sioscirclekorean",
  11358. 0x3266,
  11359. "sioskiyeokkorean",
  11360. 0x317a,
  11361. "sioskorean",
  11362. 0x3145,
  11363. "siosnieunkorean",
  11364. 0x317b,
  11365. "siosparenkorean",
  11366. 0x3206,
  11367. "siospieupkorean",
  11368. 0x317d,
  11369. "siostikeutkorean",
  11370. 0x317c,
  11371. "six",
  11372. 0x0036,
  11373. "sixarabic",
  11374. 0x0666,
  11375. "sixbengali",
  11376. 0x09ec,
  11377. "sixcircle",
  11378. 0x2465,
  11379. "sixcircleinversesansserif",
  11380. 0x278f,
  11381. "sixdeva",
  11382. 0x096c,
  11383. "sixgujarati",
  11384. 0x0aec,
  11385. "sixgurmukhi",
  11386. 0x0a6c,
  11387. "sixhackarabic",
  11388. 0x0666,
  11389. "sixhangzhou",
  11390. 0x3026,
  11391. "sixideographicparen",
  11392. 0x3225,
  11393. "sixinferior",
  11394. 0x2086,
  11395. "sixmonospace",
  11396. 0xff16,
  11397. "sixoldstyle",
  11398. 0xf736,
  11399. "sixparen",
  11400. 0x2479,
  11401. "sixperiod",
  11402. 0x248d,
  11403. "sixpersian",
  11404. 0x06f6,
  11405. "sixroman",
  11406. 0x2175,
  11407. "sixsuperior",
  11408. 0x2076,
  11409. "sixteencircle",
  11410. 0x246f,
  11411. "sixteencurrencydenominatorbengali",
  11412. 0x09f9,
  11413. "sixteenparen",
  11414. 0x2483,
  11415. "sixteenperiod",
  11416. 0x2497,
  11417. "sixthai",
  11418. 0x0e56,
  11419. "slash",
  11420. 0x002f,
  11421. "slashmonospace",
  11422. 0xff0f,
  11423. "slong",
  11424. 0x017f,
  11425. "slongdotaccent",
  11426. 0x1e9b,
  11427. "smileface",
  11428. 0x263a,
  11429. "smonospace",
  11430. 0xff53,
  11431. "sofpasuqhebrew",
  11432. 0x05c3,
  11433. "softhyphen",
  11434. 0x00ad,
  11435. "softsigncyrillic",
  11436. 0x044c,
  11437. "sohiragana",
  11438. 0x305d,
  11439. "sokatakana",
  11440. 0x30bd,
  11441. "sokatakanahalfwidth",
  11442. 0xff7f,
  11443. "soliduslongoverlaycmb",
  11444. 0x0338,
  11445. "solidusshortoverlaycmb",
  11446. 0x0337,
  11447. "sorusithai",
  11448. 0x0e29,
  11449. "sosalathai",
  11450. 0x0e28,
  11451. "sosothai",
  11452. 0x0e0b,
  11453. "sosuathai",
  11454. 0x0e2a,
  11455. "space",
  11456. 0x0020,
  11457. "spacehackarabic",
  11458. 0x0020,
  11459. "spade",
  11460. 0x2660,
  11461. "spadesuitblack",
  11462. 0x2660,
  11463. "spadesuitwhite",
  11464. 0x2664,
  11465. "sparen",
  11466. 0x24ae,
  11467. "squarebelowcmb",
  11468. 0x033b,
  11469. "squarecc",
  11470. 0x33c4,
  11471. "squarecm",
  11472. 0x339d,
  11473. "squarediagonalcrosshatchfill",
  11474. 0x25a9,
  11475. "squarehorizontalfill",
  11476. 0x25a4,
  11477. "squarekg",
  11478. 0x338f,
  11479. "squarekm",
  11480. 0x339e,
  11481. "squarekmcapital",
  11482. 0x33ce,
  11483. "squareln",
  11484. 0x33d1,
  11485. "squarelog",
  11486. 0x33d2,
  11487. "squaremg",
  11488. 0x338e,
  11489. "squaremil",
  11490. 0x33d5,
  11491. "squaremm",
  11492. 0x339c,
  11493. "squaremsquared",
  11494. 0x33a1,
  11495. "squareorthogonalcrosshatchfill",
  11496. 0x25a6,
  11497. "squareupperlefttolowerrightfill",
  11498. 0x25a7,
  11499. "squareupperrighttolowerleftfill",
  11500. 0x25a8,
  11501. "squareverticalfill",
  11502. 0x25a5,
  11503. "squarewhitewithsmallblack",
  11504. 0x25a3,
  11505. "srsquare",
  11506. 0x33db,
  11507. "ssabengali",
  11508. 0x09b7,
  11509. "ssadeva",
  11510. 0x0937,
  11511. "ssagujarati",
  11512. 0x0ab7,
  11513. "ssangcieuckorean",
  11514. 0x3149,
  11515. "ssanghieuhkorean",
  11516. 0x3185,
  11517. "ssangieungkorean",
  11518. 0x3180,
  11519. "ssangkiyeokkorean",
  11520. 0x3132,
  11521. "ssangnieunkorean",
  11522. 0x3165,
  11523. "ssangpieupkorean",
  11524. 0x3143,
  11525. "ssangsioskorean",
  11526. 0x3146,
  11527. "ssangtikeutkorean",
  11528. 0x3138,
  11529. "ssuperior",
  11530. 0xf6f2,
  11531. "sterling",
  11532. 0x00a3,
  11533. "sterlingmonospace",
  11534. 0xffe1,
  11535. "strokelongoverlaycmb",
  11536. 0x0336,
  11537. "strokeshortoverlaycmb",
  11538. 0x0335,
  11539. "subset",
  11540. 0x2282,
  11541. "subsetnotequal",
  11542. 0x228a,
  11543. "subsetorequal",
  11544. 0x2286,
  11545. "succeeds",
  11546. 0x227b,
  11547. "suchthat",
  11548. 0x220b,
  11549. "suhiragana",
  11550. 0x3059,
  11551. "sukatakana",
  11552. 0x30b9,
  11553. "sukatakanahalfwidth",
  11554. 0xff7d,
  11555. "sukunarabic",
  11556. 0x0652,
  11557. "summation",
  11558. 0x2211,
  11559. "sun",
  11560. 0x263c,
  11561. "superset",
  11562. 0x2283,
  11563. "supersetnotequal",
  11564. 0x228b,
  11565. "supersetorequal",
  11566. 0x2287,
  11567. "svsquare",
  11568. 0x33dc,
  11569. "syouwaerasquare",
  11570. 0x337c,
  11571. "t",
  11572. 0x0074,
  11573. "tabengali",
  11574. 0x09a4,
  11575. "tackdown",
  11576. 0x22a4,
  11577. "tackleft",
  11578. 0x22a3,
  11579. "tadeva",
  11580. 0x0924,
  11581. "tagujarati",
  11582. 0x0aa4,
  11583. "tagurmukhi",
  11584. 0x0a24,
  11585. "taharabic",
  11586. 0x0637,
  11587. "tahfinalarabic",
  11588. 0xfec2,
  11589. "tahinitialarabic",
  11590. 0xfec3,
  11591. "tahiragana",
  11592. 0x305f,
  11593. "tahmedialarabic",
  11594. 0xfec4,
  11595. "taisyouerasquare",
  11596. 0x337d,
  11597. "takatakana",
  11598. 0x30bf,
  11599. "takatakanahalfwidth",
  11600. 0xff80,
  11601. "tatweelarabic",
  11602. 0x0640,
  11603. "tau",
  11604. 0x03c4,
  11605. "tav",
  11606. 0x05ea,
  11607. "tavdages",
  11608. 0xfb4a,
  11609. "tavdagesh",
  11610. 0xfb4a,
  11611. "tavdageshhebrew",
  11612. 0xfb4a,
  11613. "tavhebrew",
  11614. 0x05ea,
  11615. "tbar",
  11616. 0x0167,
  11617. "tbopomofo",
  11618. 0x310a,
  11619. "tcaron",
  11620. 0x0165,
  11621. "tccurl",
  11622. 0x02a8,
  11623. "tcedilla",
  11624. 0x0163,
  11625. "tcheharabic",
  11626. 0x0686,
  11627. "tchehfinalarabic",
  11628. 0xfb7b,
  11629. "tchehinitialarabic",
  11630. 0xfb7c,
  11631. "tchehmedialarabic",
  11632. 0xfb7d,
  11633. "tcircle",
  11634. 0x24e3,
  11635. "tcircumflexbelow",
  11636. 0x1e71,
  11637. "tcommaaccent",
  11638. 0x0163,
  11639. "tdieresis",
  11640. 0x1e97,
  11641. "tdotaccent",
  11642. 0x1e6b,
  11643. "tdotbelow",
  11644. 0x1e6d,
  11645. "tecyrillic",
  11646. 0x0442,
  11647. "tedescendercyrillic",
  11648. 0x04ad,
  11649. "teharabic",
  11650. 0x062a,
  11651. "tehfinalarabic",
  11652. 0xfe96,
  11653. "tehhahinitialarabic",
  11654. 0xfca2,
  11655. "tehhahisolatedarabic",
  11656. 0xfc0c,
  11657. "tehinitialarabic",
  11658. 0xfe97,
  11659. "tehiragana",
  11660. 0x3066,
  11661. "tehjeeminitialarabic",
  11662. 0xfca1,
  11663. "tehjeemisolatedarabic",
  11664. 0xfc0b,
  11665. "tehmarbutaarabic",
  11666. 0x0629,
  11667. "tehmarbutafinalarabic",
  11668. 0xfe94,
  11669. "tehmedialarabic",
  11670. 0xfe98,
  11671. "tehmeeminitialarabic",
  11672. 0xfca4,
  11673. "tehmeemisolatedarabic",
  11674. 0xfc0e,
  11675. "tehnoonfinalarabic",
  11676. 0xfc73,
  11677. "tekatakana",
  11678. 0x30c6,
  11679. "tekatakanahalfwidth",
  11680. 0xff83,
  11681. "telephone",
  11682. 0x2121,
  11683. "telephoneblack",
  11684. 0x260e,
  11685. "telishagedolahebrew",
  11686. 0x05a0,
  11687. "telishaqetanahebrew",
  11688. 0x05a9,
  11689. "tencircle",
  11690. 0x2469,
  11691. "tenideographicparen",
  11692. 0x3229,
  11693. "tenparen",
  11694. 0x247d,
  11695. "tenperiod",
  11696. 0x2491,
  11697. "tenroman",
  11698. 0x2179,
  11699. "tesh",
  11700. 0x02a7,
  11701. "tet",
  11702. 0x05d8,
  11703. "tetdagesh",
  11704. 0xfb38,
  11705. "tetdageshhebrew",
  11706. 0xfb38,
  11707. "tethebrew",
  11708. 0x05d8,
  11709. "tetsecyrillic",
  11710. 0x04b5,
  11711. "tevirhebrew",
  11712. 0x059b,
  11713. "tevirlefthebrew",
  11714. 0x059b,
  11715. "thabengali",
  11716. 0x09a5,
  11717. "thadeva",
  11718. 0x0925,
  11719. "thagujarati",
  11720. 0x0aa5,
  11721. "thagurmukhi",
  11722. 0x0a25,
  11723. "thalarabic",
  11724. 0x0630,
  11725. "thalfinalarabic",
  11726. 0xfeac,
  11727. "thanthakhatlowleftthai",
  11728. 0xf898,
  11729. "thanthakhatlowrightthai",
  11730. 0xf897,
  11731. "thanthakhatthai",
  11732. 0x0e4c,
  11733. "thanthakhatupperleftthai",
  11734. 0xf896,
  11735. "theharabic",
  11736. 0x062b,
  11737. "thehfinalarabic",
  11738. 0xfe9a,
  11739. "thehinitialarabic",
  11740. 0xfe9b,
  11741. "thehmedialarabic",
  11742. 0xfe9c,
  11743. "thereexists",
  11744. 0x2203,
  11745. "therefore",
  11746. 0x2234,
  11747. "theta",
  11748. 0x03b8,
  11749. "theta1",
  11750. 0x03d1,
  11751. "thetasymbolgreek",
  11752. 0x03d1,
  11753. "thieuthacirclekorean",
  11754. 0x3279,
  11755. "thieuthaparenkorean",
  11756. 0x3219,
  11757. "thieuthcirclekorean",
  11758. 0x326b,
  11759. "thieuthkorean",
  11760. 0x314c,
  11761. "thieuthparenkorean",
  11762. 0x320b,
  11763. "thirteencircle",
  11764. 0x246c,
  11765. "thirteenparen",
  11766. 0x2480,
  11767. "thirteenperiod",
  11768. 0x2494,
  11769. "thonangmonthothai",
  11770. 0x0e11,
  11771. "thook",
  11772. 0x01ad,
  11773. "thophuthaothai",
  11774. 0x0e12,
  11775. "thorn",
  11776. 0x00fe,
  11777. "thothahanthai",
  11778. 0x0e17,
  11779. "thothanthai",
  11780. 0x0e10,
  11781. "thothongthai",
  11782. 0x0e18,
  11783. "thothungthai",
  11784. 0x0e16,
  11785. "thousandcyrillic",
  11786. 0x0482,
  11787. "thousandsseparatorarabic",
  11788. 0x066c,
  11789. "thousandsseparatorpersian",
  11790. 0x066c,
  11791. "three",
  11792. 0x0033,
  11793. "threearabic",
  11794. 0x0663,
  11795. "threebengali",
  11796. 0x09e9,
  11797. "threecircle",
  11798. 0x2462,
  11799. "threecircleinversesansserif",
  11800. 0x278c,
  11801. "threedeva",
  11802. 0x0969,
  11803. "threeeighths",
  11804. 0x215c,
  11805. "threegujarati",
  11806. 0x0ae9,
  11807. "threegurmukhi",
  11808. 0x0a69,
  11809. "threehackarabic",
  11810. 0x0663,
  11811. "threehangzhou",
  11812. 0x3023,
  11813. "threeideographicparen",
  11814. 0x3222,
  11815. "threeinferior",
  11816. 0x2083,
  11817. "threemonospace",
  11818. 0xff13,
  11819. "threenumeratorbengali",
  11820. 0x09f6,
  11821. "threeoldstyle",
  11822. 0xf733,
  11823. "threeparen",
  11824. 0x2476,
  11825. "threeperiod",
  11826. 0x248a,
  11827. "threepersian",
  11828. 0x06f3,
  11829. "threequarters",
  11830. 0x00be,
  11831. "threequartersemdash",
  11832. 0xf6de,
  11833. "threeroman",
  11834. 0x2172,
  11835. "threesuperior",
  11836. 0x00b3,
  11837. "threethai",
  11838. 0x0e53,
  11839. "thzsquare",
  11840. 0x3394,
  11841. "tihiragana",
  11842. 0x3061,
  11843. "tikatakana",
  11844. 0x30c1,
  11845. "tikatakanahalfwidth",
  11846. 0xff81,
  11847. "tikeutacirclekorean",
  11848. 0x3270,
  11849. "tikeutaparenkorean",
  11850. 0x3210,
  11851. "tikeutcirclekorean",
  11852. 0x3262,
  11853. "tikeutkorean",
  11854. 0x3137,
  11855. "tikeutparenkorean",
  11856. 0x3202,
  11857. "tilde",
  11858. 0x02dc,
  11859. "tildebelowcmb",
  11860. 0x0330,
  11861. "tildecmb",
  11862. 0x0303,
  11863. "tildecomb",
  11864. 0x0303,
  11865. "tildedoublecmb",
  11866. 0x0360,
  11867. "tildeoperator",
  11868. 0x223c,
  11869. "tildeoverlaycmb",
  11870. 0x0334,
  11871. "tildeverticalcmb",
  11872. 0x033e,
  11873. "timescircle",
  11874. 0x2297,
  11875. "tipehahebrew",
  11876. 0x0596,
  11877. "tipehalefthebrew",
  11878. 0x0596,
  11879. "tippigurmukhi",
  11880. 0x0a70,
  11881. "titlocyrilliccmb",
  11882. 0x0483,
  11883. "tiwnarmenian",
  11884. 0x057f,
  11885. "tlinebelow",
  11886. 0x1e6f,
  11887. "tmonospace",
  11888. 0xff54,
  11889. "toarmenian",
  11890. 0x0569,
  11891. "tohiragana",
  11892. 0x3068,
  11893. "tokatakana",
  11894. 0x30c8,
  11895. "tokatakanahalfwidth",
  11896. 0xff84,
  11897. "tonebarextrahighmod",
  11898. 0x02e5,
  11899. "tonebarextralowmod",
  11900. 0x02e9,
  11901. "tonebarhighmod",
  11902. 0x02e6,
  11903. "tonebarlowmod",
  11904. 0x02e8,
  11905. "tonebarmidmod",
  11906. 0x02e7,
  11907. "tonefive",
  11908. 0x01bd,
  11909. "tonesix",
  11910. 0x0185,
  11911. "tonetwo",
  11912. 0x01a8,
  11913. "tonos",
  11914. 0x0384,
  11915. "tonsquare",
  11916. 0x3327,
  11917. "topatakthai",
  11918. 0x0e0f,
  11919. "tortoiseshellbracketleft",
  11920. 0x3014,
  11921. "tortoiseshellbracketleftsmall",
  11922. 0xfe5d,
  11923. "tortoiseshellbracketleftvertical",
  11924. 0xfe39,
  11925. "tortoiseshellbracketright",
  11926. 0x3015,
  11927. "tortoiseshellbracketrightsmall",
  11928. 0xfe5e,
  11929. "tortoiseshellbracketrightvertical",
  11930. 0xfe3a,
  11931. "totaothai",
  11932. 0x0e15,
  11933. "tpalatalhook",
  11934. 0x01ab,
  11935. "tparen",
  11936. 0x24af,
  11937. "trademark",
  11938. 0x2122,
  11939. "trademarksans",
  11940. 0xf8ea,
  11941. "trademarkserif",
  11942. 0xf6db,
  11943. "tretroflexhook",
  11944. 0x0288,
  11945. "triagdn",
  11946. 0x25bc,
  11947. "triaglf",
  11948. 0x25c4,
  11949. "triagrt",
  11950. 0x25ba,
  11951. "triagup",
  11952. 0x25b2,
  11953. "ts",
  11954. 0x02a6,
  11955. "tsadi",
  11956. 0x05e6,
  11957. "tsadidagesh",
  11958. 0xfb46,
  11959. "tsadidageshhebrew",
  11960. 0xfb46,
  11961. "tsadihebrew",
  11962. 0x05e6,
  11963. "tsecyrillic",
  11964. 0x0446,
  11965. "tsere",
  11966. 0x05b5,
  11967. "tsere12",
  11968. 0x05b5,
  11969. "tsere1e",
  11970. 0x05b5,
  11971. "tsere2b",
  11972. 0x05b5,
  11973. "tserehebrew",
  11974. 0x05b5,
  11975. "tserenarrowhebrew",
  11976. 0x05b5,
  11977. "tserequarterhebrew",
  11978. 0x05b5,
  11979. "tserewidehebrew",
  11980. 0x05b5,
  11981. "tshecyrillic",
  11982. 0x045b,
  11983. "tsuperior",
  11984. 0xf6f3,
  11985. "ttabengali",
  11986. 0x099f,
  11987. "ttadeva",
  11988. 0x091f,
  11989. "ttagujarati",
  11990. 0x0a9f,
  11991. "ttagurmukhi",
  11992. 0x0a1f,
  11993. "tteharabic",
  11994. 0x0679,
  11995. "ttehfinalarabic",
  11996. 0xfb67,
  11997. "ttehinitialarabic",
  11998. 0xfb68,
  11999. "ttehmedialarabic",
  12000. 0xfb69,
  12001. "tthabengali",
  12002. 0x09a0,
  12003. "tthadeva",
  12004. 0x0920,
  12005. "tthagujarati",
  12006. 0x0aa0,
  12007. "tthagurmukhi",
  12008. 0x0a20,
  12009. "tturned",
  12010. 0x0287,
  12011. "tuhiragana",
  12012. 0x3064,
  12013. "tukatakana",
  12014. 0x30c4,
  12015. "tukatakanahalfwidth",
  12016. 0xff82,
  12017. "tusmallhiragana",
  12018. 0x3063,
  12019. "tusmallkatakana",
  12020. 0x30c3,
  12021. "tusmallkatakanahalfwidth",
  12022. 0xff6f,
  12023. "twelvecircle",
  12024. 0x246b,
  12025. "twelveparen",
  12026. 0x247f,
  12027. "twelveperiod",
  12028. 0x2493,
  12029. "twelveroman",
  12030. 0x217b,
  12031. "twentycircle",
  12032. 0x2473,
  12033. "twentyhangzhou",
  12034. 0x5344,
  12035. "twentyparen",
  12036. 0x2487,
  12037. "twentyperiod",
  12038. 0x249b,
  12039. "two",
  12040. 0x0032,
  12041. "twoarabic",
  12042. 0x0662,
  12043. "twobengali",
  12044. 0x09e8,
  12045. "twocircle",
  12046. 0x2461,
  12047. "twocircleinversesansserif",
  12048. 0x278b,
  12049. "twodeva",
  12050. 0x0968,
  12051. "twodotenleader",
  12052. 0x2025,
  12053. "twodotleader",
  12054. 0x2025,
  12055. "twodotleadervertical",
  12056. 0xfe30,
  12057. "twogujarati",
  12058. 0x0ae8,
  12059. "twogurmukhi",
  12060. 0x0a68,
  12061. "twohackarabic",
  12062. 0x0662,
  12063. "twohangzhou",
  12064. 0x3022,
  12065. "twoideographicparen",
  12066. 0x3221,
  12067. "twoinferior",
  12068. 0x2082,
  12069. "twomonospace",
  12070. 0xff12,
  12071. "twonumeratorbengali",
  12072. 0x09f5,
  12073. "twooldstyle",
  12074. 0xf732,
  12075. "twoparen",
  12076. 0x2475,
  12077. "twoperiod",
  12078. 0x2489,
  12079. "twopersian",
  12080. 0x06f2,
  12081. "tworoman",
  12082. 0x2171,
  12083. "twostroke",
  12084. 0x01bb,
  12085. "twosuperior",
  12086. 0x00b2,
  12087. "twothai",
  12088. 0x0e52,
  12089. "twothirds",
  12090. 0x2154,
  12091. "u",
  12092. 0x0075,
  12093. "uacute",
  12094. 0x00fa,
  12095. "ubar",
  12096. 0x0289,
  12097. "ubengali",
  12098. 0x0989,
  12099. "ubopomofo",
  12100. 0x3128,
  12101. "ubreve",
  12102. 0x016d,
  12103. "ucaron",
  12104. 0x01d4,
  12105. "ucircle",
  12106. 0x24e4,
  12107. "ucircumflex",
  12108. 0x00fb,
  12109. "ucircumflexbelow",
  12110. 0x1e77,
  12111. "ucyrillic",
  12112. 0x0443,
  12113. "udattadeva",
  12114. 0x0951,
  12115. "udblacute",
  12116. 0x0171,
  12117. "udblgrave",
  12118. 0x0215,
  12119. "udeva",
  12120. 0x0909,
  12121. "udieresis",
  12122. 0x00fc,
  12123. "udieresisacute",
  12124. 0x01d8,
  12125. "udieresisbelow",
  12126. 0x1e73,
  12127. "udieresiscaron",
  12128. 0x01da,
  12129. "udieresiscyrillic",
  12130. 0x04f1,
  12131. "udieresisgrave",
  12132. 0x01dc,
  12133. "udieresismacron",
  12134. 0x01d6,
  12135. "udotbelow",
  12136. 0x1ee5,
  12137. "ugrave",
  12138. 0x00f9,
  12139. "ugujarati",
  12140. 0x0a89,
  12141. "ugurmukhi",
  12142. 0x0a09,
  12143. "uhiragana",
  12144. 0x3046,
  12145. "uhookabove",
  12146. 0x1ee7,
  12147. "uhorn",
  12148. 0x01b0,
  12149. "uhornacute",
  12150. 0x1ee9,
  12151. "uhorndotbelow",
  12152. 0x1ef1,
  12153. "uhorngrave",
  12154. 0x1eeb,
  12155. "uhornhookabove",
  12156. 0x1eed,
  12157. "uhorntilde",
  12158. 0x1eef,
  12159. "uhungarumlaut",
  12160. 0x0171,
  12161. "uhungarumlautcyrillic",
  12162. 0x04f3,
  12163. "uinvertedbreve",
  12164. 0x0217,
  12165. "ukatakana",
  12166. 0x30a6,
  12167. "ukatakanahalfwidth",
  12168. 0xff73,
  12169. "ukcyrillic",
  12170. 0x0479,
  12171. "ukorean",
  12172. 0x315c,
  12173. "umacron",
  12174. 0x016b,
  12175. "umacroncyrillic",
  12176. 0x04ef,
  12177. "umacrondieresis",
  12178. 0x1e7b,
  12179. "umatragurmukhi",
  12180. 0x0a41,
  12181. "umonospace",
  12182. 0xff55,
  12183. "underscore",
  12184. 0x005f,
  12185. "underscoredbl",
  12186. 0x2017,
  12187. "underscoremonospace",
  12188. 0xff3f,
  12189. "underscorevertical",
  12190. 0xfe33,
  12191. "underscorewavy",
  12192. 0xfe4f,
  12193. "union",
  12194. 0x222a,
  12195. "universal",
  12196. 0x2200,
  12197. "uogonek",
  12198. 0x0173,
  12199. "uparen",
  12200. 0x24b0,
  12201. "upblock",
  12202. 0x2580,
  12203. "upperdothebrew",
  12204. 0x05c4,
  12205. "upsilon",
  12206. 0x03c5,
  12207. "upsilondieresis",
  12208. 0x03cb,
  12209. "upsilondieresistonos",
  12210. 0x03b0,
  12211. "upsilonlatin",
  12212. 0x028a,
  12213. "upsilontonos",
  12214. 0x03cd,
  12215. "uptackbelowcmb",
  12216. 0x031d,
  12217. "uptackmod",
  12218. 0x02d4,
  12219. "uragurmukhi",
  12220. 0x0a73,
  12221. "uring",
  12222. 0x016f,
  12223. "ushortcyrillic",
  12224. 0x045e,
  12225. "usmallhiragana",
  12226. 0x3045,
  12227. "usmallkatakana",
  12228. 0x30a5,
  12229. "usmallkatakanahalfwidth",
  12230. 0xff69,
  12231. "ustraightcyrillic",
  12232. 0x04af,
  12233. "ustraightstrokecyrillic",
  12234. 0x04b1,
  12235. "utilde",
  12236. 0x0169,
  12237. "utildeacute",
  12238. 0x1e79,
  12239. "utildebelow",
  12240. 0x1e75,
  12241. "uubengali",
  12242. 0x098a,
  12243. "uudeva",
  12244. 0x090a,
  12245. "uugujarati",
  12246. 0x0a8a,
  12247. "uugurmukhi",
  12248. 0x0a0a,
  12249. "uumatragurmukhi",
  12250. 0x0a42,
  12251. "uuvowelsignbengali",
  12252. 0x09c2,
  12253. "uuvowelsigndeva",
  12254. 0x0942,
  12255. "uuvowelsigngujarati",
  12256. 0x0ac2,
  12257. "uvowelsignbengali",
  12258. 0x09c1,
  12259. "uvowelsigndeva",
  12260. 0x0941,
  12261. "uvowelsigngujarati",
  12262. 0x0ac1,
  12263. "v",
  12264. 0x0076,
  12265. "vadeva",
  12266. 0x0935,
  12267. "vagujarati",
  12268. 0x0ab5,
  12269. "vagurmukhi",
  12270. 0x0a35,
  12271. "vakatakana",
  12272. 0x30f7,
  12273. "vav",
  12274. 0x05d5,
  12275. "vavdagesh",
  12276. 0xfb35,
  12277. "vavdagesh65",
  12278. 0xfb35,
  12279. "vavdageshhebrew",
  12280. 0xfb35,
  12281. "vavhebrew",
  12282. 0x05d5,
  12283. "vavholam",
  12284. 0xfb4b,
  12285. "vavholamhebrew",
  12286. 0xfb4b,
  12287. "vavvavhebrew",
  12288. 0x05f0,
  12289. "vavyodhebrew",
  12290. 0x05f1,
  12291. "vcircle",
  12292. 0x24e5,
  12293. "vdotbelow",
  12294. 0x1e7f,
  12295. "vecyrillic",
  12296. 0x0432,
  12297. "veharabic",
  12298. 0x06a4,
  12299. "vehfinalarabic",
  12300. 0xfb6b,
  12301. "vehinitialarabic",
  12302. 0xfb6c,
  12303. "vehmedialarabic",
  12304. 0xfb6d,
  12305. "vekatakana",
  12306. 0x30f9,
  12307. "venus",
  12308. 0x2640,
  12309. "verticalbar",
  12310. 0x007c,
  12311. "verticallineabovecmb",
  12312. 0x030d,
  12313. "verticallinebelowcmb",
  12314. 0x0329,
  12315. "verticallinelowmod",
  12316. 0x02cc,
  12317. "verticallinemod",
  12318. 0x02c8,
  12319. "vewarmenian",
  12320. 0x057e,
  12321. "vhook",
  12322. 0x028b,
  12323. "vikatakana",
  12324. 0x30f8,
  12325. "viramabengali",
  12326. 0x09cd,
  12327. "viramadeva",
  12328. 0x094d,
  12329. "viramagujarati",
  12330. 0x0acd,
  12331. "visargabengali",
  12332. 0x0983,
  12333. "visargadeva",
  12334. 0x0903,
  12335. "visargagujarati",
  12336. 0x0a83,
  12337. "vmonospace",
  12338. 0xff56,
  12339. "voarmenian",
  12340. 0x0578,
  12341. "voicediterationhiragana",
  12342. 0x309e,
  12343. "voicediterationkatakana",
  12344. 0x30fe,
  12345. "voicedmarkkana",
  12346. 0x309b,
  12347. "voicedmarkkanahalfwidth",
  12348. 0xff9e,
  12349. "vokatakana",
  12350. 0x30fa,
  12351. "vparen",
  12352. 0x24b1,
  12353. "vtilde",
  12354. 0x1e7d,
  12355. "vturned",
  12356. 0x028c,
  12357. "vuhiragana",
  12358. 0x3094,
  12359. "vukatakana",
  12360. 0x30f4,
  12361. "w",
  12362. 0x0077,
  12363. "wacute",
  12364. 0x1e83,
  12365. "waekorean",
  12366. 0x3159,
  12367. "wahiragana",
  12368. 0x308f,
  12369. "wakatakana",
  12370. 0x30ef,
  12371. "wakatakanahalfwidth",
  12372. 0xff9c,
  12373. "wakorean",
  12374. 0x3158,
  12375. "wasmallhiragana",
  12376. 0x308e,
  12377. "wasmallkatakana",
  12378. 0x30ee,
  12379. "wattosquare",
  12380. 0x3357,
  12381. "wavedash",
  12382. 0x301c,
  12383. "wavyunderscorevertical",
  12384. 0xfe34,
  12385. "wawarabic",
  12386. 0x0648,
  12387. "wawfinalarabic",
  12388. 0xfeee,
  12389. "wawhamzaabovearabic",
  12390. 0x0624,
  12391. "wawhamzaabovefinalarabic",
  12392. 0xfe86,
  12393. "wbsquare",
  12394. 0x33dd,
  12395. "wcircle",
  12396. 0x24e6,
  12397. "wcircumflex",
  12398. 0x0175,
  12399. "wdieresis",
  12400. 0x1e85,
  12401. "wdotaccent",
  12402. 0x1e87,
  12403. "wdotbelow",
  12404. 0x1e89,
  12405. "wehiragana",
  12406. 0x3091,
  12407. "weierstrass",
  12408. 0x2118,
  12409. "wekatakana",
  12410. 0x30f1,
  12411. "wekorean",
  12412. 0x315e,
  12413. "weokorean",
  12414. 0x315d,
  12415. "wgrave",
  12416. 0x1e81,
  12417. "whitebullet",
  12418. 0x25e6,
  12419. "whitecircle",
  12420. 0x25cb,
  12421. "whitecircleinverse",
  12422. 0x25d9,
  12423. "whitecornerbracketleft",
  12424. 0x300e,
  12425. "whitecornerbracketleftvertical",
  12426. 0xfe43,
  12427. "whitecornerbracketright",
  12428. 0x300f,
  12429. "whitecornerbracketrightvertical",
  12430. 0xfe44,
  12431. "whitediamond",
  12432. 0x25c7,
  12433. "whitediamondcontainingblacksmalldiamond",
  12434. 0x25c8,
  12435. "whitedownpointingsmalltriangle",
  12436. 0x25bf,
  12437. "whitedownpointingtriangle",
  12438. 0x25bd,
  12439. "whiteleftpointingsmalltriangle",
  12440. 0x25c3,
  12441. "whiteleftpointingtriangle",
  12442. 0x25c1,
  12443. "whitelenticularbracketleft",
  12444. 0x3016,
  12445. "whitelenticularbracketright",
  12446. 0x3017,
  12447. "whiterightpointingsmalltriangle",
  12448. 0x25b9,
  12449. "whiterightpointingtriangle",
  12450. 0x25b7,
  12451. "whitesmallsquare",
  12452. 0x25ab,
  12453. "whitesmilingface",
  12454. 0x263a,
  12455. "whitesquare",
  12456. 0x25a1,
  12457. "whitestar",
  12458. 0x2606,
  12459. "whitetelephone",
  12460. 0x260f,
  12461. "whitetortoiseshellbracketleft",
  12462. 0x3018,
  12463. "whitetortoiseshellbracketright",
  12464. 0x3019,
  12465. "whiteuppointingsmalltriangle",
  12466. 0x25b5,
  12467. "whiteuppointingtriangle",
  12468. 0x25b3,
  12469. "wihiragana",
  12470. 0x3090,
  12471. "wikatakana",
  12472. 0x30f0,
  12473. "wikorean",
  12474. 0x315f,
  12475. "wmonospace",
  12476. 0xff57,
  12477. "wohiragana",
  12478. 0x3092,
  12479. "wokatakana",
  12480. 0x30f2,
  12481. "wokatakanahalfwidth",
  12482. 0xff66,
  12483. "won",
  12484. 0x20a9,
  12485. "wonmonospace",
  12486. 0xffe6,
  12487. "wowaenthai",
  12488. 0x0e27,
  12489. "wparen",
  12490. 0x24b2,
  12491. "wring",
  12492. 0x1e98,
  12493. "wsuperior",
  12494. 0x02b7,
  12495. "wturned",
  12496. 0x028d,
  12497. "wynn",
  12498. 0x01bf,
  12499. "x",
  12500. 0x0078,
  12501. "xabovecmb",
  12502. 0x033d,
  12503. "xbopomofo",
  12504. 0x3112,
  12505. "xcircle",
  12506. 0x24e7,
  12507. "xdieresis",
  12508. 0x1e8d,
  12509. "xdotaccent",
  12510. 0x1e8b,
  12511. "xeharmenian",
  12512. 0x056d,
  12513. "xi",
  12514. 0x03be,
  12515. "xmonospace",
  12516. 0xff58,
  12517. "xparen",
  12518. 0x24b3,
  12519. "xsuperior",
  12520. 0x02e3,
  12521. "y",
  12522. 0x0079,
  12523. "yaadosquare",
  12524. 0x334e,
  12525. "yabengali",
  12526. 0x09af,
  12527. "yacute",
  12528. 0x00fd,
  12529. "yadeva",
  12530. 0x092f,
  12531. "yaekorean",
  12532. 0x3152,
  12533. "yagujarati",
  12534. 0x0aaf,
  12535. "yagurmukhi",
  12536. 0x0a2f,
  12537. "yahiragana",
  12538. 0x3084,
  12539. "yakatakana",
  12540. 0x30e4,
  12541. "yakatakanahalfwidth",
  12542. 0xff94,
  12543. "yakorean",
  12544. 0x3151,
  12545. "yamakkanthai",
  12546. 0x0e4e,
  12547. "yasmallhiragana",
  12548. 0x3083,
  12549. "yasmallkatakana",
  12550. 0x30e3,
  12551. "yasmallkatakanahalfwidth",
  12552. 0xff6c,
  12553. "yatcyrillic",
  12554. 0x0463,
  12555. "ycircle",
  12556. 0x24e8,
  12557. "ycircumflex",
  12558. 0x0177,
  12559. "ydieresis",
  12560. 0x00ff,
  12561. "ydotaccent",
  12562. 0x1e8f,
  12563. "ydotbelow",
  12564. 0x1ef5,
  12565. "yeharabic",
  12566. 0x064a,
  12567. "yehbarreearabic",
  12568. 0x06d2,
  12569. "yehbarreefinalarabic",
  12570. 0xfbaf,
  12571. "yehfinalarabic",
  12572. 0xfef2,
  12573. "yehhamzaabovearabic",
  12574. 0x0626,
  12575. "yehhamzaabovefinalarabic",
  12576. 0xfe8a,
  12577. "yehhamzaaboveinitialarabic",
  12578. 0xfe8b,
  12579. "yehhamzaabovemedialarabic",
  12580. 0xfe8c,
  12581. "yehinitialarabic",
  12582. 0xfef3,
  12583. "yehmedialarabic",
  12584. 0xfef4,
  12585. "yehmeeminitialarabic",
  12586. 0xfcdd,
  12587. "yehmeemisolatedarabic",
  12588. 0xfc58,
  12589. "yehnoonfinalarabic",
  12590. 0xfc94,
  12591. "yehthreedotsbelowarabic",
  12592. 0x06d1,
  12593. "yekorean",
  12594. 0x3156,
  12595. "yen",
  12596. 0x00a5,
  12597. "yenmonospace",
  12598. 0xffe5,
  12599. "yeokorean",
  12600. 0x3155,
  12601. "yeorinhieuhkorean",
  12602. 0x3186,
  12603. "yerahbenyomohebrew",
  12604. 0x05aa,
  12605. "yerahbenyomolefthebrew",
  12606. 0x05aa,
  12607. "yericyrillic",
  12608. 0x044b,
  12609. "yerudieresiscyrillic",
  12610. 0x04f9,
  12611. "yesieungkorean",
  12612. 0x3181,
  12613. "yesieungpansioskorean",
  12614. 0x3183,
  12615. "yesieungsioskorean",
  12616. 0x3182,
  12617. "yetivhebrew",
  12618. 0x059a,
  12619. "ygrave",
  12620. 0x1ef3,
  12621. "yhook",
  12622. 0x01b4,
  12623. "yhookabove",
  12624. 0x1ef7,
  12625. "yiarmenian",
  12626. 0x0575,
  12627. "yicyrillic",
  12628. 0x0457,
  12629. "yikorean",
  12630. 0x3162,
  12631. "yinyang",
  12632. 0x262f,
  12633. "yiwnarmenian",
  12634. 0x0582,
  12635. "ymonospace",
  12636. 0xff59,
  12637. "yod",
  12638. 0x05d9,
  12639. "yoddagesh",
  12640. 0xfb39,
  12641. "yoddageshhebrew",
  12642. 0xfb39,
  12643. "yodhebrew",
  12644. 0x05d9,
  12645. "yodyodhebrew",
  12646. 0x05f2,
  12647. "yodyodpatahhebrew",
  12648. 0xfb1f,
  12649. "yohiragana",
  12650. 0x3088,
  12651. "yoikorean",
  12652. 0x3189,
  12653. "yokatakana",
  12654. 0x30e8,
  12655. "yokatakanahalfwidth",
  12656. 0xff96,
  12657. "yokorean",
  12658. 0x315b,
  12659. "yosmallhiragana",
  12660. 0x3087,
  12661. "yosmallkatakana",
  12662. 0x30e7,
  12663. "yosmallkatakanahalfwidth",
  12664. 0xff6e,
  12665. "yotgreek",
  12666. 0x03f3,
  12667. "yoyaekorean",
  12668. 0x3188,
  12669. "yoyakorean",
  12670. 0x3187,
  12671. "yoyakthai",
  12672. 0x0e22,
  12673. "yoyingthai",
  12674. 0x0e0d,
  12675. "yparen",
  12676. 0x24b4,
  12677. "ypogegrammeni",
  12678. 0x037a,
  12679. "ypogegrammenigreekcmb",
  12680. 0x0345,
  12681. "yr",
  12682. 0x01a6,
  12683. "yring",
  12684. 0x1e99,
  12685. "ysuperior",
  12686. 0x02b8,
  12687. "ytilde",
  12688. 0x1ef9,
  12689. "yturned",
  12690. 0x028e,
  12691. "yuhiragana",
  12692. 0x3086,
  12693. "yuikorean",
  12694. 0x318c,
  12695. "yukatakana",
  12696. 0x30e6,
  12697. "yukatakanahalfwidth",
  12698. 0xff95,
  12699. "yukorean",
  12700. 0x3160,
  12701. "yusbigcyrillic",
  12702. 0x046b,
  12703. "yusbigiotifiedcyrillic",
  12704. 0x046d,
  12705. "yuslittlecyrillic",
  12706. 0x0467,
  12707. "yuslittleiotifiedcyrillic",
  12708. 0x0469,
  12709. "yusmallhiragana",
  12710. 0x3085,
  12711. "yusmallkatakana",
  12712. 0x30e5,
  12713. "yusmallkatakanahalfwidth",
  12714. 0xff6d,
  12715. "yuyekorean",
  12716. 0x318b,
  12717. "yuyeokorean",
  12718. 0x318a,
  12719. "yyabengali",
  12720. 0x09df,
  12721. "yyadeva",
  12722. 0x095f,
  12723. "z",
  12724. 0x007a,
  12725. "zaarmenian",
  12726. 0x0566,
  12727. "zacute",
  12728. 0x017a,
  12729. "zadeva",
  12730. 0x095b,
  12731. "zagurmukhi",
  12732. 0x0a5b,
  12733. "zaharabic",
  12734. 0x0638,
  12735. "zahfinalarabic",
  12736. 0xfec6,
  12737. "zahinitialarabic",
  12738. 0xfec7,
  12739. "zahiragana",
  12740. 0x3056,
  12741. "zahmedialarabic",
  12742. 0xfec8,
  12743. "zainarabic",
  12744. 0x0632,
  12745. "zainfinalarabic",
  12746. 0xfeb0,
  12747. "zakatakana",
  12748. 0x30b6,
  12749. "zaqefgadolhebrew",
  12750. 0x0595,
  12751. "zaqefqatanhebrew",
  12752. 0x0594,
  12753. "zarqahebrew",
  12754. 0x0598,
  12755. "zayin",
  12756. 0x05d6,
  12757. "zayindagesh",
  12758. 0xfb36,
  12759. "zayindageshhebrew",
  12760. 0xfb36,
  12761. "zayinhebrew",
  12762. 0x05d6,
  12763. "zbopomofo",
  12764. 0x3117,
  12765. "zcaron",
  12766. 0x017e,
  12767. "zcircle",
  12768. 0x24e9,
  12769. "zcircumflex",
  12770. 0x1e91,
  12771. "zcurl",
  12772. 0x0291,
  12773. "zdot",
  12774. 0x017c,
  12775. "zdotaccent",
  12776. 0x017c,
  12777. "zdotbelow",
  12778. 0x1e93,
  12779. "zecyrillic",
  12780. 0x0437,
  12781. "zedescendercyrillic",
  12782. 0x0499,
  12783. "zedieresiscyrillic",
  12784. 0x04df,
  12785. "zehiragana",
  12786. 0x305c,
  12787. "zekatakana",
  12788. 0x30bc,
  12789. "zero",
  12790. 0x0030,
  12791. "zeroarabic",
  12792. 0x0660,
  12793. "zerobengali",
  12794. 0x09e6,
  12795. "zerodeva",
  12796. 0x0966,
  12797. "zerogujarati",
  12798. 0x0ae6,
  12799. "zerogurmukhi",
  12800. 0x0a66,
  12801. "zerohackarabic",
  12802. 0x0660,
  12803. "zeroinferior",
  12804. 0x2080,
  12805. "zeromonospace",
  12806. 0xff10,
  12807. "zerooldstyle",
  12808. 0xf730,
  12809. "zeropersian",
  12810. 0x06f0,
  12811. "zerosuperior",
  12812. 0x2070,
  12813. "zerothai",
  12814. 0x0e50,
  12815. "zerowidthjoiner",
  12816. 0xfeff,
  12817. "zerowidthnonjoiner",
  12818. 0x200c,
  12819. "zerowidthspace",
  12820. 0x200b,
  12821. "zeta",
  12822. 0x03b6,
  12823. "zhbopomofo",
  12824. 0x3113,
  12825. "zhearmenian",
  12826. 0x056a,
  12827. "zhebrevecyrillic",
  12828. 0x04c2,
  12829. "zhecyrillic",
  12830. 0x0436,
  12831. "zhedescendercyrillic",
  12832. 0x0497,
  12833. "zhedieresiscyrillic",
  12834. 0x04dd,
  12835. "zihiragana",
  12836. 0x3058,
  12837. "zikatakana",
  12838. 0x30b8,
  12839. "zinorhebrew",
  12840. 0x05ae,
  12841. "zlinebelow",
  12842. 0x1e95,
  12843. "zmonospace",
  12844. 0xff5a,
  12845. "zohiragana",
  12846. 0x305e,
  12847. "zokatakana",
  12848. 0x30be,
  12849. "zparen",
  12850. 0x24b5,
  12851. "zretroflexhook",
  12852. 0x0290,
  12853. "zstroke",
  12854. 0x01b6,
  12855. "zuhiragana",
  12856. 0x305a,
  12857. "zukatakana",
  12858. 0x30ba,
  12859. ".notdef",
  12860. 0x0000,
  12861. "angbracketleftbig",
  12862. 0x2329,
  12863. "angbracketleftBig",
  12864. 0x2329,
  12865. "angbracketleftbigg",
  12866. 0x2329,
  12867. "angbracketleftBigg",
  12868. 0x2329,
  12869. "angbracketrightBig",
  12870. 0x232a,
  12871. "angbracketrightbig",
  12872. 0x232a,
  12873. "angbracketrightBigg",
  12874. 0x232a,
  12875. "angbracketrightbigg",
  12876. 0x232a,
  12877. "arrowhookleft",
  12878. 0x21aa,
  12879. "arrowhookright",
  12880. 0x21a9,
  12881. "arrowlefttophalf",
  12882. 0x21bc,
  12883. "arrowleftbothalf",
  12884. 0x21bd,
  12885. "arrownortheast",
  12886. 0x2197,
  12887. "arrownorthwest",
  12888. 0x2196,
  12889. "arrowrighttophalf",
  12890. 0x21c0,
  12891. "arrowrightbothalf",
  12892. 0x21c1,
  12893. "arrowsoutheast",
  12894. 0x2198,
  12895. "arrowsouthwest",
  12896. 0x2199,
  12897. "backslashbig",
  12898. 0x2216,
  12899. "backslashBig",
  12900. 0x2216,
  12901. "backslashBigg",
  12902. 0x2216,
  12903. "backslashbigg",
  12904. 0x2216,
  12905. "bardbl",
  12906. 0x2016,
  12907. "bracehtipdownleft",
  12908. 0xfe37,
  12909. "bracehtipdownright",
  12910. 0xfe37,
  12911. "bracehtipupleft",
  12912. 0xfe38,
  12913. "bracehtipupright",
  12914. 0xfe38,
  12915. "braceleftBig",
  12916. 0x007b,
  12917. "braceleftbig",
  12918. 0x007b,
  12919. "braceleftbigg",
  12920. 0x007b,
  12921. "braceleftBigg",
  12922. 0x007b,
  12923. "bracerightBig",
  12924. 0x007d,
  12925. "bracerightbig",
  12926. 0x007d,
  12927. "bracerightbigg",
  12928. 0x007d,
  12929. "bracerightBigg",
  12930. 0x007d,
  12931. "bracketleftbig",
  12932. 0x005b,
  12933. "bracketleftBig",
  12934. 0x005b,
  12935. "bracketleftbigg",
  12936. 0x005b,
  12937. "bracketleftBigg",
  12938. 0x005b,
  12939. "bracketrightBig",
  12940. 0x005d,
  12941. "bracketrightbig",
  12942. 0x005d,
  12943. "bracketrightbigg",
  12944. 0x005d,
  12945. "bracketrightBigg",
  12946. 0x005d,
  12947. "ceilingleftbig",
  12948. 0x2308,
  12949. "ceilingleftBig",
  12950. 0x2308,
  12951. "ceilingleftBigg",
  12952. 0x2308,
  12953. "ceilingleftbigg",
  12954. 0x2308,
  12955. "ceilingrightbig",
  12956. 0x2309,
  12957. "ceilingrightBig",
  12958. 0x2309,
  12959. "ceilingrightbigg",
  12960. 0x2309,
  12961. "ceilingrightBigg",
  12962. 0x2309,
  12963. "circledotdisplay",
  12964. 0x2299,
  12965. "circledottext",
  12966. 0x2299,
  12967. "circlemultiplydisplay",
  12968. 0x2297,
  12969. "circlemultiplytext",
  12970. 0x2297,
  12971. "circleplusdisplay",
  12972. 0x2295,
  12973. "circleplustext",
  12974. 0x2295,
  12975. "contintegraldisplay",
  12976. 0x222e,
  12977. "contintegraltext",
  12978. 0x222e,
  12979. "coproductdisplay",
  12980. 0x2210,
  12981. "coproducttext",
  12982. 0x2210,
  12983. "floorleftBig",
  12984. 0x230a,
  12985. "floorleftbig",
  12986. 0x230a,
  12987. "floorleftbigg",
  12988. 0x230a,
  12989. "floorleftBigg",
  12990. 0x230a,
  12991. "floorrightbig",
  12992. 0x230b,
  12993. "floorrightBig",
  12994. 0x230b,
  12995. "floorrightBigg",
  12996. 0x230b,
  12997. "floorrightbigg",
  12998. 0x230b,
  12999. "hatwide",
  13000. 0x0302,
  13001. "hatwider",
  13002. 0x0302,
  13003. "hatwidest",
  13004. 0x0302,
  13005. "intercal",
  13006. 0x1d40,
  13007. "integraldisplay",
  13008. 0x222b,
  13009. "integraltext",
  13010. 0x222b,
  13011. "intersectiondisplay",
  13012. 0x22c2,
  13013. "intersectiontext",
  13014. 0x22c2,
  13015. "logicalanddisplay",
  13016. 0x2227,
  13017. "logicalandtext",
  13018. 0x2227,
  13019. "logicalordisplay",
  13020. 0x2228,
  13021. "logicalortext",
  13022. 0x2228,
  13023. "parenleftBig",
  13024. 0x0028,
  13025. "parenleftbig",
  13026. 0x0028,
  13027. "parenleftBigg",
  13028. 0x0028,
  13029. "parenleftbigg",
  13030. 0x0028,
  13031. "parenrightBig",
  13032. 0x0029,
  13033. "parenrightbig",
  13034. 0x0029,
  13035. "parenrightBigg",
  13036. 0x0029,
  13037. "parenrightbigg",
  13038. 0x0029,
  13039. "prime",
  13040. 0x2032,
  13041. "productdisplay",
  13042. 0x220f,
  13043. "producttext",
  13044. 0x220f,
  13045. "radicalbig",
  13046. 0x221a,
  13047. "radicalBig",
  13048. 0x221a,
  13049. "radicalBigg",
  13050. 0x221a,
  13051. "radicalbigg",
  13052. 0x221a,
  13053. "radicalbt",
  13054. 0x221a,
  13055. "radicaltp",
  13056. 0x221a,
  13057. "radicalvertex",
  13058. 0x221a,
  13059. "slashbig",
  13060. 0x002f,
  13061. "slashBig",
  13062. 0x002f,
  13063. "slashBigg",
  13064. 0x002f,
  13065. "slashbigg",
  13066. 0x002f,
  13067. "summationdisplay",
  13068. 0x2211,
  13069. "summationtext",
  13070. 0x2211,
  13071. "tildewide",
  13072. 0x02dc,
  13073. "tildewider",
  13074. 0x02dc,
  13075. "tildewidest",
  13076. 0x02dc,
  13077. "uniondisplay",
  13078. 0x22c3,
  13079. "unionmultidisplay",
  13080. 0x228e,
  13081. "unionmultitext",
  13082. 0x228e,
  13083. "unionsqdisplay",
  13084. 0x2294,
  13085. "unionsqtext",
  13086. 0x2294,
  13087. "uniontext",
  13088. 0x22c3,
  13089. "vextenddouble",
  13090. 0x2225,
  13091. "vextendsingle",
  13092. 0x2223
  13093. ];
  13094. });
  13095. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  13096. return [
  13097. "space",
  13098. 0x0020,
  13099. "a1",
  13100. 0x2701,
  13101. "a2",
  13102. 0x2702,
  13103. "a202",
  13104. 0x2703,
  13105. "a3",
  13106. 0x2704,
  13107. "a4",
  13108. 0x260e,
  13109. "a5",
  13110. 0x2706,
  13111. "a119",
  13112. 0x2707,
  13113. "a118",
  13114. 0x2708,
  13115. "a117",
  13116. 0x2709,
  13117. "a11",
  13118. 0x261b,
  13119. "a12",
  13120. 0x261e,
  13121. "a13",
  13122. 0x270c,
  13123. "a14",
  13124. 0x270d,
  13125. "a15",
  13126. 0x270e,
  13127. "a16",
  13128. 0x270f,
  13129. "a105",
  13130. 0x2710,
  13131. "a17",
  13132. 0x2711,
  13133. "a18",
  13134. 0x2712,
  13135. "a19",
  13136. 0x2713,
  13137. "a20",
  13138. 0x2714,
  13139. "a21",
  13140. 0x2715,
  13141. "a22",
  13142. 0x2716,
  13143. "a23",
  13144. 0x2717,
  13145. "a24",
  13146. 0x2718,
  13147. "a25",
  13148. 0x2719,
  13149. "a26",
  13150. 0x271a,
  13151. "a27",
  13152. 0x271b,
  13153. "a28",
  13154. 0x271c,
  13155. "a6",
  13156. 0x271d,
  13157. "a7",
  13158. 0x271e,
  13159. "a8",
  13160. 0x271f,
  13161. "a9",
  13162. 0x2720,
  13163. "a10",
  13164. 0x2721,
  13165. "a29",
  13166. 0x2722,
  13167. "a30",
  13168. 0x2723,
  13169. "a31",
  13170. 0x2724,
  13171. "a32",
  13172. 0x2725,
  13173. "a33",
  13174. 0x2726,
  13175. "a34",
  13176. 0x2727,
  13177. "a35",
  13178. 0x2605,
  13179. "a36",
  13180. 0x2729,
  13181. "a37",
  13182. 0x272a,
  13183. "a38",
  13184. 0x272b,
  13185. "a39",
  13186. 0x272c,
  13187. "a40",
  13188. 0x272d,
  13189. "a41",
  13190. 0x272e,
  13191. "a42",
  13192. 0x272f,
  13193. "a43",
  13194. 0x2730,
  13195. "a44",
  13196. 0x2731,
  13197. "a45",
  13198. 0x2732,
  13199. "a46",
  13200. 0x2733,
  13201. "a47",
  13202. 0x2734,
  13203. "a48",
  13204. 0x2735,
  13205. "a49",
  13206. 0x2736,
  13207. "a50",
  13208. 0x2737,
  13209. "a51",
  13210. 0x2738,
  13211. "a52",
  13212. 0x2739,
  13213. "a53",
  13214. 0x273a,
  13215. "a54",
  13216. 0x273b,
  13217. "a55",
  13218. 0x273c,
  13219. "a56",
  13220. 0x273d,
  13221. "a57",
  13222. 0x273e,
  13223. "a58",
  13224. 0x273f,
  13225. "a59",
  13226. 0x2740,
  13227. "a60",
  13228. 0x2741,
  13229. "a61",
  13230. 0x2742,
  13231. "a62",
  13232. 0x2743,
  13233. "a63",
  13234. 0x2744,
  13235. "a64",
  13236. 0x2745,
  13237. "a65",
  13238. 0x2746,
  13239. "a66",
  13240. 0x2747,
  13241. "a67",
  13242. 0x2748,
  13243. "a68",
  13244. 0x2749,
  13245. "a69",
  13246. 0x274a,
  13247. "a70",
  13248. 0x274b,
  13249. "a71",
  13250. 0x25cf,
  13251. "a72",
  13252. 0x274d,
  13253. "a73",
  13254. 0x25a0,
  13255. "a74",
  13256. 0x274f,
  13257. "a203",
  13258. 0x2750,
  13259. "a75",
  13260. 0x2751,
  13261. "a204",
  13262. 0x2752,
  13263. "a76",
  13264. 0x25b2,
  13265. "a77",
  13266. 0x25bc,
  13267. "a78",
  13268. 0x25c6,
  13269. "a79",
  13270. 0x2756,
  13271. "a81",
  13272. 0x25d7,
  13273. "a82",
  13274. 0x2758,
  13275. "a83",
  13276. 0x2759,
  13277. "a84",
  13278. 0x275a,
  13279. "a97",
  13280. 0x275b,
  13281. "a98",
  13282. 0x275c,
  13283. "a99",
  13284. 0x275d,
  13285. "a100",
  13286. 0x275e,
  13287. "a101",
  13288. 0x2761,
  13289. "a102",
  13290. 0x2762,
  13291. "a103",
  13292. 0x2763,
  13293. "a104",
  13294. 0x2764,
  13295. "a106",
  13296. 0x2765,
  13297. "a107",
  13298. 0x2766,
  13299. "a108",
  13300. 0x2767,
  13301. "a112",
  13302. 0x2663,
  13303. "a111",
  13304. 0x2666,
  13305. "a110",
  13306. 0x2665,
  13307. "a109",
  13308. 0x2660,
  13309. "a120",
  13310. 0x2460,
  13311. "a121",
  13312. 0x2461,
  13313. "a122",
  13314. 0x2462,
  13315. "a123",
  13316. 0x2463,
  13317. "a124",
  13318. 0x2464,
  13319. "a125",
  13320. 0x2465,
  13321. "a126",
  13322. 0x2466,
  13323. "a127",
  13324. 0x2467,
  13325. "a128",
  13326. 0x2468,
  13327. "a129",
  13328. 0x2469,
  13329. "a130",
  13330. 0x2776,
  13331. "a131",
  13332. 0x2777,
  13333. "a132",
  13334. 0x2778,
  13335. "a133",
  13336. 0x2779,
  13337. "a134",
  13338. 0x277a,
  13339. "a135",
  13340. 0x277b,
  13341. "a136",
  13342. 0x277c,
  13343. "a137",
  13344. 0x277d,
  13345. "a138",
  13346. 0x277e,
  13347. "a139",
  13348. 0x277f,
  13349. "a140",
  13350. 0x2780,
  13351. "a141",
  13352. 0x2781,
  13353. "a142",
  13354. 0x2782,
  13355. "a143",
  13356. 0x2783,
  13357. "a144",
  13358. 0x2784,
  13359. "a145",
  13360. 0x2785,
  13361. "a146",
  13362. 0x2786,
  13363. "a147",
  13364. 0x2787,
  13365. "a148",
  13366. 0x2788,
  13367. "a149",
  13368. 0x2789,
  13369. "a150",
  13370. 0x278a,
  13371. "a151",
  13372. 0x278b,
  13373. "a152",
  13374. 0x278c,
  13375. "a153",
  13376. 0x278d,
  13377. "a154",
  13378. 0x278e,
  13379. "a155",
  13380. 0x278f,
  13381. "a156",
  13382. 0x2790,
  13383. "a157",
  13384. 0x2791,
  13385. "a158",
  13386. 0x2792,
  13387. "a159",
  13388. 0x2793,
  13389. "a160",
  13390. 0x2794,
  13391. "a161",
  13392. 0x2192,
  13393. "a163",
  13394. 0x2194,
  13395. "a164",
  13396. 0x2195,
  13397. "a196",
  13398. 0x2798,
  13399. "a165",
  13400. 0x2799,
  13401. "a192",
  13402. 0x279a,
  13403. "a166",
  13404. 0x279b,
  13405. "a167",
  13406. 0x279c,
  13407. "a168",
  13408. 0x279d,
  13409. "a169",
  13410. 0x279e,
  13411. "a170",
  13412. 0x279f,
  13413. "a171",
  13414. 0x27a0,
  13415. "a172",
  13416. 0x27a1,
  13417. "a173",
  13418. 0x27a2,
  13419. "a162",
  13420. 0x27a3,
  13421. "a174",
  13422. 0x27a4,
  13423. "a175",
  13424. 0x27a5,
  13425. "a176",
  13426. 0x27a6,
  13427. "a177",
  13428. 0x27a7,
  13429. "a178",
  13430. 0x27a8,
  13431. "a179",
  13432. 0x27a9,
  13433. "a193",
  13434. 0x27aa,
  13435. "a180",
  13436. 0x27ab,
  13437. "a199",
  13438. 0x27ac,
  13439. "a181",
  13440. 0x27ad,
  13441. "a200",
  13442. 0x27ae,
  13443. "a182",
  13444. 0x27af,
  13445. "a201",
  13446. 0x27b1,
  13447. "a183",
  13448. 0x27b2,
  13449. "a184",
  13450. 0x27b3,
  13451. "a197",
  13452. 0x27b4,
  13453. "a185",
  13454. 0x27b5,
  13455. "a194",
  13456. 0x27b6,
  13457. "a198",
  13458. 0x27b7,
  13459. "a186",
  13460. 0x27b8,
  13461. "a195",
  13462. 0x27b9,
  13463. "a187",
  13464. 0x27ba,
  13465. "a188",
  13466. 0x27bb,
  13467. "a189",
  13468. 0x27bc,
  13469. "a190",
  13470. 0x27bd,
  13471. "a191",
  13472. 0x27be,
  13473. "a89",
  13474. 0x2768,
  13475. "a90",
  13476. 0x2769,
  13477. "a93",
  13478. 0x276a,
  13479. "a94",
  13480. 0x276b,
  13481. "a91",
  13482. 0x276c,
  13483. "a92",
  13484. 0x276d,
  13485. "a205",
  13486. 0x276e,
  13487. "a85",
  13488. 0x276f,
  13489. "a206",
  13490. 0x2770,
  13491. "a86",
  13492. 0x2771,
  13493. "a87",
  13494. 0x2772,
  13495. "a88",
  13496. 0x2773,
  13497. "a95",
  13498. 0x2774,
  13499. "a96",
  13500. 0x2775,
  13501. ".notdef",
  13502. 0x0000
  13503. ];
  13504. });
  13505. /***/ }),
  13506. /* 21 */
  13507. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  13508. __w_pdfjs_require__.r(__webpack_exports__);
  13509. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  13510. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  13511. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  13512. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  13513. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  13514. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  13515. /* harmony export */ });
  13516. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(9);
  13517. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  13518. t[63721] = 0x00a9;
  13519. t[63193] = 0x00a9;
  13520. t[63720] = 0x00ae;
  13521. t[63194] = 0x00ae;
  13522. t[63722] = 0x2122;
  13523. t[63195] = 0x2122;
  13524. t[63729] = 0x23a7;
  13525. t[63730] = 0x23a8;
  13526. t[63731] = 0x23a9;
  13527. t[63740] = 0x23ab;
  13528. t[63741] = 0x23ac;
  13529. t[63742] = 0x23ad;
  13530. t[63726] = 0x23a1;
  13531. t[63727] = 0x23a2;
  13532. t[63728] = 0x23a3;
  13533. t[63737] = 0x23a4;
  13534. t[63738] = 0x23a5;
  13535. t[63739] = 0x23a6;
  13536. t[63723] = 0x239b;
  13537. t[63724] = 0x239c;
  13538. t[63725] = 0x239d;
  13539. t[63734] = 0x239e;
  13540. t[63735] = 0x239f;
  13541. t[63736] = 0x23a0;
  13542. });
  13543. function mapSpecialUnicodeValues(code) {
  13544. if (code >= 0xfff0 && code <= 0xffff) {
  13545. return 0;
  13546. } else if (code >= 0xf600 && code <= 0xf8ff) {
  13547. return getSpecialPUASymbols()[code] || code;
  13548. } else if (code === 0x00ad) {
  13549. return 0x002d;
  13550. }
  13551. return code;
  13552. }
  13553. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  13554. let unicode = glyphsUnicodeMap[name];
  13555. if (unicode !== undefined) {
  13556. return unicode;
  13557. }
  13558. if (!name) {
  13559. return -1;
  13560. }
  13561. if (name[0] === "u") {
  13562. const nameLen = name.length;
  13563. let hexStr;
  13564. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  13565. hexStr = name.substring(3);
  13566. } else if (nameLen >= 5 && nameLen <= 7) {
  13567. hexStr = name.substring(1);
  13568. } else {
  13569. return -1;
  13570. }
  13571. if (hexStr === hexStr.toUpperCase()) {
  13572. unicode = parseInt(hexStr, 16);
  13573. if (unicode >= 0) {
  13574. return unicode;
  13575. }
  13576. }
  13577. }
  13578. return -1;
  13579. }
  13580. const UnicodeRanges = [
  13581. {
  13582. begin: 0x0000,
  13583. end: 0x007f
  13584. },
  13585. {
  13586. begin: 0x0080,
  13587. end: 0x00ff
  13588. },
  13589. {
  13590. begin: 0x0100,
  13591. end: 0x017f
  13592. },
  13593. {
  13594. begin: 0x0180,
  13595. end: 0x024f
  13596. },
  13597. {
  13598. begin: 0x0250,
  13599. end: 0x02af
  13600. },
  13601. {
  13602. begin: 0x02b0,
  13603. end: 0x02ff
  13604. },
  13605. {
  13606. begin: 0x0300,
  13607. end: 0x036f
  13608. },
  13609. {
  13610. begin: 0x0370,
  13611. end: 0x03ff
  13612. },
  13613. {
  13614. begin: 0x2c80,
  13615. end: 0x2cff
  13616. },
  13617. {
  13618. begin: 0x0400,
  13619. end: 0x04ff
  13620. },
  13621. {
  13622. begin: 0x0530,
  13623. end: 0x058f
  13624. },
  13625. {
  13626. begin: 0x0590,
  13627. end: 0x05ff
  13628. },
  13629. {
  13630. begin: 0xa500,
  13631. end: 0xa63f
  13632. },
  13633. {
  13634. begin: 0x0600,
  13635. end: 0x06ff
  13636. },
  13637. {
  13638. begin: 0x07c0,
  13639. end: 0x07ff
  13640. },
  13641. {
  13642. begin: 0x0900,
  13643. end: 0x097f
  13644. },
  13645. {
  13646. begin: 0x0980,
  13647. end: 0x09ff
  13648. },
  13649. {
  13650. begin: 0x0a00,
  13651. end: 0x0a7f
  13652. },
  13653. {
  13654. begin: 0x0a80,
  13655. end: 0x0aff
  13656. },
  13657. {
  13658. begin: 0x0b00,
  13659. end: 0x0b7f
  13660. },
  13661. {
  13662. begin: 0x0b80,
  13663. end: 0x0bff
  13664. },
  13665. {
  13666. begin: 0x0c00,
  13667. end: 0x0c7f
  13668. },
  13669. {
  13670. begin: 0x0c80,
  13671. end: 0x0cff
  13672. },
  13673. {
  13674. begin: 0x0d00,
  13675. end: 0x0d7f
  13676. },
  13677. {
  13678. begin: 0x0e00,
  13679. end: 0x0e7f
  13680. },
  13681. {
  13682. begin: 0x0e80,
  13683. end: 0x0eff
  13684. },
  13685. {
  13686. begin: 0x10a0,
  13687. end: 0x10ff
  13688. },
  13689. {
  13690. begin: 0x1b00,
  13691. end: 0x1b7f
  13692. },
  13693. {
  13694. begin: 0x1100,
  13695. end: 0x11ff
  13696. },
  13697. {
  13698. begin: 0x1e00,
  13699. end: 0x1eff
  13700. },
  13701. {
  13702. begin: 0x1f00,
  13703. end: 0x1fff
  13704. },
  13705. {
  13706. begin: 0x2000,
  13707. end: 0x206f
  13708. },
  13709. {
  13710. begin: 0x2070,
  13711. end: 0x209f
  13712. },
  13713. {
  13714. begin: 0x20a0,
  13715. end: 0x20cf
  13716. },
  13717. {
  13718. begin: 0x20d0,
  13719. end: 0x20ff
  13720. },
  13721. {
  13722. begin: 0x2100,
  13723. end: 0x214f
  13724. },
  13725. {
  13726. begin: 0x2150,
  13727. end: 0x218f
  13728. },
  13729. {
  13730. begin: 0x2190,
  13731. end: 0x21ff
  13732. },
  13733. {
  13734. begin: 0x2200,
  13735. end: 0x22ff
  13736. },
  13737. {
  13738. begin: 0x2300,
  13739. end: 0x23ff
  13740. },
  13741. {
  13742. begin: 0x2400,
  13743. end: 0x243f
  13744. },
  13745. {
  13746. begin: 0x2440,
  13747. end: 0x245f
  13748. },
  13749. {
  13750. begin: 0x2460,
  13751. end: 0x24ff
  13752. },
  13753. {
  13754. begin: 0x2500,
  13755. end: 0x257f
  13756. },
  13757. {
  13758. begin: 0x2580,
  13759. end: 0x259f
  13760. },
  13761. {
  13762. begin: 0x25a0,
  13763. end: 0x25ff
  13764. },
  13765. {
  13766. begin: 0x2600,
  13767. end: 0x26ff
  13768. },
  13769. {
  13770. begin: 0x2700,
  13771. end: 0x27bf
  13772. },
  13773. {
  13774. begin: 0x3000,
  13775. end: 0x303f
  13776. },
  13777. {
  13778. begin: 0x3040,
  13779. end: 0x309f
  13780. },
  13781. {
  13782. begin: 0x30a0,
  13783. end: 0x30ff
  13784. },
  13785. {
  13786. begin: 0x3100,
  13787. end: 0x312f
  13788. },
  13789. {
  13790. begin: 0x3130,
  13791. end: 0x318f
  13792. },
  13793. {
  13794. begin: 0xa840,
  13795. end: 0xa87f
  13796. },
  13797. {
  13798. begin: 0x3200,
  13799. end: 0x32ff
  13800. },
  13801. {
  13802. begin: 0x3300,
  13803. end: 0x33ff
  13804. },
  13805. {
  13806. begin: 0xac00,
  13807. end: 0xd7af
  13808. },
  13809. {
  13810. begin: 0xd800,
  13811. end: 0xdfff
  13812. },
  13813. {
  13814. begin: 0x10900,
  13815. end: 0x1091f
  13816. },
  13817. {
  13818. begin: 0x4e00,
  13819. end: 0x9fff
  13820. },
  13821. {
  13822. begin: 0xe000,
  13823. end: 0xf8ff
  13824. },
  13825. {
  13826. begin: 0x31c0,
  13827. end: 0x31ef
  13828. },
  13829. {
  13830. begin: 0xfb00,
  13831. end: 0xfb4f
  13832. },
  13833. {
  13834. begin: 0xfb50,
  13835. end: 0xfdff
  13836. },
  13837. {
  13838. begin: 0xfe20,
  13839. end: 0xfe2f
  13840. },
  13841. {
  13842. begin: 0xfe10,
  13843. end: 0xfe1f
  13844. },
  13845. {
  13846. begin: 0xfe50,
  13847. end: 0xfe6f
  13848. },
  13849. {
  13850. begin: 0xfe70,
  13851. end: 0xfeff
  13852. },
  13853. {
  13854. begin: 0xff00,
  13855. end: 0xffef
  13856. },
  13857. {
  13858. begin: 0xfff0,
  13859. end: 0xffff
  13860. },
  13861. {
  13862. begin: 0x0f00,
  13863. end: 0x0fff
  13864. },
  13865. {
  13866. begin: 0x0700,
  13867. end: 0x074f
  13868. },
  13869. {
  13870. begin: 0x0780,
  13871. end: 0x07bf
  13872. },
  13873. {
  13874. begin: 0x0d80,
  13875. end: 0x0dff
  13876. },
  13877. {
  13878. begin: 0x1000,
  13879. end: 0x109f
  13880. },
  13881. {
  13882. begin: 0x1200,
  13883. end: 0x137f
  13884. },
  13885. {
  13886. begin: 0x13a0,
  13887. end: 0x13ff
  13888. },
  13889. {
  13890. begin: 0x1400,
  13891. end: 0x167f
  13892. },
  13893. {
  13894. begin: 0x1680,
  13895. end: 0x169f
  13896. },
  13897. {
  13898. begin: 0x16a0,
  13899. end: 0x16ff
  13900. },
  13901. {
  13902. begin: 0x1780,
  13903. end: 0x17ff
  13904. },
  13905. {
  13906. begin: 0x1800,
  13907. end: 0x18af
  13908. },
  13909. {
  13910. begin: 0x2800,
  13911. end: 0x28ff
  13912. },
  13913. {
  13914. begin: 0xa000,
  13915. end: 0xa48f
  13916. },
  13917. {
  13918. begin: 0x1700,
  13919. end: 0x171f
  13920. },
  13921. {
  13922. begin: 0x10300,
  13923. end: 0x1032f
  13924. },
  13925. {
  13926. begin: 0x10330,
  13927. end: 0x1034f
  13928. },
  13929. {
  13930. begin: 0x10400,
  13931. end: 0x1044f
  13932. },
  13933. {
  13934. begin: 0x1d000,
  13935. end: 0x1d0ff
  13936. },
  13937. {
  13938. begin: 0x1d400,
  13939. end: 0x1d7ff
  13940. },
  13941. {
  13942. begin: 0xff000,
  13943. end: 0xffffd
  13944. },
  13945. {
  13946. begin: 0xfe00,
  13947. end: 0xfe0f
  13948. },
  13949. {
  13950. begin: 0xe0000,
  13951. end: 0xe007f
  13952. },
  13953. {
  13954. begin: 0x1900,
  13955. end: 0x194f
  13956. },
  13957. {
  13958. begin: 0x1950,
  13959. end: 0x197f
  13960. },
  13961. {
  13962. begin: 0x1980,
  13963. end: 0x19df
  13964. },
  13965. {
  13966. begin: 0x1a00,
  13967. end: 0x1a1f
  13968. },
  13969. {
  13970. begin: 0x2c00,
  13971. end: 0x2c5f
  13972. },
  13973. {
  13974. begin: 0x2d30,
  13975. end: 0x2d7f
  13976. },
  13977. {
  13978. begin: 0x4dc0,
  13979. end: 0x4dff
  13980. },
  13981. {
  13982. begin: 0xa800,
  13983. end: 0xa82f
  13984. },
  13985. {
  13986. begin: 0x10000,
  13987. end: 0x1007f
  13988. },
  13989. {
  13990. begin: 0x10140,
  13991. end: 0x1018f
  13992. },
  13993. {
  13994. begin: 0x10380,
  13995. end: 0x1039f
  13996. },
  13997. {
  13998. begin: 0x103a0,
  13999. end: 0x103df
  14000. },
  14001. {
  14002. begin: 0x10450,
  14003. end: 0x1047f
  14004. },
  14005. {
  14006. begin: 0x10480,
  14007. end: 0x104af
  14008. },
  14009. {
  14010. begin: 0x10800,
  14011. end: 0x1083f
  14012. },
  14013. {
  14014. begin: 0x10a00,
  14015. end: 0x10a5f
  14016. },
  14017. {
  14018. begin: 0x1d300,
  14019. end: 0x1d35f
  14020. },
  14021. {
  14022. begin: 0x12000,
  14023. end: 0x123ff
  14024. },
  14025. {
  14026. begin: 0x1d360,
  14027. end: 0x1d37f
  14028. },
  14029. {
  14030. begin: 0x1b80,
  14031. end: 0x1bbf
  14032. },
  14033. {
  14034. begin: 0x1c00,
  14035. end: 0x1c4f
  14036. },
  14037. {
  14038. begin: 0x1c50,
  14039. end: 0x1c7f
  14040. },
  14041. {
  14042. begin: 0xa880,
  14043. end: 0xa8df
  14044. },
  14045. {
  14046. begin: 0xa900,
  14047. end: 0xa92f
  14048. },
  14049. {
  14050. begin: 0xa930,
  14051. end: 0xa95f
  14052. },
  14053. {
  14054. begin: 0xaa00,
  14055. end: 0xaa5f
  14056. },
  14057. {
  14058. begin: 0x10190,
  14059. end: 0x101cf
  14060. },
  14061. {
  14062. begin: 0x101d0,
  14063. end: 0x101ff
  14064. },
  14065. {
  14066. begin: 0x102a0,
  14067. end: 0x102df
  14068. },
  14069. {
  14070. begin: 0x1f030,
  14071. end: 0x1f09f
  14072. }
  14073. ];
  14074. function getUnicodeRangeFor(value) {
  14075. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  14076. const range = UnicodeRanges[i];
  14077. if (value >= range.begin && value < range.end) {
  14078. return i;
  14079. }
  14080. }
  14081. return -1;
  14082. }
  14083. function isRTLRangeFor(value) {
  14084. let range = UnicodeRanges[13];
  14085. if (value >= range.begin && value < range.end) {
  14086. return true;
  14087. }
  14088. range = UnicodeRanges[11];
  14089. if (value >= range.begin && value < range.end) {
  14090. return true;
  14091. }
  14092. return false;
  14093. }
  14094. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  14095. return [
  14096. "\u00A8",
  14097. "\u0020\u0308",
  14098. "\u00AF",
  14099. "\u0020\u0304",
  14100. "\u00B4",
  14101. "\u0020\u0301",
  14102. "\u00B5",
  14103. "\u03BC",
  14104. "\u00B8",
  14105. "\u0020\u0327",
  14106. "\u0132",
  14107. "\u0049\u004A",
  14108. "\u0133",
  14109. "\u0069\u006A",
  14110. "\u013F",
  14111. "\u004C\u00B7",
  14112. "\u0140",
  14113. "\u006C\u00B7",
  14114. "\u0149",
  14115. "\u02BC\u006E",
  14116. "\u017F",
  14117. "\u0073",
  14118. "\u01C4",
  14119. "\u0044\u017D",
  14120. "\u01C5",
  14121. "\u0044\u017E",
  14122. "\u01C6",
  14123. "\u0064\u017E",
  14124. "\u01C7",
  14125. "\u004C\u004A",
  14126. "\u01C8",
  14127. "\u004C\u006A",
  14128. "\u01C9",
  14129. "\u006C\u006A",
  14130. "\u01CA",
  14131. "\u004E\u004A",
  14132. "\u01CB",
  14133. "\u004E\u006A",
  14134. "\u01CC",
  14135. "\u006E\u006A",
  14136. "\u01F1",
  14137. "\u0044\u005A",
  14138. "\u01F2",
  14139. "\u0044\u007A",
  14140. "\u01F3",
  14141. "\u0064\u007A",
  14142. "\u02D8",
  14143. "\u0020\u0306",
  14144. "\u02D9",
  14145. "\u0020\u0307",
  14146. "\u02DA",
  14147. "\u0020\u030A",
  14148. "\u02DB",
  14149. "\u0020\u0328",
  14150. "\u02DC",
  14151. "\u0020\u0303",
  14152. "\u02DD",
  14153. "\u0020\u030B",
  14154. "\u037A",
  14155. "\u0020\u0345",
  14156. "\u0384",
  14157. "\u0020\u0301",
  14158. "\u03D0",
  14159. "\u03B2",
  14160. "\u03D1",
  14161. "\u03B8",
  14162. "\u03D2",
  14163. "\u03A5",
  14164. "\u03D5",
  14165. "\u03C6",
  14166. "\u03D6",
  14167. "\u03C0",
  14168. "\u03F0",
  14169. "\u03BA",
  14170. "\u03F1",
  14171. "\u03C1",
  14172. "\u03F2",
  14173. "\u03C2",
  14174. "\u03F4",
  14175. "\u0398",
  14176. "\u03F5",
  14177. "\u03B5",
  14178. "\u03F9",
  14179. "\u03A3",
  14180. "\u0587",
  14181. "\u0565\u0582",
  14182. "\u0675",
  14183. "\u0627\u0674",
  14184. "\u0676",
  14185. "\u0648\u0674",
  14186. "\u0677",
  14187. "\u06C7\u0674",
  14188. "\u0678",
  14189. "\u064A\u0674",
  14190. "\u0E33",
  14191. "\u0E4D\u0E32",
  14192. "\u0EB3",
  14193. "\u0ECD\u0EB2",
  14194. "\u0EDC",
  14195. "\u0EAB\u0E99",
  14196. "\u0EDD",
  14197. "\u0EAB\u0EA1",
  14198. "\u0F77",
  14199. "\u0FB2\u0F81",
  14200. "\u0F79",
  14201. "\u0FB3\u0F81",
  14202. "\u1E9A",
  14203. "\u0061\u02BE",
  14204. "\u1FBD",
  14205. "\u0020\u0313",
  14206. "\u1FBF",
  14207. "\u0020\u0313",
  14208. "\u1FC0",
  14209. "\u0020\u0342",
  14210. "\u1FFE",
  14211. "\u0020\u0314",
  14212. "\u2002",
  14213. "\u0020",
  14214. "\u2003",
  14215. "\u0020",
  14216. "\u2004",
  14217. "\u0020",
  14218. "\u2005",
  14219. "\u0020",
  14220. "\u2006",
  14221. "\u0020",
  14222. "\u2008",
  14223. "\u0020",
  14224. "\u2009",
  14225. "\u0020",
  14226. "\u200A",
  14227. "\u0020",
  14228. "\u2017",
  14229. "\u0020\u0333",
  14230. "\u2024",
  14231. "\u002E",
  14232. "\u2025",
  14233. "\u002E\u002E",
  14234. "\u2026",
  14235. "\u002E\u002E\u002E",
  14236. "\u2033",
  14237. "\u2032\u2032",
  14238. "\u2034",
  14239. "\u2032\u2032\u2032",
  14240. "\u2036",
  14241. "\u2035\u2035",
  14242. "\u2037",
  14243. "\u2035\u2035\u2035",
  14244. "\u203C",
  14245. "\u0021\u0021",
  14246. "\u203E",
  14247. "\u0020\u0305",
  14248. "\u2047",
  14249. "\u003F\u003F",
  14250. "\u2048",
  14251. "\u003F\u0021",
  14252. "\u2049",
  14253. "\u0021\u003F",
  14254. "\u2057",
  14255. "\u2032\u2032\u2032\u2032",
  14256. "\u205F",
  14257. "\u0020",
  14258. "\u20A8",
  14259. "\u0052\u0073",
  14260. "\u2100",
  14261. "\u0061\u002F\u0063",
  14262. "\u2101",
  14263. "\u0061\u002F\u0073",
  14264. "\u2103",
  14265. "\u00B0\u0043",
  14266. "\u2105",
  14267. "\u0063\u002F\u006F",
  14268. "\u2106",
  14269. "\u0063\u002F\u0075",
  14270. "\u2107",
  14271. "\u0190",
  14272. "\u2109",
  14273. "\u00B0\u0046",
  14274. "\u2116",
  14275. "\u004E\u006F",
  14276. "\u2121",
  14277. "\u0054\u0045\u004C",
  14278. "\u2135",
  14279. "\u05D0",
  14280. "\u2136",
  14281. "\u05D1",
  14282. "\u2137",
  14283. "\u05D2",
  14284. "\u2138",
  14285. "\u05D3",
  14286. "\u213B",
  14287. "\u0046\u0041\u0058",
  14288. "\u2160",
  14289. "\u0049",
  14290. "\u2161",
  14291. "\u0049\u0049",
  14292. "\u2162",
  14293. "\u0049\u0049\u0049",
  14294. "\u2163",
  14295. "\u0049\u0056",
  14296. "\u2164",
  14297. "\u0056",
  14298. "\u2165",
  14299. "\u0056\u0049",
  14300. "\u2166",
  14301. "\u0056\u0049\u0049",
  14302. "\u2167",
  14303. "\u0056\u0049\u0049\u0049",
  14304. "\u2168",
  14305. "\u0049\u0058",
  14306. "\u2169",
  14307. "\u0058",
  14308. "\u216A",
  14309. "\u0058\u0049",
  14310. "\u216B",
  14311. "\u0058\u0049\u0049",
  14312. "\u216C",
  14313. "\u004C",
  14314. "\u216D",
  14315. "\u0043",
  14316. "\u216E",
  14317. "\u0044",
  14318. "\u216F",
  14319. "\u004D",
  14320. "\u2170",
  14321. "\u0069",
  14322. "\u2171",
  14323. "\u0069\u0069",
  14324. "\u2172",
  14325. "\u0069\u0069\u0069",
  14326. "\u2173",
  14327. "\u0069\u0076",
  14328. "\u2174",
  14329. "\u0076",
  14330. "\u2175",
  14331. "\u0076\u0069",
  14332. "\u2176",
  14333. "\u0076\u0069\u0069",
  14334. "\u2177",
  14335. "\u0076\u0069\u0069\u0069",
  14336. "\u2178",
  14337. "\u0069\u0078",
  14338. "\u2179",
  14339. "\u0078",
  14340. "\u217A",
  14341. "\u0078\u0069",
  14342. "\u217B",
  14343. "\u0078\u0069\u0069",
  14344. "\u217C",
  14345. "\u006C",
  14346. "\u217D",
  14347. "\u0063",
  14348. "\u217E",
  14349. "\u0064",
  14350. "\u217F",
  14351. "\u006D",
  14352. "\u222C",
  14353. "\u222B\u222B",
  14354. "\u222D",
  14355. "\u222B\u222B\u222B",
  14356. "\u222F",
  14357. "\u222E\u222E",
  14358. "\u2230",
  14359. "\u222E\u222E\u222E",
  14360. "\u2474",
  14361. "\u0028\u0031\u0029",
  14362. "\u2475",
  14363. "\u0028\u0032\u0029",
  14364. "\u2476",
  14365. "\u0028\u0033\u0029",
  14366. "\u2477",
  14367. "\u0028\u0034\u0029",
  14368. "\u2478",
  14369. "\u0028\u0035\u0029",
  14370. "\u2479",
  14371. "\u0028\u0036\u0029",
  14372. "\u247A",
  14373. "\u0028\u0037\u0029",
  14374. "\u247B",
  14375. "\u0028\u0038\u0029",
  14376. "\u247C",
  14377. "\u0028\u0039\u0029",
  14378. "\u247D",
  14379. "\u0028\u0031\u0030\u0029",
  14380. "\u247E",
  14381. "\u0028\u0031\u0031\u0029",
  14382. "\u247F",
  14383. "\u0028\u0031\u0032\u0029",
  14384. "\u2480",
  14385. "\u0028\u0031\u0033\u0029",
  14386. "\u2481",
  14387. "\u0028\u0031\u0034\u0029",
  14388. "\u2482",
  14389. "\u0028\u0031\u0035\u0029",
  14390. "\u2483",
  14391. "\u0028\u0031\u0036\u0029",
  14392. "\u2484",
  14393. "\u0028\u0031\u0037\u0029",
  14394. "\u2485",
  14395. "\u0028\u0031\u0038\u0029",
  14396. "\u2486",
  14397. "\u0028\u0031\u0039\u0029",
  14398. "\u2487",
  14399. "\u0028\u0032\u0030\u0029",
  14400. "\u2488",
  14401. "\u0031\u002E",
  14402. "\u2489",
  14403. "\u0032\u002E",
  14404. "\u248A",
  14405. "\u0033\u002E",
  14406. "\u248B",
  14407. "\u0034\u002E",
  14408. "\u248C",
  14409. "\u0035\u002E",
  14410. "\u248D",
  14411. "\u0036\u002E",
  14412. "\u248E",
  14413. "\u0037\u002E",
  14414. "\u248F",
  14415. "\u0038\u002E",
  14416. "\u2490",
  14417. "\u0039\u002E",
  14418. "\u2491",
  14419. "\u0031\u0030\u002E",
  14420. "\u2492",
  14421. "\u0031\u0031\u002E",
  14422. "\u2493",
  14423. "\u0031\u0032\u002E",
  14424. "\u2494",
  14425. "\u0031\u0033\u002E",
  14426. "\u2495",
  14427. "\u0031\u0034\u002E",
  14428. "\u2496",
  14429. "\u0031\u0035\u002E",
  14430. "\u2497",
  14431. "\u0031\u0036\u002E",
  14432. "\u2498",
  14433. "\u0031\u0037\u002E",
  14434. "\u2499",
  14435. "\u0031\u0038\u002E",
  14436. "\u249A",
  14437. "\u0031\u0039\u002E",
  14438. "\u249B",
  14439. "\u0032\u0030\u002E",
  14440. "\u249C",
  14441. "\u0028\u0061\u0029",
  14442. "\u249D",
  14443. "\u0028\u0062\u0029",
  14444. "\u249E",
  14445. "\u0028\u0063\u0029",
  14446. "\u249F",
  14447. "\u0028\u0064\u0029",
  14448. "\u24A0",
  14449. "\u0028\u0065\u0029",
  14450. "\u24A1",
  14451. "\u0028\u0066\u0029",
  14452. "\u24A2",
  14453. "\u0028\u0067\u0029",
  14454. "\u24A3",
  14455. "\u0028\u0068\u0029",
  14456. "\u24A4",
  14457. "\u0028\u0069\u0029",
  14458. "\u24A5",
  14459. "\u0028\u006A\u0029",
  14460. "\u24A6",
  14461. "\u0028\u006B\u0029",
  14462. "\u24A7",
  14463. "\u0028\u006C\u0029",
  14464. "\u24A8",
  14465. "\u0028\u006D\u0029",
  14466. "\u24A9",
  14467. "\u0028\u006E\u0029",
  14468. "\u24AA",
  14469. "\u0028\u006F\u0029",
  14470. "\u24AB",
  14471. "\u0028\u0070\u0029",
  14472. "\u24AC",
  14473. "\u0028\u0071\u0029",
  14474. "\u24AD",
  14475. "\u0028\u0072\u0029",
  14476. "\u24AE",
  14477. "\u0028\u0073\u0029",
  14478. "\u24AF",
  14479. "\u0028\u0074\u0029",
  14480. "\u24B0",
  14481. "\u0028\u0075\u0029",
  14482. "\u24B1",
  14483. "\u0028\u0076\u0029",
  14484. "\u24B2",
  14485. "\u0028\u0077\u0029",
  14486. "\u24B3",
  14487. "\u0028\u0078\u0029",
  14488. "\u24B4",
  14489. "\u0028\u0079\u0029",
  14490. "\u24B5",
  14491. "\u0028\u007A\u0029",
  14492. "\u2A0C",
  14493. "\u222B\u222B\u222B\u222B",
  14494. "\u2A74",
  14495. "\u003A\u003A\u003D",
  14496. "\u2A75",
  14497. "\u003D\u003D",
  14498. "\u2A76",
  14499. "\u003D\u003D\u003D",
  14500. "\u2E9F",
  14501. "\u6BCD",
  14502. "\u2EF3",
  14503. "\u9F9F",
  14504. "\u2F00",
  14505. "\u4E00",
  14506. "\u2F01",
  14507. "\u4E28",
  14508. "\u2F02",
  14509. "\u4E36",
  14510. "\u2F03",
  14511. "\u4E3F",
  14512. "\u2F04",
  14513. "\u4E59",
  14514. "\u2F05",
  14515. "\u4E85",
  14516. "\u2F06",
  14517. "\u4E8C",
  14518. "\u2F07",
  14519. "\u4EA0",
  14520. "\u2F08",
  14521. "\u4EBA",
  14522. "\u2F09",
  14523. "\u513F",
  14524. "\u2F0A",
  14525. "\u5165",
  14526. "\u2F0B",
  14527. "\u516B",
  14528. "\u2F0C",
  14529. "\u5182",
  14530. "\u2F0D",
  14531. "\u5196",
  14532. "\u2F0E",
  14533. "\u51AB",
  14534. "\u2F0F",
  14535. "\u51E0",
  14536. "\u2F10",
  14537. "\u51F5",
  14538. "\u2F11",
  14539. "\u5200",
  14540. "\u2F12",
  14541. "\u529B",
  14542. "\u2F13",
  14543. "\u52F9",
  14544. "\u2F14",
  14545. "\u5315",
  14546. "\u2F15",
  14547. "\u531A",
  14548. "\u2F16",
  14549. "\u5338",
  14550. "\u2F17",
  14551. "\u5341",
  14552. "\u2F18",
  14553. "\u535C",
  14554. "\u2F19",
  14555. "\u5369",
  14556. "\u2F1A",
  14557. "\u5382",
  14558. "\u2F1B",
  14559. "\u53B6",
  14560. "\u2F1C",
  14561. "\u53C8",
  14562. "\u2F1D",
  14563. "\u53E3",
  14564. "\u2F1E",
  14565. "\u56D7",
  14566. "\u2F1F",
  14567. "\u571F",
  14568. "\u2F20",
  14569. "\u58EB",
  14570. "\u2F21",
  14571. "\u5902",
  14572. "\u2F22",
  14573. "\u590A",
  14574. "\u2F23",
  14575. "\u5915",
  14576. "\u2F24",
  14577. "\u5927",
  14578. "\u2F25",
  14579. "\u5973",
  14580. "\u2F26",
  14581. "\u5B50",
  14582. "\u2F27",
  14583. "\u5B80",
  14584. "\u2F28",
  14585. "\u5BF8",
  14586. "\u2F29",
  14587. "\u5C0F",
  14588. "\u2F2A",
  14589. "\u5C22",
  14590. "\u2F2B",
  14591. "\u5C38",
  14592. "\u2F2C",
  14593. "\u5C6E",
  14594. "\u2F2D",
  14595. "\u5C71",
  14596. "\u2F2E",
  14597. "\u5DDB",
  14598. "\u2F2F",
  14599. "\u5DE5",
  14600. "\u2F30",
  14601. "\u5DF1",
  14602. "\u2F31",
  14603. "\u5DFE",
  14604. "\u2F32",
  14605. "\u5E72",
  14606. "\u2F33",
  14607. "\u5E7A",
  14608. "\u2F34",
  14609. "\u5E7F",
  14610. "\u2F35",
  14611. "\u5EF4",
  14612. "\u2F36",
  14613. "\u5EFE",
  14614. "\u2F37",
  14615. "\u5F0B",
  14616. "\u2F38",
  14617. "\u5F13",
  14618. "\u2F39",
  14619. "\u5F50",
  14620. "\u2F3A",
  14621. "\u5F61",
  14622. "\u2F3B",
  14623. "\u5F73",
  14624. "\u2F3C",
  14625. "\u5FC3",
  14626. "\u2F3D",
  14627. "\u6208",
  14628. "\u2F3E",
  14629. "\u6236",
  14630. "\u2F3F",
  14631. "\u624B",
  14632. "\u2F40",
  14633. "\u652F",
  14634. "\u2F41",
  14635. "\u6534",
  14636. "\u2F42",
  14637. "\u6587",
  14638. "\u2F43",
  14639. "\u6597",
  14640. "\u2F44",
  14641. "\u65A4",
  14642. "\u2F45",
  14643. "\u65B9",
  14644. "\u2F46",
  14645. "\u65E0",
  14646. "\u2F47",
  14647. "\u65E5",
  14648. "\u2F48",
  14649. "\u66F0",
  14650. "\u2F49",
  14651. "\u6708",
  14652. "\u2F4A",
  14653. "\u6728",
  14654. "\u2F4B",
  14655. "\u6B20",
  14656. "\u2F4C",
  14657. "\u6B62",
  14658. "\u2F4D",
  14659. "\u6B79",
  14660. "\u2F4E",
  14661. "\u6BB3",
  14662. "\u2F4F",
  14663. "\u6BCB",
  14664. "\u2F50",
  14665. "\u6BD4",
  14666. "\u2F51",
  14667. "\u6BDB",
  14668. "\u2F52",
  14669. "\u6C0F",
  14670. "\u2F53",
  14671. "\u6C14",
  14672. "\u2F54",
  14673. "\u6C34",
  14674. "\u2F55",
  14675. "\u706B",
  14676. "\u2F56",
  14677. "\u722A",
  14678. "\u2F57",
  14679. "\u7236",
  14680. "\u2F58",
  14681. "\u723B",
  14682. "\u2F59",
  14683. "\u723F",
  14684. "\u2F5A",
  14685. "\u7247",
  14686. "\u2F5B",
  14687. "\u7259",
  14688. "\u2F5C",
  14689. "\u725B",
  14690. "\u2F5D",
  14691. "\u72AC",
  14692. "\u2F5E",
  14693. "\u7384",
  14694. "\u2F5F",
  14695. "\u7389",
  14696. "\u2F60",
  14697. "\u74DC",
  14698. "\u2F61",
  14699. "\u74E6",
  14700. "\u2F62",
  14701. "\u7518",
  14702. "\u2F63",
  14703. "\u751F",
  14704. "\u2F64",
  14705. "\u7528",
  14706. "\u2F65",
  14707. "\u7530",
  14708. "\u2F66",
  14709. "\u758B",
  14710. "\u2F67",
  14711. "\u7592",
  14712. "\u2F68",
  14713. "\u7676",
  14714. "\u2F69",
  14715. "\u767D",
  14716. "\u2F6A",
  14717. "\u76AE",
  14718. "\u2F6B",
  14719. "\u76BF",
  14720. "\u2F6C",
  14721. "\u76EE",
  14722. "\u2F6D",
  14723. "\u77DB",
  14724. "\u2F6E",
  14725. "\u77E2",
  14726. "\u2F6F",
  14727. "\u77F3",
  14728. "\u2F70",
  14729. "\u793A",
  14730. "\u2F71",
  14731. "\u79B8",
  14732. "\u2F72",
  14733. "\u79BE",
  14734. "\u2F73",
  14735. "\u7A74",
  14736. "\u2F74",
  14737. "\u7ACB",
  14738. "\u2F75",
  14739. "\u7AF9",
  14740. "\u2F76",
  14741. "\u7C73",
  14742. "\u2F77",
  14743. "\u7CF8",
  14744. "\u2F78",
  14745. "\u7F36",
  14746. "\u2F79",
  14747. "\u7F51",
  14748. "\u2F7A",
  14749. "\u7F8A",
  14750. "\u2F7B",
  14751. "\u7FBD",
  14752. "\u2F7C",
  14753. "\u8001",
  14754. "\u2F7D",
  14755. "\u800C",
  14756. "\u2F7E",
  14757. "\u8012",
  14758. "\u2F7F",
  14759. "\u8033",
  14760. "\u2F80",
  14761. "\u807F",
  14762. "\u2F81",
  14763. "\u8089",
  14764. "\u2F82",
  14765. "\u81E3",
  14766. "\u2F83",
  14767. "\u81EA",
  14768. "\u2F84",
  14769. "\u81F3",
  14770. "\u2F85",
  14771. "\u81FC",
  14772. "\u2F86",
  14773. "\u820C",
  14774. "\u2F87",
  14775. "\u821B",
  14776. "\u2F88",
  14777. "\u821F",
  14778. "\u2F89",
  14779. "\u826E",
  14780. "\u2F8A",
  14781. "\u8272",
  14782. "\u2F8B",
  14783. "\u8278",
  14784. "\u2F8C",
  14785. "\u864D",
  14786. "\u2F8D",
  14787. "\u866B",
  14788. "\u2F8E",
  14789. "\u8840",
  14790. "\u2F8F",
  14791. "\u884C",
  14792. "\u2F90",
  14793. "\u8863",
  14794. "\u2F91",
  14795. "\u897E",
  14796. "\u2F92",
  14797. "\u898B",
  14798. "\u2F93",
  14799. "\u89D2",
  14800. "\u2F94",
  14801. "\u8A00",
  14802. "\u2F95",
  14803. "\u8C37",
  14804. "\u2F96",
  14805. "\u8C46",
  14806. "\u2F97",
  14807. "\u8C55",
  14808. "\u2F98",
  14809. "\u8C78",
  14810. "\u2F99",
  14811. "\u8C9D",
  14812. "\u2F9A",
  14813. "\u8D64",
  14814. "\u2F9B",
  14815. "\u8D70",
  14816. "\u2F9C",
  14817. "\u8DB3",
  14818. "\u2F9D",
  14819. "\u8EAB",
  14820. "\u2F9E",
  14821. "\u8ECA",
  14822. "\u2F9F",
  14823. "\u8F9B",
  14824. "\u2FA0",
  14825. "\u8FB0",
  14826. "\u2FA1",
  14827. "\u8FB5",
  14828. "\u2FA2",
  14829. "\u9091",
  14830. "\u2FA3",
  14831. "\u9149",
  14832. "\u2FA4",
  14833. "\u91C6",
  14834. "\u2FA5",
  14835. "\u91CC",
  14836. "\u2FA6",
  14837. "\u91D1",
  14838. "\u2FA7",
  14839. "\u9577",
  14840. "\u2FA8",
  14841. "\u9580",
  14842. "\u2FA9",
  14843. "\u961C",
  14844. "\u2FAA",
  14845. "\u96B6",
  14846. "\u2FAB",
  14847. "\u96B9",
  14848. "\u2FAC",
  14849. "\u96E8",
  14850. "\u2FAD",
  14851. "\u9751",
  14852. "\u2FAE",
  14853. "\u975E",
  14854. "\u2FAF",
  14855. "\u9762",
  14856. "\u2FB0",
  14857. "\u9769",
  14858. "\u2FB1",
  14859. "\u97CB",
  14860. "\u2FB2",
  14861. "\u97ED",
  14862. "\u2FB3",
  14863. "\u97F3",
  14864. "\u2FB4",
  14865. "\u9801",
  14866. "\u2FB5",
  14867. "\u98A8",
  14868. "\u2FB6",
  14869. "\u98DB",
  14870. "\u2FB7",
  14871. "\u98DF",
  14872. "\u2FB8",
  14873. "\u9996",
  14874. "\u2FB9",
  14875. "\u9999",
  14876. "\u2FBA",
  14877. "\u99AC",
  14878. "\u2FBB",
  14879. "\u9AA8",
  14880. "\u2FBC",
  14881. "\u9AD8",
  14882. "\u2FBD",
  14883. "\u9ADF",
  14884. "\u2FBE",
  14885. "\u9B25",
  14886. "\u2FBF",
  14887. "\u9B2F",
  14888. "\u2FC0",
  14889. "\u9B32",
  14890. "\u2FC1",
  14891. "\u9B3C",
  14892. "\u2FC2",
  14893. "\u9B5A",
  14894. "\u2FC3",
  14895. "\u9CE5",
  14896. "\u2FC4",
  14897. "\u9E75",
  14898. "\u2FC5",
  14899. "\u9E7F",
  14900. "\u2FC6",
  14901. "\u9EA5",
  14902. "\u2FC7",
  14903. "\u9EBB",
  14904. "\u2FC8",
  14905. "\u9EC3",
  14906. "\u2FC9",
  14907. "\u9ECD",
  14908. "\u2FCA",
  14909. "\u9ED1",
  14910. "\u2FCB",
  14911. "\u9EF9",
  14912. "\u2FCC",
  14913. "\u9EFD",
  14914. "\u2FCD",
  14915. "\u9F0E",
  14916. "\u2FCE",
  14917. "\u9F13",
  14918. "\u2FCF",
  14919. "\u9F20",
  14920. "\u2FD0",
  14921. "\u9F3B",
  14922. "\u2FD1",
  14923. "\u9F4A",
  14924. "\u2FD2",
  14925. "\u9F52",
  14926. "\u2FD3",
  14927. "\u9F8D",
  14928. "\u2FD4",
  14929. "\u9F9C",
  14930. "\u2FD5",
  14931. "\u9FA0",
  14932. "\u3036",
  14933. "\u3012",
  14934. "\u3038",
  14935. "\u5341",
  14936. "\u3039",
  14937. "\u5344",
  14938. "\u303A",
  14939. "\u5345",
  14940. "\u309B",
  14941. "\u0020\u3099",
  14942. "\u309C",
  14943. "\u0020\u309A",
  14944. "\u3131",
  14945. "\u1100",
  14946. "\u3132",
  14947. "\u1101",
  14948. "\u3133",
  14949. "\u11AA",
  14950. "\u3134",
  14951. "\u1102",
  14952. "\u3135",
  14953. "\u11AC",
  14954. "\u3136",
  14955. "\u11AD",
  14956. "\u3137",
  14957. "\u1103",
  14958. "\u3138",
  14959. "\u1104",
  14960. "\u3139",
  14961. "\u1105",
  14962. "\u313A",
  14963. "\u11B0",
  14964. "\u313B",
  14965. "\u11B1",
  14966. "\u313C",
  14967. "\u11B2",
  14968. "\u313D",
  14969. "\u11B3",
  14970. "\u313E",
  14971. "\u11B4",
  14972. "\u313F",
  14973. "\u11B5",
  14974. "\u3140",
  14975. "\u111A",
  14976. "\u3141",
  14977. "\u1106",
  14978. "\u3142",
  14979. "\u1107",
  14980. "\u3143",
  14981. "\u1108",
  14982. "\u3144",
  14983. "\u1121",
  14984. "\u3145",
  14985. "\u1109",
  14986. "\u3146",
  14987. "\u110A",
  14988. "\u3147",
  14989. "\u110B",
  14990. "\u3148",
  14991. "\u110C",
  14992. "\u3149",
  14993. "\u110D",
  14994. "\u314A",
  14995. "\u110E",
  14996. "\u314B",
  14997. "\u110F",
  14998. "\u314C",
  14999. "\u1110",
  15000. "\u314D",
  15001. "\u1111",
  15002. "\u314E",
  15003. "\u1112",
  15004. "\u314F",
  15005. "\u1161",
  15006. "\u3150",
  15007. "\u1162",
  15008. "\u3151",
  15009. "\u1163",
  15010. "\u3152",
  15011. "\u1164",
  15012. "\u3153",
  15013. "\u1165",
  15014. "\u3154",
  15015. "\u1166",
  15016. "\u3155",
  15017. "\u1167",
  15018. "\u3156",
  15019. "\u1168",
  15020. "\u3157",
  15021. "\u1169",
  15022. "\u3158",
  15023. "\u116A",
  15024. "\u3159",
  15025. "\u116B",
  15026. "\u315A",
  15027. "\u116C",
  15028. "\u315B",
  15029. "\u116D",
  15030. "\u315C",
  15031. "\u116E",
  15032. "\u315D",
  15033. "\u116F",
  15034. "\u315E",
  15035. "\u1170",
  15036. "\u315F",
  15037. "\u1171",
  15038. "\u3160",
  15039. "\u1172",
  15040. "\u3161",
  15041. "\u1173",
  15042. "\u3162",
  15043. "\u1174",
  15044. "\u3163",
  15045. "\u1175",
  15046. "\u3164",
  15047. "\u1160",
  15048. "\u3165",
  15049. "\u1114",
  15050. "\u3166",
  15051. "\u1115",
  15052. "\u3167",
  15053. "\u11C7",
  15054. "\u3168",
  15055. "\u11C8",
  15056. "\u3169",
  15057. "\u11CC",
  15058. "\u316A",
  15059. "\u11CE",
  15060. "\u316B",
  15061. "\u11D3",
  15062. "\u316C",
  15063. "\u11D7",
  15064. "\u316D",
  15065. "\u11D9",
  15066. "\u316E",
  15067. "\u111C",
  15068. "\u316F",
  15069. "\u11DD",
  15070. "\u3170",
  15071. "\u11DF",
  15072. "\u3171",
  15073. "\u111D",
  15074. "\u3172",
  15075. "\u111E",
  15076. "\u3173",
  15077. "\u1120",
  15078. "\u3174",
  15079. "\u1122",
  15080. "\u3175",
  15081. "\u1123",
  15082. "\u3176",
  15083. "\u1127",
  15084. "\u3177",
  15085. "\u1129",
  15086. "\u3178",
  15087. "\u112B",
  15088. "\u3179",
  15089. "\u112C",
  15090. "\u317A",
  15091. "\u112D",
  15092. "\u317B",
  15093. "\u112E",
  15094. "\u317C",
  15095. "\u112F",
  15096. "\u317D",
  15097. "\u1132",
  15098. "\u317E",
  15099. "\u1136",
  15100. "\u317F",
  15101. "\u1140",
  15102. "\u3180",
  15103. "\u1147",
  15104. "\u3181",
  15105. "\u114C",
  15106. "\u3182",
  15107. "\u11F1",
  15108. "\u3183",
  15109. "\u11F2",
  15110. "\u3184",
  15111. "\u1157",
  15112. "\u3185",
  15113. "\u1158",
  15114. "\u3186",
  15115. "\u1159",
  15116. "\u3187",
  15117. "\u1184",
  15118. "\u3188",
  15119. "\u1185",
  15120. "\u3189",
  15121. "\u1188",
  15122. "\u318A",
  15123. "\u1191",
  15124. "\u318B",
  15125. "\u1192",
  15126. "\u318C",
  15127. "\u1194",
  15128. "\u318D",
  15129. "\u119E",
  15130. "\u318E",
  15131. "\u11A1",
  15132. "\u3200",
  15133. "\u0028\u1100\u0029",
  15134. "\u3201",
  15135. "\u0028\u1102\u0029",
  15136. "\u3202",
  15137. "\u0028\u1103\u0029",
  15138. "\u3203",
  15139. "\u0028\u1105\u0029",
  15140. "\u3204",
  15141. "\u0028\u1106\u0029",
  15142. "\u3205",
  15143. "\u0028\u1107\u0029",
  15144. "\u3206",
  15145. "\u0028\u1109\u0029",
  15146. "\u3207",
  15147. "\u0028\u110B\u0029",
  15148. "\u3208",
  15149. "\u0028\u110C\u0029",
  15150. "\u3209",
  15151. "\u0028\u110E\u0029",
  15152. "\u320A",
  15153. "\u0028\u110F\u0029",
  15154. "\u320B",
  15155. "\u0028\u1110\u0029",
  15156. "\u320C",
  15157. "\u0028\u1111\u0029",
  15158. "\u320D",
  15159. "\u0028\u1112\u0029",
  15160. "\u320E",
  15161. "\u0028\u1100\u1161\u0029",
  15162. "\u320F",
  15163. "\u0028\u1102\u1161\u0029",
  15164. "\u3210",
  15165. "\u0028\u1103\u1161\u0029",
  15166. "\u3211",
  15167. "\u0028\u1105\u1161\u0029",
  15168. "\u3212",
  15169. "\u0028\u1106\u1161\u0029",
  15170. "\u3213",
  15171. "\u0028\u1107\u1161\u0029",
  15172. "\u3214",
  15173. "\u0028\u1109\u1161\u0029",
  15174. "\u3215",
  15175. "\u0028\u110B\u1161\u0029",
  15176. "\u3216",
  15177. "\u0028\u110C\u1161\u0029",
  15178. "\u3217",
  15179. "\u0028\u110E\u1161\u0029",
  15180. "\u3218",
  15181. "\u0028\u110F\u1161\u0029",
  15182. "\u3219",
  15183. "\u0028\u1110\u1161\u0029",
  15184. "\u321A",
  15185. "\u0028\u1111\u1161\u0029",
  15186. "\u321B",
  15187. "\u0028\u1112\u1161\u0029",
  15188. "\u321C",
  15189. "\u0028\u110C\u116E\u0029",
  15190. "\u321D",
  15191. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  15192. "\u321E",
  15193. "\u0028\u110B\u1169\u1112\u116E\u0029",
  15194. "\u3220",
  15195. "\u0028\u4E00\u0029",
  15196. "\u3221",
  15197. "\u0028\u4E8C\u0029",
  15198. "\u3222",
  15199. "\u0028\u4E09\u0029",
  15200. "\u3223",
  15201. "\u0028\u56DB\u0029",
  15202. "\u3224",
  15203. "\u0028\u4E94\u0029",
  15204. "\u3225",
  15205. "\u0028\u516D\u0029",
  15206. "\u3226",
  15207. "\u0028\u4E03\u0029",
  15208. "\u3227",
  15209. "\u0028\u516B\u0029",
  15210. "\u3228",
  15211. "\u0028\u4E5D\u0029",
  15212. "\u3229",
  15213. "\u0028\u5341\u0029",
  15214. "\u322A",
  15215. "\u0028\u6708\u0029",
  15216. "\u322B",
  15217. "\u0028\u706B\u0029",
  15218. "\u322C",
  15219. "\u0028\u6C34\u0029",
  15220. "\u322D",
  15221. "\u0028\u6728\u0029",
  15222. "\u322E",
  15223. "\u0028\u91D1\u0029",
  15224. "\u322F",
  15225. "\u0028\u571F\u0029",
  15226. "\u3230",
  15227. "\u0028\u65E5\u0029",
  15228. "\u3231",
  15229. "\u0028\u682A\u0029",
  15230. "\u3232",
  15231. "\u0028\u6709\u0029",
  15232. "\u3233",
  15233. "\u0028\u793E\u0029",
  15234. "\u3234",
  15235. "\u0028\u540D\u0029",
  15236. "\u3235",
  15237. "\u0028\u7279\u0029",
  15238. "\u3236",
  15239. "\u0028\u8CA1\u0029",
  15240. "\u3237",
  15241. "\u0028\u795D\u0029",
  15242. "\u3238",
  15243. "\u0028\u52B4\u0029",
  15244. "\u3239",
  15245. "\u0028\u4EE3\u0029",
  15246. "\u323A",
  15247. "\u0028\u547C\u0029",
  15248. "\u323B",
  15249. "\u0028\u5B66\u0029",
  15250. "\u323C",
  15251. "\u0028\u76E3\u0029",
  15252. "\u323D",
  15253. "\u0028\u4F01\u0029",
  15254. "\u323E",
  15255. "\u0028\u8CC7\u0029",
  15256. "\u323F",
  15257. "\u0028\u5354\u0029",
  15258. "\u3240",
  15259. "\u0028\u796D\u0029",
  15260. "\u3241",
  15261. "\u0028\u4F11\u0029",
  15262. "\u3242",
  15263. "\u0028\u81EA\u0029",
  15264. "\u3243",
  15265. "\u0028\u81F3\u0029",
  15266. "\u32C0",
  15267. "\u0031\u6708",
  15268. "\u32C1",
  15269. "\u0032\u6708",
  15270. "\u32C2",
  15271. "\u0033\u6708",
  15272. "\u32C3",
  15273. "\u0034\u6708",
  15274. "\u32C4",
  15275. "\u0035\u6708",
  15276. "\u32C5",
  15277. "\u0036\u6708",
  15278. "\u32C6",
  15279. "\u0037\u6708",
  15280. "\u32C7",
  15281. "\u0038\u6708",
  15282. "\u32C8",
  15283. "\u0039\u6708",
  15284. "\u32C9",
  15285. "\u0031\u0030\u6708",
  15286. "\u32CA",
  15287. "\u0031\u0031\u6708",
  15288. "\u32CB",
  15289. "\u0031\u0032\u6708",
  15290. "\u3358",
  15291. "\u0030\u70B9",
  15292. "\u3359",
  15293. "\u0031\u70B9",
  15294. "\u335A",
  15295. "\u0032\u70B9",
  15296. "\u335B",
  15297. "\u0033\u70B9",
  15298. "\u335C",
  15299. "\u0034\u70B9",
  15300. "\u335D",
  15301. "\u0035\u70B9",
  15302. "\u335E",
  15303. "\u0036\u70B9",
  15304. "\u335F",
  15305. "\u0037\u70B9",
  15306. "\u3360",
  15307. "\u0038\u70B9",
  15308. "\u3361",
  15309. "\u0039\u70B9",
  15310. "\u3362",
  15311. "\u0031\u0030\u70B9",
  15312. "\u3363",
  15313. "\u0031\u0031\u70B9",
  15314. "\u3364",
  15315. "\u0031\u0032\u70B9",
  15316. "\u3365",
  15317. "\u0031\u0033\u70B9",
  15318. "\u3366",
  15319. "\u0031\u0034\u70B9",
  15320. "\u3367",
  15321. "\u0031\u0035\u70B9",
  15322. "\u3368",
  15323. "\u0031\u0036\u70B9",
  15324. "\u3369",
  15325. "\u0031\u0037\u70B9",
  15326. "\u336A",
  15327. "\u0031\u0038\u70B9",
  15328. "\u336B",
  15329. "\u0031\u0039\u70B9",
  15330. "\u336C",
  15331. "\u0032\u0030\u70B9",
  15332. "\u336D",
  15333. "\u0032\u0031\u70B9",
  15334. "\u336E",
  15335. "\u0032\u0032\u70B9",
  15336. "\u336F",
  15337. "\u0032\u0033\u70B9",
  15338. "\u3370",
  15339. "\u0032\u0034\u70B9",
  15340. "\u33E0",
  15341. "\u0031\u65E5",
  15342. "\u33E1",
  15343. "\u0032\u65E5",
  15344. "\u33E2",
  15345. "\u0033\u65E5",
  15346. "\u33E3",
  15347. "\u0034\u65E5",
  15348. "\u33E4",
  15349. "\u0035\u65E5",
  15350. "\u33E5",
  15351. "\u0036\u65E5",
  15352. "\u33E6",
  15353. "\u0037\u65E5",
  15354. "\u33E7",
  15355. "\u0038\u65E5",
  15356. "\u33E8",
  15357. "\u0039\u65E5",
  15358. "\u33E9",
  15359. "\u0031\u0030\u65E5",
  15360. "\u33EA",
  15361. "\u0031\u0031\u65E5",
  15362. "\u33EB",
  15363. "\u0031\u0032\u65E5",
  15364. "\u33EC",
  15365. "\u0031\u0033\u65E5",
  15366. "\u33ED",
  15367. "\u0031\u0034\u65E5",
  15368. "\u33EE",
  15369. "\u0031\u0035\u65E5",
  15370. "\u33EF",
  15371. "\u0031\u0036\u65E5",
  15372. "\u33F0",
  15373. "\u0031\u0037\u65E5",
  15374. "\u33F1",
  15375. "\u0031\u0038\u65E5",
  15376. "\u33F2",
  15377. "\u0031\u0039\u65E5",
  15378. "\u33F3",
  15379. "\u0032\u0030\u65E5",
  15380. "\u33F4",
  15381. "\u0032\u0031\u65E5",
  15382. "\u33F5",
  15383. "\u0032\u0032\u65E5",
  15384. "\u33F6",
  15385. "\u0032\u0033\u65E5",
  15386. "\u33F7",
  15387. "\u0032\u0034\u65E5",
  15388. "\u33F8",
  15389. "\u0032\u0035\u65E5",
  15390. "\u33F9",
  15391. "\u0032\u0036\u65E5",
  15392. "\u33FA",
  15393. "\u0032\u0037\u65E5",
  15394. "\u33FB",
  15395. "\u0032\u0038\u65E5",
  15396. "\u33FC",
  15397. "\u0032\u0039\u65E5",
  15398. "\u33FD",
  15399. "\u0033\u0030\u65E5",
  15400. "\u33FE",
  15401. "\u0033\u0031\u65E5",
  15402. "\uFB00",
  15403. "\u0066\u0066",
  15404. "\uFB01",
  15405. "\u0066\u0069",
  15406. "\uFB02",
  15407. "\u0066\u006C",
  15408. "\uFB03",
  15409. "\u0066\u0066\u0069",
  15410. "\uFB04",
  15411. "\u0066\u0066\u006C",
  15412. "\uFB05",
  15413. "\u017F\u0074",
  15414. "\uFB06",
  15415. "\u0073\u0074",
  15416. "\uFB13",
  15417. "\u0574\u0576",
  15418. "\uFB14",
  15419. "\u0574\u0565",
  15420. "\uFB15",
  15421. "\u0574\u056B",
  15422. "\uFB16",
  15423. "\u057E\u0576",
  15424. "\uFB17",
  15425. "\u0574\u056D",
  15426. "\uFB4F",
  15427. "\u05D0\u05DC",
  15428. "\uFB50",
  15429. "\u0671",
  15430. "\uFB51",
  15431. "\u0671",
  15432. "\uFB52",
  15433. "\u067B",
  15434. "\uFB53",
  15435. "\u067B",
  15436. "\uFB54",
  15437. "\u067B",
  15438. "\uFB55",
  15439. "\u067B",
  15440. "\uFB56",
  15441. "\u067E",
  15442. "\uFB57",
  15443. "\u067E",
  15444. "\uFB58",
  15445. "\u067E",
  15446. "\uFB59",
  15447. "\u067E",
  15448. "\uFB5A",
  15449. "\u0680",
  15450. "\uFB5B",
  15451. "\u0680",
  15452. "\uFB5C",
  15453. "\u0680",
  15454. "\uFB5D",
  15455. "\u0680",
  15456. "\uFB5E",
  15457. "\u067A",
  15458. "\uFB5F",
  15459. "\u067A",
  15460. "\uFB60",
  15461. "\u067A",
  15462. "\uFB61",
  15463. "\u067A",
  15464. "\uFB62",
  15465. "\u067F",
  15466. "\uFB63",
  15467. "\u067F",
  15468. "\uFB64",
  15469. "\u067F",
  15470. "\uFB65",
  15471. "\u067F",
  15472. "\uFB66",
  15473. "\u0679",
  15474. "\uFB67",
  15475. "\u0679",
  15476. "\uFB68",
  15477. "\u0679",
  15478. "\uFB69",
  15479. "\u0679",
  15480. "\uFB6A",
  15481. "\u06A4",
  15482. "\uFB6B",
  15483. "\u06A4",
  15484. "\uFB6C",
  15485. "\u06A4",
  15486. "\uFB6D",
  15487. "\u06A4",
  15488. "\uFB6E",
  15489. "\u06A6",
  15490. "\uFB6F",
  15491. "\u06A6",
  15492. "\uFB70",
  15493. "\u06A6",
  15494. "\uFB71",
  15495. "\u06A6",
  15496. "\uFB72",
  15497. "\u0684",
  15498. "\uFB73",
  15499. "\u0684",
  15500. "\uFB74",
  15501. "\u0684",
  15502. "\uFB75",
  15503. "\u0684",
  15504. "\uFB76",
  15505. "\u0683",
  15506. "\uFB77",
  15507. "\u0683",
  15508. "\uFB78",
  15509. "\u0683",
  15510. "\uFB79",
  15511. "\u0683",
  15512. "\uFB7A",
  15513. "\u0686",
  15514. "\uFB7B",
  15515. "\u0686",
  15516. "\uFB7C",
  15517. "\u0686",
  15518. "\uFB7D",
  15519. "\u0686",
  15520. "\uFB7E",
  15521. "\u0687",
  15522. "\uFB7F",
  15523. "\u0687",
  15524. "\uFB80",
  15525. "\u0687",
  15526. "\uFB81",
  15527. "\u0687",
  15528. "\uFB82",
  15529. "\u068D",
  15530. "\uFB83",
  15531. "\u068D",
  15532. "\uFB84",
  15533. "\u068C",
  15534. "\uFB85",
  15535. "\u068C",
  15536. "\uFB86",
  15537. "\u068E",
  15538. "\uFB87",
  15539. "\u068E",
  15540. "\uFB88",
  15541. "\u0688",
  15542. "\uFB89",
  15543. "\u0688",
  15544. "\uFB8A",
  15545. "\u0698",
  15546. "\uFB8B",
  15547. "\u0698",
  15548. "\uFB8C",
  15549. "\u0691",
  15550. "\uFB8D",
  15551. "\u0691",
  15552. "\uFB8E",
  15553. "\u06A9",
  15554. "\uFB8F",
  15555. "\u06A9",
  15556. "\uFB90",
  15557. "\u06A9",
  15558. "\uFB91",
  15559. "\u06A9",
  15560. "\uFB92",
  15561. "\u06AF",
  15562. "\uFB93",
  15563. "\u06AF",
  15564. "\uFB94",
  15565. "\u06AF",
  15566. "\uFB95",
  15567. "\u06AF",
  15568. "\uFB96",
  15569. "\u06B3",
  15570. "\uFB97",
  15571. "\u06B3",
  15572. "\uFB98",
  15573. "\u06B3",
  15574. "\uFB99",
  15575. "\u06B3",
  15576. "\uFB9A",
  15577. "\u06B1",
  15578. "\uFB9B",
  15579. "\u06B1",
  15580. "\uFB9C",
  15581. "\u06B1",
  15582. "\uFB9D",
  15583. "\u06B1",
  15584. "\uFB9E",
  15585. "\u06BA",
  15586. "\uFB9F",
  15587. "\u06BA",
  15588. "\uFBA0",
  15589. "\u06BB",
  15590. "\uFBA1",
  15591. "\u06BB",
  15592. "\uFBA2",
  15593. "\u06BB",
  15594. "\uFBA3",
  15595. "\u06BB",
  15596. "\uFBA4",
  15597. "\u06C0",
  15598. "\uFBA5",
  15599. "\u06C0",
  15600. "\uFBA6",
  15601. "\u06C1",
  15602. "\uFBA7",
  15603. "\u06C1",
  15604. "\uFBA8",
  15605. "\u06C1",
  15606. "\uFBA9",
  15607. "\u06C1",
  15608. "\uFBAA",
  15609. "\u06BE",
  15610. "\uFBAB",
  15611. "\u06BE",
  15612. "\uFBAC",
  15613. "\u06BE",
  15614. "\uFBAD",
  15615. "\u06BE",
  15616. "\uFBAE",
  15617. "\u06D2",
  15618. "\uFBAF",
  15619. "\u06D2",
  15620. "\uFBB0",
  15621. "\u06D3",
  15622. "\uFBB1",
  15623. "\u06D3",
  15624. "\uFBD3",
  15625. "\u06AD",
  15626. "\uFBD4",
  15627. "\u06AD",
  15628. "\uFBD5",
  15629. "\u06AD",
  15630. "\uFBD6",
  15631. "\u06AD",
  15632. "\uFBD7",
  15633. "\u06C7",
  15634. "\uFBD8",
  15635. "\u06C7",
  15636. "\uFBD9",
  15637. "\u06C6",
  15638. "\uFBDA",
  15639. "\u06C6",
  15640. "\uFBDB",
  15641. "\u06C8",
  15642. "\uFBDC",
  15643. "\u06C8",
  15644. "\uFBDD",
  15645. "\u0677",
  15646. "\uFBDE",
  15647. "\u06CB",
  15648. "\uFBDF",
  15649. "\u06CB",
  15650. "\uFBE0",
  15651. "\u06C5",
  15652. "\uFBE1",
  15653. "\u06C5",
  15654. "\uFBE2",
  15655. "\u06C9",
  15656. "\uFBE3",
  15657. "\u06C9",
  15658. "\uFBE4",
  15659. "\u06D0",
  15660. "\uFBE5",
  15661. "\u06D0",
  15662. "\uFBE6",
  15663. "\u06D0",
  15664. "\uFBE7",
  15665. "\u06D0",
  15666. "\uFBE8",
  15667. "\u0649",
  15668. "\uFBE9",
  15669. "\u0649",
  15670. "\uFBEA",
  15671. "\u0626\u0627",
  15672. "\uFBEB",
  15673. "\u0626\u0627",
  15674. "\uFBEC",
  15675. "\u0626\u06D5",
  15676. "\uFBED",
  15677. "\u0626\u06D5",
  15678. "\uFBEE",
  15679. "\u0626\u0648",
  15680. "\uFBEF",
  15681. "\u0626\u0648",
  15682. "\uFBF0",
  15683. "\u0626\u06C7",
  15684. "\uFBF1",
  15685. "\u0626\u06C7",
  15686. "\uFBF2",
  15687. "\u0626\u06C6",
  15688. "\uFBF3",
  15689. "\u0626\u06C6",
  15690. "\uFBF4",
  15691. "\u0626\u06C8",
  15692. "\uFBF5",
  15693. "\u0626\u06C8",
  15694. "\uFBF6",
  15695. "\u0626\u06D0",
  15696. "\uFBF7",
  15697. "\u0626\u06D0",
  15698. "\uFBF8",
  15699. "\u0626\u06D0",
  15700. "\uFBF9",
  15701. "\u0626\u0649",
  15702. "\uFBFA",
  15703. "\u0626\u0649",
  15704. "\uFBFB",
  15705. "\u0626\u0649",
  15706. "\uFBFC",
  15707. "\u06CC",
  15708. "\uFBFD",
  15709. "\u06CC",
  15710. "\uFBFE",
  15711. "\u06CC",
  15712. "\uFBFF",
  15713. "\u06CC",
  15714. "\uFC00",
  15715. "\u0626\u062C",
  15716. "\uFC01",
  15717. "\u0626\u062D",
  15718. "\uFC02",
  15719. "\u0626\u0645",
  15720. "\uFC03",
  15721. "\u0626\u0649",
  15722. "\uFC04",
  15723. "\u0626\u064A",
  15724. "\uFC05",
  15725. "\u0628\u062C",
  15726. "\uFC06",
  15727. "\u0628\u062D",
  15728. "\uFC07",
  15729. "\u0628\u062E",
  15730. "\uFC08",
  15731. "\u0628\u0645",
  15732. "\uFC09",
  15733. "\u0628\u0649",
  15734. "\uFC0A",
  15735. "\u0628\u064A",
  15736. "\uFC0B",
  15737. "\u062A\u062C",
  15738. "\uFC0C",
  15739. "\u062A\u062D",
  15740. "\uFC0D",
  15741. "\u062A\u062E",
  15742. "\uFC0E",
  15743. "\u062A\u0645",
  15744. "\uFC0F",
  15745. "\u062A\u0649",
  15746. "\uFC10",
  15747. "\u062A\u064A",
  15748. "\uFC11",
  15749. "\u062B\u062C",
  15750. "\uFC12",
  15751. "\u062B\u0645",
  15752. "\uFC13",
  15753. "\u062B\u0649",
  15754. "\uFC14",
  15755. "\u062B\u064A",
  15756. "\uFC15",
  15757. "\u062C\u062D",
  15758. "\uFC16",
  15759. "\u062C\u0645",
  15760. "\uFC17",
  15761. "\u062D\u062C",
  15762. "\uFC18",
  15763. "\u062D\u0645",
  15764. "\uFC19",
  15765. "\u062E\u062C",
  15766. "\uFC1A",
  15767. "\u062E\u062D",
  15768. "\uFC1B",
  15769. "\u062E\u0645",
  15770. "\uFC1C",
  15771. "\u0633\u062C",
  15772. "\uFC1D",
  15773. "\u0633\u062D",
  15774. "\uFC1E",
  15775. "\u0633\u062E",
  15776. "\uFC1F",
  15777. "\u0633\u0645",
  15778. "\uFC20",
  15779. "\u0635\u062D",
  15780. "\uFC21",
  15781. "\u0635\u0645",
  15782. "\uFC22",
  15783. "\u0636\u062C",
  15784. "\uFC23",
  15785. "\u0636\u062D",
  15786. "\uFC24",
  15787. "\u0636\u062E",
  15788. "\uFC25",
  15789. "\u0636\u0645",
  15790. "\uFC26",
  15791. "\u0637\u062D",
  15792. "\uFC27",
  15793. "\u0637\u0645",
  15794. "\uFC28",
  15795. "\u0638\u0645",
  15796. "\uFC29",
  15797. "\u0639\u062C",
  15798. "\uFC2A",
  15799. "\u0639\u0645",
  15800. "\uFC2B",
  15801. "\u063A\u062C",
  15802. "\uFC2C",
  15803. "\u063A\u0645",
  15804. "\uFC2D",
  15805. "\u0641\u062C",
  15806. "\uFC2E",
  15807. "\u0641\u062D",
  15808. "\uFC2F",
  15809. "\u0641\u062E",
  15810. "\uFC30",
  15811. "\u0641\u0645",
  15812. "\uFC31",
  15813. "\u0641\u0649",
  15814. "\uFC32",
  15815. "\u0641\u064A",
  15816. "\uFC33",
  15817. "\u0642\u062D",
  15818. "\uFC34",
  15819. "\u0642\u0645",
  15820. "\uFC35",
  15821. "\u0642\u0649",
  15822. "\uFC36",
  15823. "\u0642\u064A",
  15824. "\uFC37",
  15825. "\u0643\u0627",
  15826. "\uFC38",
  15827. "\u0643\u062C",
  15828. "\uFC39",
  15829. "\u0643\u062D",
  15830. "\uFC3A",
  15831. "\u0643\u062E",
  15832. "\uFC3B",
  15833. "\u0643\u0644",
  15834. "\uFC3C",
  15835. "\u0643\u0645",
  15836. "\uFC3D",
  15837. "\u0643\u0649",
  15838. "\uFC3E",
  15839. "\u0643\u064A",
  15840. "\uFC3F",
  15841. "\u0644\u062C",
  15842. "\uFC40",
  15843. "\u0644\u062D",
  15844. "\uFC41",
  15845. "\u0644\u062E",
  15846. "\uFC42",
  15847. "\u0644\u0645",
  15848. "\uFC43",
  15849. "\u0644\u0649",
  15850. "\uFC44",
  15851. "\u0644\u064A",
  15852. "\uFC45",
  15853. "\u0645\u062C",
  15854. "\uFC46",
  15855. "\u0645\u062D",
  15856. "\uFC47",
  15857. "\u0645\u062E",
  15858. "\uFC48",
  15859. "\u0645\u0645",
  15860. "\uFC49",
  15861. "\u0645\u0649",
  15862. "\uFC4A",
  15863. "\u0645\u064A",
  15864. "\uFC4B",
  15865. "\u0646\u062C",
  15866. "\uFC4C",
  15867. "\u0646\u062D",
  15868. "\uFC4D",
  15869. "\u0646\u062E",
  15870. "\uFC4E",
  15871. "\u0646\u0645",
  15872. "\uFC4F",
  15873. "\u0646\u0649",
  15874. "\uFC50",
  15875. "\u0646\u064A",
  15876. "\uFC51",
  15877. "\u0647\u062C",
  15878. "\uFC52",
  15879. "\u0647\u0645",
  15880. "\uFC53",
  15881. "\u0647\u0649",
  15882. "\uFC54",
  15883. "\u0647\u064A",
  15884. "\uFC55",
  15885. "\u064A\u062C",
  15886. "\uFC56",
  15887. "\u064A\u062D",
  15888. "\uFC57",
  15889. "\u064A\u062E",
  15890. "\uFC58",
  15891. "\u064A\u0645",
  15892. "\uFC59",
  15893. "\u064A\u0649",
  15894. "\uFC5A",
  15895. "\u064A\u064A",
  15896. "\uFC5B",
  15897. "\u0630\u0670",
  15898. "\uFC5C",
  15899. "\u0631\u0670",
  15900. "\uFC5D",
  15901. "\u0649\u0670",
  15902. "\uFC5E",
  15903. "\u0020\u064C\u0651",
  15904. "\uFC5F",
  15905. "\u0020\u064D\u0651",
  15906. "\uFC60",
  15907. "\u0020\u064E\u0651",
  15908. "\uFC61",
  15909. "\u0020\u064F\u0651",
  15910. "\uFC62",
  15911. "\u0020\u0650\u0651",
  15912. "\uFC63",
  15913. "\u0020\u0651\u0670",
  15914. "\uFC64",
  15915. "\u0626\u0631",
  15916. "\uFC65",
  15917. "\u0626\u0632",
  15918. "\uFC66",
  15919. "\u0626\u0645",
  15920. "\uFC67",
  15921. "\u0626\u0646",
  15922. "\uFC68",
  15923. "\u0626\u0649",
  15924. "\uFC69",
  15925. "\u0626\u064A",
  15926. "\uFC6A",
  15927. "\u0628\u0631",
  15928. "\uFC6B",
  15929. "\u0628\u0632",
  15930. "\uFC6C",
  15931. "\u0628\u0645",
  15932. "\uFC6D",
  15933. "\u0628\u0646",
  15934. "\uFC6E",
  15935. "\u0628\u0649",
  15936. "\uFC6F",
  15937. "\u0628\u064A",
  15938. "\uFC70",
  15939. "\u062A\u0631",
  15940. "\uFC71",
  15941. "\u062A\u0632",
  15942. "\uFC72",
  15943. "\u062A\u0645",
  15944. "\uFC73",
  15945. "\u062A\u0646",
  15946. "\uFC74",
  15947. "\u062A\u0649",
  15948. "\uFC75",
  15949. "\u062A\u064A",
  15950. "\uFC76",
  15951. "\u062B\u0631",
  15952. "\uFC77",
  15953. "\u062B\u0632",
  15954. "\uFC78",
  15955. "\u062B\u0645",
  15956. "\uFC79",
  15957. "\u062B\u0646",
  15958. "\uFC7A",
  15959. "\u062B\u0649",
  15960. "\uFC7B",
  15961. "\u062B\u064A",
  15962. "\uFC7C",
  15963. "\u0641\u0649",
  15964. "\uFC7D",
  15965. "\u0641\u064A",
  15966. "\uFC7E",
  15967. "\u0642\u0649",
  15968. "\uFC7F",
  15969. "\u0642\u064A",
  15970. "\uFC80",
  15971. "\u0643\u0627",
  15972. "\uFC81",
  15973. "\u0643\u0644",
  15974. "\uFC82",
  15975. "\u0643\u0645",
  15976. "\uFC83",
  15977. "\u0643\u0649",
  15978. "\uFC84",
  15979. "\u0643\u064A",
  15980. "\uFC85",
  15981. "\u0644\u0645",
  15982. "\uFC86",
  15983. "\u0644\u0649",
  15984. "\uFC87",
  15985. "\u0644\u064A",
  15986. "\uFC88",
  15987. "\u0645\u0627",
  15988. "\uFC89",
  15989. "\u0645\u0645",
  15990. "\uFC8A",
  15991. "\u0646\u0631",
  15992. "\uFC8B",
  15993. "\u0646\u0632",
  15994. "\uFC8C",
  15995. "\u0646\u0645",
  15996. "\uFC8D",
  15997. "\u0646\u0646",
  15998. "\uFC8E",
  15999. "\u0646\u0649",
  16000. "\uFC8F",
  16001. "\u0646\u064A",
  16002. "\uFC90",
  16003. "\u0649\u0670",
  16004. "\uFC91",
  16005. "\u064A\u0631",
  16006. "\uFC92",
  16007. "\u064A\u0632",
  16008. "\uFC93",
  16009. "\u064A\u0645",
  16010. "\uFC94",
  16011. "\u064A\u0646",
  16012. "\uFC95",
  16013. "\u064A\u0649",
  16014. "\uFC96",
  16015. "\u064A\u064A",
  16016. "\uFC97",
  16017. "\u0626\u062C",
  16018. "\uFC98",
  16019. "\u0626\u062D",
  16020. "\uFC99",
  16021. "\u0626\u062E",
  16022. "\uFC9A",
  16023. "\u0626\u0645",
  16024. "\uFC9B",
  16025. "\u0626\u0647",
  16026. "\uFC9C",
  16027. "\u0628\u062C",
  16028. "\uFC9D",
  16029. "\u0628\u062D",
  16030. "\uFC9E",
  16031. "\u0628\u062E",
  16032. "\uFC9F",
  16033. "\u0628\u0645",
  16034. "\uFCA0",
  16035. "\u0628\u0647",
  16036. "\uFCA1",
  16037. "\u062A\u062C",
  16038. "\uFCA2",
  16039. "\u062A\u062D",
  16040. "\uFCA3",
  16041. "\u062A\u062E",
  16042. "\uFCA4",
  16043. "\u062A\u0645",
  16044. "\uFCA5",
  16045. "\u062A\u0647",
  16046. "\uFCA6",
  16047. "\u062B\u0645",
  16048. "\uFCA7",
  16049. "\u062C\u062D",
  16050. "\uFCA8",
  16051. "\u062C\u0645",
  16052. "\uFCA9",
  16053. "\u062D\u062C",
  16054. "\uFCAA",
  16055. "\u062D\u0645",
  16056. "\uFCAB",
  16057. "\u062E\u062C",
  16058. "\uFCAC",
  16059. "\u062E\u0645",
  16060. "\uFCAD",
  16061. "\u0633\u062C",
  16062. "\uFCAE",
  16063. "\u0633\u062D",
  16064. "\uFCAF",
  16065. "\u0633\u062E",
  16066. "\uFCB0",
  16067. "\u0633\u0645",
  16068. "\uFCB1",
  16069. "\u0635\u062D",
  16070. "\uFCB2",
  16071. "\u0635\u062E",
  16072. "\uFCB3",
  16073. "\u0635\u0645",
  16074. "\uFCB4",
  16075. "\u0636\u062C",
  16076. "\uFCB5",
  16077. "\u0636\u062D",
  16078. "\uFCB6",
  16079. "\u0636\u062E",
  16080. "\uFCB7",
  16081. "\u0636\u0645",
  16082. "\uFCB8",
  16083. "\u0637\u062D",
  16084. "\uFCB9",
  16085. "\u0638\u0645",
  16086. "\uFCBA",
  16087. "\u0639\u062C",
  16088. "\uFCBB",
  16089. "\u0639\u0645",
  16090. "\uFCBC",
  16091. "\u063A\u062C",
  16092. "\uFCBD",
  16093. "\u063A\u0645",
  16094. "\uFCBE",
  16095. "\u0641\u062C",
  16096. "\uFCBF",
  16097. "\u0641\u062D",
  16098. "\uFCC0",
  16099. "\u0641\u062E",
  16100. "\uFCC1",
  16101. "\u0641\u0645",
  16102. "\uFCC2",
  16103. "\u0642\u062D",
  16104. "\uFCC3",
  16105. "\u0642\u0645",
  16106. "\uFCC4",
  16107. "\u0643\u062C",
  16108. "\uFCC5",
  16109. "\u0643\u062D",
  16110. "\uFCC6",
  16111. "\u0643\u062E",
  16112. "\uFCC7",
  16113. "\u0643\u0644",
  16114. "\uFCC8",
  16115. "\u0643\u0645",
  16116. "\uFCC9",
  16117. "\u0644\u062C",
  16118. "\uFCCA",
  16119. "\u0644\u062D",
  16120. "\uFCCB",
  16121. "\u0644\u062E",
  16122. "\uFCCC",
  16123. "\u0644\u0645",
  16124. "\uFCCD",
  16125. "\u0644\u0647",
  16126. "\uFCCE",
  16127. "\u0645\u062C",
  16128. "\uFCCF",
  16129. "\u0645\u062D",
  16130. "\uFCD0",
  16131. "\u0645\u062E",
  16132. "\uFCD1",
  16133. "\u0645\u0645",
  16134. "\uFCD2",
  16135. "\u0646\u062C",
  16136. "\uFCD3",
  16137. "\u0646\u062D",
  16138. "\uFCD4",
  16139. "\u0646\u062E",
  16140. "\uFCD5",
  16141. "\u0646\u0645",
  16142. "\uFCD6",
  16143. "\u0646\u0647",
  16144. "\uFCD7",
  16145. "\u0647\u062C",
  16146. "\uFCD8",
  16147. "\u0647\u0645",
  16148. "\uFCD9",
  16149. "\u0647\u0670",
  16150. "\uFCDA",
  16151. "\u064A\u062C",
  16152. "\uFCDB",
  16153. "\u064A\u062D",
  16154. "\uFCDC",
  16155. "\u064A\u062E",
  16156. "\uFCDD",
  16157. "\u064A\u0645",
  16158. "\uFCDE",
  16159. "\u064A\u0647",
  16160. "\uFCDF",
  16161. "\u0626\u0645",
  16162. "\uFCE0",
  16163. "\u0626\u0647",
  16164. "\uFCE1",
  16165. "\u0628\u0645",
  16166. "\uFCE2",
  16167. "\u0628\u0647",
  16168. "\uFCE3",
  16169. "\u062A\u0645",
  16170. "\uFCE4",
  16171. "\u062A\u0647",
  16172. "\uFCE5",
  16173. "\u062B\u0645",
  16174. "\uFCE6",
  16175. "\u062B\u0647",
  16176. "\uFCE7",
  16177. "\u0633\u0645",
  16178. "\uFCE8",
  16179. "\u0633\u0647",
  16180. "\uFCE9",
  16181. "\u0634\u0645",
  16182. "\uFCEA",
  16183. "\u0634\u0647",
  16184. "\uFCEB",
  16185. "\u0643\u0644",
  16186. "\uFCEC",
  16187. "\u0643\u0645",
  16188. "\uFCED",
  16189. "\u0644\u0645",
  16190. "\uFCEE",
  16191. "\u0646\u0645",
  16192. "\uFCEF",
  16193. "\u0646\u0647",
  16194. "\uFCF0",
  16195. "\u064A\u0645",
  16196. "\uFCF1",
  16197. "\u064A\u0647",
  16198. "\uFCF2",
  16199. "\u0640\u064E\u0651",
  16200. "\uFCF3",
  16201. "\u0640\u064F\u0651",
  16202. "\uFCF4",
  16203. "\u0640\u0650\u0651",
  16204. "\uFCF5",
  16205. "\u0637\u0649",
  16206. "\uFCF6",
  16207. "\u0637\u064A",
  16208. "\uFCF7",
  16209. "\u0639\u0649",
  16210. "\uFCF8",
  16211. "\u0639\u064A",
  16212. "\uFCF9",
  16213. "\u063A\u0649",
  16214. "\uFCFA",
  16215. "\u063A\u064A",
  16216. "\uFCFB",
  16217. "\u0633\u0649",
  16218. "\uFCFC",
  16219. "\u0633\u064A",
  16220. "\uFCFD",
  16221. "\u0634\u0649",
  16222. "\uFCFE",
  16223. "\u0634\u064A",
  16224. "\uFCFF",
  16225. "\u062D\u0649",
  16226. "\uFD00",
  16227. "\u062D\u064A",
  16228. "\uFD01",
  16229. "\u062C\u0649",
  16230. "\uFD02",
  16231. "\u062C\u064A",
  16232. "\uFD03",
  16233. "\u062E\u0649",
  16234. "\uFD04",
  16235. "\u062E\u064A",
  16236. "\uFD05",
  16237. "\u0635\u0649",
  16238. "\uFD06",
  16239. "\u0635\u064A",
  16240. "\uFD07",
  16241. "\u0636\u0649",
  16242. "\uFD08",
  16243. "\u0636\u064A",
  16244. "\uFD09",
  16245. "\u0634\u062C",
  16246. "\uFD0A",
  16247. "\u0634\u062D",
  16248. "\uFD0B",
  16249. "\u0634\u062E",
  16250. "\uFD0C",
  16251. "\u0634\u0645",
  16252. "\uFD0D",
  16253. "\u0634\u0631",
  16254. "\uFD0E",
  16255. "\u0633\u0631",
  16256. "\uFD0F",
  16257. "\u0635\u0631",
  16258. "\uFD10",
  16259. "\u0636\u0631",
  16260. "\uFD11",
  16261. "\u0637\u0649",
  16262. "\uFD12",
  16263. "\u0637\u064A",
  16264. "\uFD13",
  16265. "\u0639\u0649",
  16266. "\uFD14",
  16267. "\u0639\u064A",
  16268. "\uFD15",
  16269. "\u063A\u0649",
  16270. "\uFD16",
  16271. "\u063A\u064A",
  16272. "\uFD17",
  16273. "\u0633\u0649",
  16274. "\uFD18",
  16275. "\u0633\u064A",
  16276. "\uFD19",
  16277. "\u0634\u0649",
  16278. "\uFD1A",
  16279. "\u0634\u064A",
  16280. "\uFD1B",
  16281. "\u062D\u0649",
  16282. "\uFD1C",
  16283. "\u062D\u064A",
  16284. "\uFD1D",
  16285. "\u062C\u0649",
  16286. "\uFD1E",
  16287. "\u062C\u064A",
  16288. "\uFD1F",
  16289. "\u062E\u0649",
  16290. "\uFD20",
  16291. "\u062E\u064A",
  16292. "\uFD21",
  16293. "\u0635\u0649",
  16294. "\uFD22",
  16295. "\u0635\u064A",
  16296. "\uFD23",
  16297. "\u0636\u0649",
  16298. "\uFD24",
  16299. "\u0636\u064A",
  16300. "\uFD25",
  16301. "\u0634\u062C",
  16302. "\uFD26",
  16303. "\u0634\u062D",
  16304. "\uFD27",
  16305. "\u0634\u062E",
  16306. "\uFD28",
  16307. "\u0634\u0645",
  16308. "\uFD29",
  16309. "\u0634\u0631",
  16310. "\uFD2A",
  16311. "\u0633\u0631",
  16312. "\uFD2B",
  16313. "\u0635\u0631",
  16314. "\uFD2C",
  16315. "\u0636\u0631",
  16316. "\uFD2D",
  16317. "\u0634\u062C",
  16318. "\uFD2E",
  16319. "\u0634\u062D",
  16320. "\uFD2F",
  16321. "\u0634\u062E",
  16322. "\uFD30",
  16323. "\u0634\u0645",
  16324. "\uFD31",
  16325. "\u0633\u0647",
  16326. "\uFD32",
  16327. "\u0634\u0647",
  16328. "\uFD33",
  16329. "\u0637\u0645",
  16330. "\uFD34",
  16331. "\u0633\u062C",
  16332. "\uFD35",
  16333. "\u0633\u062D",
  16334. "\uFD36",
  16335. "\u0633\u062E",
  16336. "\uFD37",
  16337. "\u0634\u062C",
  16338. "\uFD38",
  16339. "\u0634\u062D",
  16340. "\uFD39",
  16341. "\u0634\u062E",
  16342. "\uFD3A",
  16343. "\u0637\u0645",
  16344. "\uFD3B",
  16345. "\u0638\u0645",
  16346. "\uFD3C",
  16347. "\u0627\u064B",
  16348. "\uFD3D",
  16349. "\u0627\u064B",
  16350. "\uFD50",
  16351. "\u062A\u062C\u0645",
  16352. "\uFD51",
  16353. "\u062A\u062D\u062C",
  16354. "\uFD52",
  16355. "\u062A\u062D\u062C",
  16356. "\uFD53",
  16357. "\u062A\u062D\u0645",
  16358. "\uFD54",
  16359. "\u062A\u062E\u0645",
  16360. "\uFD55",
  16361. "\u062A\u0645\u062C",
  16362. "\uFD56",
  16363. "\u062A\u0645\u062D",
  16364. "\uFD57",
  16365. "\u062A\u0645\u062E",
  16366. "\uFD58",
  16367. "\u062C\u0645\u062D",
  16368. "\uFD59",
  16369. "\u062C\u0645\u062D",
  16370. "\uFD5A",
  16371. "\u062D\u0645\u064A",
  16372. "\uFD5B",
  16373. "\u062D\u0645\u0649",
  16374. "\uFD5C",
  16375. "\u0633\u062D\u062C",
  16376. "\uFD5D",
  16377. "\u0633\u062C\u062D",
  16378. "\uFD5E",
  16379. "\u0633\u062C\u0649",
  16380. "\uFD5F",
  16381. "\u0633\u0645\u062D",
  16382. "\uFD60",
  16383. "\u0633\u0645\u062D",
  16384. "\uFD61",
  16385. "\u0633\u0645\u062C",
  16386. "\uFD62",
  16387. "\u0633\u0645\u0645",
  16388. "\uFD63",
  16389. "\u0633\u0645\u0645",
  16390. "\uFD64",
  16391. "\u0635\u062D\u062D",
  16392. "\uFD65",
  16393. "\u0635\u062D\u062D",
  16394. "\uFD66",
  16395. "\u0635\u0645\u0645",
  16396. "\uFD67",
  16397. "\u0634\u062D\u0645",
  16398. "\uFD68",
  16399. "\u0634\u062D\u0645",
  16400. "\uFD69",
  16401. "\u0634\u062C\u064A",
  16402. "\uFD6A",
  16403. "\u0634\u0645\u062E",
  16404. "\uFD6B",
  16405. "\u0634\u0645\u062E",
  16406. "\uFD6C",
  16407. "\u0634\u0645\u0645",
  16408. "\uFD6D",
  16409. "\u0634\u0645\u0645",
  16410. "\uFD6E",
  16411. "\u0636\u062D\u0649",
  16412. "\uFD6F",
  16413. "\u0636\u062E\u0645",
  16414. "\uFD70",
  16415. "\u0636\u062E\u0645",
  16416. "\uFD71",
  16417. "\u0637\u0645\u062D",
  16418. "\uFD72",
  16419. "\u0637\u0645\u062D",
  16420. "\uFD73",
  16421. "\u0637\u0645\u0645",
  16422. "\uFD74",
  16423. "\u0637\u0645\u064A",
  16424. "\uFD75",
  16425. "\u0639\u062C\u0645",
  16426. "\uFD76",
  16427. "\u0639\u0645\u0645",
  16428. "\uFD77",
  16429. "\u0639\u0645\u0645",
  16430. "\uFD78",
  16431. "\u0639\u0645\u0649",
  16432. "\uFD79",
  16433. "\u063A\u0645\u0645",
  16434. "\uFD7A",
  16435. "\u063A\u0645\u064A",
  16436. "\uFD7B",
  16437. "\u063A\u0645\u0649",
  16438. "\uFD7C",
  16439. "\u0641\u062E\u0645",
  16440. "\uFD7D",
  16441. "\u0641\u062E\u0645",
  16442. "\uFD7E",
  16443. "\u0642\u0645\u062D",
  16444. "\uFD7F",
  16445. "\u0642\u0645\u0645",
  16446. "\uFD80",
  16447. "\u0644\u062D\u0645",
  16448. "\uFD81",
  16449. "\u0644\u062D\u064A",
  16450. "\uFD82",
  16451. "\u0644\u062D\u0649",
  16452. "\uFD83",
  16453. "\u0644\u062C\u062C",
  16454. "\uFD84",
  16455. "\u0644\u062C\u062C",
  16456. "\uFD85",
  16457. "\u0644\u062E\u0645",
  16458. "\uFD86",
  16459. "\u0644\u062E\u0645",
  16460. "\uFD87",
  16461. "\u0644\u0645\u062D",
  16462. "\uFD88",
  16463. "\u0644\u0645\u062D",
  16464. "\uFD89",
  16465. "\u0645\u062D\u062C",
  16466. "\uFD8A",
  16467. "\u0645\u062D\u0645",
  16468. "\uFD8B",
  16469. "\u0645\u062D\u064A",
  16470. "\uFD8C",
  16471. "\u0645\u062C\u062D",
  16472. "\uFD8D",
  16473. "\u0645\u062C\u0645",
  16474. "\uFD8E",
  16475. "\u0645\u062E\u062C",
  16476. "\uFD8F",
  16477. "\u0645\u062E\u0645",
  16478. "\uFD92",
  16479. "\u0645\u062C\u062E",
  16480. "\uFD93",
  16481. "\u0647\u0645\u062C",
  16482. "\uFD94",
  16483. "\u0647\u0645\u0645",
  16484. "\uFD95",
  16485. "\u0646\u062D\u0645",
  16486. "\uFD96",
  16487. "\u0646\u062D\u0649",
  16488. "\uFD97",
  16489. "\u0646\u062C\u0645",
  16490. "\uFD98",
  16491. "\u0646\u062C\u0645",
  16492. "\uFD99",
  16493. "\u0646\u062C\u0649",
  16494. "\uFD9A",
  16495. "\u0646\u0645\u064A",
  16496. "\uFD9B",
  16497. "\u0646\u0645\u0649",
  16498. "\uFD9C",
  16499. "\u064A\u0645\u0645",
  16500. "\uFD9D",
  16501. "\u064A\u0645\u0645",
  16502. "\uFD9E",
  16503. "\u0628\u062E\u064A",
  16504. "\uFD9F",
  16505. "\u062A\u062C\u064A",
  16506. "\uFDA0",
  16507. "\u062A\u062C\u0649",
  16508. "\uFDA1",
  16509. "\u062A\u062E\u064A",
  16510. "\uFDA2",
  16511. "\u062A\u062E\u0649",
  16512. "\uFDA3",
  16513. "\u062A\u0645\u064A",
  16514. "\uFDA4",
  16515. "\u062A\u0645\u0649",
  16516. "\uFDA5",
  16517. "\u062C\u0645\u064A",
  16518. "\uFDA6",
  16519. "\u062C\u062D\u0649",
  16520. "\uFDA7",
  16521. "\u062C\u0645\u0649",
  16522. "\uFDA8",
  16523. "\u0633\u062E\u0649",
  16524. "\uFDA9",
  16525. "\u0635\u062D\u064A",
  16526. "\uFDAA",
  16527. "\u0634\u062D\u064A",
  16528. "\uFDAB",
  16529. "\u0636\u062D\u064A",
  16530. "\uFDAC",
  16531. "\u0644\u062C\u064A",
  16532. "\uFDAD",
  16533. "\u0644\u0645\u064A",
  16534. "\uFDAE",
  16535. "\u064A\u062D\u064A",
  16536. "\uFDAF",
  16537. "\u064A\u062C\u064A",
  16538. "\uFDB0",
  16539. "\u064A\u0645\u064A",
  16540. "\uFDB1",
  16541. "\u0645\u0645\u064A",
  16542. "\uFDB2",
  16543. "\u0642\u0645\u064A",
  16544. "\uFDB3",
  16545. "\u0646\u062D\u064A",
  16546. "\uFDB4",
  16547. "\u0642\u0645\u062D",
  16548. "\uFDB5",
  16549. "\u0644\u062D\u0645",
  16550. "\uFDB6",
  16551. "\u0639\u0645\u064A",
  16552. "\uFDB7",
  16553. "\u0643\u0645\u064A",
  16554. "\uFDB8",
  16555. "\u0646\u062C\u062D",
  16556. "\uFDB9",
  16557. "\u0645\u062E\u064A",
  16558. "\uFDBA",
  16559. "\u0644\u062C\u0645",
  16560. "\uFDBB",
  16561. "\u0643\u0645\u0645",
  16562. "\uFDBC",
  16563. "\u0644\u062C\u0645",
  16564. "\uFDBD",
  16565. "\u0646\u062C\u062D",
  16566. "\uFDBE",
  16567. "\u062C\u062D\u064A",
  16568. "\uFDBF",
  16569. "\u062D\u062C\u064A",
  16570. "\uFDC0",
  16571. "\u0645\u062C\u064A",
  16572. "\uFDC1",
  16573. "\u0641\u0645\u064A",
  16574. "\uFDC2",
  16575. "\u0628\u062D\u064A",
  16576. "\uFDC3",
  16577. "\u0643\u0645\u0645",
  16578. "\uFDC4",
  16579. "\u0639\u062C\u0645",
  16580. "\uFDC5",
  16581. "\u0635\u0645\u0645",
  16582. "\uFDC6",
  16583. "\u0633\u062E\u064A",
  16584. "\uFDC7",
  16585. "\u0646\u062C\u064A",
  16586. "\uFE49",
  16587. "\u203E",
  16588. "\uFE4A",
  16589. "\u203E",
  16590. "\uFE4B",
  16591. "\u203E",
  16592. "\uFE4C",
  16593. "\u203E",
  16594. "\uFE4D",
  16595. "\u005F",
  16596. "\uFE4E",
  16597. "\u005F",
  16598. "\uFE4F",
  16599. "\u005F",
  16600. "\uFE80",
  16601. "\u0621",
  16602. "\uFE81",
  16603. "\u0622",
  16604. "\uFE82",
  16605. "\u0622",
  16606. "\uFE83",
  16607. "\u0623",
  16608. "\uFE84",
  16609. "\u0623",
  16610. "\uFE85",
  16611. "\u0624",
  16612. "\uFE86",
  16613. "\u0624",
  16614. "\uFE87",
  16615. "\u0625",
  16616. "\uFE88",
  16617. "\u0625",
  16618. "\uFE89",
  16619. "\u0626",
  16620. "\uFE8A",
  16621. "\u0626",
  16622. "\uFE8B",
  16623. "\u0626",
  16624. "\uFE8C",
  16625. "\u0626",
  16626. "\uFE8D",
  16627. "\u0627",
  16628. "\uFE8E",
  16629. "\u0627",
  16630. "\uFE8F",
  16631. "\u0628",
  16632. "\uFE90",
  16633. "\u0628",
  16634. "\uFE91",
  16635. "\u0628",
  16636. "\uFE92",
  16637. "\u0628",
  16638. "\uFE93",
  16639. "\u0629",
  16640. "\uFE94",
  16641. "\u0629",
  16642. "\uFE95",
  16643. "\u062A",
  16644. "\uFE96",
  16645. "\u062A",
  16646. "\uFE97",
  16647. "\u062A",
  16648. "\uFE98",
  16649. "\u062A",
  16650. "\uFE99",
  16651. "\u062B",
  16652. "\uFE9A",
  16653. "\u062B",
  16654. "\uFE9B",
  16655. "\u062B",
  16656. "\uFE9C",
  16657. "\u062B",
  16658. "\uFE9D",
  16659. "\u062C",
  16660. "\uFE9E",
  16661. "\u062C",
  16662. "\uFE9F",
  16663. "\u062C",
  16664. "\uFEA0",
  16665. "\u062C",
  16666. "\uFEA1",
  16667. "\u062D",
  16668. "\uFEA2",
  16669. "\u062D",
  16670. "\uFEA3",
  16671. "\u062D",
  16672. "\uFEA4",
  16673. "\u062D",
  16674. "\uFEA5",
  16675. "\u062E",
  16676. "\uFEA6",
  16677. "\u062E",
  16678. "\uFEA7",
  16679. "\u062E",
  16680. "\uFEA8",
  16681. "\u062E",
  16682. "\uFEA9",
  16683. "\u062F",
  16684. "\uFEAA",
  16685. "\u062F",
  16686. "\uFEAB",
  16687. "\u0630",
  16688. "\uFEAC",
  16689. "\u0630",
  16690. "\uFEAD",
  16691. "\u0631",
  16692. "\uFEAE",
  16693. "\u0631",
  16694. "\uFEAF",
  16695. "\u0632",
  16696. "\uFEB0",
  16697. "\u0632",
  16698. "\uFEB1",
  16699. "\u0633",
  16700. "\uFEB2",
  16701. "\u0633",
  16702. "\uFEB3",
  16703. "\u0633",
  16704. "\uFEB4",
  16705. "\u0633",
  16706. "\uFEB5",
  16707. "\u0634",
  16708. "\uFEB6",
  16709. "\u0634",
  16710. "\uFEB7",
  16711. "\u0634",
  16712. "\uFEB8",
  16713. "\u0634",
  16714. "\uFEB9",
  16715. "\u0635",
  16716. "\uFEBA",
  16717. "\u0635",
  16718. "\uFEBB",
  16719. "\u0635",
  16720. "\uFEBC",
  16721. "\u0635",
  16722. "\uFEBD",
  16723. "\u0636",
  16724. "\uFEBE",
  16725. "\u0636",
  16726. "\uFEBF",
  16727. "\u0636",
  16728. "\uFEC0",
  16729. "\u0636",
  16730. "\uFEC1",
  16731. "\u0637",
  16732. "\uFEC2",
  16733. "\u0637",
  16734. "\uFEC3",
  16735. "\u0637",
  16736. "\uFEC4",
  16737. "\u0637",
  16738. "\uFEC5",
  16739. "\u0638",
  16740. "\uFEC6",
  16741. "\u0638",
  16742. "\uFEC7",
  16743. "\u0638",
  16744. "\uFEC8",
  16745. "\u0638",
  16746. "\uFEC9",
  16747. "\u0639",
  16748. "\uFECA",
  16749. "\u0639",
  16750. "\uFECB",
  16751. "\u0639",
  16752. "\uFECC",
  16753. "\u0639",
  16754. "\uFECD",
  16755. "\u063A",
  16756. "\uFECE",
  16757. "\u063A",
  16758. "\uFECF",
  16759. "\u063A",
  16760. "\uFED0",
  16761. "\u063A",
  16762. "\uFED1",
  16763. "\u0641",
  16764. "\uFED2",
  16765. "\u0641",
  16766. "\uFED3",
  16767. "\u0641",
  16768. "\uFED4",
  16769. "\u0641",
  16770. "\uFED5",
  16771. "\u0642",
  16772. "\uFED6",
  16773. "\u0642",
  16774. "\uFED7",
  16775. "\u0642",
  16776. "\uFED8",
  16777. "\u0642",
  16778. "\uFED9",
  16779. "\u0643",
  16780. "\uFEDA",
  16781. "\u0643",
  16782. "\uFEDB",
  16783. "\u0643",
  16784. "\uFEDC",
  16785. "\u0643",
  16786. "\uFEDD",
  16787. "\u0644",
  16788. "\uFEDE",
  16789. "\u0644",
  16790. "\uFEDF",
  16791. "\u0644",
  16792. "\uFEE0",
  16793. "\u0644",
  16794. "\uFEE1",
  16795. "\u0645",
  16796. "\uFEE2",
  16797. "\u0645",
  16798. "\uFEE3",
  16799. "\u0645",
  16800. "\uFEE4",
  16801. "\u0645",
  16802. "\uFEE5",
  16803. "\u0646",
  16804. "\uFEE6",
  16805. "\u0646",
  16806. "\uFEE7",
  16807. "\u0646",
  16808. "\uFEE8",
  16809. "\u0646",
  16810. "\uFEE9",
  16811. "\u0647",
  16812. "\uFEEA",
  16813. "\u0647",
  16814. "\uFEEB",
  16815. "\u0647",
  16816. "\uFEEC",
  16817. "\u0647",
  16818. "\uFEED",
  16819. "\u0648",
  16820. "\uFEEE",
  16821. "\u0648",
  16822. "\uFEEF",
  16823. "\u0649",
  16824. "\uFEF0",
  16825. "\u0649",
  16826. "\uFEF1",
  16827. "\u064A",
  16828. "\uFEF2",
  16829. "\u064A",
  16830. "\uFEF3",
  16831. "\u064A",
  16832. "\uFEF4",
  16833. "\u064A",
  16834. "\uFEF5",
  16835. "\u0644\u0622",
  16836. "\uFEF6",
  16837. "\u0644\u0622",
  16838. "\uFEF7",
  16839. "\u0644\u0623",
  16840. "\uFEF8",
  16841. "\u0644\u0623",
  16842. "\uFEF9",
  16843. "\u0644\u0625",
  16844. "\uFEFA",
  16845. "\u0644\u0625",
  16846. "\uFEFB",
  16847. "\u0644\u0627",
  16848. "\uFEFC",
  16849. "\u0644\u0627"
  16850. ];
  16851. });
  16852. function reverseIfRtl(chars) {
  16853. const charsLength = chars.length;
  16854. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  16855. return chars;
  16856. }
  16857. const buf = [];
  16858. for (let ii = charsLength - 1; ii >= 0; ii--) {
  16859. buf.push(chars[ii]);
  16860. }
  16861. return buf.join("");
  16862. }
  16863. /***/ }),
  16864. /* 22 */
  16865. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  16866. Object.defineProperty(exports, "__esModule", ({
  16867. value: true
  16868. }));
  16869. exports.getQuadPoints = getQuadPoints;
  16870. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  16871. var _util = __w_pdfjs_require__(2);
  16872. var _core_utils = __w_pdfjs_require__(9);
  16873. var _default_appearance = __w_pdfjs_require__(23);
  16874. var _primitives = __w_pdfjs_require__(5);
  16875. var _bidi = __w_pdfjs_require__(59);
  16876. var _catalog = __w_pdfjs_require__(64);
  16877. var _colorspace = __w_pdfjs_require__(24);
  16878. var _file_spec = __w_pdfjs_require__(66);
  16879. var _object_loader = __w_pdfjs_require__(70);
  16880. var _operator_list = __w_pdfjs_require__(62);
  16881. var _stream = __w_pdfjs_require__(10);
  16882. var _writer = __w_pdfjs_require__(71);
  16883. class AnnotationFactory {
  16884. static create(xref, ref, pdfManager, idFactory, collectFields) {
  16885. return Promise.all([pdfManager.ensureCatalog("acroForm"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex]));
  16886. }
  16887. static _create(xref, ref, pdfManager, idFactory, acroForm, collectFields, pageIndex = -1) {
  16888. const dict = xref.fetchIfRef(ref);
  16889. if (!(0, _primitives.isDict)(dict)) {
  16890. return undefined;
  16891. }
  16892. const id = (0, _primitives.isRef)(ref) ? ref.toString() : `annot_${idFactory.createObjId()}`;
  16893. let subtype = dict.get("Subtype");
  16894. subtype = (0, _primitives.isName)(subtype) ? subtype.name : null;
  16895. const parameters = {
  16896. xref,
  16897. ref,
  16898. dict,
  16899. subtype,
  16900. id,
  16901. pdfManager,
  16902. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  16903. collectFields,
  16904. pageIndex
  16905. };
  16906. switch (subtype) {
  16907. case "Link":
  16908. return new LinkAnnotation(parameters);
  16909. case "Text":
  16910. return new TextAnnotation(parameters);
  16911. case "Widget":
  16912. let fieldType = (0, _core_utils.getInheritableProperty)({
  16913. dict,
  16914. key: "FT"
  16915. });
  16916. fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  16917. switch (fieldType) {
  16918. case "Tx":
  16919. return new TextWidgetAnnotation(parameters);
  16920. case "Btn":
  16921. return new ButtonWidgetAnnotation(parameters);
  16922. case "Ch":
  16923. return new ChoiceWidgetAnnotation(parameters);
  16924. case "Sig":
  16925. return new SignatureWidgetAnnotation(parameters);
  16926. }
  16927. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  16928. return new WidgetAnnotation(parameters);
  16929. case "Popup":
  16930. return new PopupAnnotation(parameters);
  16931. case "FreeText":
  16932. return new FreeTextAnnotation(parameters);
  16933. case "Line":
  16934. return new LineAnnotation(parameters);
  16935. case "Square":
  16936. return new SquareAnnotation(parameters);
  16937. case "Circle":
  16938. return new CircleAnnotation(parameters);
  16939. case "PolyLine":
  16940. return new PolylineAnnotation(parameters);
  16941. case "Polygon":
  16942. return new PolygonAnnotation(parameters);
  16943. case "Caret":
  16944. return new CaretAnnotation(parameters);
  16945. case "Ink":
  16946. return new InkAnnotation(parameters);
  16947. case "Highlight":
  16948. return new HighlightAnnotation(parameters);
  16949. case "Underline":
  16950. return new UnderlineAnnotation(parameters);
  16951. case "Squiggly":
  16952. return new SquigglyAnnotation(parameters);
  16953. case "StrikeOut":
  16954. return new StrikeOutAnnotation(parameters);
  16955. case "Stamp":
  16956. return new StampAnnotation(parameters);
  16957. case "FileAttachment":
  16958. return new FileAttachmentAnnotation(parameters);
  16959. default:
  16960. if (!collectFields) {
  16961. if (!subtype) {
  16962. (0, _util.warn)("Annotation is missing the required /Subtype.");
  16963. } else {
  16964. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  16965. }
  16966. }
  16967. return new Annotation(parameters);
  16968. }
  16969. }
  16970. static async _getPageIndex(xref, ref, pdfManager) {
  16971. try {
  16972. const annotDict = await xref.fetchIfRefAsync(ref);
  16973. if (!(0, _primitives.isDict)(annotDict)) {
  16974. return -1;
  16975. }
  16976. const pageRef = annotDict.getRaw("P");
  16977. if (!(0, _primitives.isRef)(pageRef)) {
  16978. return -1;
  16979. }
  16980. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  16981. return pageIndex;
  16982. } catch (ex) {
  16983. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  16984. return -1;
  16985. }
  16986. }
  16987. }
  16988. exports.AnnotationFactory = AnnotationFactory;
  16989. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  16990. if (!Array.isArray(color)) {
  16991. return defaultColor;
  16992. }
  16993. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  16994. switch (color.length) {
  16995. case 0:
  16996. return null;
  16997. case 1:
  16998. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  16999. return rgbColor;
  17000. case 3:
  17001. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  17002. return rgbColor;
  17003. case 4:
  17004. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  17005. return rgbColor;
  17006. default:
  17007. return defaultColor;
  17008. }
  17009. }
  17010. function getQuadPoints(dict, rect) {
  17011. if (!dict.has("QuadPoints")) {
  17012. return null;
  17013. }
  17014. const quadPoints = dict.getArray("QuadPoints");
  17015. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  17016. return null;
  17017. }
  17018. const quadPointsLists = [];
  17019. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  17020. quadPointsLists.push([]);
  17021. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  17022. const x = quadPoints[j];
  17023. const y = quadPoints[j + 1];
  17024. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  17025. return null;
  17026. }
  17027. quadPointsLists[i].push({
  17028. x,
  17029. y
  17030. });
  17031. }
  17032. }
  17033. return quadPointsLists.map(quadPointsList => {
  17034. 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]);
  17035. return [{
  17036. x: minX,
  17037. y: maxY
  17038. }, {
  17039. x: maxX,
  17040. y: maxY
  17041. }, {
  17042. x: minX,
  17043. y: minY
  17044. }, {
  17045. x: maxX,
  17046. y: minY
  17047. }];
  17048. });
  17049. }
  17050. function getTransformMatrix(rect, bbox, matrix) {
  17051. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  17052. if (minX === maxX || minY === maxY) {
  17053. return [1, 0, 0, 1, rect[0], rect[1]];
  17054. }
  17055. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  17056. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  17057. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  17058. }
  17059. class Annotation {
  17060. constructor(params) {
  17061. const dict = params.dict;
  17062. this.setTitle(dict.get("T"));
  17063. this.setContents(dict.get("Contents"));
  17064. this.setModificationDate(dict.get("M"));
  17065. this.setFlags(dict.get("F"));
  17066. this.setRectangle(dict.getArray("Rect"));
  17067. this.setColor(dict.getArray("C"));
  17068. this.setBorderStyle(dict);
  17069. this.setAppearance(dict);
  17070. this.setBorderAndBackgroundColors(dict.get("MK"));
  17071. this._streams = [];
  17072. if (this.appearance) {
  17073. this._streams.push(this.appearance);
  17074. }
  17075. this.data = {
  17076. annotationFlags: this.flags,
  17077. borderStyle: this.borderStyle,
  17078. color: this.color,
  17079. backgroundColor: this.backgroundColor,
  17080. borderColor: this.borderColor,
  17081. contentsObj: this._contents,
  17082. hasAppearance: !!this.appearance,
  17083. id: params.id,
  17084. modificationDate: this.modificationDate,
  17085. rect: this.rectangle,
  17086. subtype: params.subtype
  17087. };
  17088. if (params.collectFields) {
  17089. const kids = dict.get("Kids");
  17090. if (Array.isArray(kids)) {
  17091. const kidIds = [];
  17092. for (const kid of kids) {
  17093. if ((0, _primitives.isRef)(kid)) {
  17094. kidIds.push(kid.toString());
  17095. }
  17096. }
  17097. if (kidIds.length !== 0) {
  17098. this.data.kidIds = kidIds;
  17099. }
  17100. }
  17101. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17102. this.data.fieldName = this._constructFieldName(dict);
  17103. this.data.pageIndex = params.pageIndex;
  17104. }
  17105. this._fallbackFontDict = null;
  17106. }
  17107. _hasFlag(flags, flag) {
  17108. return !!(flags & flag);
  17109. }
  17110. _isViewable(flags) {
  17111. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  17112. }
  17113. _isPrintable(flags) {
  17114. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  17115. }
  17116. mustBeViewed(annotationStorage) {
  17117. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17118. if (storageEntry && storageEntry.hidden !== undefined) {
  17119. return !storageEntry.hidden;
  17120. }
  17121. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  17122. }
  17123. mustBePrinted(annotationStorage) {
  17124. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17125. if (storageEntry && storageEntry.print !== undefined) {
  17126. return storageEntry.print;
  17127. }
  17128. return this.printable;
  17129. }
  17130. get viewable() {
  17131. if (this.data.quadPoints === null) {
  17132. return false;
  17133. }
  17134. if (this.flags === 0) {
  17135. return true;
  17136. }
  17137. return this._isViewable(this.flags);
  17138. }
  17139. get printable() {
  17140. if (this.data.quadPoints === null) {
  17141. return false;
  17142. }
  17143. if (this.flags === 0) {
  17144. return false;
  17145. }
  17146. return this._isPrintable(this.flags);
  17147. }
  17148. _parseStringHelper(data) {
  17149. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  17150. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  17151. return {
  17152. str,
  17153. dir
  17154. };
  17155. }
  17156. setTitle(title) {
  17157. this._title = this._parseStringHelper(title);
  17158. }
  17159. setContents(contents) {
  17160. this._contents = this._parseStringHelper(contents);
  17161. }
  17162. setModificationDate(modificationDate) {
  17163. this.modificationDate = (0, _util.isString)(modificationDate) ? modificationDate : null;
  17164. }
  17165. setFlags(flags) {
  17166. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  17167. }
  17168. hasFlag(flag) {
  17169. return this._hasFlag(this.flags, flag);
  17170. }
  17171. setRectangle(rectangle) {
  17172. if (Array.isArray(rectangle) && rectangle.length === 4) {
  17173. this.rectangle = _util.Util.normalizeRect(rectangle);
  17174. } else {
  17175. this.rectangle = [0, 0, 0, 0];
  17176. }
  17177. }
  17178. setColor(color) {
  17179. this.color = getRgbColor(color);
  17180. }
  17181. setBorderAndBackgroundColors(mk) {
  17182. if (mk instanceof _primitives.Dict) {
  17183. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  17184. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  17185. } else {
  17186. this.borderColor = this.backgroundColor = null;
  17187. }
  17188. }
  17189. setBorderStyle(borderStyle) {
  17190. this.borderStyle = new AnnotationBorderStyle();
  17191. if (!(0, _primitives.isDict)(borderStyle)) {
  17192. return;
  17193. }
  17194. if (borderStyle.has("BS")) {
  17195. const dict = borderStyle.get("BS");
  17196. const dictType = dict.get("Type");
  17197. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  17198. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  17199. this.borderStyle.setStyle(dict.get("S"));
  17200. this.borderStyle.setDashArray(dict.getArray("D"));
  17201. }
  17202. } else if (borderStyle.has("Border")) {
  17203. const array = borderStyle.getArray("Border");
  17204. if (Array.isArray(array) && array.length >= 3) {
  17205. this.borderStyle.setHorizontalCornerRadius(array[0]);
  17206. this.borderStyle.setVerticalCornerRadius(array[1]);
  17207. this.borderStyle.setWidth(array[2], this.rectangle);
  17208. if (array.length === 4) {
  17209. this.borderStyle.setDashArray(array[3]);
  17210. }
  17211. }
  17212. } else {
  17213. this.borderStyle.setWidth(0);
  17214. }
  17215. }
  17216. setAppearance(dict) {
  17217. this.appearance = null;
  17218. const appearanceStates = dict.get("AP");
  17219. if (!(0, _primitives.isDict)(appearanceStates)) {
  17220. return;
  17221. }
  17222. const normalAppearanceState = appearanceStates.get("N");
  17223. if ((0, _primitives.isStream)(normalAppearanceState)) {
  17224. this.appearance = normalAppearanceState;
  17225. return;
  17226. }
  17227. if (!(0, _primitives.isDict)(normalAppearanceState)) {
  17228. return;
  17229. }
  17230. const as = dict.get("AS");
  17231. if (!(0, _primitives.isName)(as) || !normalAppearanceState.has(as.name)) {
  17232. return;
  17233. }
  17234. this.appearance = normalAppearanceState.get(as.name);
  17235. }
  17236. loadResources(keys) {
  17237. return this.appearance.dict.getAsync("Resources").then(resources => {
  17238. if (!resources) {
  17239. return undefined;
  17240. }
  17241. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  17242. return objectLoader.load().then(function () {
  17243. return resources;
  17244. });
  17245. });
  17246. }
  17247. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  17248. if (!this.appearance) {
  17249. return Promise.resolve(new _operator_list.OperatorList());
  17250. }
  17251. const appearance = this.appearance;
  17252. const data = this.data;
  17253. const appearanceDict = appearance.dict;
  17254. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"]);
  17255. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  17256. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  17257. const transform = getTransformMatrix(data.rect, bbox, matrix);
  17258. return resourcesPromise.then(resources => {
  17259. const opList = new _operator_list.OperatorList();
  17260. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix]);
  17261. return evaluator.getOperatorList({
  17262. stream: appearance,
  17263. task,
  17264. resources,
  17265. operatorList: opList,
  17266. fallbackFontDict: this._fallbackFontDict
  17267. }).then(() => {
  17268. opList.addOp(_util.OPS.endAnnotation, []);
  17269. this.reset();
  17270. return opList;
  17271. });
  17272. });
  17273. }
  17274. async save(evaluator, task, annotationStorage) {
  17275. return null;
  17276. }
  17277. getFieldObject() {
  17278. if (this.data.kidIds) {
  17279. return {
  17280. id: this.data.id,
  17281. actions: this.data.actions,
  17282. name: this.data.fieldName,
  17283. strokeColor: this.data.borderColor,
  17284. fillColor: this.data.backgroundColor,
  17285. type: "",
  17286. kidIds: this.data.kidIds,
  17287. page: this.data.pageIndex
  17288. };
  17289. }
  17290. return null;
  17291. }
  17292. reset() {
  17293. for (const stream of this._streams) {
  17294. stream.reset();
  17295. }
  17296. }
  17297. _constructFieldName(dict) {
  17298. if (!dict.has("T") && !dict.has("Parent")) {
  17299. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  17300. return "";
  17301. }
  17302. if (!dict.has("Parent")) {
  17303. return (0, _util.stringToPDFString)(dict.get("T"));
  17304. }
  17305. const fieldName = [];
  17306. if (dict.has("T")) {
  17307. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  17308. }
  17309. let loopDict = dict;
  17310. const visited = new _primitives.RefSet();
  17311. if (dict.objId) {
  17312. visited.put(dict.objId);
  17313. }
  17314. while (loopDict.has("Parent")) {
  17315. loopDict = loopDict.get("Parent");
  17316. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  17317. break;
  17318. }
  17319. if (loopDict.objId) {
  17320. visited.put(loopDict.objId);
  17321. }
  17322. if (loopDict.has("T")) {
  17323. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  17324. }
  17325. }
  17326. return fieldName.join(".");
  17327. }
  17328. }
  17329. exports.Annotation = Annotation;
  17330. class AnnotationBorderStyle {
  17331. constructor() {
  17332. this.width = 1;
  17333. this.style = _util.AnnotationBorderStyleType.SOLID;
  17334. this.dashArray = [3];
  17335. this.horizontalCornerRadius = 0;
  17336. this.verticalCornerRadius = 0;
  17337. }
  17338. setWidth(width, rect = [0, 0, 0, 0]) {
  17339. if ((0, _primitives.isName)(width)) {
  17340. this.width = 0;
  17341. return;
  17342. }
  17343. if (Number.isInteger(width)) {
  17344. if (width > 0) {
  17345. const maxWidth = (rect[2] - rect[0]) / 2;
  17346. const maxHeight = (rect[3] - rect[1]) / 2;
  17347. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  17348. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  17349. width = 1;
  17350. }
  17351. }
  17352. this.width = width;
  17353. }
  17354. }
  17355. setStyle(style) {
  17356. if (!(0, _primitives.isName)(style)) {
  17357. return;
  17358. }
  17359. switch (style.name) {
  17360. case "S":
  17361. this.style = _util.AnnotationBorderStyleType.SOLID;
  17362. break;
  17363. case "D":
  17364. this.style = _util.AnnotationBorderStyleType.DASHED;
  17365. break;
  17366. case "B":
  17367. this.style = _util.AnnotationBorderStyleType.BEVELED;
  17368. break;
  17369. case "I":
  17370. this.style = _util.AnnotationBorderStyleType.INSET;
  17371. break;
  17372. case "U":
  17373. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  17374. break;
  17375. default:
  17376. break;
  17377. }
  17378. }
  17379. setDashArray(dashArray) {
  17380. if (Array.isArray(dashArray) && dashArray.length > 0) {
  17381. let isValid = true;
  17382. let allZeros = true;
  17383. for (const element of dashArray) {
  17384. const validNumber = +element >= 0;
  17385. if (!validNumber) {
  17386. isValid = false;
  17387. break;
  17388. } else if (element > 0) {
  17389. allZeros = false;
  17390. }
  17391. }
  17392. if (isValid && !allZeros) {
  17393. this.dashArray = dashArray;
  17394. } else {
  17395. this.width = 0;
  17396. }
  17397. } else if (dashArray) {
  17398. this.width = 0;
  17399. }
  17400. }
  17401. setHorizontalCornerRadius(radius) {
  17402. if (Number.isInteger(radius)) {
  17403. this.horizontalCornerRadius = radius;
  17404. }
  17405. }
  17406. setVerticalCornerRadius(radius) {
  17407. if (Number.isInteger(radius)) {
  17408. this.verticalCornerRadius = radius;
  17409. }
  17410. }
  17411. }
  17412. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  17413. class MarkupAnnotation extends Annotation {
  17414. constructor(parameters) {
  17415. super(parameters);
  17416. const dict = parameters.dict;
  17417. if (dict.has("IRT")) {
  17418. const rawIRT = dict.getRaw("IRT");
  17419. this.data.inReplyTo = (0, _primitives.isRef)(rawIRT) ? rawIRT.toString() : null;
  17420. const rt = dict.get("RT");
  17421. this.data.replyType = (0, _primitives.isName)(rt) ? rt.name : _util.AnnotationReplyType.REPLY;
  17422. }
  17423. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  17424. const parent = dict.get("IRT");
  17425. this.setTitle(parent.get("T"));
  17426. this.data.titleObj = this._title;
  17427. this.setContents(parent.get("Contents"));
  17428. this.data.contentsObj = this._contents;
  17429. if (!parent.has("CreationDate")) {
  17430. this.data.creationDate = null;
  17431. } else {
  17432. this.setCreationDate(parent.get("CreationDate"));
  17433. this.data.creationDate = this.creationDate;
  17434. }
  17435. if (!parent.has("M")) {
  17436. this.data.modificationDate = null;
  17437. } else {
  17438. this.setModificationDate(parent.get("M"));
  17439. this.data.modificationDate = this.modificationDate;
  17440. }
  17441. this.data.hasPopup = parent.has("Popup");
  17442. if (!parent.has("C")) {
  17443. this.data.color = null;
  17444. } else {
  17445. this.setColor(parent.getArray("C"));
  17446. this.data.color = this.color;
  17447. }
  17448. } else {
  17449. this.data.titleObj = this._title;
  17450. this.setCreationDate(dict.get("CreationDate"));
  17451. this.data.creationDate = this.creationDate;
  17452. this.data.hasPopup = dict.has("Popup");
  17453. if (!dict.has("C")) {
  17454. this.data.color = null;
  17455. }
  17456. }
  17457. }
  17458. setCreationDate(creationDate) {
  17459. this.creationDate = (0, _util.isString)(creationDate) ? creationDate : null;
  17460. }
  17461. _setDefaultAppearance({
  17462. xref,
  17463. extra,
  17464. strokeColor,
  17465. fillColor,
  17466. blendMode,
  17467. strokeAlpha,
  17468. fillAlpha,
  17469. pointsCallback
  17470. }) {
  17471. let minX = Number.MAX_VALUE;
  17472. let minY = Number.MAX_VALUE;
  17473. let maxX = Number.MIN_VALUE;
  17474. let maxY = Number.MIN_VALUE;
  17475. const buffer = ["q"];
  17476. if (extra) {
  17477. buffer.push(extra);
  17478. }
  17479. if (strokeColor) {
  17480. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  17481. }
  17482. if (fillColor) {
  17483. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  17484. }
  17485. let pointsArray = this.data.quadPoints;
  17486. if (!pointsArray) {
  17487. pointsArray = [[{
  17488. x: this.rectangle[0],
  17489. y: this.rectangle[3]
  17490. }, {
  17491. x: this.rectangle[2],
  17492. y: this.rectangle[3]
  17493. }, {
  17494. x: this.rectangle[0],
  17495. y: this.rectangle[1]
  17496. }, {
  17497. x: this.rectangle[2],
  17498. y: this.rectangle[1]
  17499. }]];
  17500. }
  17501. for (const points of pointsArray) {
  17502. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  17503. minX = Math.min(minX, mX);
  17504. maxX = Math.max(maxX, MX);
  17505. minY = Math.min(minY, mY);
  17506. maxY = Math.max(maxY, MY);
  17507. }
  17508. buffer.push("Q");
  17509. const formDict = new _primitives.Dict(xref);
  17510. const appearanceStreamDict = new _primitives.Dict(xref);
  17511. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  17512. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  17513. appearanceStream.dict = appearanceStreamDict;
  17514. formDict.set("Fm0", appearanceStream);
  17515. const gsDict = new _primitives.Dict(xref);
  17516. if (blendMode) {
  17517. gsDict.set("BM", _primitives.Name.get(blendMode));
  17518. }
  17519. if (typeof strokeAlpha === "number") {
  17520. gsDict.set("CA", strokeAlpha);
  17521. }
  17522. if (typeof fillAlpha === "number") {
  17523. gsDict.set("ca", fillAlpha);
  17524. }
  17525. const stateDict = new _primitives.Dict(xref);
  17526. stateDict.set("GS0", gsDict);
  17527. const resources = new _primitives.Dict(xref);
  17528. resources.set("ExtGState", stateDict);
  17529. resources.set("XObject", formDict);
  17530. const appearanceDict = new _primitives.Dict(xref);
  17531. appearanceDict.set("Resources", resources);
  17532. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  17533. appearanceDict.set("BBox", bbox);
  17534. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  17535. this.appearance.dict = appearanceDict;
  17536. this._streams.push(this.appearance, appearanceStream);
  17537. }
  17538. }
  17539. exports.MarkupAnnotation = MarkupAnnotation;
  17540. class WidgetAnnotation extends Annotation {
  17541. constructor(params) {
  17542. super(params);
  17543. const dict = params.dict;
  17544. const data = this.data;
  17545. this.ref = params.ref;
  17546. data.annotationType = _util.AnnotationType.WIDGET;
  17547. if (data.fieldName === undefined) {
  17548. data.fieldName = this._constructFieldName(dict);
  17549. }
  17550. if (data.actions === undefined) {
  17551. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17552. }
  17553. const fieldValue = (0, _core_utils.getInheritableProperty)({
  17554. dict,
  17555. key: "V",
  17556. getArray: true
  17557. });
  17558. data.fieldValue = this._decodeFormValue(fieldValue);
  17559. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  17560. dict,
  17561. key: "DV",
  17562. getArray: true
  17563. });
  17564. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  17565. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  17566. data.fieldValue = data.defaultFieldValue;
  17567. }
  17568. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  17569. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  17570. dict,
  17571. key: "DA"
  17572. }) || params.acroForm.get("DA");
  17573. this._defaultAppearance = (0, _util.isString)(defaultAppearance) ? defaultAppearance : "";
  17574. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  17575. const fieldType = (0, _core_utils.getInheritableProperty)({
  17576. dict,
  17577. key: "FT"
  17578. });
  17579. data.fieldType = (0, _primitives.isName)(fieldType) ? fieldType.name : null;
  17580. const localResources = (0, _core_utils.getInheritableProperty)({
  17581. dict,
  17582. key: "DR"
  17583. });
  17584. const acroFormResources = params.acroForm.get("DR");
  17585. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  17586. this._fieldResources = {
  17587. localResources,
  17588. acroFormResources,
  17589. appearanceResources,
  17590. mergedResources: _primitives.Dict.merge({
  17591. xref: params.xref,
  17592. dictArray: [localResources, appearanceResources, acroFormResources],
  17593. mergeSubDicts: true
  17594. })
  17595. };
  17596. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  17597. dict,
  17598. key: "Ff"
  17599. });
  17600. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  17601. data.fieldFlags = 0;
  17602. }
  17603. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  17604. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  17605. }
  17606. _decodeFormValue(formValue) {
  17607. if (Array.isArray(formValue)) {
  17608. return formValue.filter(item => (0, _util.isString)(item)).map(item => (0, _util.stringToPDFString)(item));
  17609. } else if ((0, _primitives.isName)(formValue)) {
  17610. return (0, _util.stringToPDFString)(formValue.name);
  17611. } else if ((0, _util.isString)(formValue)) {
  17612. return (0, _util.stringToPDFString)(formValue);
  17613. }
  17614. return null;
  17615. }
  17616. hasFieldFlag(flag) {
  17617. return !!(this.data.fieldFlags & flag);
  17618. }
  17619. getOperatorList(evaluator, task, renderForms, annotationStorage) {
  17620. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  17621. return Promise.resolve(new _operator_list.OperatorList());
  17622. }
  17623. if (!this._hasText) {
  17624. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  17625. }
  17626. return this._getAppearance(evaluator, task, annotationStorage).then(content => {
  17627. if (this.appearance && content === null) {
  17628. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  17629. }
  17630. const operatorList = new _operator_list.OperatorList();
  17631. if (!this._defaultAppearance || content === null) {
  17632. return operatorList;
  17633. }
  17634. const matrix = [1, 0, 0, 1, 0, 0];
  17635. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17636. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  17637. operatorList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, matrix]);
  17638. const stream = new _stream.StringStream(content);
  17639. return evaluator.getOperatorList({
  17640. stream,
  17641. task,
  17642. resources: this._fieldResources.mergedResources,
  17643. operatorList
  17644. }).then(function () {
  17645. operatorList.addOp(_util.OPS.endAnnotation, []);
  17646. return operatorList;
  17647. });
  17648. });
  17649. }
  17650. async save(evaluator, task, annotationStorage) {
  17651. if (!annotationStorage) {
  17652. return null;
  17653. }
  17654. const storageEntry = annotationStorage.get(this.data.id);
  17655. const value = storageEntry && storageEntry.value;
  17656. if (value === this.data.fieldValue || value === undefined) {
  17657. return null;
  17658. }
  17659. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  17660. if (appearance === null) {
  17661. return null;
  17662. }
  17663. const {
  17664. xref
  17665. } = evaluator;
  17666. const dict = xref.fetchIfRef(this.ref);
  17667. if (!(0, _primitives.isDict)(dict)) {
  17668. return null;
  17669. }
  17670. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17671. const xfa = {
  17672. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  17673. value
  17674. };
  17675. const newRef = xref.getNewRef();
  17676. const AP = new _primitives.Dict(xref);
  17677. AP.set("N", newRef);
  17678. const encrypt = xref.encrypt;
  17679. let originalTransform = null;
  17680. let newTransform = null;
  17681. if (encrypt) {
  17682. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  17683. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  17684. appearance = newTransform.encryptString(appearance);
  17685. }
  17686. dict.set("V", (0, _util.isAscii)(value) ? value : (0, _util.stringToUTF16BEString)(value));
  17687. dict.set("AP", AP);
  17688. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  17689. const appearanceDict = new _primitives.Dict(xref);
  17690. appearanceDict.set("Length", appearance.length);
  17691. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  17692. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  17693. appearanceDict.set("BBox", bbox);
  17694. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  17695. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  17696. bufferOriginal.push("\nendobj\n");
  17697. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  17698. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  17699. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  17700. return [{
  17701. ref: this.ref,
  17702. data: bufferOriginal.join(""),
  17703. xfa
  17704. }, {
  17705. ref: newRef,
  17706. data: bufferNew.join(""),
  17707. xfa: null
  17708. }];
  17709. }
  17710. async _getAppearance(evaluator, task, annotationStorage) {
  17711. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  17712. if (!annotationStorage || isPassword) {
  17713. return null;
  17714. }
  17715. const storageEntry = annotationStorage.get(this.data.id);
  17716. let value = storageEntry && storageEntry.value;
  17717. if (value === undefined) {
  17718. return null;
  17719. }
  17720. value = value.trim();
  17721. if (value === "") {
  17722. return "";
  17723. }
  17724. let lineCount = -1;
  17725. if (this.data.multiLine) {
  17726. lineCount = value.split(/\r\n|\r|\n/).length;
  17727. }
  17728. const defaultPadding = 2;
  17729. const hPadding = defaultPadding;
  17730. const totalHeight = this.data.rect[3] - this.data.rect[1];
  17731. const totalWidth = this.data.rect[2] - this.data.rect[0];
  17732. if (!this._defaultAppearance) {
  17733. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  17734. }
  17735. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight, lineCount);
  17736. const font = await this._getFontData(evaluator, task);
  17737. let descent = font.descent;
  17738. if (isNaN(descent)) {
  17739. descent = 0;
  17740. }
  17741. const vPadding = defaultPadding + Math.abs(descent) * fontSize;
  17742. const alignment = this.data.textAlignment;
  17743. if (this.data.multiLine) {
  17744. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding);
  17745. }
  17746. const encodedString = font.encodeString(value).join("");
  17747. if (this.data.comb) {
  17748. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding);
  17749. }
  17750. if (alignment === 0 || alignment > 2) {
  17751. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  17752. }
  17753. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  17754. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  17755. }
  17756. async _getFontData(evaluator, task) {
  17757. const operatorList = new _operator_list.OperatorList();
  17758. const initialState = {
  17759. font: null,
  17760. clone() {
  17761. return this;
  17762. }
  17763. };
  17764. const {
  17765. fontName,
  17766. fontSize
  17767. } = this.data.defaultAppearanceData;
  17768. await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  17769. return initialState.font;
  17770. }
  17771. _computeFontSize(height, lineCount) {
  17772. let {
  17773. fontSize
  17774. } = this.data.defaultAppearanceData;
  17775. if (!fontSize) {
  17776. const roundWithOneDigit = x => Math.round(x * 10) / 10;
  17777. const FONT_FACTOR = 0.8;
  17778. if (lineCount === -1) {
  17779. fontSize = roundWithOneDigit(FONT_FACTOR * height);
  17780. } else {
  17781. fontSize = 10;
  17782. let lineHeight = fontSize / FONT_FACTOR;
  17783. let numberOfLines = Math.round(height / lineHeight);
  17784. numberOfLines = Math.max(numberOfLines, lineCount);
  17785. lineHeight = height / numberOfLines;
  17786. fontSize = roundWithOneDigit(FONT_FACTOR * lineHeight);
  17787. }
  17788. const {
  17789. fontName,
  17790. fontColor
  17791. } = this.data.defaultAppearanceData;
  17792. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  17793. fontSize,
  17794. fontName,
  17795. fontColor
  17796. });
  17797. }
  17798. return [this._defaultAppearance, fontSize];
  17799. }
  17800. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  17801. const glyphs = font.charsToGlyphs(text);
  17802. const scale = fontSize / 1000;
  17803. let width = 0;
  17804. for (const glyph of glyphs) {
  17805. width += glyph.width * scale;
  17806. }
  17807. let shift;
  17808. if (alignment === 1) {
  17809. shift = (totalWidth - width) / 2;
  17810. } else if (alignment === 2) {
  17811. shift = totalWidth - width - hPadding;
  17812. } else {
  17813. shift = hPadding;
  17814. }
  17815. shift = shift.toFixed(2);
  17816. vPadding = vPadding.toFixed(2);
  17817. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  17818. }
  17819. _getSaveFieldResources(xref) {
  17820. const {
  17821. localResources,
  17822. appearanceResources,
  17823. acroFormResources
  17824. } = this._fieldResources;
  17825. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  17826. if (!fontName) {
  17827. return localResources || _primitives.Dict.empty;
  17828. }
  17829. for (const resources of [localResources, appearanceResources]) {
  17830. if (resources instanceof _primitives.Dict) {
  17831. const localFont = resources.get("Font");
  17832. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  17833. return resources;
  17834. }
  17835. }
  17836. }
  17837. if (acroFormResources instanceof _primitives.Dict) {
  17838. const acroFormFont = acroFormResources.get("Font");
  17839. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  17840. const subFontDict = new _primitives.Dict(xref);
  17841. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  17842. const subResourcesDict = new _primitives.Dict(xref);
  17843. subResourcesDict.set("Font", subFontDict);
  17844. return _primitives.Dict.merge({
  17845. xref,
  17846. dictArray: [subResourcesDict, localResources],
  17847. mergeSubDicts: true
  17848. });
  17849. }
  17850. }
  17851. return localResources || _primitives.Dict.empty;
  17852. }
  17853. getFieldObject() {
  17854. return null;
  17855. }
  17856. }
  17857. class TextWidgetAnnotation extends WidgetAnnotation {
  17858. constructor(params) {
  17859. super(params);
  17860. this._hasText = true;
  17861. const dict = params.dict;
  17862. if (!(0, _util.isString)(this.data.fieldValue)) {
  17863. this.data.fieldValue = "";
  17864. }
  17865. let alignment = (0, _core_utils.getInheritableProperty)({
  17866. dict,
  17867. key: "Q"
  17868. });
  17869. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  17870. alignment = null;
  17871. }
  17872. this.data.textAlignment = alignment;
  17873. let maximumLength = (0, _core_utils.getInheritableProperty)({
  17874. dict,
  17875. key: "MaxLen"
  17876. });
  17877. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  17878. maximumLength = null;
  17879. }
  17880. this.data.maxLen = maximumLength;
  17881. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  17882. 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;
  17883. }
  17884. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
  17885. const combWidth = (width / this.data.maxLen).toFixed(2);
  17886. const buf = [];
  17887. const positions = font.getCharPositions(text);
  17888. for (const [start, end] of positions) {
  17889. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  17890. }
  17891. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  17892. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  17893. }
  17894. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) {
  17895. const lines = text.split(/\r\n|\r|\n/);
  17896. const buf = [];
  17897. const totalWidth = width - 2 * hPadding;
  17898. for (const line of lines) {
  17899. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  17900. for (const chunk of chunks) {
  17901. const padding = buf.length === 0 ? hPadding : 0;
  17902. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  17903. }
  17904. }
  17905. const renderedText = buf.join("\n");
  17906. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  17907. }
  17908. _splitLine(line, font, fontSize, width) {
  17909. line = font.encodeString(line).join("");
  17910. const glyphs = font.charsToGlyphs(line);
  17911. if (glyphs.length <= 1) {
  17912. return [line];
  17913. }
  17914. const positions = font.getCharPositions(line);
  17915. const scale = fontSize / 1000;
  17916. const chunks = [];
  17917. let lastSpacePosInStringStart = -1,
  17918. lastSpacePosInStringEnd = -1,
  17919. lastSpacePos = -1,
  17920. startChunk = 0,
  17921. currentWidth = 0;
  17922. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  17923. const [start, end] = positions[i];
  17924. const glyph = glyphs[i];
  17925. const glyphWidth = glyph.width * scale;
  17926. if (glyph.unicode === " ") {
  17927. if (currentWidth + glyphWidth > width) {
  17928. chunks.push(line.substring(startChunk, start));
  17929. startChunk = start;
  17930. currentWidth = glyphWidth;
  17931. lastSpacePosInStringStart = -1;
  17932. lastSpacePos = -1;
  17933. } else {
  17934. currentWidth += glyphWidth;
  17935. lastSpacePosInStringStart = start;
  17936. lastSpacePosInStringEnd = end;
  17937. lastSpacePos = i;
  17938. }
  17939. } else {
  17940. if (currentWidth + glyphWidth > width) {
  17941. if (lastSpacePosInStringStart !== -1) {
  17942. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  17943. startChunk = lastSpacePosInStringEnd;
  17944. i = lastSpacePos + 1;
  17945. lastSpacePosInStringStart = -1;
  17946. currentWidth = 0;
  17947. } else {
  17948. chunks.push(line.substring(startChunk, start));
  17949. startChunk = start;
  17950. currentWidth = glyphWidth;
  17951. }
  17952. } else {
  17953. currentWidth += glyphWidth;
  17954. }
  17955. }
  17956. }
  17957. if (startChunk < line.length) {
  17958. chunks.push(line.substring(startChunk, line.length));
  17959. }
  17960. return chunks;
  17961. }
  17962. getFieldObject() {
  17963. return {
  17964. id: this.data.id,
  17965. value: this.data.fieldValue,
  17966. defaultValue: this.data.defaultFieldValue,
  17967. multiline: this.data.multiLine,
  17968. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  17969. charLimit: this.data.maxLen,
  17970. comb: this.data.comb,
  17971. editable: !this.data.readOnly,
  17972. hidden: this.data.hidden,
  17973. name: this.data.fieldName,
  17974. rect: this.data.rect,
  17975. actions: this.data.actions,
  17976. page: this.data.pageIndex,
  17977. strokeColor: this.data.borderColor,
  17978. fillColor: this.data.backgroundColor,
  17979. type: "text"
  17980. };
  17981. }
  17982. }
  17983. class ButtonWidgetAnnotation extends WidgetAnnotation {
  17984. constructor(params) {
  17985. super(params);
  17986. this.checkedAppearance = null;
  17987. this.uncheckedAppearance = null;
  17988. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  17989. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  17990. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  17991. this.data.isTooltipOnly = false;
  17992. if (this.data.checkBox) {
  17993. this._processCheckBox(params);
  17994. } else if (this.data.radioButton) {
  17995. this._processRadioButton(params);
  17996. } else if (this.data.pushButton) {
  17997. this._processPushButton(params);
  17998. } else {
  17999. (0, _util.warn)("Invalid field flags for button widget annotation");
  18000. }
  18001. }
  18002. async getOperatorList(evaluator, task, renderForms, annotationStorage) {
  18003. if (this.data.pushButton) {
  18004. return super.getOperatorList(evaluator, task, false, annotationStorage);
  18005. }
  18006. let value = null;
  18007. if (annotationStorage) {
  18008. const storageEntry = annotationStorage.get(this.data.id);
  18009. value = storageEntry ? storageEntry.value : null;
  18010. }
  18011. if (value === null) {
  18012. if (this.appearance) {
  18013. return super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  18014. }
  18015. if (this.data.checkBox) {
  18016. value = this.data.fieldValue === this.data.exportValue;
  18017. } else {
  18018. value = this.data.fieldValue === this.data.buttonValue;
  18019. }
  18020. }
  18021. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  18022. if (appearance) {
  18023. const savedAppearance = this.appearance;
  18024. this.appearance = appearance;
  18025. const operatorList = super.getOperatorList(evaluator, task, renderForms, annotationStorage);
  18026. this.appearance = savedAppearance;
  18027. return operatorList;
  18028. }
  18029. return new _operator_list.OperatorList();
  18030. }
  18031. async save(evaluator, task, annotationStorage) {
  18032. if (this.data.checkBox) {
  18033. return this._saveCheckbox(evaluator, task, annotationStorage);
  18034. }
  18035. if (this.data.radioButton) {
  18036. return this._saveRadioButton(evaluator, task, annotationStorage);
  18037. }
  18038. return null;
  18039. }
  18040. async _saveCheckbox(evaluator, task, annotationStorage) {
  18041. if (!annotationStorage) {
  18042. return null;
  18043. }
  18044. const storageEntry = annotationStorage.get(this.data.id);
  18045. const value = storageEntry && storageEntry.value;
  18046. if (value === undefined) {
  18047. return null;
  18048. }
  18049. const defaultValue = this.data.fieldValue === this.data.exportValue;
  18050. if (defaultValue === value) {
  18051. return null;
  18052. }
  18053. const dict = evaluator.xref.fetchIfRef(this.ref);
  18054. if (!(0, _primitives.isDict)(dict)) {
  18055. return null;
  18056. }
  18057. const xfa = {
  18058. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18059. value: value ? this.data.exportValue : ""
  18060. };
  18061. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  18062. dict.set("V", name);
  18063. dict.set("AS", name);
  18064. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18065. const encrypt = evaluator.xref.encrypt;
  18066. let originalTransform = null;
  18067. if (encrypt) {
  18068. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18069. }
  18070. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18071. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18072. buffer.push("\nendobj\n");
  18073. return [{
  18074. ref: this.ref,
  18075. data: buffer.join(""),
  18076. xfa
  18077. }];
  18078. }
  18079. async _saveRadioButton(evaluator, task, annotationStorage) {
  18080. if (!annotationStorage) {
  18081. return null;
  18082. }
  18083. const storageEntry = annotationStorage.get(this.data.id);
  18084. const value = storageEntry && storageEntry.value;
  18085. if (value === undefined) {
  18086. return null;
  18087. }
  18088. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  18089. if (defaultValue === value) {
  18090. return null;
  18091. }
  18092. const dict = evaluator.xref.fetchIfRef(this.ref);
  18093. if (!(0, _primitives.isDict)(dict)) {
  18094. return null;
  18095. }
  18096. const xfa = {
  18097. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18098. value: value ? this.data.buttonValue : ""
  18099. };
  18100. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  18101. let parentBuffer = null;
  18102. const encrypt = evaluator.xref.encrypt;
  18103. if (value) {
  18104. if ((0, _primitives.isRef)(this.parent)) {
  18105. const parent = evaluator.xref.fetch(this.parent);
  18106. let parentTransform = null;
  18107. if (encrypt) {
  18108. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  18109. }
  18110. parent.set("V", name);
  18111. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  18112. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  18113. parentBuffer.push("\nendobj\n");
  18114. } else if ((0, _primitives.isDict)(this.parent)) {
  18115. this.parent.set("V", name);
  18116. }
  18117. }
  18118. dict.set("AS", name);
  18119. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18120. let originalTransform = null;
  18121. if (encrypt) {
  18122. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18123. }
  18124. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18125. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18126. buffer.push("\nendobj\n");
  18127. const newRefs = [{
  18128. ref: this.ref,
  18129. data: buffer.join(""),
  18130. xfa
  18131. }];
  18132. if (parentBuffer !== null) {
  18133. newRefs.push({
  18134. ref: this.parent,
  18135. data: parentBuffer.join(""),
  18136. xfa: null
  18137. });
  18138. }
  18139. return newRefs;
  18140. }
  18141. _getDefaultCheckedAppearance(params, type) {
  18142. const width = this.data.rect[2] - this.data.rect[0];
  18143. const height = this.data.rect[3] - this.data.rect[1];
  18144. const bbox = [0, 0, width, height];
  18145. const FONT_RATIO = 0.8;
  18146. const fontSize = Math.min(width, height) * FONT_RATIO;
  18147. let metrics, char;
  18148. if (type === "check") {
  18149. metrics = {
  18150. width: 0.755 * fontSize,
  18151. height: 0.705 * fontSize
  18152. };
  18153. char = "\x33";
  18154. } else if (type === "disc") {
  18155. metrics = {
  18156. width: 0.791 * fontSize,
  18157. height: 0.705 * fontSize
  18158. };
  18159. char = "\x6C";
  18160. } else {
  18161. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  18162. }
  18163. const xShift = (width - metrics.width) / 2;
  18164. const yShift = (height - metrics.height) / 2;
  18165. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  18166. const appearanceStreamDict = new _primitives.Dict(params.xref);
  18167. appearanceStreamDict.set("FormType", 1);
  18168. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  18169. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  18170. appearanceStreamDict.set("BBox", bbox);
  18171. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  18172. appearanceStreamDict.set("Length", appearance.length);
  18173. const resources = new _primitives.Dict(params.xref);
  18174. const font = new _primitives.Dict(params.xref);
  18175. font.set("PdfJsZaDb", this.fallbackFontDict);
  18176. resources.set("Font", font);
  18177. appearanceStreamDict.set("Resources", resources);
  18178. this.checkedAppearance = new _stream.StringStream(appearance);
  18179. this.checkedAppearance.dict = appearanceStreamDict;
  18180. this._streams.push(this.checkedAppearance);
  18181. }
  18182. _processCheckBox(params) {
  18183. const customAppearance = params.dict.get("AP");
  18184. if (!(0, _primitives.isDict)(customAppearance)) {
  18185. return;
  18186. }
  18187. const normalAppearance = customAppearance.get("N");
  18188. if (!(0, _primitives.isDict)(normalAppearance)) {
  18189. return;
  18190. }
  18191. const asValue = this._decodeFormValue(params.dict.get("AS"));
  18192. if (typeof asValue === "string") {
  18193. this.data.fieldValue = asValue;
  18194. }
  18195. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  18196. const exportValues = normalAppearance.getKeys();
  18197. if (exportValues.length === 0) {
  18198. exportValues.push("Off", yes);
  18199. } else if (exportValues.length === 1) {
  18200. if (exportValues[0] === "Off") {
  18201. exportValues.push(yes);
  18202. } else {
  18203. exportValues.unshift("Off");
  18204. }
  18205. } else if (exportValues.includes(yes)) {
  18206. exportValues.length = 0;
  18207. exportValues.push("Off", yes);
  18208. } else {
  18209. const otherYes = exportValues.find(v => v !== "Off");
  18210. exportValues.length = 0;
  18211. exportValues.push("Off", otherYes);
  18212. }
  18213. if (!exportValues.includes(this.data.fieldValue)) {
  18214. this.data.fieldValue = "Off";
  18215. }
  18216. this.data.exportValue = exportValues[1];
  18217. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  18218. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18219. if (this.checkedAppearance) {
  18220. this._streams.push(this.checkedAppearance);
  18221. } else {
  18222. this._getDefaultCheckedAppearance(params, "check");
  18223. }
  18224. if (this.uncheckedAppearance) {
  18225. this._streams.push(this.uncheckedAppearance);
  18226. }
  18227. this._fallbackFontDict = this.fallbackFontDict;
  18228. }
  18229. _processRadioButton(params) {
  18230. this.data.fieldValue = this.data.buttonValue = null;
  18231. const fieldParent = params.dict.get("Parent");
  18232. if ((0, _primitives.isDict)(fieldParent)) {
  18233. this.parent = params.dict.getRaw("Parent");
  18234. const fieldParentValue = fieldParent.get("V");
  18235. if ((0, _primitives.isName)(fieldParentValue)) {
  18236. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  18237. }
  18238. }
  18239. const appearanceStates = params.dict.get("AP");
  18240. if (!(0, _primitives.isDict)(appearanceStates)) {
  18241. return;
  18242. }
  18243. const normalAppearance = appearanceStates.get("N");
  18244. if (!(0, _primitives.isDict)(normalAppearance)) {
  18245. return;
  18246. }
  18247. for (const key of normalAppearance.getKeys()) {
  18248. if (key !== "Off") {
  18249. this.data.buttonValue = this._decodeFormValue(key);
  18250. break;
  18251. }
  18252. }
  18253. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  18254. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18255. if (this.checkedAppearance) {
  18256. this._streams.push(this.checkedAppearance);
  18257. } else {
  18258. this._getDefaultCheckedAppearance(params, "disc");
  18259. }
  18260. if (this.uncheckedAppearance) {
  18261. this._streams.push(this.uncheckedAppearance);
  18262. }
  18263. this._fallbackFontDict = this.fallbackFontDict;
  18264. }
  18265. _processPushButton(params) {
  18266. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  18267. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  18268. return;
  18269. }
  18270. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  18271. _catalog.Catalog.parseDestDictionary({
  18272. destDict: params.dict,
  18273. resultObj: this.data,
  18274. docBaseUrl: params.pdfManager.docBaseUrl
  18275. });
  18276. }
  18277. getFieldObject() {
  18278. let type = "button";
  18279. let exportValues;
  18280. if (this.data.checkBox) {
  18281. type = "checkbox";
  18282. exportValues = this.data.exportValue;
  18283. } else if (this.data.radioButton) {
  18284. type = "radiobutton";
  18285. exportValues = this.data.buttonValue;
  18286. }
  18287. return {
  18288. id: this.data.id,
  18289. value: this.data.fieldValue || "Off",
  18290. defaultValue: this.data.defaultFieldValue,
  18291. exportValues,
  18292. editable: !this.data.readOnly,
  18293. name: this.data.fieldName,
  18294. rect: this.data.rect,
  18295. hidden: this.data.hidden,
  18296. actions: this.data.actions,
  18297. page: this.data.pageIndex,
  18298. strokeColor: this.data.borderColor,
  18299. fillColor: this.data.backgroundColor,
  18300. type
  18301. };
  18302. }
  18303. get fallbackFontDict() {
  18304. const dict = new _primitives.Dict();
  18305. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  18306. dict.set("Type", _primitives.Name.get("FallbackType"));
  18307. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  18308. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  18309. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  18310. }
  18311. }
  18312. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  18313. constructor(params) {
  18314. super(params);
  18315. this.data.options = [];
  18316. const options = (0, _core_utils.getInheritableProperty)({
  18317. dict: params.dict,
  18318. key: "Opt"
  18319. });
  18320. if (Array.isArray(options)) {
  18321. const xref = params.xref;
  18322. for (let i = 0, ii = options.length; i < ii; i++) {
  18323. const option = xref.fetchIfRef(options[i]);
  18324. const isOptionArray = Array.isArray(option);
  18325. this.data.options[i] = {
  18326. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  18327. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  18328. };
  18329. }
  18330. }
  18331. if ((0, _util.isString)(this.data.fieldValue)) {
  18332. this.data.fieldValue = [this.data.fieldValue];
  18333. } else if (!this.data.fieldValue) {
  18334. this.data.fieldValue = [];
  18335. }
  18336. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  18337. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  18338. this._hasText = true;
  18339. }
  18340. getFieldObject() {
  18341. const type = this.data.combo ? "combobox" : "listbox";
  18342. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  18343. return {
  18344. id: this.data.id,
  18345. value,
  18346. defaultValue: this.data.defaultFieldValue,
  18347. editable: !this.data.readOnly,
  18348. name: this.data.fieldName,
  18349. rect: this.data.rect,
  18350. numItems: this.data.fieldValue.length,
  18351. multipleSelection: this.data.multiSelect,
  18352. hidden: this.data.hidden,
  18353. actions: this.data.actions,
  18354. items: this.data.options,
  18355. page: this.data.pageIndex,
  18356. strokeColor: this.data.borderColor,
  18357. fillColor: this.data.backgroundColor,
  18358. type
  18359. };
  18360. }
  18361. }
  18362. class SignatureWidgetAnnotation extends WidgetAnnotation {
  18363. constructor(params) {
  18364. super(params);
  18365. this.data.fieldValue = null;
  18366. }
  18367. getFieldObject() {
  18368. return {
  18369. id: this.data.id,
  18370. value: null,
  18371. page: this.data.pageIndex,
  18372. type: "signature"
  18373. };
  18374. }
  18375. }
  18376. class TextAnnotation extends MarkupAnnotation {
  18377. constructor(parameters) {
  18378. const DEFAULT_ICON_SIZE = 22;
  18379. super(parameters);
  18380. const dict = parameters.dict;
  18381. this.data.annotationType = _util.AnnotationType.TEXT;
  18382. if (this.data.hasAppearance) {
  18383. this.data.name = "NoIcon";
  18384. } else {
  18385. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  18386. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  18387. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  18388. }
  18389. if (dict.has("State")) {
  18390. this.data.state = dict.get("State") || null;
  18391. this.data.stateModel = dict.get("StateModel") || null;
  18392. } else {
  18393. this.data.state = null;
  18394. this.data.stateModel = null;
  18395. }
  18396. }
  18397. }
  18398. class LinkAnnotation extends Annotation {
  18399. constructor(params) {
  18400. super(params);
  18401. this.data.annotationType = _util.AnnotationType.LINK;
  18402. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  18403. if (quadPoints) {
  18404. this.data.quadPoints = quadPoints;
  18405. }
  18406. _catalog.Catalog.parseDestDictionary({
  18407. destDict: params.dict,
  18408. resultObj: this.data,
  18409. docBaseUrl: params.pdfManager.docBaseUrl
  18410. });
  18411. }
  18412. }
  18413. class PopupAnnotation extends Annotation {
  18414. constructor(parameters) {
  18415. super(parameters);
  18416. this.data.annotationType = _util.AnnotationType.POPUP;
  18417. let parentItem = parameters.dict.get("Parent");
  18418. if (!parentItem) {
  18419. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  18420. return;
  18421. }
  18422. const parentSubtype = parentItem.get("Subtype");
  18423. this.data.parentType = (0, _primitives.isName)(parentSubtype) ? parentSubtype.name : null;
  18424. const rawParent = parameters.dict.getRaw("Parent");
  18425. this.data.parentId = (0, _primitives.isRef)(rawParent) ? rawParent.toString() : null;
  18426. const parentRect = parentItem.getArray("Rect");
  18427. if (Array.isArray(parentRect) && parentRect.length === 4) {
  18428. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  18429. } else {
  18430. this.data.parentRect = [0, 0, 0, 0];
  18431. }
  18432. const rt = parentItem.get("RT");
  18433. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  18434. parentItem = parentItem.get("IRT");
  18435. }
  18436. if (!parentItem.has("M")) {
  18437. this.data.modificationDate = null;
  18438. } else {
  18439. this.setModificationDate(parentItem.get("M"));
  18440. this.data.modificationDate = this.modificationDate;
  18441. }
  18442. if (!parentItem.has("C")) {
  18443. this.data.color = null;
  18444. } else {
  18445. this.setColor(parentItem.getArray("C"));
  18446. this.data.color = this.color;
  18447. }
  18448. if (!this.viewable) {
  18449. const parentFlags = parentItem.get("F");
  18450. if (this._isViewable(parentFlags)) {
  18451. this.setFlags(parentFlags);
  18452. }
  18453. }
  18454. this.setTitle(parentItem.get("T"));
  18455. this.data.titleObj = this._title;
  18456. this.setContents(parentItem.get("Contents"));
  18457. this.data.contentsObj = this._contents;
  18458. }
  18459. }
  18460. class FreeTextAnnotation extends MarkupAnnotation {
  18461. constructor(parameters) {
  18462. super(parameters);
  18463. this.data.annotationType = _util.AnnotationType.FREETEXT;
  18464. }
  18465. }
  18466. class LineAnnotation extends MarkupAnnotation {
  18467. constructor(parameters) {
  18468. super(parameters);
  18469. this.data.annotationType = _util.AnnotationType.LINE;
  18470. const lineCoordinates = parameters.dict.getArray("L");
  18471. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  18472. if (!this.appearance) {
  18473. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18474. const strokeAlpha = parameters.dict.get("CA");
  18475. let fillColor = null,
  18476. interiorColor = parameters.dict.getArray("IC");
  18477. if (interiorColor) {
  18478. interiorColor = getRgbColor(interiorColor, null);
  18479. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18480. }
  18481. const fillAlpha = fillColor ? strokeAlpha : null;
  18482. const borderWidth = this.borderStyle.width || 1,
  18483. borderAdjust = 2 * borderWidth;
  18484. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  18485. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18486. this.rectangle = bbox;
  18487. }
  18488. this._setDefaultAppearance({
  18489. xref: parameters.xref,
  18490. extra: `${borderWidth} w`,
  18491. strokeColor,
  18492. fillColor,
  18493. strokeAlpha,
  18494. fillAlpha,
  18495. pointsCallback: (buffer, points) => {
  18496. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  18497. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  18498. }
  18499. });
  18500. }
  18501. }
  18502. }
  18503. class SquareAnnotation extends MarkupAnnotation {
  18504. constructor(parameters) {
  18505. super(parameters);
  18506. this.data.annotationType = _util.AnnotationType.SQUARE;
  18507. if (!this.appearance) {
  18508. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18509. const strokeAlpha = parameters.dict.get("CA");
  18510. let fillColor = null,
  18511. interiorColor = parameters.dict.getArray("IC");
  18512. if (interiorColor) {
  18513. interiorColor = getRgbColor(interiorColor, null);
  18514. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18515. }
  18516. const fillAlpha = fillColor ? strokeAlpha : null;
  18517. this._setDefaultAppearance({
  18518. xref: parameters.xref,
  18519. extra: `${this.borderStyle.width} w`,
  18520. strokeColor,
  18521. fillColor,
  18522. strokeAlpha,
  18523. fillAlpha,
  18524. pointsCallback: (buffer, points) => {
  18525. const x = points[2].x + this.borderStyle.width / 2;
  18526. const y = points[2].y + this.borderStyle.width / 2;
  18527. const width = points[3].x - points[2].x - this.borderStyle.width;
  18528. const height = points[1].y - points[3].y - this.borderStyle.width;
  18529. buffer.push(`${x} ${y} ${width} ${height} re`);
  18530. if (fillColor) {
  18531. buffer.push("B");
  18532. } else {
  18533. buffer.push("S");
  18534. }
  18535. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18536. }
  18537. });
  18538. }
  18539. }
  18540. }
  18541. class CircleAnnotation extends MarkupAnnotation {
  18542. constructor(parameters) {
  18543. super(parameters);
  18544. this.data.annotationType = _util.AnnotationType.CIRCLE;
  18545. if (!this.appearance) {
  18546. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18547. const strokeAlpha = parameters.dict.get("CA");
  18548. let fillColor = null;
  18549. let interiorColor = parameters.dict.getArray("IC");
  18550. if (interiorColor) {
  18551. interiorColor = getRgbColor(interiorColor, null);
  18552. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18553. }
  18554. const fillAlpha = fillColor ? strokeAlpha : null;
  18555. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  18556. this._setDefaultAppearance({
  18557. xref: parameters.xref,
  18558. extra: `${this.borderStyle.width} w`,
  18559. strokeColor,
  18560. fillColor,
  18561. strokeAlpha,
  18562. fillAlpha,
  18563. pointsCallback: (buffer, points) => {
  18564. const x0 = points[0].x + this.borderStyle.width / 2;
  18565. const y0 = points[0].y - this.borderStyle.width / 2;
  18566. const x1 = points[3].x - this.borderStyle.width / 2;
  18567. const y1 = points[3].y + this.borderStyle.width / 2;
  18568. const xMid = x0 + (x1 - x0) / 2;
  18569. const yMid = y0 + (y1 - y0) / 2;
  18570. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  18571. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  18572. buffer.push(`${xMid} ${y1} m`, `${xMid + xOffset} ${y1} ${x1} ${yMid + yOffset} ${x1} ${yMid} c`, `${x1} ${yMid - yOffset} ${xMid + xOffset} ${y0} ${xMid} ${y0} c`, `${xMid - xOffset} ${y0} ${x0} ${yMid - yOffset} ${x0} ${yMid} c`, `${x0} ${yMid + yOffset} ${xMid - xOffset} ${y1} ${xMid} ${y1} c`, "h");
  18573. if (fillColor) {
  18574. buffer.push("B");
  18575. } else {
  18576. buffer.push("S");
  18577. }
  18578. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18579. }
  18580. });
  18581. }
  18582. }
  18583. }
  18584. class PolylineAnnotation extends MarkupAnnotation {
  18585. constructor(parameters) {
  18586. super(parameters);
  18587. this.data.annotationType = _util.AnnotationType.POLYLINE;
  18588. this.data.vertices = [];
  18589. const rawVertices = parameters.dict.getArray("Vertices");
  18590. if (!Array.isArray(rawVertices)) {
  18591. return;
  18592. }
  18593. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  18594. this.data.vertices.push({
  18595. x: rawVertices[i],
  18596. y: rawVertices[i + 1]
  18597. });
  18598. }
  18599. if (!this.appearance) {
  18600. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18601. const strokeAlpha = parameters.dict.get("CA");
  18602. const borderWidth = this.borderStyle.width || 1,
  18603. borderAdjust = 2 * borderWidth;
  18604. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  18605. for (const vertex of this.data.vertices) {
  18606. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  18607. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  18608. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  18609. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  18610. }
  18611. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18612. this.rectangle = bbox;
  18613. }
  18614. this._setDefaultAppearance({
  18615. xref: parameters.xref,
  18616. extra: `${borderWidth} w`,
  18617. strokeColor,
  18618. strokeAlpha,
  18619. pointsCallback: (buffer, points) => {
  18620. const vertices = this.data.vertices;
  18621. for (let i = 0, ii = vertices.length; i < ii; i++) {
  18622. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  18623. }
  18624. buffer.push("S");
  18625. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18626. }
  18627. });
  18628. }
  18629. }
  18630. }
  18631. class PolygonAnnotation extends PolylineAnnotation {
  18632. constructor(parameters) {
  18633. super(parameters);
  18634. this.data.annotationType = _util.AnnotationType.POLYGON;
  18635. }
  18636. }
  18637. class CaretAnnotation extends MarkupAnnotation {
  18638. constructor(parameters) {
  18639. super(parameters);
  18640. this.data.annotationType = _util.AnnotationType.CARET;
  18641. }
  18642. }
  18643. class InkAnnotation extends MarkupAnnotation {
  18644. constructor(parameters) {
  18645. super(parameters);
  18646. this.data.annotationType = _util.AnnotationType.INK;
  18647. this.data.inkLists = [];
  18648. const rawInkLists = parameters.dict.getArray("InkList");
  18649. if (!Array.isArray(rawInkLists)) {
  18650. return;
  18651. }
  18652. const xref = parameters.xref;
  18653. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  18654. this.data.inkLists.push([]);
  18655. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  18656. this.data.inkLists[i].push({
  18657. x: xref.fetchIfRef(rawInkLists[i][j]),
  18658. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  18659. });
  18660. }
  18661. }
  18662. if (!this.appearance) {
  18663. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18664. const strokeAlpha = parameters.dict.get("CA");
  18665. const borderWidth = this.borderStyle.width || 1,
  18666. borderAdjust = 2 * borderWidth;
  18667. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  18668. for (const inkLists of this.data.inkLists) {
  18669. for (const vertex of inkLists) {
  18670. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  18671. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  18672. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  18673. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  18674. }
  18675. }
  18676. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18677. this.rectangle = bbox;
  18678. }
  18679. this._setDefaultAppearance({
  18680. xref: parameters.xref,
  18681. extra: `${borderWidth} w`,
  18682. strokeColor,
  18683. strokeAlpha,
  18684. pointsCallback: (buffer, points) => {
  18685. for (const inkList of this.data.inkLists) {
  18686. for (let i = 0, ii = inkList.length; i < ii; i++) {
  18687. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  18688. }
  18689. buffer.push("S");
  18690. }
  18691. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18692. }
  18693. });
  18694. }
  18695. }
  18696. }
  18697. class HighlightAnnotation extends MarkupAnnotation {
  18698. constructor(parameters) {
  18699. super(parameters);
  18700. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  18701. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18702. if (quadPoints) {
  18703. const resources = this.appearance && this.appearance.dict.get("Resources");
  18704. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  18705. if (this.appearance) {
  18706. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  18707. }
  18708. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  18709. const fillAlpha = parameters.dict.get("CA");
  18710. this._setDefaultAppearance({
  18711. xref: parameters.xref,
  18712. fillColor,
  18713. blendMode: "Multiply",
  18714. fillAlpha,
  18715. pointsCallback: (buffer, points) => {
  18716. buffer.push(`${points[0].x} ${points[0].y} m`, `${points[1].x} ${points[1].y} l`, `${points[3].x} ${points[3].y} l`, `${points[2].x} ${points[2].y} l`, "f");
  18717. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18718. }
  18719. });
  18720. }
  18721. } else {
  18722. this.data.hasPopup = false;
  18723. }
  18724. }
  18725. }
  18726. class UnderlineAnnotation extends MarkupAnnotation {
  18727. constructor(parameters) {
  18728. super(parameters);
  18729. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  18730. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18731. if (quadPoints) {
  18732. if (!this.appearance) {
  18733. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18734. const strokeAlpha = parameters.dict.get("CA");
  18735. this._setDefaultAppearance({
  18736. xref: parameters.xref,
  18737. extra: "[] 0 d 1 w",
  18738. strokeColor,
  18739. strokeAlpha,
  18740. pointsCallback: (buffer, points) => {
  18741. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  18742. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18743. }
  18744. });
  18745. }
  18746. } else {
  18747. this.data.hasPopup = false;
  18748. }
  18749. }
  18750. }
  18751. class SquigglyAnnotation extends MarkupAnnotation {
  18752. constructor(parameters) {
  18753. super(parameters);
  18754. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  18755. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18756. if (quadPoints) {
  18757. if (!this.appearance) {
  18758. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18759. const strokeAlpha = parameters.dict.get("CA");
  18760. this._setDefaultAppearance({
  18761. xref: parameters.xref,
  18762. extra: "[] 0 d 1 w",
  18763. strokeColor,
  18764. strokeAlpha,
  18765. pointsCallback: (buffer, points) => {
  18766. const dy = (points[0].y - points[2].y) / 6;
  18767. let shift = dy;
  18768. let x = points[2].x;
  18769. const y = points[2].y;
  18770. const xEnd = points[3].x;
  18771. buffer.push(`${x} ${y + shift} m`);
  18772. do {
  18773. x += 2;
  18774. shift = shift === 0 ? dy : 0;
  18775. buffer.push(`${x} ${y + shift} l`);
  18776. } while (x < xEnd);
  18777. buffer.push("S");
  18778. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  18779. }
  18780. });
  18781. }
  18782. } else {
  18783. this.data.hasPopup = false;
  18784. }
  18785. }
  18786. }
  18787. class StrikeOutAnnotation extends MarkupAnnotation {
  18788. constructor(parameters) {
  18789. super(parameters);
  18790. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  18791. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  18792. if (quadPoints) {
  18793. if (!this.appearance) {
  18794. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18795. const strokeAlpha = parameters.dict.get("CA");
  18796. this._setDefaultAppearance({
  18797. xref: parameters.xref,
  18798. extra: "[] 0 d 1 w",
  18799. strokeColor,
  18800. strokeAlpha,
  18801. pointsCallback: (buffer, points) => {
  18802. buffer.push(`${(points[0].x + points[2].x) / 2} ` + `${(points[0].y + points[2].y) / 2} m`, `${(points[1].x + points[3].x) / 2} ` + `${(points[1].y + points[3].y) / 2} l`, "S");
  18803. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18804. }
  18805. });
  18806. }
  18807. } else {
  18808. this.data.hasPopup = false;
  18809. }
  18810. }
  18811. }
  18812. class StampAnnotation extends MarkupAnnotation {
  18813. constructor(parameters) {
  18814. super(parameters);
  18815. this.data.annotationType = _util.AnnotationType.STAMP;
  18816. }
  18817. }
  18818. class FileAttachmentAnnotation extends MarkupAnnotation {
  18819. constructor(parameters) {
  18820. super(parameters);
  18821. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  18822. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  18823. this.data.file = file.serializable;
  18824. }
  18825. }
  18826. /***/ }),
  18827. /* 23 */
  18828. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18829. Object.defineProperty(exports, "__esModule", ({
  18830. value: true
  18831. }));
  18832. exports.createDefaultAppearance = createDefaultAppearance;
  18833. exports.parseDefaultAppearance = parseDefaultAppearance;
  18834. var _util = __w_pdfjs_require__(2);
  18835. var _colorspace = __w_pdfjs_require__(24);
  18836. var _core_utils = __w_pdfjs_require__(9);
  18837. var _evaluator = __w_pdfjs_require__(25);
  18838. var _primitives = __w_pdfjs_require__(5);
  18839. var _stream = __w_pdfjs_require__(10);
  18840. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  18841. constructor(str) {
  18842. super(new _stream.StringStream(str));
  18843. }
  18844. parse() {
  18845. const operation = {
  18846. fn: 0,
  18847. args: []
  18848. };
  18849. const result = {
  18850. fontSize: 0,
  18851. fontName: "",
  18852. fontColor: new Uint8ClampedArray(3)
  18853. };
  18854. try {
  18855. while (true) {
  18856. operation.args.length = 0;
  18857. if (!this.read(operation)) {
  18858. break;
  18859. }
  18860. if (this.savedStatesDepth !== 0) {
  18861. continue;
  18862. }
  18863. const {
  18864. fn,
  18865. args
  18866. } = operation;
  18867. switch (fn | 0) {
  18868. case _util.OPS.setFont:
  18869. const [fontName, fontSize] = args;
  18870. if (fontName instanceof _primitives.Name) {
  18871. result.fontName = fontName.name;
  18872. }
  18873. if (typeof fontSize === "number" && fontSize > 0) {
  18874. result.fontSize = fontSize;
  18875. }
  18876. break;
  18877. case _util.OPS.setFillRGBColor:
  18878. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  18879. break;
  18880. case _util.OPS.setFillGray:
  18881. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  18882. break;
  18883. case _util.OPS.setFillColorSpace:
  18884. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  18885. break;
  18886. }
  18887. }
  18888. } catch (reason) {
  18889. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  18890. }
  18891. return result;
  18892. }
  18893. }
  18894. function parseDefaultAppearance(str) {
  18895. return new DefaultAppearanceEvaluator(str).parse();
  18896. }
  18897. function createDefaultAppearance({
  18898. fontSize,
  18899. fontName,
  18900. fontColor
  18901. }) {
  18902. let colorCmd;
  18903. if (fontColor.every(c => c === 0)) {
  18904. colorCmd = "0 g";
  18905. } else {
  18906. colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg";
  18907. }
  18908. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${colorCmd}`;
  18909. }
  18910. /***/ }),
  18911. /* 24 */
  18912. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  18913. Object.defineProperty(exports, "__esModule", ({
  18914. value: true
  18915. }));
  18916. exports.ColorSpace = void 0;
  18917. var _util = __w_pdfjs_require__(2);
  18918. var _primitives = __w_pdfjs_require__(5);
  18919. var _core_utils = __w_pdfjs_require__(9);
  18920. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  18921. const COMPONENTS = 3;
  18922. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  18923. const xRatio = w1 / w2;
  18924. const yRatio = h1 / h2;
  18925. let newIndex = 0,
  18926. oldIndex;
  18927. const xScaled = new Uint16Array(w2);
  18928. const w1Scanline = w1 * COMPONENTS;
  18929. for (let i = 0; i < w2; i++) {
  18930. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  18931. }
  18932. for (let i = 0; i < h2; i++) {
  18933. const py = Math.floor(i * yRatio) * w1Scanline;
  18934. for (let j = 0; j < w2; j++) {
  18935. oldIndex = py + xScaled[j];
  18936. dest[newIndex++] = src[oldIndex++];
  18937. dest[newIndex++] = src[oldIndex++];
  18938. dest[newIndex++] = src[oldIndex++];
  18939. newIndex += alpha01;
  18940. }
  18941. }
  18942. }
  18943. class ColorSpace {
  18944. constructor(name, numComps) {
  18945. if (this.constructor === ColorSpace) {
  18946. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  18947. }
  18948. this.name = name;
  18949. this.numComps = numComps;
  18950. }
  18951. getRgb(src, srcOffset) {
  18952. const rgb = new Uint8ClampedArray(3);
  18953. this.getRgbItem(src, srcOffset, rgb, 0);
  18954. return rgb;
  18955. }
  18956. getRgbItem(src, srcOffset, dest, destOffset) {
  18957. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  18958. }
  18959. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  18960. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  18961. }
  18962. getOutputLength(inputLength, alpha01) {
  18963. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  18964. }
  18965. isPassthrough(bits) {
  18966. return false;
  18967. }
  18968. isDefaultDecode(decodeMap, bpc) {
  18969. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  18970. }
  18971. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  18972. const count = originalWidth * originalHeight;
  18973. let rgbBuf = null;
  18974. const numComponentColors = 1 << bpc;
  18975. const needsResizing = originalHeight !== height || originalWidth !== width;
  18976. if (this.isPassthrough(bpc)) {
  18977. rgbBuf = comps;
  18978. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  18979. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  18980. for (let i = 0; i < numComponentColors; i++) {
  18981. allColors[i] = i;
  18982. }
  18983. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  18984. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  18985. if (!needsResizing) {
  18986. let destPos = 0;
  18987. for (let i = 0; i < count; ++i) {
  18988. const key = comps[i] * 3;
  18989. dest[destPos++] = colorMap[key];
  18990. dest[destPos++] = colorMap[key + 1];
  18991. dest[destPos++] = colorMap[key + 2];
  18992. destPos += alpha01;
  18993. }
  18994. } else {
  18995. rgbBuf = new Uint8Array(count * 3);
  18996. let rgbPos = 0;
  18997. for (let i = 0; i < count; ++i) {
  18998. const key = comps[i] * 3;
  18999. rgbBuf[rgbPos++] = colorMap[key];
  19000. rgbBuf[rgbPos++] = colorMap[key + 1];
  19001. rgbBuf[rgbPos++] = colorMap[key + 2];
  19002. }
  19003. }
  19004. } else {
  19005. if (!needsResizing) {
  19006. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  19007. } else {
  19008. rgbBuf = new Uint8ClampedArray(count * 3);
  19009. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  19010. }
  19011. }
  19012. if (rgbBuf) {
  19013. if (needsResizing) {
  19014. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  19015. } else {
  19016. let destPos = 0,
  19017. rgbPos = 0;
  19018. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  19019. dest[destPos++] = rgbBuf[rgbPos++];
  19020. dest[destPos++] = rgbBuf[rgbPos++];
  19021. dest[destPos++] = rgbBuf[rgbPos++];
  19022. destPos += alpha01;
  19023. }
  19024. }
  19025. }
  19026. }
  19027. get usesZeroToOneRange() {
  19028. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  19029. }
  19030. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  19031. if (!localColorSpaceCache) {
  19032. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  19033. }
  19034. if (!parsedColorSpace) {
  19035. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  19036. }
  19037. let csName, csRef;
  19038. if (cacheKey instanceof _primitives.Ref) {
  19039. csRef = cacheKey;
  19040. cacheKey = xref.fetch(cacheKey);
  19041. }
  19042. if (cacheKey instanceof _primitives.Name) {
  19043. csName = cacheKey.name;
  19044. }
  19045. if (csName || csRef) {
  19046. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  19047. }
  19048. }
  19049. static getCached(cacheKey, xref, localColorSpaceCache) {
  19050. if (!localColorSpaceCache) {
  19051. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  19052. }
  19053. if (cacheKey instanceof _primitives.Ref) {
  19054. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  19055. if (localColorSpace) {
  19056. return localColorSpace;
  19057. }
  19058. try {
  19059. cacheKey = xref.fetch(cacheKey);
  19060. } catch (ex) {
  19061. if (ex instanceof _core_utils.MissingDataException) {
  19062. throw ex;
  19063. }
  19064. }
  19065. }
  19066. if (cacheKey instanceof _primitives.Name) {
  19067. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  19068. if (localColorSpace) {
  19069. return localColorSpace;
  19070. }
  19071. }
  19072. return null;
  19073. }
  19074. static async parseAsync({
  19075. cs,
  19076. xref,
  19077. resources = null,
  19078. pdfFunctionFactory,
  19079. localColorSpaceCache
  19080. }) {
  19081. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19082. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19083. return parsedColorSpace;
  19084. }
  19085. static parse({
  19086. cs,
  19087. xref,
  19088. resources = null,
  19089. pdfFunctionFactory,
  19090. localColorSpaceCache
  19091. }) {
  19092. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  19093. if (cachedColorSpace) {
  19094. return cachedColorSpace;
  19095. }
  19096. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19097. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19098. return parsedColorSpace;
  19099. }
  19100. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  19101. cs = xref.fetchIfRef(cs);
  19102. if ((0, _primitives.isName)(cs)) {
  19103. switch (cs.name) {
  19104. case "DeviceGray":
  19105. case "G":
  19106. return this.singletons.gray;
  19107. case "DeviceRGB":
  19108. case "RGB":
  19109. return this.singletons.rgb;
  19110. case "DeviceCMYK":
  19111. case "CMYK":
  19112. return this.singletons.cmyk;
  19113. case "Pattern":
  19114. return new PatternCS(null);
  19115. default:
  19116. if ((0, _primitives.isDict)(resources)) {
  19117. const colorSpaces = resources.get("ColorSpace");
  19118. if ((0, _primitives.isDict)(colorSpaces)) {
  19119. const resourcesCS = colorSpaces.get(cs.name);
  19120. if (resourcesCS) {
  19121. if ((0, _primitives.isName)(resourcesCS)) {
  19122. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  19123. }
  19124. cs = resourcesCS;
  19125. break;
  19126. }
  19127. }
  19128. }
  19129. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  19130. }
  19131. }
  19132. if (Array.isArray(cs)) {
  19133. const mode = xref.fetchIfRef(cs[0]).name;
  19134. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  19135. switch (mode) {
  19136. case "DeviceGray":
  19137. case "G":
  19138. return this.singletons.gray;
  19139. case "DeviceRGB":
  19140. case "RGB":
  19141. return this.singletons.rgb;
  19142. case "DeviceCMYK":
  19143. case "CMYK":
  19144. return this.singletons.cmyk;
  19145. case "CalGray":
  19146. params = xref.fetchIfRef(cs[1]);
  19147. whitePoint = params.getArray("WhitePoint");
  19148. blackPoint = params.getArray("BlackPoint");
  19149. gamma = params.get("Gamma");
  19150. return new CalGrayCS(whitePoint, blackPoint, gamma);
  19151. case "CalRGB":
  19152. params = xref.fetchIfRef(cs[1]);
  19153. whitePoint = params.getArray("WhitePoint");
  19154. blackPoint = params.getArray("BlackPoint");
  19155. gamma = params.getArray("Gamma");
  19156. const matrix = params.getArray("Matrix");
  19157. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  19158. case "ICCBased":
  19159. const stream = xref.fetchIfRef(cs[1]);
  19160. const dict = stream.dict;
  19161. numComps = dict.get("N");
  19162. const alt = dict.get("Alternate");
  19163. if (alt) {
  19164. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  19165. if (altCS.numComps === numComps) {
  19166. return altCS;
  19167. }
  19168. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  19169. }
  19170. if (numComps === 1) {
  19171. return this.singletons.gray;
  19172. } else if (numComps === 3) {
  19173. return this.singletons.rgb;
  19174. } else if (numComps === 4) {
  19175. return this.singletons.cmyk;
  19176. }
  19177. break;
  19178. case "Pattern":
  19179. baseCS = cs[1] || null;
  19180. if (baseCS) {
  19181. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  19182. }
  19183. return new PatternCS(baseCS);
  19184. case "Indexed":
  19185. case "I":
  19186. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  19187. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  19188. const lookup = xref.fetchIfRef(cs[3]);
  19189. return new IndexedCS(baseCS, hiVal, lookup);
  19190. case "Separation":
  19191. case "DeviceN":
  19192. const name = xref.fetchIfRef(cs[1]);
  19193. numComps = Array.isArray(name) ? name.length : 1;
  19194. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  19195. const tintFn = pdfFunctionFactory.create(cs[3]);
  19196. return new AlternateCS(numComps, baseCS, tintFn);
  19197. case "Lab":
  19198. params = xref.fetchIfRef(cs[1]);
  19199. whitePoint = params.getArray("WhitePoint");
  19200. blackPoint = params.getArray("BlackPoint");
  19201. const range = params.getArray("Range");
  19202. return new LabCS(whitePoint, blackPoint, range);
  19203. default:
  19204. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  19205. }
  19206. }
  19207. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  19208. }
  19209. static isDefaultDecode(decode, numComps) {
  19210. if (!Array.isArray(decode)) {
  19211. return true;
  19212. }
  19213. if (numComps * 2 !== decode.length) {
  19214. (0, _util.warn)("The decode map is not the correct length");
  19215. return true;
  19216. }
  19217. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  19218. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  19219. return false;
  19220. }
  19221. }
  19222. return true;
  19223. }
  19224. static get singletons() {
  19225. return (0, _util.shadow)(this, "singletons", {
  19226. get gray() {
  19227. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  19228. },
  19229. get rgb() {
  19230. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  19231. },
  19232. get cmyk() {
  19233. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  19234. }
  19235. });
  19236. }
  19237. }
  19238. exports.ColorSpace = ColorSpace;
  19239. class AlternateCS extends ColorSpace {
  19240. constructor(numComps, base, tintFn) {
  19241. super("Alternate", numComps);
  19242. this.base = base;
  19243. this.tintFn = tintFn;
  19244. this.tmpBuf = new Float32Array(base.numComps);
  19245. }
  19246. getRgbItem(src, srcOffset, dest, destOffset) {
  19247. const tmpBuf = this.tmpBuf;
  19248. this.tintFn(src, srcOffset, tmpBuf, 0);
  19249. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  19250. }
  19251. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19252. const tintFn = this.tintFn;
  19253. const base = this.base;
  19254. const scale = 1 / ((1 << bits) - 1);
  19255. const baseNumComps = base.numComps;
  19256. const usesZeroToOneRange = base.usesZeroToOneRange;
  19257. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  19258. let pos = isPassthrough ? destOffset : 0;
  19259. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  19260. const numComps = this.numComps;
  19261. const scaled = new Float32Array(numComps);
  19262. const tinted = new Float32Array(baseNumComps);
  19263. let i, j;
  19264. for (i = 0; i < count; i++) {
  19265. for (j = 0; j < numComps; j++) {
  19266. scaled[j] = src[srcOffset++] * scale;
  19267. }
  19268. tintFn(scaled, 0, tinted, 0);
  19269. if (usesZeroToOneRange) {
  19270. for (j = 0; j < baseNumComps; j++) {
  19271. baseBuf[pos++] = tinted[j] * 255;
  19272. }
  19273. } else {
  19274. base.getRgbItem(tinted, 0, baseBuf, pos);
  19275. pos += baseNumComps;
  19276. }
  19277. }
  19278. if (!isPassthrough) {
  19279. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  19280. }
  19281. }
  19282. getOutputLength(inputLength, alpha01) {
  19283. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  19284. }
  19285. }
  19286. class PatternCS extends ColorSpace {
  19287. constructor(baseCS) {
  19288. super("Pattern", null);
  19289. this.base = baseCS;
  19290. }
  19291. isDefaultDecode(decodeMap, bpc) {
  19292. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  19293. }
  19294. }
  19295. class IndexedCS extends ColorSpace {
  19296. constructor(base, highVal, lookup) {
  19297. super("Indexed", 1);
  19298. this.base = base;
  19299. this.highVal = highVal;
  19300. const length = base.numComps * highVal;
  19301. this.lookup = new Uint8Array(length);
  19302. if ((0, _primitives.isStream)(lookup)) {
  19303. const bytes = lookup.getBytes(length);
  19304. this.lookup.set(bytes);
  19305. } else if (typeof lookup === "string") {
  19306. for (let i = 0; i < length; ++i) {
  19307. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  19308. }
  19309. } else {
  19310. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  19311. }
  19312. }
  19313. getRgbItem(src, srcOffset, dest, destOffset) {
  19314. const numComps = this.base.numComps;
  19315. const start = src[srcOffset] * numComps;
  19316. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  19317. }
  19318. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19319. const base = this.base;
  19320. const numComps = base.numComps;
  19321. const outputDelta = base.getOutputLength(numComps, alpha01);
  19322. const lookup = this.lookup;
  19323. for (let i = 0; i < count; ++i) {
  19324. const lookupPos = src[srcOffset++] * numComps;
  19325. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  19326. destOffset += outputDelta;
  19327. }
  19328. }
  19329. getOutputLength(inputLength, alpha01) {
  19330. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  19331. }
  19332. isDefaultDecode(decodeMap, bpc) {
  19333. if (!Array.isArray(decodeMap)) {
  19334. return true;
  19335. }
  19336. if (decodeMap.length !== 2) {
  19337. (0, _util.warn)("Decode map length is not correct");
  19338. return true;
  19339. }
  19340. if (!Number.isInteger(bpc) || bpc < 1) {
  19341. (0, _util.warn)("Bits per component is not correct");
  19342. return true;
  19343. }
  19344. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  19345. }
  19346. }
  19347. class DeviceGrayCS extends ColorSpace {
  19348. constructor() {
  19349. super("DeviceGray", 1);
  19350. }
  19351. getRgbItem(src, srcOffset, dest, destOffset) {
  19352. const c = src[srcOffset] * 255;
  19353. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  19354. }
  19355. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19356. const scale = 255 / ((1 << bits) - 1);
  19357. let j = srcOffset,
  19358. q = destOffset;
  19359. for (let i = 0; i < count; ++i) {
  19360. const c = scale * src[j++];
  19361. dest[q++] = c;
  19362. dest[q++] = c;
  19363. dest[q++] = c;
  19364. q += alpha01;
  19365. }
  19366. }
  19367. getOutputLength(inputLength, alpha01) {
  19368. return inputLength * (3 + alpha01);
  19369. }
  19370. }
  19371. class DeviceRgbCS extends ColorSpace {
  19372. constructor() {
  19373. super("DeviceRGB", 3);
  19374. }
  19375. getRgbItem(src, srcOffset, dest, destOffset) {
  19376. dest[destOffset] = src[srcOffset] * 255;
  19377. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  19378. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  19379. }
  19380. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19381. if (bits === 8 && alpha01 === 0) {
  19382. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  19383. return;
  19384. }
  19385. const scale = 255 / ((1 << bits) - 1);
  19386. let j = srcOffset,
  19387. q = destOffset;
  19388. for (let i = 0; i < count; ++i) {
  19389. dest[q++] = scale * src[j++];
  19390. dest[q++] = scale * src[j++];
  19391. dest[q++] = scale * src[j++];
  19392. q += alpha01;
  19393. }
  19394. }
  19395. getOutputLength(inputLength, alpha01) {
  19396. return inputLength * (3 + alpha01) / 3 | 0;
  19397. }
  19398. isPassthrough(bits) {
  19399. return bits === 8;
  19400. }
  19401. }
  19402. const DeviceCmykCS = function DeviceCmykCSClosure() {
  19403. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  19404. const c = src[srcOffset] * srcScale;
  19405. const m = src[srcOffset + 1] * srcScale;
  19406. const y = src[srcOffset + 2] * srcScale;
  19407. const k = src[srcOffset + 3] * srcScale;
  19408. 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);
  19409. 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);
  19410. 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);
  19411. }
  19412. class DeviceCmykCS extends ColorSpace {
  19413. constructor() {
  19414. super("DeviceCMYK", 4);
  19415. }
  19416. getRgbItem(src, srcOffset, dest, destOffset) {
  19417. convertToRgb(src, srcOffset, 1, dest, destOffset);
  19418. }
  19419. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19420. const scale = 1 / ((1 << bits) - 1);
  19421. for (let i = 0; i < count; i++) {
  19422. convertToRgb(src, srcOffset, scale, dest, destOffset);
  19423. srcOffset += 4;
  19424. destOffset += 3 + alpha01;
  19425. }
  19426. }
  19427. getOutputLength(inputLength, alpha01) {
  19428. return inputLength / 4 * (3 + alpha01) | 0;
  19429. }
  19430. }
  19431. return DeviceCmykCS;
  19432. }();
  19433. const CalGrayCS = function CalGrayCSClosure() {
  19434. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19435. const A = src[srcOffset] * scale;
  19436. const AG = A ** cs.G;
  19437. const L = cs.YW * AG;
  19438. const val = Math.max(295.8 * L ** 0.333333333333333333 - 40.8, 0);
  19439. dest[destOffset] = val;
  19440. dest[destOffset + 1] = val;
  19441. dest[destOffset + 2] = val;
  19442. }
  19443. class CalGrayCS extends ColorSpace {
  19444. constructor(whitePoint, blackPoint, gamma) {
  19445. super("CalGray", 1);
  19446. if (!whitePoint) {
  19447. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  19448. }
  19449. blackPoint = blackPoint || [0, 0, 0];
  19450. gamma = gamma || 1;
  19451. this.XW = whitePoint[0];
  19452. this.YW = whitePoint[1];
  19453. this.ZW = whitePoint[2];
  19454. this.XB = blackPoint[0];
  19455. this.YB = blackPoint[1];
  19456. this.ZB = blackPoint[2];
  19457. this.G = gamma;
  19458. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  19459. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  19460. }
  19461. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  19462. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  19463. this.XB = this.YB = this.ZB = 0;
  19464. }
  19465. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  19466. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  19467. }
  19468. if (this.G < 1) {
  19469. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  19470. this.G = 1;
  19471. }
  19472. }
  19473. getRgbItem(src, srcOffset, dest, destOffset) {
  19474. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  19475. }
  19476. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19477. const scale = 1 / ((1 << bits) - 1);
  19478. for (let i = 0; i < count; ++i) {
  19479. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  19480. srcOffset += 1;
  19481. destOffset += 3 + alpha01;
  19482. }
  19483. }
  19484. getOutputLength(inputLength, alpha01) {
  19485. return inputLength * (3 + alpha01);
  19486. }
  19487. }
  19488. return CalGrayCS;
  19489. }();
  19490. const CalRGBCS = function CalRGBCSClosure() {
  19491. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  19492. 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]);
  19493. 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]);
  19494. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  19495. const tempNormalizeMatrix = new Float32Array(3);
  19496. const tempConvertMatrix1 = new Float32Array(3);
  19497. const tempConvertMatrix2 = new Float32Array(3);
  19498. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  19499. function matrixProduct(a, b, result) {
  19500. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  19501. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  19502. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  19503. }
  19504. function convertToFlat(sourceWhitePoint, LMS, result) {
  19505. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  19506. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  19507. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  19508. }
  19509. function convertToD65(sourceWhitePoint, LMS, result) {
  19510. const D65X = 0.95047;
  19511. const D65Y = 1;
  19512. const D65Z = 1.08883;
  19513. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  19514. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  19515. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  19516. }
  19517. function sRGBTransferFunction(color) {
  19518. if (color <= 0.0031308) {
  19519. return adjustToRange(0, 1, 12.92 * color);
  19520. }
  19521. if (color >= 0.99554525) {
  19522. return 1;
  19523. }
  19524. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  19525. }
  19526. function adjustToRange(min, max, value) {
  19527. return Math.max(min, Math.min(max, value));
  19528. }
  19529. function decodeL(L) {
  19530. if (L < 0) {
  19531. return -decodeL(-L);
  19532. }
  19533. if (L > 8.0) {
  19534. return ((L + 16) / 116) ** 3;
  19535. }
  19536. return L * DECODE_L_CONSTANT;
  19537. }
  19538. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  19539. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  19540. result[0] = XYZ_Flat[0];
  19541. result[1] = XYZ_Flat[1];
  19542. result[2] = XYZ_Flat[2];
  19543. return;
  19544. }
  19545. const zeroDecodeL = decodeL(0);
  19546. const X_DST = zeroDecodeL;
  19547. const X_SRC = decodeL(sourceBlackPoint[0]);
  19548. const Y_DST = zeroDecodeL;
  19549. const Y_SRC = decodeL(sourceBlackPoint[1]);
  19550. const Z_DST = zeroDecodeL;
  19551. const Z_SRC = decodeL(sourceBlackPoint[2]);
  19552. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  19553. const X_Offset = 1 - X_Scale;
  19554. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  19555. const Y_Offset = 1 - Y_Scale;
  19556. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  19557. const Z_Offset = 1 - Z_Scale;
  19558. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  19559. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  19560. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  19561. }
  19562. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  19563. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  19564. result[0] = XYZ_In[0];
  19565. result[1] = XYZ_In[1];
  19566. result[2] = XYZ_In[2];
  19567. return;
  19568. }
  19569. const LMS = result;
  19570. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19571. const LMS_Flat = tempNormalizeMatrix;
  19572. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  19573. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  19574. }
  19575. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  19576. const LMS = result;
  19577. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19578. const LMS_D65 = tempNormalizeMatrix;
  19579. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  19580. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  19581. }
  19582. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19583. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  19584. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  19585. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  19586. const AGR = A === 1 ? 1 : A ** cs.GR;
  19587. const BGG = B === 1 ? 1 : B ** cs.GG;
  19588. const CGB = C === 1 ? 1 : C ** cs.GB;
  19589. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  19590. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  19591. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  19592. const XYZ = tempConvertMatrix1;
  19593. XYZ[0] = X;
  19594. XYZ[1] = Y;
  19595. XYZ[2] = Z;
  19596. const XYZ_Flat = tempConvertMatrix2;
  19597. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  19598. const XYZ_Black = tempConvertMatrix1;
  19599. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  19600. const XYZ_D65 = tempConvertMatrix2;
  19601. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  19602. const SRGB = tempConvertMatrix1;
  19603. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  19604. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  19605. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  19606. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  19607. }
  19608. class CalRGBCS extends ColorSpace {
  19609. constructor(whitePoint, blackPoint, gamma, matrix) {
  19610. super("CalRGB", 3);
  19611. if (!whitePoint) {
  19612. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  19613. }
  19614. blackPoint = blackPoint || new Float32Array(3);
  19615. gamma = gamma || new Float32Array([1, 1, 1]);
  19616. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  19617. const XW = whitePoint[0];
  19618. const YW = whitePoint[1];
  19619. const ZW = whitePoint[2];
  19620. this.whitePoint = whitePoint;
  19621. const XB = blackPoint[0];
  19622. const YB = blackPoint[1];
  19623. const ZB = blackPoint[2];
  19624. this.blackPoint = blackPoint;
  19625. this.GR = gamma[0];
  19626. this.GG = gamma[1];
  19627. this.GB = gamma[2];
  19628. this.MXA = matrix[0];
  19629. this.MYA = matrix[1];
  19630. this.MZA = matrix[2];
  19631. this.MXB = matrix[3];
  19632. this.MYB = matrix[4];
  19633. this.MZB = matrix[5];
  19634. this.MXC = matrix[6];
  19635. this.MYC = matrix[7];
  19636. this.MZC = matrix[8];
  19637. if (XW < 0 || ZW < 0 || YW !== 1) {
  19638. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  19639. }
  19640. if (XB < 0 || YB < 0 || ZB < 0) {
  19641. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  19642. this.blackPoint = new Float32Array(3);
  19643. }
  19644. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  19645. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  19646. this.GR = this.GG = this.GB = 1;
  19647. }
  19648. }
  19649. getRgbItem(src, srcOffset, dest, destOffset) {
  19650. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  19651. }
  19652. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19653. const scale = 1 / ((1 << bits) - 1);
  19654. for (let i = 0; i < count; ++i) {
  19655. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  19656. srcOffset += 3;
  19657. destOffset += 3 + alpha01;
  19658. }
  19659. }
  19660. getOutputLength(inputLength, alpha01) {
  19661. return inputLength * (3 + alpha01) / 3 | 0;
  19662. }
  19663. }
  19664. return CalRGBCS;
  19665. }();
  19666. const LabCS = function LabCSClosure() {
  19667. function fn_g(x) {
  19668. let result;
  19669. if (x >= 6 / 29) {
  19670. result = x ** 3;
  19671. } else {
  19672. result = 108 / 841 * (x - 4 / 29);
  19673. }
  19674. return result;
  19675. }
  19676. function decode(value, high1, low2, high2) {
  19677. return low2 + value * (high2 - low2) / high1;
  19678. }
  19679. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  19680. let Ls = src[srcOffset];
  19681. let as = src[srcOffset + 1];
  19682. let bs = src[srcOffset + 2];
  19683. if (maxVal !== false) {
  19684. Ls = decode(Ls, maxVal, 0, 100);
  19685. as = decode(as, maxVal, cs.amin, cs.amax);
  19686. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  19687. }
  19688. if (as > cs.amax) {
  19689. as = cs.amax;
  19690. } else if (as < cs.amin) {
  19691. as = cs.amin;
  19692. }
  19693. if (bs > cs.bmax) {
  19694. bs = cs.bmax;
  19695. } else if (bs < cs.bmin) {
  19696. bs = cs.bmin;
  19697. }
  19698. const M = (Ls + 16) / 116;
  19699. const L = M + as / 500;
  19700. const N = M - bs / 200;
  19701. const X = cs.XW * fn_g(L);
  19702. const Y = cs.YW * fn_g(M);
  19703. const Z = cs.ZW * fn_g(N);
  19704. let r, g, b;
  19705. if (cs.ZW < 1) {
  19706. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  19707. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  19708. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  19709. } else {
  19710. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  19711. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  19712. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  19713. }
  19714. dest[destOffset] = Math.sqrt(r) * 255;
  19715. dest[destOffset + 1] = Math.sqrt(g) * 255;
  19716. dest[destOffset + 2] = Math.sqrt(b) * 255;
  19717. }
  19718. class LabCS extends ColorSpace {
  19719. constructor(whitePoint, blackPoint, range) {
  19720. super("Lab", 3);
  19721. if (!whitePoint) {
  19722. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  19723. }
  19724. blackPoint = blackPoint || [0, 0, 0];
  19725. range = range || [-100, 100, -100, 100];
  19726. this.XW = whitePoint[0];
  19727. this.YW = whitePoint[1];
  19728. this.ZW = whitePoint[2];
  19729. this.amin = range[0];
  19730. this.amax = range[1];
  19731. this.bmin = range[2];
  19732. this.bmax = range[3];
  19733. this.XB = blackPoint[0];
  19734. this.YB = blackPoint[1];
  19735. this.ZB = blackPoint[2];
  19736. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  19737. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  19738. }
  19739. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  19740. (0, _util.info)("Invalid BlackPoint, falling back to default");
  19741. this.XB = this.YB = this.ZB = 0;
  19742. }
  19743. if (this.amin > this.amax || this.bmin > this.bmax) {
  19744. (0, _util.info)("Invalid Range, falling back to defaults");
  19745. this.amin = -100;
  19746. this.amax = 100;
  19747. this.bmin = -100;
  19748. this.bmax = 100;
  19749. }
  19750. }
  19751. getRgbItem(src, srcOffset, dest, destOffset) {
  19752. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  19753. }
  19754. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19755. const maxVal = (1 << bits) - 1;
  19756. for (let i = 0; i < count; i++) {
  19757. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  19758. srcOffset += 3;
  19759. destOffset += 3 + alpha01;
  19760. }
  19761. }
  19762. getOutputLength(inputLength, alpha01) {
  19763. return inputLength * (3 + alpha01) / 3 | 0;
  19764. }
  19765. isDefaultDecode(decodeMap, bpc) {
  19766. return true;
  19767. }
  19768. get usesZeroToOneRange() {
  19769. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  19770. }
  19771. }
  19772. return LabCS;
  19773. }();
  19774. /***/ }),
  19775. /* 25 */
  19776. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19777. Object.defineProperty(exports, "__esModule", ({
  19778. value: true
  19779. }));
  19780. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  19781. var _util = __w_pdfjs_require__(2);
  19782. var _cmap = __w_pdfjs_require__(26);
  19783. var _primitives = __w_pdfjs_require__(5);
  19784. var _fonts = __w_pdfjs_require__(44);
  19785. var _fonts_utils = __w_pdfjs_require__(18);
  19786. var _encodings = __w_pdfjs_require__(19);
  19787. var _standard_fonts = __w_pdfjs_require__(47);
  19788. var _unicode = __w_pdfjs_require__(21);
  19789. var _pattern = __w_pdfjs_require__(55);
  19790. var _xfa_fonts = __w_pdfjs_require__(12);
  19791. var _to_unicode_map = __w_pdfjs_require__(48);
  19792. var _function = __w_pdfjs_require__(56);
  19793. var _parser = __w_pdfjs_require__(27);
  19794. var _image_utils = __w_pdfjs_require__(58);
  19795. var _stream = __w_pdfjs_require__(10);
  19796. var _bidi = __w_pdfjs_require__(59);
  19797. var _colorspace = __w_pdfjs_require__(24);
  19798. var _decode_stream = __w_pdfjs_require__(29);
  19799. var _glyphlist = __w_pdfjs_require__(20);
  19800. var _core_utils = __w_pdfjs_require__(9);
  19801. var _metrics = __w_pdfjs_require__(60);
  19802. var _murmurhash = __w_pdfjs_require__(61);
  19803. var _operator_list = __w_pdfjs_require__(62);
  19804. var _image = __w_pdfjs_require__(63);
  19805. const DefaultPartialEvaluatorOptions = Object.freeze({
  19806. maxImageSize: -1,
  19807. disableFontFace: false,
  19808. ignoreErrors: false,
  19809. isEvalSupported: true,
  19810. fontExtraProperties: false,
  19811. useSystemFonts: true,
  19812. cMapUrl: null,
  19813. standardFontDataUrl: null
  19814. });
  19815. const PatternType = {
  19816. TILING: 1,
  19817. SHADING: 2
  19818. };
  19819. const TEXT_CHUNK_BATCH_SIZE = 10;
  19820. const deferred = Promise.resolve();
  19821. function normalizeBlendMode(value, parsingArray = false) {
  19822. if (Array.isArray(value)) {
  19823. for (let i = 0, ii = value.length; i < ii; i++) {
  19824. const maybeBM = normalizeBlendMode(value[i], true);
  19825. if (maybeBM) {
  19826. return maybeBM;
  19827. }
  19828. }
  19829. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  19830. return "source-over";
  19831. }
  19832. if (!(0, _primitives.isName)(value)) {
  19833. if (parsingArray) {
  19834. return null;
  19835. }
  19836. return "source-over";
  19837. }
  19838. switch (value.name) {
  19839. case "Normal":
  19840. case "Compatible":
  19841. return "source-over";
  19842. case "Multiply":
  19843. return "multiply";
  19844. case "Screen":
  19845. return "screen";
  19846. case "Overlay":
  19847. return "overlay";
  19848. case "Darken":
  19849. return "darken";
  19850. case "Lighten":
  19851. return "lighten";
  19852. case "ColorDodge":
  19853. return "color-dodge";
  19854. case "ColorBurn":
  19855. return "color-burn";
  19856. case "HardLight":
  19857. return "hard-light";
  19858. case "SoftLight":
  19859. return "soft-light";
  19860. case "Difference":
  19861. return "difference";
  19862. case "Exclusion":
  19863. return "exclusion";
  19864. case "Hue":
  19865. return "hue";
  19866. case "Saturation":
  19867. return "saturation";
  19868. case "Color":
  19869. return "color";
  19870. case "Luminosity":
  19871. return "luminosity";
  19872. }
  19873. if (parsingArray) {
  19874. return null;
  19875. }
  19876. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  19877. return "source-over";
  19878. }
  19879. class TimeSlotManager {
  19880. static get TIME_SLOT_DURATION_MS() {
  19881. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  19882. }
  19883. static get CHECK_TIME_EVERY() {
  19884. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  19885. }
  19886. constructor() {
  19887. this.reset();
  19888. }
  19889. check() {
  19890. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  19891. return false;
  19892. }
  19893. this.checked = 0;
  19894. return this.endTime <= Date.now();
  19895. }
  19896. reset() {
  19897. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  19898. this.checked = 0;
  19899. }
  19900. }
  19901. class PartialEvaluator {
  19902. constructor({
  19903. xref,
  19904. handler,
  19905. pageIndex,
  19906. idFactory,
  19907. fontCache,
  19908. builtInCMapCache,
  19909. standardFontDataCache,
  19910. globalImageCache,
  19911. options = null
  19912. }) {
  19913. this.xref = xref;
  19914. this.handler = handler;
  19915. this.pageIndex = pageIndex;
  19916. this.idFactory = idFactory;
  19917. this.fontCache = fontCache;
  19918. this.builtInCMapCache = builtInCMapCache;
  19919. this.standardFontDataCache = standardFontDataCache;
  19920. this.globalImageCache = globalImageCache;
  19921. this.options = options || DefaultPartialEvaluatorOptions;
  19922. this.parsingType3Font = false;
  19923. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  19924. }
  19925. get _pdfFunctionFactory() {
  19926. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  19927. xref: this.xref,
  19928. isEvalSupported: this.options.isEvalSupported
  19929. });
  19930. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  19931. }
  19932. clone(newOptions = null) {
  19933. const newEvaluator = Object.create(this);
  19934. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  19935. return newEvaluator;
  19936. }
  19937. hasBlendModes(resources, nonBlendModesSet) {
  19938. if (!(resources instanceof _primitives.Dict)) {
  19939. return false;
  19940. }
  19941. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  19942. return false;
  19943. }
  19944. const processed = new _primitives.RefSet(nonBlendModesSet);
  19945. if (resources.objId) {
  19946. processed.put(resources.objId);
  19947. }
  19948. const nodes = [resources],
  19949. xref = this.xref;
  19950. while (nodes.length) {
  19951. const node = nodes.shift();
  19952. const graphicStates = node.get("ExtGState");
  19953. if (graphicStates instanceof _primitives.Dict) {
  19954. for (let graphicState of graphicStates.getRawValues()) {
  19955. if (graphicState instanceof _primitives.Ref) {
  19956. if (processed.has(graphicState)) {
  19957. continue;
  19958. }
  19959. try {
  19960. graphicState = xref.fetch(graphicState);
  19961. } catch (ex) {
  19962. processed.put(graphicState);
  19963. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  19964. continue;
  19965. }
  19966. }
  19967. if (!(graphicState instanceof _primitives.Dict)) {
  19968. continue;
  19969. }
  19970. if (graphicState.objId) {
  19971. processed.put(graphicState.objId);
  19972. }
  19973. const bm = graphicState.get("BM");
  19974. if (bm instanceof _primitives.Name) {
  19975. if (bm.name !== "Normal") {
  19976. return true;
  19977. }
  19978. continue;
  19979. }
  19980. if (bm !== undefined && Array.isArray(bm)) {
  19981. for (const element of bm) {
  19982. if (element instanceof _primitives.Name && element.name !== "Normal") {
  19983. return true;
  19984. }
  19985. }
  19986. }
  19987. }
  19988. }
  19989. const xObjects = node.get("XObject");
  19990. if (!(xObjects instanceof _primitives.Dict)) {
  19991. continue;
  19992. }
  19993. for (let xObject of xObjects.getRawValues()) {
  19994. if (xObject instanceof _primitives.Ref) {
  19995. if (processed.has(xObject)) {
  19996. continue;
  19997. }
  19998. try {
  19999. xObject = xref.fetch(xObject);
  20000. } catch (ex) {
  20001. processed.put(xObject);
  20002. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  20003. continue;
  20004. }
  20005. }
  20006. if (!(0, _primitives.isStream)(xObject)) {
  20007. continue;
  20008. }
  20009. if (xObject.dict.objId) {
  20010. processed.put(xObject.dict.objId);
  20011. }
  20012. const xResources = xObject.dict.get("Resources");
  20013. if (!(xResources instanceof _primitives.Dict)) {
  20014. continue;
  20015. }
  20016. if (xResources.objId && processed.has(xResources.objId)) {
  20017. continue;
  20018. }
  20019. nodes.push(xResources);
  20020. if (xResources.objId) {
  20021. processed.put(xResources.objId);
  20022. }
  20023. }
  20024. }
  20025. processed.forEach(ref => {
  20026. nonBlendModesSet.put(ref);
  20027. });
  20028. return false;
  20029. }
  20030. async fetchBuiltInCMap(name) {
  20031. const cachedData = this.builtInCMapCache.get(name);
  20032. if (cachedData) {
  20033. return cachedData;
  20034. }
  20035. let data;
  20036. if (this.options.cMapUrl !== null) {
  20037. const url = `${this.options.cMapUrl}${name}.bcmap`;
  20038. const response = await fetch(url);
  20039. if (!response.ok) {
  20040. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  20041. }
  20042. data = {
  20043. cMapData: new Uint8Array(await response.arrayBuffer()),
  20044. compressionType: _util.CMapCompressionType.BINARY
  20045. };
  20046. } else {
  20047. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  20048. name
  20049. });
  20050. }
  20051. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  20052. this.builtInCMapCache.set(name, data);
  20053. }
  20054. return data;
  20055. }
  20056. async fetchStandardFontData(name) {
  20057. const cachedData = this.standardFontDataCache.get(name);
  20058. if (cachedData) {
  20059. return new _stream.Stream(cachedData);
  20060. }
  20061. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  20062. return null;
  20063. }
  20064. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  20065. filename = standardFontNameToFileName[name];
  20066. let data;
  20067. if (this.options.standardFontDataUrl !== null) {
  20068. const url = `${this.options.standardFontDataUrl}${filename}`;
  20069. const response = await fetch(url);
  20070. if (!response.ok) {
  20071. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  20072. } else {
  20073. data = await response.arrayBuffer();
  20074. }
  20075. } else {
  20076. try {
  20077. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  20078. filename
  20079. });
  20080. } catch (e) {
  20081. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  20082. }
  20083. }
  20084. if (!data) {
  20085. return null;
  20086. }
  20087. this.standardFontDataCache.set(name, data);
  20088. return new _stream.Stream(data);
  20089. }
  20090. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  20091. const dict = xobj.dict;
  20092. const matrix = dict.getArray("Matrix");
  20093. let bbox = dict.getArray("BBox");
  20094. if (Array.isArray(bbox) && bbox.length === 4) {
  20095. bbox = _util.Util.normalizeRect(bbox);
  20096. } else {
  20097. bbox = null;
  20098. }
  20099. let optionalContent, groupOptions;
  20100. if (dict.has("OC")) {
  20101. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20102. }
  20103. if (optionalContent !== undefined) {
  20104. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  20105. }
  20106. const group = dict.get("Group");
  20107. if (group) {
  20108. groupOptions = {
  20109. matrix,
  20110. bbox,
  20111. smask,
  20112. isolated: false,
  20113. knockout: false
  20114. };
  20115. const groupSubtype = group.get("S");
  20116. let colorSpace = null;
  20117. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  20118. groupOptions.isolated = group.get("I") || false;
  20119. groupOptions.knockout = group.get("K") || false;
  20120. if (group.has("CS")) {
  20121. const cs = group.getRaw("CS");
  20122. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  20123. if (cachedColorSpace) {
  20124. colorSpace = cachedColorSpace;
  20125. } else {
  20126. colorSpace = await this.parseColorSpace({
  20127. cs,
  20128. resources,
  20129. localColorSpaceCache
  20130. });
  20131. }
  20132. }
  20133. }
  20134. if (smask && smask.backdrop) {
  20135. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  20136. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  20137. }
  20138. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  20139. }
  20140. operatorList.addOp(_util.OPS.paintFormXObjectBegin, [matrix, bbox]);
  20141. return this.getOperatorList({
  20142. stream: xobj,
  20143. task,
  20144. resources: dict.get("Resources") || resources,
  20145. operatorList,
  20146. initialState
  20147. }).then(function () {
  20148. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  20149. if (group) {
  20150. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  20151. }
  20152. if (optionalContent !== undefined) {
  20153. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20154. }
  20155. });
  20156. }
  20157. _sendImgData(objId, imgData, cacheGlobally = false) {
  20158. const transfers = imgData ? [imgData.data.buffer] : null;
  20159. if (this.parsingType3Font || cacheGlobally) {
  20160. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  20161. }
  20162. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  20163. }
  20164. async buildPaintImageXObject({
  20165. resources,
  20166. image,
  20167. isInline = false,
  20168. operatorList,
  20169. cacheKey,
  20170. localImageCache,
  20171. localColorSpaceCache
  20172. }) {
  20173. const dict = image.dict;
  20174. const imageRef = dict.objId;
  20175. const w = dict.get("Width", "W");
  20176. const h = dict.get("Height", "H");
  20177. if (!(w && (0, _util.isNum)(w)) || !(h && (0, _util.isNum)(h))) {
  20178. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  20179. return;
  20180. }
  20181. const maxImageSize = this.options.maxImageSize;
  20182. if (maxImageSize !== -1 && w * h > maxImageSize) {
  20183. (0, _util.warn)("Image exceeded maximum allowed size and was removed.");
  20184. return;
  20185. }
  20186. let optionalContent;
  20187. if (dict.has("OC")) {
  20188. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20189. }
  20190. if (optionalContent !== undefined) {
  20191. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  20192. }
  20193. const imageMask = dict.get("ImageMask", "IM") || false;
  20194. const interpolate = dict.get("Interpolate", "I");
  20195. let imgData, args;
  20196. if (imageMask) {
  20197. const width = dict.get("Width", "W");
  20198. const height = dict.get("Height", "H");
  20199. const bitStrideLength = width + 7 >> 3;
  20200. const imgArray = image.getBytes(bitStrideLength * height, true);
  20201. const decode = dict.getArray("Decode", "D");
  20202. imgData = _image.PDFImage.createMask({
  20203. imgArray,
  20204. width,
  20205. height,
  20206. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  20207. inverseDecode: !!decode && decode[0] > 0,
  20208. interpolate
  20209. });
  20210. imgData.cached = !!cacheKey;
  20211. args = [imgData];
  20212. operatorList.addOp(_util.OPS.paintImageMaskXObject, args);
  20213. if (cacheKey) {
  20214. localImageCache.set(cacheKey, imageRef, {
  20215. fn: _util.OPS.paintImageMaskXObject,
  20216. args
  20217. });
  20218. }
  20219. if (optionalContent !== undefined) {
  20220. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20221. }
  20222. return;
  20223. }
  20224. const softMask = dict.get("SMask", "SM") || false;
  20225. const mask = dict.get("Mask") || false;
  20226. const SMALL_IMAGE_DIMENSIONS = 200;
  20227. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  20228. const imageObj = new _image.PDFImage({
  20229. xref: this.xref,
  20230. res: resources,
  20231. image,
  20232. isInline,
  20233. pdfFunctionFactory: this._pdfFunctionFactory,
  20234. localColorSpaceCache
  20235. });
  20236. imgData = imageObj.createImageData(true);
  20237. operatorList.addOp(_util.OPS.paintInlineImageXObject, [imgData]);
  20238. if (optionalContent !== undefined) {
  20239. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20240. }
  20241. return;
  20242. }
  20243. let objId = `img_${this.idFactory.createObjId()}`,
  20244. cacheGlobally = false;
  20245. if (this.parsingType3Font) {
  20246. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  20247. } else if (imageRef) {
  20248. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  20249. if (cacheGlobally) {
  20250. objId = `${this.idFactory.getDocId()}_${objId}`;
  20251. }
  20252. }
  20253. operatorList.addDependency(objId);
  20254. args = [objId, w, h];
  20255. _image.PDFImage.buildImage({
  20256. xref: this.xref,
  20257. res: resources,
  20258. image,
  20259. isInline,
  20260. pdfFunctionFactory: this._pdfFunctionFactory,
  20261. localColorSpaceCache
  20262. }).then(imageObj => {
  20263. imgData = imageObj.createImageData(false);
  20264. if (cacheKey && imageRef && cacheGlobally) {
  20265. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  20266. }
  20267. return this._sendImgData(objId, imgData, cacheGlobally);
  20268. }).catch(reason => {
  20269. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  20270. return this._sendImgData(objId, null, cacheGlobally);
  20271. });
  20272. operatorList.addOp(_util.OPS.paintImageXObject, args);
  20273. if (cacheKey) {
  20274. localImageCache.set(cacheKey, imageRef, {
  20275. fn: _util.OPS.paintImageXObject,
  20276. args
  20277. });
  20278. if (imageRef) {
  20279. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  20280. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  20281. if (cacheGlobally) {
  20282. this.globalImageCache.setData(imageRef, {
  20283. objId,
  20284. fn: _util.OPS.paintImageXObject,
  20285. args,
  20286. byteSize: 0
  20287. });
  20288. }
  20289. }
  20290. }
  20291. if (optionalContent !== undefined) {
  20292. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20293. }
  20294. }
  20295. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  20296. const smaskContent = smask.get("G");
  20297. const smaskOptions = {
  20298. subtype: smask.get("S").name,
  20299. backdrop: smask.get("BC")
  20300. };
  20301. const transferObj = smask.get("TR");
  20302. if ((0, _function.isPDFFunction)(transferObj)) {
  20303. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20304. const transferMap = new Uint8Array(256);
  20305. const tmp = new Float32Array(1);
  20306. for (let i = 0; i < 256; i++) {
  20307. tmp[0] = i / 255;
  20308. transferFn(tmp, 0, tmp, 0);
  20309. transferMap[i] = tmp[0] * 255 | 0;
  20310. }
  20311. smaskOptions.transferMap = transferMap;
  20312. }
  20313. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  20314. }
  20315. handleTransferFunction(tr) {
  20316. let transferArray;
  20317. if (Array.isArray(tr)) {
  20318. transferArray = tr;
  20319. } else if ((0, _function.isPDFFunction)(tr)) {
  20320. transferArray = [tr];
  20321. } else {
  20322. return null;
  20323. }
  20324. const transferMaps = [];
  20325. let numFns = 0,
  20326. numEffectfulFns = 0;
  20327. for (const entry of transferArray) {
  20328. const transferObj = this.xref.fetchIfRef(entry);
  20329. numFns++;
  20330. if ((0, _primitives.isName)(transferObj, "Identity")) {
  20331. transferMaps.push(null);
  20332. continue;
  20333. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  20334. return null;
  20335. }
  20336. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20337. const transferMap = new Uint8Array(256),
  20338. tmp = new Float32Array(1);
  20339. for (let j = 0; j < 256; j++) {
  20340. tmp[0] = j / 255;
  20341. transferFn(tmp, 0, tmp, 0);
  20342. transferMap[j] = tmp[0] * 255 | 0;
  20343. }
  20344. transferMaps.push(transferMap);
  20345. numEffectfulFns++;
  20346. }
  20347. if (!(numFns === 1 || numFns === 4)) {
  20348. return null;
  20349. }
  20350. if (numEffectfulFns === 0) {
  20351. return null;
  20352. }
  20353. return transferMaps;
  20354. }
  20355. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  20356. const tilingOpList = new _operator_list.OperatorList();
  20357. const patternResources = _primitives.Dict.merge({
  20358. xref: this.xref,
  20359. dictArray: [patternDict.get("Resources"), resources]
  20360. });
  20361. return this.getOperatorList({
  20362. stream: pattern,
  20363. task,
  20364. resources: patternResources,
  20365. operatorList: tilingOpList
  20366. }).then(function () {
  20367. const operatorListIR = tilingOpList.getIR();
  20368. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  20369. operatorList.addDependencies(tilingOpList.dependencies);
  20370. operatorList.addOp(fn, tilingPatternIR);
  20371. if (patternDict.objId) {
  20372. localTilingPatternCache.set(null, patternDict.objId, {
  20373. operatorListIR,
  20374. dict: patternDict
  20375. });
  20376. }
  20377. }).catch(reason => {
  20378. if (reason instanceof _util.AbortException) {
  20379. return;
  20380. }
  20381. if (this.options.ignoreErrors) {
  20382. this.handler.send("UnsupportedFeature", {
  20383. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  20384. });
  20385. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  20386. return;
  20387. }
  20388. throw reason;
  20389. });
  20390. }
  20391. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  20392. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  20393. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  20394. if (!translated.font.isType3Font) {
  20395. return translated;
  20396. }
  20397. return translated.loadType3Data(this, resources, task).then(function () {
  20398. operatorList.addDependencies(translated.type3Dependencies);
  20399. return translated;
  20400. }).catch(reason => {
  20401. this.handler.send("UnsupportedFeature", {
  20402. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  20403. });
  20404. return new TranslatedFont({
  20405. loadedName: "g_font_error",
  20406. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  20407. dict: translated.font,
  20408. evaluatorOptions: this.options
  20409. });
  20410. });
  20411. }).then(translated => {
  20412. state.font = translated.font;
  20413. translated.send(this.handler);
  20414. return translated.loadedName;
  20415. });
  20416. }
  20417. handleText(chars, state) {
  20418. const font = state.font;
  20419. const glyphs = font.charsToGlyphs(chars);
  20420. if (font.data) {
  20421. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  20422. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  20423. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  20424. }
  20425. }
  20426. return glyphs;
  20427. }
  20428. ensureStateFont(state) {
  20429. if (state.font) {
  20430. return;
  20431. }
  20432. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  20433. if (this.options.ignoreErrors) {
  20434. this.handler.send("UnsupportedFeature", {
  20435. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  20436. });
  20437. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  20438. return;
  20439. }
  20440. throw reason;
  20441. }
  20442. async setGState({
  20443. resources,
  20444. gState,
  20445. operatorList,
  20446. cacheKey,
  20447. task,
  20448. stateManager,
  20449. localGStateCache,
  20450. localColorSpaceCache
  20451. }) {
  20452. const gStateRef = gState.objId;
  20453. let isSimpleGState = true;
  20454. const gStateObj = [];
  20455. const gStateKeys = gState.getKeys();
  20456. let promise = Promise.resolve();
  20457. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  20458. const key = gStateKeys[i];
  20459. const value = gState.get(key);
  20460. switch (key) {
  20461. case "Type":
  20462. break;
  20463. case "LW":
  20464. case "LC":
  20465. case "LJ":
  20466. case "ML":
  20467. case "D":
  20468. case "RI":
  20469. case "FL":
  20470. case "CA":
  20471. case "ca":
  20472. gStateObj.push([key, value]);
  20473. break;
  20474. case "Font":
  20475. isSimpleGState = false;
  20476. promise = promise.then(() => {
  20477. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  20478. operatorList.addDependency(loadedName);
  20479. gStateObj.push([key, [loadedName, value[1]]]);
  20480. });
  20481. });
  20482. break;
  20483. case "BM":
  20484. gStateObj.push([key, normalizeBlendMode(value)]);
  20485. break;
  20486. case "SMask":
  20487. if ((0, _primitives.isName)(value, "None")) {
  20488. gStateObj.push([key, false]);
  20489. break;
  20490. }
  20491. if ((0, _primitives.isDict)(value)) {
  20492. isSimpleGState = false;
  20493. promise = promise.then(() => {
  20494. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  20495. });
  20496. gStateObj.push([key, true]);
  20497. } else {
  20498. (0, _util.warn)("Unsupported SMask type");
  20499. }
  20500. break;
  20501. case "TR":
  20502. const transferMaps = this.handleTransferFunction(value);
  20503. gStateObj.push([key, transferMaps]);
  20504. break;
  20505. case "OP":
  20506. case "op":
  20507. case "OPM":
  20508. case "BG":
  20509. case "BG2":
  20510. case "UCR":
  20511. case "UCR2":
  20512. case "TR2":
  20513. case "HT":
  20514. case "SM":
  20515. case "SA":
  20516. case "AIS":
  20517. case "TK":
  20518. (0, _util.info)("graphic state operator " + key);
  20519. break;
  20520. default:
  20521. (0, _util.info)("Unknown graphic state operator " + key);
  20522. break;
  20523. }
  20524. }
  20525. return promise.then(function () {
  20526. if (gStateObj.length > 0) {
  20527. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  20528. }
  20529. if (isSimpleGState) {
  20530. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  20531. }
  20532. });
  20533. }
  20534. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  20535. const errorFont = async () => {
  20536. return new TranslatedFont({
  20537. loadedName: "g_font_error",
  20538. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  20539. dict: font,
  20540. evaluatorOptions: this.options
  20541. });
  20542. };
  20543. const xref = this.xref;
  20544. let fontRef;
  20545. if (font) {
  20546. if (!(0, _primitives.isRef)(font)) {
  20547. throw new _util.FormatError('The "font" object should be a reference.');
  20548. }
  20549. fontRef = font;
  20550. } else {
  20551. const fontRes = resources.get("Font");
  20552. if (fontRes) {
  20553. fontRef = fontRes.getRaw(fontName);
  20554. }
  20555. }
  20556. if (!fontRef) {
  20557. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  20558. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  20559. (0, _util.warn)(`${partialMsg}.`);
  20560. return errorFont();
  20561. }
  20562. this.handler.send("UnsupportedFeature", {
  20563. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  20564. });
  20565. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  20566. if (fallbackFontDict) {
  20567. fontRef = fallbackFontDict;
  20568. } else {
  20569. fontRef = PartialEvaluator.fallbackFontDict;
  20570. }
  20571. }
  20572. if (this.fontCache.has(fontRef)) {
  20573. return this.fontCache.get(fontRef);
  20574. }
  20575. font = xref.fetchIfRef(fontRef);
  20576. if (!(0, _primitives.isDict)(font)) {
  20577. return errorFont();
  20578. }
  20579. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  20580. return this.fontCache.get(font.cacheKey);
  20581. }
  20582. const fontCapability = (0, _util.createPromiseCapability)();
  20583. let preEvaluatedFont;
  20584. try {
  20585. preEvaluatedFont = this.preEvaluateFont(font);
  20586. preEvaluatedFont.cssFontInfo = cssFontInfo;
  20587. } catch (reason) {
  20588. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  20589. return errorFont();
  20590. }
  20591. const {
  20592. descriptor,
  20593. hash
  20594. } = preEvaluatedFont;
  20595. const fontRefIsRef = (0, _primitives.isRef)(fontRef);
  20596. let fontID;
  20597. if (fontRefIsRef) {
  20598. fontID = `f${fontRef.toString()}`;
  20599. }
  20600. if (hash && (0, _primitives.isDict)(descriptor)) {
  20601. if (!descriptor.fontAliases) {
  20602. descriptor.fontAliases = Object.create(null);
  20603. }
  20604. const fontAliases = descriptor.fontAliases;
  20605. if (fontAliases[hash]) {
  20606. const aliasFontRef = fontAliases[hash].aliasRef;
  20607. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  20608. this.fontCache.putAlias(fontRef, aliasFontRef);
  20609. return this.fontCache.get(fontRef);
  20610. }
  20611. } else {
  20612. fontAliases[hash] = {
  20613. fontID: this.idFactory.createFontId()
  20614. };
  20615. }
  20616. if (fontRefIsRef) {
  20617. fontAliases[hash].aliasRef = fontRef;
  20618. }
  20619. fontID = fontAliases[hash].fontID;
  20620. }
  20621. if (fontRefIsRef) {
  20622. this.fontCache.put(fontRef, fontCapability.promise);
  20623. } else {
  20624. if (!fontID) {
  20625. fontID = this.idFactory.createFontId();
  20626. }
  20627. font.cacheKey = `cacheKey_${fontID}`;
  20628. this.fontCache.put(font.cacheKey, fontCapability.promise);
  20629. }
  20630. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  20631. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  20632. this.translateFont(preEvaluatedFont).then(translatedFont => {
  20633. if (translatedFont.fontType !== undefined) {
  20634. const xrefFontStats = xref.stats.fontTypes;
  20635. xrefFontStats[translatedFont.fontType] = true;
  20636. }
  20637. fontCapability.resolve(new TranslatedFont({
  20638. loadedName: font.loadedName,
  20639. font: translatedFont,
  20640. dict: font,
  20641. evaluatorOptions: this.options
  20642. }));
  20643. }).catch(reason => {
  20644. this.handler.send("UnsupportedFeature", {
  20645. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  20646. });
  20647. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  20648. try {
  20649. const fontFile3 = descriptor && descriptor.get("FontFile3");
  20650. const subtype = fontFile3 && fontFile3.get("Subtype");
  20651. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  20652. const xrefFontStats = xref.stats.fontTypes;
  20653. xrefFontStats[fontType] = true;
  20654. } catch (ex) {}
  20655. fontCapability.resolve(new TranslatedFont({
  20656. loadedName: font.loadedName,
  20657. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  20658. dict: font,
  20659. evaluatorOptions: this.options
  20660. }));
  20661. });
  20662. return fontCapability.promise;
  20663. }
  20664. buildPath(operatorList, fn, args, parsingText = false) {
  20665. const lastIndex = operatorList.length - 1;
  20666. if (!args) {
  20667. args = [];
  20668. }
  20669. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  20670. if (parsingText) {
  20671. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  20672. operatorList.addOp(_util.OPS.save, null);
  20673. }
  20674. operatorList.addOp(_util.OPS.constructPath, [[fn], args]);
  20675. if (parsingText) {
  20676. operatorList.addOp(_util.OPS.restore, null);
  20677. }
  20678. } else {
  20679. const opArgs = operatorList.argsArray[lastIndex];
  20680. opArgs[0].push(fn);
  20681. Array.prototype.push.apply(opArgs[1], args);
  20682. }
  20683. }
  20684. parseColorSpace({
  20685. cs,
  20686. resources,
  20687. localColorSpaceCache
  20688. }) {
  20689. return _colorspace.ColorSpace.parseAsync({
  20690. cs,
  20691. xref: this.xref,
  20692. resources,
  20693. pdfFunctionFactory: this._pdfFunctionFactory,
  20694. localColorSpaceCache
  20695. }).catch(reason => {
  20696. if (reason instanceof _util.AbortException) {
  20697. return null;
  20698. }
  20699. if (this.options.ignoreErrors) {
  20700. this.handler.send("UnsupportedFeature", {
  20701. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  20702. });
  20703. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  20704. return null;
  20705. }
  20706. throw reason;
  20707. });
  20708. }
  20709. parseShading({
  20710. shading,
  20711. resources,
  20712. localColorSpaceCache,
  20713. localShadingPatternCache
  20714. }) {
  20715. let id = localShadingPatternCache.get(shading);
  20716. if (!id) {
  20717. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  20718. const patternIR = shadingFill.getIR();
  20719. id = `pattern_${this.idFactory.createObjId()}`;
  20720. localShadingPatternCache.set(shading, id);
  20721. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  20722. }
  20723. return id;
  20724. }
  20725. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  20726. const patternName = args.pop();
  20727. if (patternName instanceof _primitives.Name) {
  20728. const rawPattern = patterns.getRaw(patternName.name);
  20729. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  20730. if (localTilingPattern) {
  20731. try {
  20732. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  20733. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  20734. operatorList.addOp(fn, tilingPatternIR);
  20735. return undefined;
  20736. } catch (ex) {}
  20737. }
  20738. const pattern = this.xref.fetchIfRef(rawPattern);
  20739. if (pattern) {
  20740. const dict = (0, _primitives.isStream)(pattern) ? pattern.dict : pattern;
  20741. const typeNum = dict.get("PatternType");
  20742. if (typeNum === PatternType.TILING) {
  20743. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  20744. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  20745. } else if (typeNum === PatternType.SHADING) {
  20746. const shading = dict.get("Shading");
  20747. const matrix = dict.getArray("Matrix");
  20748. const objId = this.parseShading({
  20749. shading,
  20750. resources,
  20751. localColorSpaceCache,
  20752. localShadingPatternCache
  20753. });
  20754. operatorList.addOp(fn, ["Shading", objId, matrix]);
  20755. return undefined;
  20756. }
  20757. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  20758. }
  20759. }
  20760. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  20761. }
  20762. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  20763. const MAX_NESTING = 10;
  20764. if (++nestingCounter > MAX_NESTING) {
  20765. (0, _util.warn)("Visibility expression is too deeply nested");
  20766. return;
  20767. }
  20768. const length = array.length;
  20769. const operator = this.xref.fetchIfRef(array[0]);
  20770. if (length < 2 || !(0, _primitives.isName)(operator)) {
  20771. (0, _util.warn)("Invalid visibility expression");
  20772. return;
  20773. }
  20774. switch (operator.name) {
  20775. case "And":
  20776. case "Or":
  20777. case "Not":
  20778. currentResult.push(operator.name);
  20779. break;
  20780. default:
  20781. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  20782. return;
  20783. }
  20784. for (let i = 1; i < length; i++) {
  20785. const raw = array[i];
  20786. const object = this.xref.fetchIfRef(raw);
  20787. if (Array.isArray(object)) {
  20788. const nestedResult = [];
  20789. currentResult.push(nestedResult);
  20790. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  20791. } else if ((0, _primitives.isRef)(raw)) {
  20792. currentResult.push(raw.toString());
  20793. }
  20794. }
  20795. }
  20796. async parseMarkedContentProps(contentProperties, resources) {
  20797. let optionalContent;
  20798. if ((0, _primitives.isName)(contentProperties)) {
  20799. const properties = resources.get("Properties");
  20800. optionalContent = properties.get(contentProperties.name);
  20801. } else if ((0, _primitives.isDict)(contentProperties)) {
  20802. optionalContent = contentProperties;
  20803. } else {
  20804. throw new _util.FormatError("Optional content properties malformed.");
  20805. }
  20806. const optionalContentType = optionalContent.get("Type").name;
  20807. if (optionalContentType === "OCG") {
  20808. return {
  20809. type: optionalContentType,
  20810. id: optionalContent.objId
  20811. };
  20812. } else if (optionalContentType === "OCMD") {
  20813. const expression = optionalContent.get("VE");
  20814. if (Array.isArray(expression)) {
  20815. const result = [];
  20816. this._parseVisibilityExpression(expression, 0, result);
  20817. if (result.length > 0) {
  20818. return {
  20819. type: "OCMD",
  20820. expression: result
  20821. };
  20822. }
  20823. }
  20824. const optionalContentGroups = optionalContent.get("OCGs");
  20825. if (Array.isArray(optionalContentGroups) || (0, _primitives.isDict)(optionalContentGroups)) {
  20826. const groupIds = [];
  20827. if (Array.isArray(optionalContentGroups)) {
  20828. for (const ocg of optionalContentGroups) {
  20829. groupIds.push(ocg.toString());
  20830. }
  20831. } else {
  20832. groupIds.push(optionalContentGroups.objId);
  20833. }
  20834. return {
  20835. type: optionalContentType,
  20836. ids: groupIds,
  20837. policy: (0, _primitives.isName)(optionalContent.get("P")) ? optionalContent.get("P").name : null,
  20838. expression: null
  20839. };
  20840. } else if ((0, _primitives.isRef)(optionalContentGroups)) {
  20841. return {
  20842. type: optionalContentType,
  20843. id: optionalContentGroups.toString()
  20844. };
  20845. }
  20846. }
  20847. return null;
  20848. }
  20849. getOperatorList({
  20850. stream,
  20851. task,
  20852. resources,
  20853. operatorList,
  20854. initialState = null,
  20855. fallbackFontDict = null
  20856. }) {
  20857. resources = resources || _primitives.Dict.empty;
  20858. initialState = initialState || new EvalState();
  20859. if (!operatorList) {
  20860. throw new Error('getOperatorList: missing "operatorList" parameter');
  20861. }
  20862. const self = this;
  20863. const xref = this.xref;
  20864. let parsingText = false;
  20865. const localImageCache = new _image_utils.LocalImageCache();
  20866. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  20867. const localGStateCache = new _image_utils.LocalGStateCache();
  20868. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  20869. const localShadingPatternCache = new Map();
  20870. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  20871. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  20872. const stateManager = new StateManager(initialState);
  20873. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  20874. const timeSlotManager = new TimeSlotManager();
  20875. function closePendingRestoreOPS(argument) {
  20876. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  20877. operatorList.addOp(_util.OPS.restore, []);
  20878. }
  20879. }
  20880. return new Promise(function promiseBody(resolve, reject) {
  20881. const next = function (promise) {
  20882. Promise.all([promise, operatorList.ready]).then(function () {
  20883. try {
  20884. promiseBody(resolve, reject);
  20885. } catch (ex) {
  20886. reject(ex);
  20887. }
  20888. }, reject);
  20889. };
  20890. task.ensureNotTerminated();
  20891. timeSlotManager.reset();
  20892. const operation = {};
  20893. let stop, i, ii, cs, name, isValidName;
  20894. while (!(stop = timeSlotManager.check())) {
  20895. operation.args = null;
  20896. if (!preprocessor.read(operation)) {
  20897. break;
  20898. }
  20899. let args = operation.args;
  20900. let fn = operation.fn;
  20901. switch (fn | 0) {
  20902. case _util.OPS.paintXObject:
  20903. isValidName = args[0] instanceof _primitives.Name;
  20904. name = args[0].name;
  20905. if (isValidName) {
  20906. const localImage = localImageCache.getByName(name);
  20907. if (localImage) {
  20908. operatorList.addOp(localImage.fn, localImage.args);
  20909. args = null;
  20910. continue;
  20911. }
  20912. }
  20913. next(new Promise(function (resolveXObject, rejectXObject) {
  20914. if (!isValidName) {
  20915. throw new _util.FormatError("XObject must be referred to by name.");
  20916. }
  20917. let xobj = xobjs.getRaw(name);
  20918. if (xobj instanceof _primitives.Ref) {
  20919. const localImage = localImageCache.getByRef(xobj);
  20920. if (localImage) {
  20921. operatorList.addOp(localImage.fn, localImage.args);
  20922. resolveXObject();
  20923. return;
  20924. }
  20925. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  20926. if (globalImage) {
  20927. operatorList.addDependency(globalImage.objId);
  20928. operatorList.addOp(globalImage.fn, globalImage.args);
  20929. resolveXObject();
  20930. return;
  20931. }
  20932. xobj = xref.fetch(xobj);
  20933. }
  20934. if (!(0, _primitives.isStream)(xobj)) {
  20935. throw new _util.FormatError("XObject should be a stream");
  20936. }
  20937. const type = xobj.dict.get("Subtype");
  20938. if (!(0, _primitives.isName)(type)) {
  20939. throw new _util.FormatError("XObject should have a Name subtype");
  20940. }
  20941. if (type.name === "Form") {
  20942. stateManager.save();
  20943. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  20944. stateManager.restore();
  20945. resolveXObject();
  20946. }, rejectXObject);
  20947. return;
  20948. } else if (type.name === "Image") {
  20949. self.buildPaintImageXObject({
  20950. resources,
  20951. image: xobj,
  20952. operatorList,
  20953. cacheKey: name,
  20954. localImageCache,
  20955. localColorSpaceCache
  20956. }).then(resolveXObject, rejectXObject);
  20957. return;
  20958. } else if (type.name === "PS") {
  20959. (0, _util.info)("Ignored XObject subtype PS");
  20960. } else {
  20961. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  20962. }
  20963. resolveXObject();
  20964. }).catch(function (reason) {
  20965. if (reason instanceof _util.AbortException) {
  20966. return;
  20967. }
  20968. if (self.options.ignoreErrors) {
  20969. self.handler.send("UnsupportedFeature", {
  20970. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  20971. });
  20972. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  20973. return;
  20974. }
  20975. throw reason;
  20976. }));
  20977. return;
  20978. case _util.OPS.setFont:
  20979. var fontSize = args[1];
  20980. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  20981. operatorList.addDependency(loadedName);
  20982. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  20983. }));
  20984. return;
  20985. case _util.OPS.beginText:
  20986. parsingText = true;
  20987. break;
  20988. case _util.OPS.endText:
  20989. parsingText = false;
  20990. break;
  20991. case _util.OPS.endInlineImage:
  20992. var cacheKey = args[0].cacheKey;
  20993. if (cacheKey) {
  20994. const localImage = localImageCache.getByName(cacheKey);
  20995. if (localImage) {
  20996. operatorList.addOp(localImage.fn, localImage.args);
  20997. args = null;
  20998. continue;
  20999. }
  21000. }
  21001. next(self.buildPaintImageXObject({
  21002. resources,
  21003. image: args[0],
  21004. isInline: true,
  21005. operatorList,
  21006. cacheKey,
  21007. localImageCache,
  21008. localColorSpaceCache
  21009. }));
  21010. return;
  21011. case _util.OPS.showText:
  21012. if (!stateManager.state.font) {
  21013. self.ensureStateFont(stateManager.state);
  21014. continue;
  21015. }
  21016. args[0] = self.handleText(args[0], stateManager.state);
  21017. break;
  21018. case _util.OPS.showSpacedText:
  21019. if (!stateManager.state.font) {
  21020. self.ensureStateFont(stateManager.state);
  21021. continue;
  21022. }
  21023. var arr = args[0];
  21024. var combinedGlyphs = [];
  21025. var arrLength = arr.length;
  21026. var state = stateManager.state;
  21027. for (i = 0; i < arrLength; ++i) {
  21028. const arrItem = arr[i];
  21029. if ((0, _util.isString)(arrItem)) {
  21030. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  21031. } else if ((0, _util.isNum)(arrItem)) {
  21032. combinedGlyphs.push(arrItem);
  21033. }
  21034. }
  21035. args[0] = combinedGlyphs;
  21036. fn = _util.OPS.showText;
  21037. break;
  21038. case _util.OPS.nextLineShowText:
  21039. if (!stateManager.state.font) {
  21040. self.ensureStateFont(stateManager.state);
  21041. continue;
  21042. }
  21043. operatorList.addOp(_util.OPS.nextLine);
  21044. args[0] = self.handleText(args[0], stateManager.state);
  21045. fn = _util.OPS.showText;
  21046. break;
  21047. case _util.OPS.nextLineSetSpacingShowText:
  21048. if (!stateManager.state.font) {
  21049. self.ensureStateFont(stateManager.state);
  21050. continue;
  21051. }
  21052. operatorList.addOp(_util.OPS.nextLine);
  21053. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  21054. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  21055. args[0] = self.handleText(args[0], stateManager.state);
  21056. fn = _util.OPS.showText;
  21057. break;
  21058. case _util.OPS.setTextRenderingMode:
  21059. stateManager.state.textRenderingMode = args[0];
  21060. break;
  21061. case _util.OPS.setFillColorSpace:
  21062. {
  21063. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21064. if (cachedColorSpace) {
  21065. stateManager.state.fillColorSpace = cachedColorSpace;
  21066. continue;
  21067. }
  21068. next(self.parseColorSpace({
  21069. cs: args[0],
  21070. resources,
  21071. localColorSpaceCache
  21072. }).then(function (colorSpace) {
  21073. if (colorSpace) {
  21074. stateManager.state.fillColorSpace = colorSpace;
  21075. }
  21076. }));
  21077. return;
  21078. }
  21079. case _util.OPS.setStrokeColorSpace:
  21080. {
  21081. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21082. if (cachedColorSpace) {
  21083. stateManager.state.strokeColorSpace = cachedColorSpace;
  21084. continue;
  21085. }
  21086. next(self.parseColorSpace({
  21087. cs: args[0],
  21088. resources,
  21089. localColorSpaceCache
  21090. }).then(function (colorSpace) {
  21091. if (colorSpace) {
  21092. stateManager.state.strokeColorSpace = colorSpace;
  21093. }
  21094. }));
  21095. return;
  21096. }
  21097. case _util.OPS.setFillColor:
  21098. cs = stateManager.state.fillColorSpace;
  21099. args = cs.getRgb(args, 0);
  21100. fn = _util.OPS.setFillRGBColor;
  21101. break;
  21102. case _util.OPS.setStrokeColor:
  21103. cs = stateManager.state.strokeColorSpace;
  21104. args = cs.getRgb(args, 0);
  21105. fn = _util.OPS.setStrokeRGBColor;
  21106. break;
  21107. case _util.OPS.setFillGray:
  21108. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  21109. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21110. fn = _util.OPS.setFillRGBColor;
  21111. break;
  21112. case _util.OPS.setStrokeGray:
  21113. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  21114. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21115. fn = _util.OPS.setStrokeRGBColor;
  21116. break;
  21117. case _util.OPS.setFillCMYKColor:
  21118. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21119. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21120. fn = _util.OPS.setFillRGBColor;
  21121. break;
  21122. case _util.OPS.setStrokeCMYKColor:
  21123. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21124. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21125. fn = _util.OPS.setStrokeRGBColor;
  21126. break;
  21127. case _util.OPS.setFillRGBColor:
  21128. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21129. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21130. break;
  21131. case _util.OPS.setStrokeRGBColor:
  21132. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21133. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21134. break;
  21135. case _util.OPS.setFillColorN:
  21136. cs = stateManager.state.fillColorSpace;
  21137. if (cs.name === "Pattern") {
  21138. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21139. return;
  21140. }
  21141. args = cs.getRgb(args, 0);
  21142. fn = _util.OPS.setFillRGBColor;
  21143. break;
  21144. case _util.OPS.setStrokeColorN:
  21145. cs = stateManager.state.strokeColorSpace;
  21146. if (cs.name === "Pattern") {
  21147. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21148. return;
  21149. }
  21150. args = cs.getRgb(args, 0);
  21151. fn = _util.OPS.setStrokeRGBColor;
  21152. break;
  21153. case _util.OPS.shadingFill:
  21154. var shadingRes = resources.get("Shading");
  21155. if (!shadingRes) {
  21156. throw new _util.FormatError("No shading resource found");
  21157. }
  21158. var shading = shadingRes.get(args[0].name);
  21159. if (!shading) {
  21160. throw new _util.FormatError("No shading object found");
  21161. }
  21162. const patternId = self.parseShading({
  21163. shading,
  21164. resources,
  21165. localColorSpaceCache,
  21166. localShadingPatternCache
  21167. });
  21168. args = [patternId];
  21169. fn = _util.OPS.shadingFill;
  21170. break;
  21171. case _util.OPS.setGState:
  21172. isValidName = args[0] instanceof _primitives.Name;
  21173. name = args[0].name;
  21174. if (isValidName) {
  21175. const localGStateObj = localGStateCache.getByName(name);
  21176. if (localGStateObj) {
  21177. if (localGStateObj.length > 0) {
  21178. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  21179. }
  21180. args = null;
  21181. continue;
  21182. }
  21183. }
  21184. next(new Promise(function (resolveGState, rejectGState) {
  21185. if (!isValidName) {
  21186. throw new _util.FormatError("GState must be referred to by name.");
  21187. }
  21188. const extGState = resources.get("ExtGState");
  21189. if (!(extGState instanceof _primitives.Dict)) {
  21190. throw new _util.FormatError("ExtGState should be a dictionary.");
  21191. }
  21192. const gState = extGState.get(name);
  21193. if (!(gState instanceof _primitives.Dict)) {
  21194. throw new _util.FormatError("GState should be a dictionary.");
  21195. }
  21196. self.setGState({
  21197. resources,
  21198. gState,
  21199. operatorList,
  21200. cacheKey: name,
  21201. task,
  21202. stateManager,
  21203. localGStateCache,
  21204. localColorSpaceCache
  21205. }).then(resolveGState, rejectGState);
  21206. }).catch(function (reason) {
  21207. if (reason instanceof _util.AbortException) {
  21208. return;
  21209. }
  21210. if (self.options.ignoreErrors) {
  21211. self.handler.send("UnsupportedFeature", {
  21212. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  21213. });
  21214. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  21215. return;
  21216. }
  21217. throw reason;
  21218. }));
  21219. return;
  21220. case _util.OPS.moveTo:
  21221. case _util.OPS.lineTo:
  21222. case _util.OPS.curveTo:
  21223. case _util.OPS.curveTo2:
  21224. case _util.OPS.curveTo3:
  21225. case _util.OPS.closePath:
  21226. case _util.OPS.rectangle:
  21227. self.buildPath(operatorList, fn, args, parsingText);
  21228. continue;
  21229. case _util.OPS.markPoint:
  21230. case _util.OPS.markPointProps:
  21231. case _util.OPS.beginCompat:
  21232. case _util.OPS.endCompat:
  21233. continue;
  21234. case _util.OPS.beginMarkedContentProps:
  21235. if (!(0, _primitives.isName)(args[0])) {
  21236. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  21237. continue;
  21238. }
  21239. if (args[0].name === "OC") {
  21240. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  21241. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  21242. }).catch(reason => {
  21243. if (reason instanceof _util.AbortException) {
  21244. return;
  21245. }
  21246. if (self.options.ignoreErrors) {
  21247. self.handler.send("UnsupportedFeature", {
  21248. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  21249. });
  21250. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  21251. return;
  21252. }
  21253. throw reason;
  21254. }));
  21255. return;
  21256. }
  21257. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  21258. break;
  21259. case _util.OPS.beginMarkedContent:
  21260. case _util.OPS.endMarkedContent:
  21261. default:
  21262. if (args !== null) {
  21263. for (i = 0, ii = args.length; i < ii; i++) {
  21264. if (args[i] instanceof _primitives.Dict) {
  21265. break;
  21266. }
  21267. }
  21268. if (i < ii) {
  21269. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  21270. continue;
  21271. }
  21272. }
  21273. }
  21274. operatorList.addOp(fn, args);
  21275. }
  21276. if (stop) {
  21277. next(deferred);
  21278. return;
  21279. }
  21280. closePendingRestoreOPS();
  21281. resolve();
  21282. }).catch(reason => {
  21283. if (reason instanceof _util.AbortException) {
  21284. return;
  21285. }
  21286. if (this.options.ignoreErrors) {
  21287. this.handler.send("UnsupportedFeature", {
  21288. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  21289. });
  21290. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  21291. closePendingRestoreOPS();
  21292. return;
  21293. }
  21294. throw reason;
  21295. });
  21296. }
  21297. getTextContent({
  21298. stream,
  21299. task,
  21300. resources,
  21301. stateManager = null,
  21302. normalizeWhitespace = false,
  21303. combineTextItems = false,
  21304. includeMarkedContent = false,
  21305. sink,
  21306. seenStyles = new Set()
  21307. }) {
  21308. resources = resources || _primitives.Dict.empty;
  21309. stateManager = stateManager || new StateManager(new TextState());
  21310. const WhitespaceRegexp = /\s/g;
  21311. const textContent = {
  21312. items: [],
  21313. styles: Object.create(null)
  21314. };
  21315. const textContentItem = {
  21316. initialized: false,
  21317. str: [],
  21318. totalWidth: 0,
  21319. totalHeight: 0,
  21320. width: 0,
  21321. height: 0,
  21322. vertical: false,
  21323. lastCharSize: 0,
  21324. prevTransform: null,
  21325. textAdvanceScale: 0,
  21326. spaceWidth: 0,
  21327. spaceInFlowMin: 0,
  21328. spaceInFlowMax: 0,
  21329. trackingSpaceMin: Infinity,
  21330. transform: null,
  21331. fontName: null,
  21332. hasEOL: false,
  21333. isLastCharWhiteSpace: false
  21334. };
  21335. const TRACKING_SPACE_FACTOR = 0.3;
  21336. const SPACE_IN_FLOW_MIN_FACTOR = 0.3;
  21337. const SPACE_IN_FLOW_MAX_FACTOR = 1.3;
  21338. const self = this;
  21339. const xref = this.xref;
  21340. const showSpacedTextBuffer = [];
  21341. let xobjs = null;
  21342. const emptyXObjectCache = new _image_utils.LocalImageCache();
  21343. const emptyGStateCache = new _image_utils.LocalGStateCache();
  21344. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21345. let textState;
  21346. function getCurrentTextTransform() {
  21347. const font = textState.font;
  21348. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  21349. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  21350. const glyphHeight = font.bbox[3] - font.bbox[1];
  21351. if (glyphHeight > 0) {
  21352. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  21353. }
  21354. }
  21355. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  21356. }
  21357. function ensureTextContentItem() {
  21358. if (textContentItem.initialized) {
  21359. return textContentItem;
  21360. }
  21361. const font = textState.font,
  21362. loadedName = font.loadedName;
  21363. if (!seenStyles.has(loadedName)) {
  21364. seenStyles.add(loadedName);
  21365. textContent.styles[loadedName] = {
  21366. fontFamily: font.fallbackName,
  21367. ascent: font.ascent,
  21368. descent: font.descent,
  21369. vertical: font.vertical
  21370. };
  21371. }
  21372. textContentItem.fontName = loadedName;
  21373. const trm = textContentItem.transform = getCurrentTextTransform();
  21374. if (!font.vertical) {
  21375. textContentItem.width = textContentItem.totalWidth = 0;
  21376. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  21377. textContentItem.vertical = false;
  21378. } else {
  21379. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  21380. textContentItem.height = textContentItem.totalHeight = 0;
  21381. textContentItem.vertical = true;
  21382. }
  21383. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21384. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21385. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  21386. textContentItem.lastCharSize = textContentItem.lastCharSize || 0;
  21387. const spaceWidth = font.spaceWidth / 1000 * textState.fontSize;
  21388. if (spaceWidth) {
  21389. textContentItem.spaceWidth = spaceWidth;
  21390. textContentItem.trackingSpaceMin = spaceWidth * TRACKING_SPACE_FACTOR;
  21391. textContentItem.spaceInFlowMin = spaceWidth * SPACE_IN_FLOW_MIN_FACTOR;
  21392. textContentItem.spaceInFlowMax = spaceWidth * SPACE_IN_FLOW_MAX_FACTOR;
  21393. } else {
  21394. textContentItem.spaceWidth = 0;
  21395. textContentItem.trackingSpaceMin = Infinity;
  21396. }
  21397. textContentItem.hasEOL = false;
  21398. textContentItem.initialized = true;
  21399. return textContentItem;
  21400. }
  21401. function updateAdvanceScale() {
  21402. if (!textContentItem.initialized) {
  21403. return;
  21404. }
  21405. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21406. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21407. const scaleFactor = scaleCtmX * scaleLineX;
  21408. if (scaleFactor === textContentItem.textAdvanceScale) {
  21409. return;
  21410. }
  21411. if (!textContentItem.vertical) {
  21412. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  21413. textContentItem.width = 0;
  21414. } else {
  21415. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  21416. textContentItem.height = 0;
  21417. }
  21418. textContentItem.textAdvanceScale = scaleFactor;
  21419. }
  21420. function replaceWhitespace(str) {
  21421. const ii = str.length;
  21422. let i = 0,
  21423. code;
  21424. while (i < ii && (code = str.charCodeAt(i)) >= 0x20 && code <= 0x7f) {
  21425. i++;
  21426. }
  21427. return i < ii ? str.replace(WhitespaceRegexp, " ") : str;
  21428. }
  21429. function runBidiTransform(textChunk) {
  21430. const text = textChunk.str.join("");
  21431. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  21432. const str = normalizeWhitespace ? replaceWhitespace(bidiResult.str) : bidiResult.str;
  21433. return {
  21434. str,
  21435. dir: bidiResult.dir,
  21436. width: textChunk.totalWidth,
  21437. height: textChunk.totalHeight,
  21438. transform: textChunk.transform,
  21439. fontName: textChunk.fontName,
  21440. hasEOL: textChunk.hasEOL
  21441. };
  21442. }
  21443. function handleSetFont(fontName, fontRef) {
  21444. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  21445. if (!translated.font.isType3Font) {
  21446. return translated;
  21447. }
  21448. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  21449. return translated;
  21450. });
  21451. }).then(function (translated) {
  21452. textState.font = translated.font;
  21453. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  21454. });
  21455. }
  21456. function compareWithLastPosition(fontSize) {
  21457. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  21458. return;
  21459. }
  21460. const currentTransform = getCurrentTextTransform();
  21461. const posX = currentTransform[4];
  21462. const posY = currentTransform[5];
  21463. const lastPosX = textContentItem.prevTransform[4];
  21464. const lastPosY = textContentItem.prevTransform[5];
  21465. if (lastPosX === posX && lastPosY === posY) {
  21466. return;
  21467. }
  21468. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  21469. const advanceY = (posY - lastPosY) / textContentItem.textAdvanceScale;
  21470. const HALF_LAST_CHAR = -0.5 * textContentItem.lastCharSize;
  21471. if (textState.font.vertical) {
  21472. if (Math.abs(advanceX) > textContentItem.width / textContentItem.textAdvanceScale) {
  21473. appendEOL();
  21474. return;
  21475. }
  21476. if (HALF_LAST_CHAR > advanceY) {
  21477. return;
  21478. }
  21479. if (advanceY > textContentItem.trackingSpaceMin) {
  21480. textContentItem.height += advanceY;
  21481. } else if (!addFakeSpaces(advanceY, 0, textContentItem.prevTransform)) {
  21482. if (textContentItem.str.length === 0) {
  21483. textContent.items.push({
  21484. str: " ",
  21485. dir: "ltr",
  21486. width: 0,
  21487. height: advanceY,
  21488. transform: textContentItem.prevTransform,
  21489. fontName: textContentItem.fontName,
  21490. hasEOL: false
  21491. });
  21492. textContentItem.isLastCharWhiteSpace = true;
  21493. } else {
  21494. textContentItem.height += advanceY;
  21495. }
  21496. }
  21497. return;
  21498. }
  21499. if (Math.abs(advanceY) > textContentItem.height / textContentItem.textAdvanceScale) {
  21500. appendEOL();
  21501. return;
  21502. }
  21503. if (HALF_LAST_CHAR > advanceX) {
  21504. return;
  21505. }
  21506. if (advanceX <= textContentItem.trackingSpaceMin) {
  21507. textContentItem.width += advanceX;
  21508. } else if (!addFakeSpaces(advanceX, 0, textContentItem.prevTransform)) {
  21509. if (textContentItem.str.length === 0) {
  21510. textContent.items.push({
  21511. str: " ",
  21512. dir: "ltr",
  21513. width: advanceX,
  21514. height: 0,
  21515. transform: textContentItem.prevTransform,
  21516. fontName: textContentItem.fontName,
  21517. hasEOL: false
  21518. });
  21519. textContentItem.isLastCharWhiteSpace = true;
  21520. } else {
  21521. textContentItem.width += advanceX;
  21522. }
  21523. }
  21524. }
  21525. function buildTextContentItem({
  21526. chars,
  21527. extraSpacing,
  21528. isFirstChunk
  21529. }) {
  21530. const font = textState.font;
  21531. if (!chars) {
  21532. const charSpacing = textState.charSpacing + extraSpacing;
  21533. if (charSpacing) {
  21534. if (!font.vertical) {
  21535. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  21536. } else {
  21537. textState.translateTextMatrix(0, charSpacing);
  21538. }
  21539. }
  21540. return;
  21541. }
  21542. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  21543. const glyphs = font.charsToGlyphs(chars);
  21544. const scale = textState.fontMatrix[0] * textState.fontSize;
  21545. if (isFirstChunk) {
  21546. compareWithLastPosition(scale);
  21547. }
  21548. let textChunk = ensureTextContentItem();
  21549. let size = 0;
  21550. let lastCharSize = 0;
  21551. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  21552. const glyph = glyphs[i];
  21553. let charSpacing = textState.charSpacing + (i === ii - 1 ? extraSpacing : 0);
  21554. let glyphUnicode = glyph.unicode;
  21555. if (glyph.isSpace) {
  21556. charSpacing += textState.wordSpacing;
  21557. textChunk.isLastCharWhiteSpace = true;
  21558. } else {
  21559. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  21560. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  21561. textChunk.isLastCharWhiteSpace = false;
  21562. }
  21563. textChunk.str.push(glyphUnicode);
  21564. const glyphWidth = font.vertical && glyph.vmetric ? glyph.vmetric[0] : glyph.width;
  21565. let scaledDim = glyphWidth * scale;
  21566. if (!font.vertical) {
  21567. scaledDim *= textState.textHScale;
  21568. textState.translateTextMatrix(scaledDim, 0);
  21569. } else {
  21570. textState.translateTextMatrix(0, scaledDim);
  21571. scaledDim = Math.abs(scaledDim);
  21572. }
  21573. size += scaledDim;
  21574. if (charSpacing) {
  21575. if (!font.vertical) {
  21576. charSpacing *= textState.textHScale;
  21577. }
  21578. scaledDim += charSpacing;
  21579. const wasSplit = charSpacing > textContentItem.trackingSpaceMin && addFakeSpaces(charSpacing, size);
  21580. if (!font.vertical) {
  21581. textState.translateTextMatrix(charSpacing, 0);
  21582. } else {
  21583. textState.translateTextMatrix(0, charSpacing);
  21584. }
  21585. if (wasSplit) {
  21586. textChunk = ensureTextContentItem();
  21587. size = 0;
  21588. } else {
  21589. size += charSpacing;
  21590. }
  21591. }
  21592. lastCharSize = scaledDim;
  21593. }
  21594. textChunk.lastCharSize = lastCharSize;
  21595. if (!font.vertical) {
  21596. textChunk.width += size;
  21597. } else {
  21598. textChunk.height += size;
  21599. }
  21600. textChunk.prevTransform = getCurrentTextTransform();
  21601. }
  21602. function appendEOL() {
  21603. if (textContentItem.initialized) {
  21604. textContentItem.hasEOL = true;
  21605. flushTextContentItem();
  21606. } else {
  21607. textContent.items.push({
  21608. str: "",
  21609. dir: "ltr",
  21610. width: 0,
  21611. height: 0,
  21612. transform: getCurrentTextTransform(),
  21613. fontName: textState.font.loadedName,
  21614. hasEOL: true
  21615. });
  21616. }
  21617. textContentItem.isLastCharWhiteSpace = false;
  21618. textContentItem.lastCharSize = 0;
  21619. }
  21620. function addFakeSpaces(width, size, transf = null) {
  21621. if (textContentItem.spaceInFlowMin <= width && width <= textContentItem.spaceInFlowMax) {
  21622. if (textContentItem.initialized) {
  21623. textContentItem.str.push(" ");
  21624. textContentItem.isLastCharWhiteSpace = true;
  21625. }
  21626. return false;
  21627. }
  21628. const fontName = textContentItem.fontName;
  21629. let height = 0;
  21630. width *= textContentItem.textAdvanceScale;
  21631. if (!textContentItem.vertical) {
  21632. textContentItem.width += size;
  21633. } else {
  21634. textContentItem.height += size;
  21635. height = width;
  21636. width = 0;
  21637. }
  21638. flushTextContentItem();
  21639. if (textContentItem.isLastCharWhiteSpace) {
  21640. return true;
  21641. }
  21642. textContentItem.isLastCharWhiteSpace = true;
  21643. textContent.items.push({
  21644. str: " ",
  21645. dir: "ltr",
  21646. width,
  21647. height,
  21648. transform: transf ? transf : getCurrentTextTransform(),
  21649. fontName,
  21650. hasEOL: false
  21651. });
  21652. return true;
  21653. }
  21654. function flushTextContentItem() {
  21655. if (!textContentItem.initialized || !textContentItem.str) {
  21656. return;
  21657. }
  21658. if (!textContentItem.vertical) {
  21659. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  21660. } else {
  21661. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  21662. }
  21663. textContent.items.push(runBidiTransform(textContentItem));
  21664. textContentItem.initialized = false;
  21665. textContentItem.str.length = 0;
  21666. }
  21667. function enqueueChunk(batch = false) {
  21668. const length = textContent.items.length;
  21669. if (length === 0) {
  21670. return;
  21671. }
  21672. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  21673. return;
  21674. }
  21675. sink.enqueue(textContent, length);
  21676. textContent.items = [];
  21677. textContent.styles = Object.create(null);
  21678. }
  21679. const timeSlotManager = new TimeSlotManager();
  21680. return new Promise(function promiseBody(resolve, reject) {
  21681. const next = function (promise) {
  21682. enqueueChunk(true);
  21683. Promise.all([promise, sink.ready]).then(function () {
  21684. try {
  21685. promiseBody(resolve, reject);
  21686. } catch (ex) {
  21687. reject(ex);
  21688. }
  21689. }, reject);
  21690. };
  21691. task.ensureNotTerminated();
  21692. timeSlotManager.reset();
  21693. const operation = {};
  21694. let stop,
  21695. args = [];
  21696. while (!(stop = timeSlotManager.check())) {
  21697. args.length = 0;
  21698. operation.args = args;
  21699. if (!preprocessor.read(operation)) {
  21700. break;
  21701. }
  21702. textState = stateManager.state;
  21703. const fn = operation.fn;
  21704. args = operation.args;
  21705. switch (fn | 0) {
  21706. case _util.OPS.setFont:
  21707. var fontNameArg = args[0].name,
  21708. fontSizeArg = args[1];
  21709. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  21710. break;
  21711. }
  21712. flushTextContentItem();
  21713. textState.fontName = fontNameArg;
  21714. textState.fontSize = fontSizeArg;
  21715. next(handleSetFont(fontNameArg, null));
  21716. return;
  21717. case _util.OPS.setTextRise:
  21718. flushTextContentItem();
  21719. textState.textRise = args[0];
  21720. break;
  21721. case _util.OPS.setHScale:
  21722. flushTextContentItem();
  21723. textState.textHScale = args[0] / 100;
  21724. break;
  21725. case _util.OPS.setLeading:
  21726. flushTextContentItem();
  21727. textState.leading = args[0];
  21728. break;
  21729. case _util.OPS.moveText:
  21730. textState.translateTextLineMatrix(args[0], args[1]);
  21731. textState.textMatrix = textState.textLineMatrix.slice();
  21732. break;
  21733. case _util.OPS.setLeadingMoveText:
  21734. flushTextContentItem();
  21735. textState.leading = -args[1];
  21736. textState.translateTextLineMatrix(args[0], args[1]);
  21737. textState.textMatrix = textState.textLineMatrix.slice();
  21738. break;
  21739. case _util.OPS.nextLine:
  21740. appendEOL();
  21741. textState.carriageReturn();
  21742. break;
  21743. case _util.OPS.setTextMatrix:
  21744. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  21745. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  21746. updateAdvanceScale();
  21747. break;
  21748. case _util.OPS.setCharSpacing:
  21749. textState.charSpacing = args[0];
  21750. break;
  21751. case _util.OPS.setWordSpacing:
  21752. textState.wordSpacing = args[0];
  21753. break;
  21754. case _util.OPS.beginText:
  21755. flushTextContentItem();
  21756. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  21757. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  21758. break;
  21759. case _util.OPS.showSpacedText:
  21760. if (!stateManager.state.font) {
  21761. self.ensureStateFont(stateManager.state);
  21762. continue;
  21763. }
  21764. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  21765. const elements = args[0];
  21766. let isFirstChunk = true;
  21767. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  21768. const item = elements[i];
  21769. if (typeof item === "string") {
  21770. showSpacedTextBuffer.push(item);
  21771. } else if (typeof item === "number" && item !== 0) {
  21772. const str = showSpacedTextBuffer.join("");
  21773. showSpacedTextBuffer.length = 0;
  21774. buildTextContentItem({
  21775. chars: str,
  21776. extraSpacing: item * spaceFactor,
  21777. isFirstChunk
  21778. });
  21779. if (str && isFirstChunk) {
  21780. isFirstChunk = false;
  21781. }
  21782. }
  21783. }
  21784. const item = elements[elements.length - 1];
  21785. if (typeof item === "string") {
  21786. showSpacedTextBuffer.push(item);
  21787. }
  21788. if (showSpacedTextBuffer.length > 0) {
  21789. const str = showSpacedTextBuffer.join("");
  21790. showSpacedTextBuffer.length = 0;
  21791. buildTextContentItem({
  21792. chars: str,
  21793. extraSpacing: 0,
  21794. isFirstChunk
  21795. });
  21796. }
  21797. break;
  21798. case _util.OPS.showText:
  21799. if (!stateManager.state.font) {
  21800. self.ensureStateFont(stateManager.state);
  21801. continue;
  21802. }
  21803. buildTextContentItem({
  21804. chars: args[0],
  21805. extraSpacing: 0,
  21806. isFirstChunk: true
  21807. });
  21808. break;
  21809. case _util.OPS.nextLineShowText:
  21810. if (!stateManager.state.font) {
  21811. self.ensureStateFont(stateManager.state);
  21812. continue;
  21813. }
  21814. textContentItem.hasEOL = true;
  21815. flushTextContentItem();
  21816. textState.carriageReturn();
  21817. buildTextContentItem({
  21818. chars: args[0],
  21819. extraSpacing: 0,
  21820. isFirstChunk: true
  21821. });
  21822. break;
  21823. case _util.OPS.nextLineSetSpacingShowText:
  21824. if (!stateManager.state.font) {
  21825. self.ensureStateFont(stateManager.state);
  21826. continue;
  21827. }
  21828. textContentItem.hasEOL = true;
  21829. flushTextContentItem();
  21830. textState.wordSpacing = args[0];
  21831. textState.charSpacing = args[1];
  21832. textState.carriageReturn();
  21833. buildTextContentItem({
  21834. chars: args[2],
  21835. extraSpacing: 0,
  21836. isFirstChunk: true
  21837. });
  21838. break;
  21839. case _util.OPS.paintXObject:
  21840. flushTextContentItem();
  21841. if (!xobjs) {
  21842. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  21843. }
  21844. var isValidName = args[0] instanceof _primitives.Name;
  21845. var name = args[0].name;
  21846. if (isValidName && emptyXObjectCache.getByName(name)) {
  21847. break;
  21848. }
  21849. next(new Promise(function (resolveXObject, rejectXObject) {
  21850. if (!isValidName) {
  21851. throw new _util.FormatError("XObject must be referred to by name.");
  21852. }
  21853. let xobj = xobjs.getRaw(name);
  21854. if (xobj instanceof _primitives.Ref) {
  21855. if (emptyXObjectCache.getByRef(xobj)) {
  21856. resolveXObject();
  21857. return;
  21858. }
  21859. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  21860. if (globalImage) {
  21861. resolveXObject();
  21862. return;
  21863. }
  21864. xobj = xref.fetch(xobj);
  21865. }
  21866. if (!(0, _primitives.isStream)(xobj)) {
  21867. throw new _util.FormatError("XObject should be a stream");
  21868. }
  21869. const type = xobj.dict.get("Subtype");
  21870. if (!(0, _primitives.isName)(type)) {
  21871. throw new _util.FormatError("XObject should have a Name subtype");
  21872. }
  21873. if (type.name !== "Form") {
  21874. emptyXObjectCache.set(name, xobj.dict.objId, true);
  21875. resolveXObject();
  21876. return;
  21877. }
  21878. const currentState = stateManager.state.clone();
  21879. const xObjStateManager = new StateManager(currentState);
  21880. const matrix = xobj.dict.getArray("Matrix");
  21881. if (Array.isArray(matrix) && matrix.length === 6) {
  21882. xObjStateManager.transform(matrix);
  21883. }
  21884. enqueueChunk();
  21885. const sinkWrapper = {
  21886. enqueueInvoked: false,
  21887. enqueue(chunk, size) {
  21888. this.enqueueInvoked = true;
  21889. sink.enqueue(chunk, size);
  21890. },
  21891. get desiredSize() {
  21892. return sink.desiredSize;
  21893. },
  21894. get ready() {
  21895. return sink.ready;
  21896. }
  21897. };
  21898. self.getTextContent({
  21899. stream: xobj,
  21900. task,
  21901. resources: xobj.dict.get("Resources") || resources,
  21902. stateManager: xObjStateManager,
  21903. normalizeWhitespace,
  21904. combineTextItems,
  21905. includeMarkedContent,
  21906. sink: sinkWrapper,
  21907. seenStyles
  21908. }).then(function () {
  21909. if (!sinkWrapper.enqueueInvoked) {
  21910. emptyXObjectCache.set(name, xobj.dict.objId, true);
  21911. }
  21912. resolveXObject();
  21913. }, rejectXObject);
  21914. }).catch(function (reason) {
  21915. if (reason instanceof _util.AbortException) {
  21916. return;
  21917. }
  21918. if (self.options.ignoreErrors) {
  21919. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  21920. return;
  21921. }
  21922. throw reason;
  21923. }));
  21924. return;
  21925. case _util.OPS.setGState:
  21926. isValidName = args[0] instanceof _primitives.Name;
  21927. name = args[0].name;
  21928. if (isValidName && emptyGStateCache.getByName(name)) {
  21929. break;
  21930. }
  21931. next(new Promise(function (resolveGState, rejectGState) {
  21932. if (!isValidName) {
  21933. throw new _util.FormatError("GState must be referred to by name.");
  21934. }
  21935. const extGState = resources.get("ExtGState");
  21936. if (!(extGState instanceof _primitives.Dict)) {
  21937. throw new _util.FormatError("ExtGState should be a dictionary.");
  21938. }
  21939. const gState = extGState.get(name);
  21940. if (!(gState instanceof _primitives.Dict)) {
  21941. throw new _util.FormatError("GState should be a dictionary.");
  21942. }
  21943. const gStateFont = gState.get("Font");
  21944. if (!gStateFont) {
  21945. emptyGStateCache.set(name, gState.objId, true);
  21946. resolveGState();
  21947. return;
  21948. }
  21949. flushTextContentItem();
  21950. textState.fontName = null;
  21951. textState.fontSize = gStateFont[1];
  21952. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  21953. }).catch(function (reason) {
  21954. if (reason instanceof _util.AbortException) {
  21955. return;
  21956. }
  21957. if (self.options.ignoreErrors) {
  21958. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  21959. return;
  21960. }
  21961. throw reason;
  21962. }));
  21963. return;
  21964. case _util.OPS.beginMarkedContent:
  21965. if (includeMarkedContent) {
  21966. textContent.items.push({
  21967. type: "beginMarkedContent",
  21968. tag: (0, _primitives.isName)(args[0]) ? args[0].name : null
  21969. });
  21970. }
  21971. break;
  21972. case _util.OPS.beginMarkedContentProps:
  21973. if (includeMarkedContent) {
  21974. flushTextContentItem();
  21975. let mcid = null;
  21976. if ((0, _primitives.isDict)(args[1])) {
  21977. mcid = args[1].get("MCID");
  21978. }
  21979. textContent.items.push({
  21980. type: "beginMarkedContentProps",
  21981. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  21982. tag: (0, _primitives.isName)(args[0]) ? args[0].name : null
  21983. });
  21984. }
  21985. break;
  21986. case _util.OPS.endMarkedContent:
  21987. if (includeMarkedContent) {
  21988. flushTextContentItem();
  21989. textContent.items.push({
  21990. type: "endMarkedContent"
  21991. });
  21992. }
  21993. break;
  21994. }
  21995. if (textContent.items.length >= sink.desiredSize) {
  21996. stop = true;
  21997. break;
  21998. }
  21999. }
  22000. if (stop) {
  22001. next(deferred);
  22002. return;
  22003. }
  22004. flushTextContentItem();
  22005. enqueueChunk();
  22006. resolve();
  22007. }).catch(reason => {
  22008. if (reason instanceof _util.AbortException) {
  22009. return;
  22010. }
  22011. if (this.options.ignoreErrors) {
  22012. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  22013. flushTextContentItem();
  22014. enqueueChunk();
  22015. return;
  22016. }
  22017. throw reason;
  22018. });
  22019. }
  22020. extractDataStructures(dict, baseDict, properties) {
  22021. const xref = this.xref;
  22022. let cidToGidBytes;
  22023. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  22024. if (properties.composite) {
  22025. const cidSystemInfo = dict.get("CIDSystemInfo");
  22026. if ((0, _primitives.isDict)(cidSystemInfo)) {
  22027. properties.cidSystemInfo = {
  22028. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  22029. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  22030. supplement: cidSystemInfo.get("Supplement")
  22031. };
  22032. }
  22033. const cidToGidMap = dict.get("CIDToGIDMap");
  22034. if ((0, _primitives.isStream)(cidToGidMap)) {
  22035. cidToGidBytes = cidToGidMap.getBytes();
  22036. }
  22037. }
  22038. const differences = [];
  22039. let baseEncodingName = null;
  22040. let encoding;
  22041. if (dict.has("Encoding")) {
  22042. encoding = dict.get("Encoding");
  22043. if ((0, _primitives.isDict)(encoding)) {
  22044. baseEncodingName = encoding.get("BaseEncoding");
  22045. baseEncodingName = (0, _primitives.isName)(baseEncodingName) ? baseEncodingName.name : null;
  22046. if (encoding.has("Differences")) {
  22047. const diffEncoding = encoding.get("Differences");
  22048. let index = 0;
  22049. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  22050. const data = xref.fetchIfRef(diffEncoding[j]);
  22051. if ((0, _util.isNum)(data)) {
  22052. index = data;
  22053. } else if ((0, _primitives.isName)(data)) {
  22054. differences[index++] = data.name;
  22055. } else {
  22056. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  22057. }
  22058. }
  22059. }
  22060. } else if ((0, _primitives.isName)(encoding)) {
  22061. baseEncodingName = encoding.name;
  22062. } else {
  22063. throw new _util.FormatError("Encoding is not a Name nor a Dict");
  22064. }
  22065. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  22066. baseEncodingName = null;
  22067. }
  22068. }
  22069. if (baseEncodingName) {
  22070. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22071. } else {
  22072. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  22073. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  22074. encoding = _encodings.StandardEncoding;
  22075. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  22076. encoding = _encodings.WinAnsiEncoding;
  22077. }
  22078. if (isSymbolicFont) {
  22079. encoding = _encodings.MacRomanEncoding;
  22080. if (!properties.file || properties.isInternalFont) {
  22081. if (/Symbol/i.test(properties.name)) {
  22082. encoding = _encodings.SymbolSetEncoding;
  22083. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  22084. encoding = _encodings.ZapfDingbatsEncoding;
  22085. }
  22086. }
  22087. }
  22088. properties.defaultEncoding = encoding;
  22089. }
  22090. properties.differences = differences;
  22091. properties.baseEncodingName = baseEncodingName;
  22092. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  22093. properties.dict = dict;
  22094. return toUnicodePromise.then(readToUnicode => {
  22095. properties.toUnicode = readToUnicode;
  22096. return this.buildToUnicode(properties);
  22097. }).then(builtToUnicode => {
  22098. properties.toUnicode = builtToUnicode;
  22099. if (cidToGidBytes) {
  22100. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  22101. }
  22102. return properties;
  22103. });
  22104. }
  22105. _simpleFontToUnicode(properties, forceGlyphs = false) {
  22106. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  22107. const toUnicode = [];
  22108. const encoding = properties.defaultEncoding.slice();
  22109. const baseEncodingName = properties.baseEncodingName;
  22110. const differences = properties.differences;
  22111. for (const charcode in differences) {
  22112. const glyphName = differences[charcode];
  22113. if (glyphName === ".notdef") {
  22114. continue;
  22115. }
  22116. encoding[charcode] = glyphName;
  22117. }
  22118. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22119. for (const charcode in encoding) {
  22120. let glyphName = encoding[charcode];
  22121. if (glyphName === "") {
  22122. continue;
  22123. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  22124. let code = 0;
  22125. switch (glyphName[0]) {
  22126. case "G":
  22127. if (glyphName.length === 3) {
  22128. code = parseInt(glyphName.substring(1), 16);
  22129. }
  22130. break;
  22131. case "g":
  22132. if (glyphName.length === 5) {
  22133. code = parseInt(glyphName.substring(1), 16);
  22134. }
  22135. break;
  22136. case "C":
  22137. case "c":
  22138. if (glyphName.length >= 3 && glyphName.length <= 4) {
  22139. const codeStr = glyphName.substring(1);
  22140. if (forceGlyphs) {
  22141. code = parseInt(codeStr, 16);
  22142. break;
  22143. }
  22144. code = +codeStr;
  22145. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  22146. return this._simpleFontToUnicode(properties, true);
  22147. }
  22148. }
  22149. break;
  22150. default:
  22151. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  22152. if (unicode !== -1) {
  22153. code = unicode;
  22154. }
  22155. }
  22156. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  22157. if (baseEncodingName && code === +charcode) {
  22158. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22159. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  22160. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22161. continue;
  22162. }
  22163. }
  22164. toUnicode[charcode] = String.fromCodePoint(code);
  22165. }
  22166. continue;
  22167. }
  22168. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22169. }
  22170. return toUnicode;
  22171. }
  22172. async buildToUnicode(properties) {
  22173. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  22174. if (properties.hasIncludedToUnicodeMap) {
  22175. if (!properties.composite && properties.hasEncoding) {
  22176. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  22177. }
  22178. return properties.toUnicode;
  22179. }
  22180. if (!properties.composite) {
  22181. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  22182. }
  22183. 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"))) {
  22184. const {
  22185. registry,
  22186. ordering
  22187. } = properties.cidSystemInfo;
  22188. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  22189. const ucs2CMap = await _cmap.CMapFactory.create({
  22190. encoding: ucs2CMapName,
  22191. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22192. useCMap: null
  22193. });
  22194. const toUnicode = [];
  22195. properties.cMap.forEach(function (charcode, cid) {
  22196. if (cid > 0xffff) {
  22197. throw new _util.FormatError("Max size of CID is 65,535");
  22198. }
  22199. const ucs2 = ucs2CMap.lookup(cid);
  22200. if (ucs2) {
  22201. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  22202. }
  22203. });
  22204. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  22205. }
  22206. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  22207. }
  22208. readToUnicode(cmapObj) {
  22209. if (!cmapObj) {
  22210. return Promise.resolve(null);
  22211. }
  22212. if ((0, _primitives.isName)(cmapObj)) {
  22213. return _cmap.CMapFactory.create({
  22214. encoding: cmapObj,
  22215. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22216. useCMap: null
  22217. }).then(function (cmap) {
  22218. if (cmap instanceof _cmap.IdentityCMap) {
  22219. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22220. }
  22221. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  22222. });
  22223. } else if ((0, _primitives.isStream)(cmapObj)) {
  22224. return _cmap.CMapFactory.create({
  22225. encoding: cmapObj,
  22226. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22227. useCMap: null
  22228. }).then(function (cmap) {
  22229. if (cmap instanceof _cmap.IdentityCMap) {
  22230. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22231. }
  22232. const map = new Array(cmap.length);
  22233. cmap.forEach(function (charCode, token) {
  22234. if (typeof token === "number") {
  22235. map[charCode] = String.fromCodePoint(token);
  22236. return;
  22237. }
  22238. const str = [];
  22239. for (let k = 0; k < token.length; k += 2) {
  22240. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22241. if ((w1 & 0xf800) !== 0xd800) {
  22242. str.push(w1);
  22243. continue;
  22244. }
  22245. k += 2;
  22246. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22247. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  22248. }
  22249. map[charCode] = String.fromCodePoint.apply(String, str);
  22250. });
  22251. return new _to_unicode_map.ToUnicodeMap(map);
  22252. }, reason => {
  22253. if (reason instanceof _util.AbortException) {
  22254. return null;
  22255. }
  22256. if (this.options.ignoreErrors) {
  22257. this.handler.send("UnsupportedFeature", {
  22258. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  22259. });
  22260. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  22261. return null;
  22262. }
  22263. throw reason;
  22264. });
  22265. }
  22266. return Promise.resolve(null);
  22267. }
  22268. readCidToGidMap(glyphsData, toUnicode) {
  22269. const result = [];
  22270. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  22271. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  22272. const code = j >> 1;
  22273. if (glyphID === 0 && !toUnicode.has(code)) {
  22274. continue;
  22275. }
  22276. result[code] = glyphID;
  22277. }
  22278. return result;
  22279. }
  22280. extractWidths(dict, descriptor, properties) {
  22281. const xref = this.xref;
  22282. let glyphsWidths = [];
  22283. let defaultWidth = 0;
  22284. const glyphsVMetrics = [];
  22285. let defaultVMetrics;
  22286. let i, ii, j, jj, start, code, widths;
  22287. if (properties.composite) {
  22288. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  22289. widths = dict.get("W");
  22290. if (widths) {
  22291. for (i = 0, ii = widths.length; i < ii; i++) {
  22292. start = xref.fetchIfRef(widths[i++]);
  22293. code = xref.fetchIfRef(widths[i]);
  22294. if (Array.isArray(code)) {
  22295. for (j = 0, jj = code.length; j < jj; j++) {
  22296. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  22297. }
  22298. } else {
  22299. const width = xref.fetchIfRef(widths[++i]);
  22300. for (j = start; j <= code; j++) {
  22301. glyphsWidths[j] = width;
  22302. }
  22303. }
  22304. }
  22305. }
  22306. if (properties.vertical) {
  22307. let vmetrics = dict.getArray("DW2") || [880, -1000];
  22308. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  22309. vmetrics = dict.get("W2");
  22310. if (vmetrics) {
  22311. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  22312. start = xref.fetchIfRef(vmetrics[i++]);
  22313. code = xref.fetchIfRef(vmetrics[i]);
  22314. if (Array.isArray(code)) {
  22315. for (j = 0, jj = code.length; j < jj; j++) {
  22316. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  22317. }
  22318. } else {
  22319. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  22320. for (j = start; j <= code; j++) {
  22321. glyphsVMetrics[j] = vmetric;
  22322. }
  22323. }
  22324. }
  22325. }
  22326. }
  22327. } else {
  22328. const firstChar = properties.firstChar;
  22329. widths = dict.get("Widths");
  22330. if (widths) {
  22331. j = firstChar;
  22332. for (i = 0, ii = widths.length; i < ii; i++) {
  22333. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  22334. }
  22335. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  22336. } else {
  22337. const baseFontName = dict.get("BaseFont");
  22338. if ((0, _primitives.isName)(baseFontName)) {
  22339. const metrics = this.getBaseFontMetrics(baseFontName.name);
  22340. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  22341. defaultWidth = metrics.defaultWidth;
  22342. }
  22343. }
  22344. }
  22345. let isMonospace = true;
  22346. let firstWidth = defaultWidth;
  22347. for (const glyph in glyphsWidths) {
  22348. const glyphWidth = glyphsWidths[glyph];
  22349. if (!glyphWidth) {
  22350. continue;
  22351. }
  22352. if (!firstWidth) {
  22353. firstWidth = glyphWidth;
  22354. continue;
  22355. }
  22356. if (firstWidth !== glyphWidth) {
  22357. isMonospace = false;
  22358. break;
  22359. }
  22360. }
  22361. if (isMonospace) {
  22362. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  22363. }
  22364. properties.defaultWidth = defaultWidth;
  22365. properties.widths = glyphsWidths;
  22366. properties.defaultVMetrics = defaultVMetrics;
  22367. properties.vmetrics = glyphsVMetrics;
  22368. }
  22369. isSerifFont(baseFontName) {
  22370. const fontNameWoStyle = baseFontName.split("-")[0];
  22371. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  22372. }
  22373. getBaseFontMetrics(name) {
  22374. let defaultWidth = 0;
  22375. let widths = Object.create(null);
  22376. let monospace = false;
  22377. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  22378. let lookupName = stdFontMap[name] || name;
  22379. const Metrics = (0, _metrics.getMetrics)();
  22380. if (!(lookupName in Metrics)) {
  22381. if (this.isSerifFont(name)) {
  22382. lookupName = "Times-Roman";
  22383. } else {
  22384. lookupName = "Helvetica";
  22385. }
  22386. }
  22387. const glyphWidths = Metrics[lookupName];
  22388. if ((0, _util.isNum)(glyphWidths)) {
  22389. defaultWidth = glyphWidths;
  22390. monospace = true;
  22391. } else {
  22392. widths = glyphWidths();
  22393. }
  22394. return {
  22395. defaultWidth,
  22396. monospace,
  22397. widths
  22398. };
  22399. }
  22400. buildCharCodeToWidth(widthsByGlyphName, properties) {
  22401. const widths = Object.create(null);
  22402. const differences = properties.differences;
  22403. const encoding = properties.defaultEncoding;
  22404. for (let charCode = 0; charCode < 256; charCode++) {
  22405. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  22406. widths[charCode] = widthsByGlyphName[differences[charCode]];
  22407. continue;
  22408. }
  22409. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  22410. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  22411. continue;
  22412. }
  22413. }
  22414. return widths;
  22415. }
  22416. preEvaluateFont(dict) {
  22417. const baseDict = dict;
  22418. let type = dict.get("Subtype");
  22419. if (!(0, _primitives.isName)(type)) {
  22420. throw new _util.FormatError("invalid font Subtype");
  22421. }
  22422. let composite = false;
  22423. let hash, toUnicode;
  22424. if (type.name === "Type0") {
  22425. const df = dict.get("DescendantFonts");
  22426. if (!df) {
  22427. throw new _util.FormatError("Descendant fonts are not specified");
  22428. }
  22429. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  22430. if (!(dict instanceof _primitives.Dict)) {
  22431. throw new _util.FormatError("Descendant font is not a dictionary.");
  22432. }
  22433. type = dict.get("Subtype");
  22434. if (!(0, _primitives.isName)(type)) {
  22435. throw new _util.FormatError("invalid font Subtype");
  22436. }
  22437. composite = true;
  22438. }
  22439. const firstChar = dict.get("FirstChar") || 0,
  22440. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  22441. const descriptor = dict.get("FontDescriptor");
  22442. if (descriptor) {
  22443. hash = new _murmurhash.MurmurHash3_64();
  22444. const encoding = baseDict.getRaw("Encoding");
  22445. if ((0, _primitives.isName)(encoding)) {
  22446. hash.update(encoding.name);
  22447. } else if ((0, _primitives.isRef)(encoding)) {
  22448. hash.update(encoding.toString());
  22449. } else if ((0, _primitives.isDict)(encoding)) {
  22450. for (const entry of encoding.getRawValues()) {
  22451. if ((0, _primitives.isName)(entry)) {
  22452. hash.update(entry.name);
  22453. } else if ((0, _primitives.isRef)(entry)) {
  22454. hash.update(entry.toString());
  22455. } else if (Array.isArray(entry)) {
  22456. const diffLength = entry.length,
  22457. diffBuf = new Array(diffLength);
  22458. for (let j = 0; j < diffLength; j++) {
  22459. const diffEntry = entry[j];
  22460. if ((0, _primitives.isName)(diffEntry)) {
  22461. diffBuf[j] = diffEntry.name;
  22462. } else if ((0, _util.isNum)(diffEntry) || (0, _primitives.isRef)(diffEntry)) {
  22463. diffBuf[j] = diffEntry.toString();
  22464. }
  22465. }
  22466. hash.update(diffBuf.join());
  22467. }
  22468. }
  22469. }
  22470. hash.update(`${firstChar}-${lastChar}`);
  22471. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  22472. if ((0, _primitives.isStream)(toUnicode)) {
  22473. const stream = toUnicode.str || toUnicode;
  22474. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  22475. hash.update(uint8array);
  22476. } else if ((0, _primitives.isName)(toUnicode)) {
  22477. hash.update(toUnicode.name);
  22478. }
  22479. const widths = dict.get("Widths") || baseDict.get("Widths");
  22480. if (Array.isArray(widths)) {
  22481. const widthsBuf = [];
  22482. for (const entry of widths) {
  22483. if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) {
  22484. widthsBuf.push(entry.toString());
  22485. }
  22486. }
  22487. hash.update(widthsBuf.join());
  22488. }
  22489. if (composite) {
  22490. hash.update("compositeFont");
  22491. const compositeWidths = dict.get("W") || baseDict.get("W");
  22492. if (Array.isArray(compositeWidths)) {
  22493. const widthsBuf = [];
  22494. for (const entry of compositeWidths) {
  22495. if ((0, _util.isNum)(entry) || (0, _primitives.isRef)(entry)) {
  22496. widthsBuf.push(entry.toString());
  22497. } else if (Array.isArray(entry)) {
  22498. const subWidthsBuf = [];
  22499. for (const element of entry) {
  22500. if ((0, _util.isNum)(element) || (0, _primitives.isRef)(element)) {
  22501. subWidthsBuf.push(element.toString());
  22502. }
  22503. }
  22504. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  22505. }
  22506. }
  22507. hash.update(widthsBuf.join());
  22508. }
  22509. }
  22510. }
  22511. return {
  22512. descriptor,
  22513. dict,
  22514. baseDict,
  22515. composite,
  22516. type: type.name,
  22517. firstChar,
  22518. lastChar,
  22519. toUnicode,
  22520. hash: hash ? hash.hexdigest() : ""
  22521. };
  22522. }
  22523. async translateFont({
  22524. descriptor,
  22525. dict,
  22526. baseDict,
  22527. composite,
  22528. type,
  22529. firstChar,
  22530. lastChar,
  22531. toUnicode,
  22532. cssFontInfo
  22533. }) {
  22534. const isType3Font = type === "Type3";
  22535. let properties;
  22536. if (!descriptor) {
  22537. if (isType3Font) {
  22538. descriptor = new _primitives.Dict(null);
  22539. descriptor.set("FontName", _primitives.Name.get(type));
  22540. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  22541. } else {
  22542. let baseFontName = dict.get("BaseFont");
  22543. if (!(0, _primitives.isName)(baseFontName)) {
  22544. throw new _util.FormatError("Base font is not specified");
  22545. }
  22546. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  22547. const metrics = this.getBaseFontMetrics(baseFontName);
  22548. const fontNameWoStyle = baseFontName.split("-")[0];
  22549. const flags = (this.isSerifFont(fontNameWoStyle) ? _fonts_utils.FontFlags.Serif : 0) | (metrics.monospace ? _fonts_utils.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts_utils.FontFlags.Symbolic : _fonts_utils.FontFlags.Nonsymbolic);
  22550. properties = {
  22551. type,
  22552. name: baseFontName,
  22553. loadedName: baseDict.loadedName,
  22554. widths: metrics.widths,
  22555. defaultWidth: metrics.defaultWidth,
  22556. isSimulatedFlags: true,
  22557. flags,
  22558. firstChar,
  22559. lastChar,
  22560. toUnicode,
  22561. xHeight: 0,
  22562. capHeight: 0,
  22563. italicAngle: 0,
  22564. isType3Font
  22565. };
  22566. const widths = dict.get("Widths");
  22567. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  22568. let file = null;
  22569. if (standardFontName) {
  22570. properties.isStandardFont = true;
  22571. file = await this.fetchStandardFontData(standardFontName);
  22572. properties.isInternalFont = !!file;
  22573. }
  22574. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  22575. if (widths) {
  22576. const glyphWidths = [];
  22577. let j = firstChar;
  22578. for (let i = 0, ii = widths.length; i < ii; i++) {
  22579. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  22580. }
  22581. newProperties.widths = glyphWidths;
  22582. } else {
  22583. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  22584. }
  22585. return new _fonts.Font(baseFontName, file, newProperties);
  22586. });
  22587. }
  22588. }
  22589. let fontName = descriptor.get("FontName");
  22590. let baseFont = dict.get("BaseFont");
  22591. if ((0, _util.isString)(fontName)) {
  22592. fontName = _primitives.Name.get(fontName);
  22593. }
  22594. if ((0, _util.isString)(baseFont)) {
  22595. baseFont = _primitives.Name.get(baseFont);
  22596. }
  22597. if (!isType3Font) {
  22598. const fontNameStr = fontName && fontName.name;
  22599. const baseFontStr = baseFont && baseFont.name;
  22600. if (fontNameStr !== baseFontStr) {
  22601. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  22602. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  22603. fontName = baseFont;
  22604. }
  22605. }
  22606. }
  22607. fontName = fontName || baseFont;
  22608. if (!(0, _primitives.isName)(fontName)) {
  22609. throw new _util.FormatError("invalid font name");
  22610. }
  22611. let fontFile, subtype, length1, length2, length3;
  22612. try {
  22613. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  22614. } catch (ex) {
  22615. if (!this.options.ignoreErrors) {
  22616. throw ex;
  22617. }
  22618. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  22619. fontFile = new _stream.NullStream();
  22620. }
  22621. let isStandardFont = false;
  22622. let isInternalFont = false;
  22623. let glyphScaleFactors = null;
  22624. if (fontFile) {
  22625. if (fontFile.dict) {
  22626. const subtypeEntry = fontFile.dict.get("Subtype");
  22627. if (subtypeEntry instanceof _primitives.Name) {
  22628. subtype = subtypeEntry.name;
  22629. }
  22630. length1 = fontFile.dict.get("Length1");
  22631. length2 = fontFile.dict.get("Length2");
  22632. length3 = fontFile.dict.get("Length3");
  22633. }
  22634. } else if (cssFontInfo) {
  22635. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  22636. if (standardFontName) {
  22637. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  22638. cssFontInfo.metrics = standardFontName.metrics || null;
  22639. glyphScaleFactors = standardFontName.factors || null;
  22640. fontFile = await this.fetchStandardFontData(standardFontName.name);
  22641. isInternalFont = !!fontFile;
  22642. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  22643. composite = true;
  22644. }
  22645. } else if (!isType3Font) {
  22646. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  22647. if (standardFontName) {
  22648. isStandardFont = true;
  22649. fontFile = await this.fetchStandardFontData(standardFontName);
  22650. isInternalFont = !!fontFile;
  22651. }
  22652. }
  22653. properties = {
  22654. type,
  22655. name: fontName.name,
  22656. subtype,
  22657. file: fontFile,
  22658. length1,
  22659. length2,
  22660. length3,
  22661. isStandardFont,
  22662. isInternalFont,
  22663. loadedName: baseDict.loadedName,
  22664. composite,
  22665. fixedPitch: false,
  22666. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  22667. firstChar,
  22668. lastChar,
  22669. toUnicode,
  22670. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  22671. ascent: descriptor.get("Ascent"),
  22672. descent: descriptor.get("Descent"),
  22673. xHeight: descriptor.get("XHeight") || 0,
  22674. capHeight: descriptor.get("CapHeight") || 0,
  22675. flags: descriptor.get("Flags"),
  22676. italicAngle: descriptor.get("ItalicAngle") || 0,
  22677. isType3Font,
  22678. cssFontInfo,
  22679. scaleFactors: glyphScaleFactors
  22680. };
  22681. if (composite) {
  22682. const cidEncoding = baseDict.get("Encoding");
  22683. if ((0, _primitives.isName)(cidEncoding)) {
  22684. properties.cidEncoding = cidEncoding.name;
  22685. }
  22686. const cMap = await _cmap.CMapFactory.create({
  22687. encoding: cidEncoding,
  22688. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22689. useCMap: null
  22690. });
  22691. properties.cMap = cMap;
  22692. properties.vertical = properties.cMap.vertical;
  22693. }
  22694. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  22695. this.extractWidths(dict, descriptor, newProperties);
  22696. return new _fonts.Font(fontName.name, fontFile, newProperties);
  22697. });
  22698. }
  22699. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  22700. function buildPath(fontChar) {
  22701. const glyphName = `${font.loadedName}_path_${fontChar}`;
  22702. try {
  22703. if (font.renderer.hasBuiltPath(fontChar)) {
  22704. return;
  22705. }
  22706. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  22707. } catch (reason) {
  22708. if (evaluatorOptions.ignoreErrors) {
  22709. handler.send("UnsupportedFeature", {
  22710. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  22711. });
  22712. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  22713. return;
  22714. }
  22715. throw reason;
  22716. }
  22717. }
  22718. for (const glyph of glyphs) {
  22719. buildPath(glyph.fontChar);
  22720. const accent = glyph.accent;
  22721. if (accent && accent.fontChar) {
  22722. buildPath(accent.fontChar);
  22723. }
  22724. }
  22725. }
  22726. static get fallbackFontDict() {
  22727. const dict = new _primitives.Dict();
  22728. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  22729. dict.set("Type", _primitives.Name.get("FallbackType"));
  22730. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  22731. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  22732. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  22733. }
  22734. }
  22735. exports.PartialEvaluator = PartialEvaluator;
  22736. class TranslatedFont {
  22737. constructor({
  22738. loadedName,
  22739. font,
  22740. dict,
  22741. evaluatorOptions
  22742. }) {
  22743. this.loadedName = loadedName;
  22744. this.font = font;
  22745. this.dict = dict;
  22746. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  22747. this.type3Loaded = null;
  22748. this.type3Dependencies = font.isType3Font ? new Set() : null;
  22749. this.sent = false;
  22750. }
  22751. send(handler) {
  22752. if (this.sent) {
  22753. return;
  22754. }
  22755. this.sent = true;
  22756. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  22757. }
  22758. fallback(handler) {
  22759. if (!this.font.data) {
  22760. return;
  22761. }
  22762. this.font.disableFontFace = true;
  22763. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  22764. }
  22765. loadType3Data(evaluator, resources, task) {
  22766. if (this.type3Loaded) {
  22767. return this.type3Loaded;
  22768. }
  22769. if (!this.font.isType3Font) {
  22770. throw new Error("Must be a Type3 font.");
  22771. }
  22772. const type3Evaluator = evaluator.clone({
  22773. ignoreErrors: false
  22774. });
  22775. type3Evaluator.parsingType3Font = true;
  22776. const translatedFont = this.font,
  22777. type3Dependencies = this.type3Dependencies;
  22778. let loadCharProcsPromise = Promise.resolve();
  22779. const charProcs = this.dict.get("CharProcs");
  22780. const fontResources = this.dict.get("Resources") || resources;
  22781. const charProcOperatorList = Object.create(null);
  22782. const isEmptyBBox = !translatedFont.bbox || (0, _util.isArrayEqual)(translatedFont.bbox, [0, 0, 0, 0]);
  22783. for (const key of charProcs.getKeys()) {
  22784. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  22785. const glyphStream = charProcs.get(key);
  22786. const operatorList = new _operator_list.OperatorList();
  22787. return type3Evaluator.getOperatorList({
  22788. stream: glyphStream,
  22789. task,
  22790. resources: fontResources,
  22791. operatorList
  22792. }).then(() => {
  22793. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  22794. this._removeType3ColorOperators(operatorList, isEmptyBBox);
  22795. }
  22796. charProcOperatorList[key] = operatorList.getIR();
  22797. for (const dependency of operatorList.dependencies) {
  22798. type3Dependencies.add(dependency);
  22799. }
  22800. }).catch(function (reason) {
  22801. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  22802. const dummyOperatorList = new _operator_list.OperatorList();
  22803. charProcOperatorList[key] = dummyOperatorList.getIR();
  22804. });
  22805. });
  22806. }
  22807. this.type3Loaded = loadCharProcsPromise.then(() => {
  22808. translatedFont.charProcOperatorList = charProcOperatorList;
  22809. if (this._bbox) {
  22810. translatedFont.isCharBBox = true;
  22811. translatedFont.bbox = this._bbox;
  22812. }
  22813. });
  22814. return this.type3Loaded;
  22815. }
  22816. _removeType3ColorOperators(operatorList, isEmptyBBox = false) {
  22817. if (isEmptyBBox) {
  22818. if (!this._bbox) {
  22819. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  22820. }
  22821. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2));
  22822. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  22823. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  22824. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  22825. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  22826. }
  22827. let i = 1,
  22828. ii = operatorList.length;
  22829. while (i < ii) {
  22830. switch (operatorList.fnArray[i]) {
  22831. case _util.OPS.setStrokeColorSpace:
  22832. case _util.OPS.setFillColorSpace:
  22833. case _util.OPS.setStrokeColor:
  22834. case _util.OPS.setStrokeColorN:
  22835. case _util.OPS.setFillColor:
  22836. case _util.OPS.setFillColorN:
  22837. case _util.OPS.setStrokeGray:
  22838. case _util.OPS.setFillGray:
  22839. case _util.OPS.setStrokeRGBColor:
  22840. case _util.OPS.setFillRGBColor:
  22841. case _util.OPS.setStrokeCMYKColor:
  22842. case _util.OPS.setFillCMYKColor:
  22843. case _util.OPS.shadingFill:
  22844. case _util.OPS.setRenderingIntent:
  22845. operatorList.fnArray.splice(i, 1);
  22846. operatorList.argsArray.splice(i, 1);
  22847. ii--;
  22848. continue;
  22849. case _util.OPS.setGState:
  22850. const [gStateObj] = operatorList.argsArray[i];
  22851. let j = 0,
  22852. jj = gStateObj.length;
  22853. while (j < jj) {
  22854. const [gStateKey] = gStateObj[j];
  22855. switch (gStateKey) {
  22856. case "TR":
  22857. case "TR2":
  22858. case "HT":
  22859. case "BG":
  22860. case "BG2":
  22861. case "UCR":
  22862. case "UCR2":
  22863. gStateObj.splice(j, 1);
  22864. jj--;
  22865. continue;
  22866. }
  22867. j++;
  22868. }
  22869. break;
  22870. }
  22871. i++;
  22872. }
  22873. }
  22874. }
  22875. class StateManager {
  22876. constructor(initialState = new EvalState()) {
  22877. this.state = initialState;
  22878. this.stateStack = [];
  22879. }
  22880. save() {
  22881. const old = this.state;
  22882. this.stateStack.push(this.state);
  22883. this.state = old.clone();
  22884. }
  22885. restore() {
  22886. const prev = this.stateStack.pop();
  22887. if (prev) {
  22888. this.state = prev;
  22889. }
  22890. }
  22891. transform(args) {
  22892. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  22893. }
  22894. }
  22895. class TextState {
  22896. constructor() {
  22897. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  22898. this.fontName = null;
  22899. this.fontSize = 0;
  22900. this.font = null;
  22901. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  22902. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  22903. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  22904. this.charSpacing = 0;
  22905. this.wordSpacing = 0;
  22906. this.leading = 0;
  22907. this.textHScale = 1;
  22908. this.textRise = 0;
  22909. }
  22910. setTextMatrix(a, b, c, d, e, f) {
  22911. const m = this.textMatrix;
  22912. m[0] = a;
  22913. m[1] = b;
  22914. m[2] = c;
  22915. m[3] = d;
  22916. m[4] = e;
  22917. m[5] = f;
  22918. }
  22919. setTextLineMatrix(a, b, c, d, e, f) {
  22920. const m = this.textLineMatrix;
  22921. m[0] = a;
  22922. m[1] = b;
  22923. m[2] = c;
  22924. m[3] = d;
  22925. m[4] = e;
  22926. m[5] = f;
  22927. }
  22928. translateTextMatrix(x, y) {
  22929. const m = this.textMatrix;
  22930. m[4] = m[0] * x + m[2] * y + m[4];
  22931. m[5] = m[1] * x + m[3] * y + m[5];
  22932. }
  22933. translateTextLineMatrix(x, y) {
  22934. const m = this.textLineMatrix;
  22935. m[4] = m[0] * x + m[2] * y + m[4];
  22936. m[5] = m[1] * x + m[3] * y + m[5];
  22937. }
  22938. carriageReturn() {
  22939. this.translateTextLineMatrix(0, -this.leading);
  22940. this.textMatrix = this.textLineMatrix.slice();
  22941. }
  22942. clone() {
  22943. const clone = Object.create(this);
  22944. clone.textMatrix = this.textMatrix.slice();
  22945. clone.textLineMatrix = this.textLineMatrix.slice();
  22946. clone.fontMatrix = this.fontMatrix.slice();
  22947. return clone;
  22948. }
  22949. }
  22950. class EvalState {
  22951. constructor() {
  22952. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  22953. this.font = null;
  22954. this.textRenderingMode = _util.TextRenderingMode.FILL;
  22955. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  22956. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  22957. }
  22958. clone() {
  22959. return Object.create(this);
  22960. }
  22961. }
  22962. class EvaluatorPreprocessor {
  22963. static get opMap() {
  22964. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  22965. t.w = {
  22966. id: _util.OPS.setLineWidth,
  22967. numArgs: 1,
  22968. variableArgs: false
  22969. };
  22970. t.J = {
  22971. id: _util.OPS.setLineCap,
  22972. numArgs: 1,
  22973. variableArgs: false
  22974. };
  22975. t.j = {
  22976. id: _util.OPS.setLineJoin,
  22977. numArgs: 1,
  22978. variableArgs: false
  22979. };
  22980. t.M = {
  22981. id: _util.OPS.setMiterLimit,
  22982. numArgs: 1,
  22983. variableArgs: false
  22984. };
  22985. t.d = {
  22986. id: _util.OPS.setDash,
  22987. numArgs: 2,
  22988. variableArgs: false
  22989. };
  22990. t.ri = {
  22991. id: _util.OPS.setRenderingIntent,
  22992. numArgs: 1,
  22993. variableArgs: false
  22994. };
  22995. t.i = {
  22996. id: _util.OPS.setFlatness,
  22997. numArgs: 1,
  22998. variableArgs: false
  22999. };
  23000. t.gs = {
  23001. id: _util.OPS.setGState,
  23002. numArgs: 1,
  23003. variableArgs: false
  23004. };
  23005. t.q = {
  23006. id: _util.OPS.save,
  23007. numArgs: 0,
  23008. variableArgs: false
  23009. };
  23010. t.Q = {
  23011. id: _util.OPS.restore,
  23012. numArgs: 0,
  23013. variableArgs: false
  23014. };
  23015. t.cm = {
  23016. id: _util.OPS.transform,
  23017. numArgs: 6,
  23018. variableArgs: false
  23019. };
  23020. t.m = {
  23021. id: _util.OPS.moveTo,
  23022. numArgs: 2,
  23023. variableArgs: false
  23024. };
  23025. t.l = {
  23026. id: _util.OPS.lineTo,
  23027. numArgs: 2,
  23028. variableArgs: false
  23029. };
  23030. t.c = {
  23031. id: _util.OPS.curveTo,
  23032. numArgs: 6,
  23033. variableArgs: false
  23034. };
  23035. t.v = {
  23036. id: _util.OPS.curveTo2,
  23037. numArgs: 4,
  23038. variableArgs: false
  23039. };
  23040. t.y = {
  23041. id: _util.OPS.curveTo3,
  23042. numArgs: 4,
  23043. variableArgs: false
  23044. };
  23045. t.h = {
  23046. id: _util.OPS.closePath,
  23047. numArgs: 0,
  23048. variableArgs: false
  23049. };
  23050. t.re = {
  23051. id: _util.OPS.rectangle,
  23052. numArgs: 4,
  23053. variableArgs: false
  23054. };
  23055. t.S = {
  23056. id: _util.OPS.stroke,
  23057. numArgs: 0,
  23058. variableArgs: false
  23059. };
  23060. t.s = {
  23061. id: _util.OPS.closeStroke,
  23062. numArgs: 0,
  23063. variableArgs: false
  23064. };
  23065. t.f = {
  23066. id: _util.OPS.fill,
  23067. numArgs: 0,
  23068. variableArgs: false
  23069. };
  23070. t.F = {
  23071. id: _util.OPS.fill,
  23072. numArgs: 0,
  23073. variableArgs: false
  23074. };
  23075. t["f*"] = {
  23076. id: _util.OPS.eoFill,
  23077. numArgs: 0,
  23078. variableArgs: false
  23079. };
  23080. t.B = {
  23081. id: _util.OPS.fillStroke,
  23082. numArgs: 0,
  23083. variableArgs: false
  23084. };
  23085. t["B*"] = {
  23086. id: _util.OPS.eoFillStroke,
  23087. numArgs: 0,
  23088. variableArgs: false
  23089. };
  23090. t.b = {
  23091. id: _util.OPS.closeFillStroke,
  23092. numArgs: 0,
  23093. variableArgs: false
  23094. };
  23095. t["b*"] = {
  23096. id: _util.OPS.closeEOFillStroke,
  23097. numArgs: 0,
  23098. variableArgs: false
  23099. };
  23100. t.n = {
  23101. id: _util.OPS.endPath,
  23102. numArgs: 0,
  23103. variableArgs: false
  23104. };
  23105. t.W = {
  23106. id: _util.OPS.clip,
  23107. numArgs: 0,
  23108. variableArgs: false
  23109. };
  23110. t["W*"] = {
  23111. id: _util.OPS.eoClip,
  23112. numArgs: 0,
  23113. variableArgs: false
  23114. };
  23115. t.BT = {
  23116. id: _util.OPS.beginText,
  23117. numArgs: 0,
  23118. variableArgs: false
  23119. };
  23120. t.ET = {
  23121. id: _util.OPS.endText,
  23122. numArgs: 0,
  23123. variableArgs: false
  23124. };
  23125. t.Tc = {
  23126. id: _util.OPS.setCharSpacing,
  23127. numArgs: 1,
  23128. variableArgs: false
  23129. };
  23130. t.Tw = {
  23131. id: _util.OPS.setWordSpacing,
  23132. numArgs: 1,
  23133. variableArgs: false
  23134. };
  23135. t.Tz = {
  23136. id: _util.OPS.setHScale,
  23137. numArgs: 1,
  23138. variableArgs: false
  23139. };
  23140. t.TL = {
  23141. id: _util.OPS.setLeading,
  23142. numArgs: 1,
  23143. variableArgs: false
  23144. };
  23145. t.Tf = {
  23146. id: _util.OPS.setFont,
  23147. numArgs: 2,
  23148. variableArgs: false
  23149. };
  23150. t.Tr = {
  23151. id: _util.OPS.setTextRenderingMode,
  23152. numArgs: 1,
  23153. variableArgs: false
  23154. };
  23155. t.Ts = {
  23156. id: _util.OPS.setTextRise,
  23157. numArgs: 1,
  23158. variableArgs: false
  23159. };
  23160. t.Td = {
  23161. id: _util.OPS.moveText,
  23162. numArgs: 2,
  23163. variableArgs: false
  23164. };
  23165. t.TD = {
  23166. id: _util.OPS.setLeadingMoveText,
  23167. numArgs: 2,
  23168. variableArgs: false
  23169. };
  23170. t.Tm = {
  23171. id: _util.OPS.setTextMatrix,
  23172. numArgs: 6,
  23173. variableArgs: false
  23174. };
  23175. t["T*"] = {
  23176. id: _util.OPS.nextLine,
  23177. numArgs: 0,
  23178. variableArgs: false
  23179. };
  23180. t.Tj = {
  23181. id: _util.OPS.showText,
  23182. numArgs: 1,
  23183. variableArgs: false
  23184. };
  23185. t.TJ = {
  23186. id: _util.OPS.showSpacedText,
  23187. numArgs: 1,
  23188. variableArgs: false
  23189. };
  23190. t["'"] = {
  23191. id: _util.OPS.nextLineShowText,
  23192. numArgs: 1,
  23193. variableArgs: false
  23194. };
  23195. t['"'] = {
  23196. id: _util.OPS.nextLineSetSpacingShowText,
  23197. numArgs: 3,
  23198. variableArgs: false
  23199. };
  23200. t.d0 = {
  23201. id: _util.OPS.setCharWidth,
  23202. numArgs: 2,
  23203. variableArgs: false
  23204. };
  23205. t.d1 = {
  23206. id: _util.OPS.setCharWidthAndBounds,
  23207. numArgs: 6,
  23208. variableArgs: false
  23209. };
  23210. t.CS = {
  23211. id: _util.OPS.setStrokeColorSpace,
  23212. numArgs: 1,
  23213. variableArgs: false
  23214. };
  23215. t.cs = {
  23216. id: _util.OPS.setFillColorSpace,
  23217. numArgs: 1,
  23218. variableArgs: false
  23219. };
  23220. t.SC = {
  23221. id: _util.OPS.setStrokeColor,
  23222. numArgs: 4,
  23223. variableArgs: true
  23224. };
  23225. t.SCN = {
  23226. id: _util.OPS.setStrokeColorN,
  23227. numArgs: 33,
  23228. variableArgs: true
  23229. };
  23230. t.sc = {
  23231. id: _util.OPS.setFillColor,
  23232. numArgs: 4,
  23233. variableArgs: true
  23234. };
  23235. t.scn = {
  23236. id: _util.OPS.setFillColorN,
  23237. numArgs: 33,
  23238. variableArgs: true
  23239. };
  23240. t.G = {
  23241. id: _util.OPS.setStrokeGray,
  23242. numArgs: 1,
  23243. variableArgs: false
  23244. };
  23245. t.g = {
  23246. id: _util.OPS.setFillGray,
  23247. numArgs: 1,
  23248. variableArgs: false
  23249. };
  23250. t.RG = {
  23251. id: _util.OPS.setStrokeRGBColor,
  23252. numArgs: 3,
  23253. variableArgs: false
  23254. };
  23255. t.rg = {
  23256. id: _util.OPS.setFillRGBColor,
  23257. numArgs: 3,
  23258. variableArgs: false
  23259. };
  23260. t.K = {
  23261. id: _util.OPS.setStrokeCMYKColor,
  23262. numArgs: 4,
  23263. variableArgs: false
  23264. };
  23265. t.k = {
  23266. id: _util.OPS.setFillCMYKColor,
  23267. numArgs: 4,
  23268. variableArgs: false
  23269. };
  23270. t.sh = {
  23271. id: _util.OPS.shadingFill,
  23272. numArgs: 1,
  23273. variableArgs: false
  23274. };
  23275. t.BI = {
  23276. id: _util.OPS.beginInlineImage,
  23277. numArgs: 0,
  23278. variableArgs: false
  23279. };
  23280. t.ID = {
  23281. id: _util.OPS.beginImageData,
  23282. numArgs: 0,
  23283. variableArgs: false
  23284. };
  23285. t.EI = {
  23286. id: _util.OPS.endInlineImage,
  23287. numArgs: 1,
  23288. variableArgs: false
  23289. };
  23290. t.Do = {
  23291. id: _util.OPS.paintXObject,
  23292. numArgs: 1,
  23293. variableArgs: false
  23294. };
  23295. t.MP = {
  23296. id: _util.OPS.markPoint,
  23297. numArgs: 1,
  23298. variableArgs: false
  23299. };
  23300. t.DP = {
  23301. id: _util.OPS.markPointProps,
  23302. numArgs: 2,
  23303. variableArgs: false
  23304. };
  23305. t.BMC = {
  23306. id: _util.OPS.beginMarkedContent,
  23307. numArgs: 1,
  23308. variableArgs: false
  23309. };
  23310. t.BDC = {
  23311. id: _util.OPS.beginMarkedContentProps,
  23312. numArgs: 2,
  23313. variableArgs: false
  23314. };
  23315. t.EMC = {
  23316. id: _util.OPS.endMarkedContent,
  23317. numArgs: 0,
  23318. variableArgs: false
  23319. };
  23320. t.BX = {
  23321. id: _util.OPS.beginCompat,
  23322. numArgs: 0,
  23323. variableArgs: false
  23324. };
  23325. t.EX = {
  23326. id: _util.OPS.endCompat,
  23327. numArgs: 0,
  23328. variableArgs: false
  23329. };
  23330. t.BM = null;
  23331. t.BD = null;
  23332. t.true = null;
  23333. t.fa = null;
  23334. t.fal = null;
  23335. t.fals = null;
  23336. t.false = null;
  23337. t.nu = null;
  23338. t.nul = null;
  23339. t.null = null;
  23340. });
  23341. return (0, _util.shadow)(this, "opMap", getOPMap());
  23342. }
  23343. static get MAX_INVALID_PATH_OPS() {
  23344. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 20);
  23345. }
  23346. constructor(stream, xref, stateManager = new StateManager()) {
  23347. this.parser = new _parser.Parser({
  23348. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  23349. xref
  23350. });
  23351. this.stateManager = stateManager;
  23352. this.nonProcessedArgs = [];
  23353. this._numInvalidPathOPS = 0;
  23354. }
  23355. get savedStatesDepth() {
  23356. return this.stateManager.stateStack.length;
  23357. }
  23358. read(operation) {
  23359. let args = operation.args;
  23360. while (true) {
  23361. const obj = this.parser.getObj();
  23362. if (obj instanceof _primitives.Cmd) {
  23363. const cmd = obj.cmd;
  23364. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  23365. if (!opSpec) {
  23366. (0, _util.warn)(`Unknown command "${cmd}".`);
  23367. continue;
  23368. }
  23369. const fn = opSpec.id;
  23370. const numArgs = opSpec.numArgs;
  23371. let argsLength = args !== null ? args.length : 0;
  23372. if (!opSpec.variableArgs) {
  23373. if (argsLength !== numArgs) {
  23374. const nonProcessedArgs = this.nonProcessedArgs;
  23375. while (argsLength > numArgs) {
  23376. nonProcessedArgs.push(args.shift());
  23377. argsLength--;
  23378. }
  23379. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  23380. if (args === null) {
  23381. args = [];
  23382. }
  23383. args.unshift(nonProcessedArgs.pop());
  23384. argsLength++;
  23385. }
  23386. }
  23387. if (argsLength < numArgs) {
  23388. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  23389. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  23390. throw new _util.FormatError(`Invalid ${partialMsg}`);
  23391. }
  23392. (0, _util.warn)(`Skipping ${partialMsg}`);
  23393. if (args !== null) {
  23394. args.length = 0;
  23395. }
  23396. continue;
  23397. }
  23398. } else if (argsLength > numArgs) {
  23399. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  23400. }
  23401. this.preprocessCommand(fn, args);
  23402. operation.fn = fn;
  23403. operation.args = args;
  23404. return true;
  23405. }
  23406. if (obj === _primitives.EOF) {
  23407. return false;
  23408. }
  23409. if (obj !== null) {
  23410. if (args === null) {
  23411. args = [];
  23412. }
  23413. args.push(obj);
  23414. if (args.length > 33) {
  23415. throw new _util.FormatError("Too many arguments");
  23416. }
  23417. }
  23418. }
  23419. }
  23420. preprocessCommand(fn, args) {
  23421. switch (fn | 0) {
  23422. case _util.OPS.save:
  23423. this.stateManager.save();
  23424. break;
  23425. case _util.OPS.restore:
  23426. this.stateManager.restore();
  23427. break;
  23428. case _util.OPS.transform:
  23429. this.stateManager.transform(args);
  23430. break;
  23431. }
  23432. }
  23433. }
  23434. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  23435. /***/ }),
  23436. /* 26 */
  23437. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23438. Object.defineProperty(exports, "__esModule", ({
  23439. value: true
  23440. }));
  23441. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  23442. var _util = __w_pdfjs_require__(2);
  23443. var _primitives = __w_pdfjs_require__(5);
  23444. var _parser = __w_pdfjs_require__(27);
  23445. var _core_utils = __w_pdfjs_require__(9);
  23446. var _stream = __w_pdfjs_require__(10);
  23447. const 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"];
  23448. const MAX_MAP_RANGE = 2 ** 24 - 1;
  23449. class CMap {
  23450. constructor(builtInCMap = false) {
  23451. this.codespaceRanges = [[], [], [], []];
  23452. this.numCodespaceRanges = 0;
  23453. this._map = [];
  23454. this.name = "";
  23455. this.vertical = false;
  23456. this.useCMap = null;
  23457. this.builtInCMap = builtInCMap;
  23458. }
  23459. addCodespaceRange(n, low, high) {
  23460. this.codespaceRanges[n - 1].push(low, high);
  23461. this.numCodespaceRanges++;
  23462. }
  23463. mapCidRange(low, high, dstLow) {
  23464. if (high - low > MAX_MAP_RANGE) {
  23465. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  23466. }
  23467. while (low <= high) {
  23468. this._map[low++] = dstLow++;
  23469. }
  23470. }
  23471. mapBfRange(low, high, dstLow) {
  23472. if (high - low > MAX_MAP_RANGE) {
  23473. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  23474. }
  23475. const lastByte = dstLow.length - 1;
  23476. while (low <= high) {
  23477. this._map[low++] = dstLow;
  23478. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(dstLow.charCodeAt(lastByte) + 1);
  23479. }
  23480. }
  23481. mapBfRangeToArray(low, high, array) {
  23482. if (high - low > MAX_MAP_RANGE) {
  23483. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  23484. }
  23485. const ii = array.length;
  23486. let i = 0;
  23487. while (low <= high && i < ii) {
  23488. this._map[low] = array[i++];
  23489. ++low;
  23490. }
  23491. }
  23492. mapOne(src, dst) {
  23493. this._map[src] = dst;
  23494. }
  23495. lookup(code) {
  23496. return this._map[code];
  23497. }
  23498. contains(code) {
  23499. return this._map[code] !== undefined;
  23500. }
  23501. forEach(callback) {
  23502. const map = this._map;
  23503. const length = map.length;
  23504. if (length <= 0x10000) {
  23505. for (let i = 0; i < length; i++) {
  23506. if (map[i] !== undefined) {
  23507. callback(i, map[i]);
  23508. }
  23509. }
  23510. } else {
  23511. for (const i in map) {
  23512. callback(i, map[i]);
  23513. }
  23514. }
  23515. }
  23516. charCodeOf(value) {
  23517. const map = this._map;
  23518. if (map.length <= 0x10000) {
  23519. return map.indexOf(value);
  23520. }
  23521. for (const charCode in map) {
  23522. if (map[charCode] === value) {
  23523. return charCode | 0;
  23524. }
  23525. }
  23526. return -1;
  23527. }
  23528. getMap() {
  23529. return this._map;
  23530. }
  23531. readCharCode(str, offset, out) {
  23532. let c = 0;
  23533. const codespaceRanges = this.codespaceRanges;
  23534. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  23535. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  23536. const codespaceRange = codespaceRanges[n];
  23537. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  23538. const low = codespaceRange[k++];
  23539. const high = codespaceRange[k++];
  23540. if (c >= low && c <= high) {
  23541. out.charcode = c;
  23542. out.length = n + 1;
  23543. return;
  23544. }
  23545. }
  23546. }
  23547. out.charcode = 0;
  23548. out.length = 1;
  23549. }
  23550. getCharCodeLength(charCode) {
  23551. const codespaceRanges = this.codespaceRanges;
  23552. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  23553. const codespaceRange = codespaceRanges[n];
  23554. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  23555. const low = codespaceRange[k++];
  23556. const high = codespaceRange[k++];
  23557. if (charCode >= low && charCode <= high) {
  23558. return n + 1;
  23559. }
  23560. }
  23561. }
  23562. return 1;
  23563. }
  23564. get length() {
  23565. return this._map.length;
  23566. }
  23567. get isIdentityCMap() {
  23568. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  23569. return false;
  23570. }
  23571. if (this._map.length !== 0x10000) {
  23572. return false;
  23573. }
  23574. for (let i = 0; i < 0x10000; i++) {
  23575. if (this._map[i] !== i) {
  23576. return false;
  23577. }
  23578. }
  23579. return true;
  23580. }
  23581. }
  23582. exports.CMap = CMap;
  23583. class IdentityCMap extends CMap {
  23584. constructor(vertical, n) {
  23585. super();
  23586. this.vertical = vertical;
  23587. this.addCodespaceRange(n, 0, 0xffff);
  23588. }
  23589. mapCidRange(low, high, dstLow) {
  23590. (0, _util.unreachable)("should not call mapCidRange");
  23591. }
  23592. mapBfRange(low, high, dstLow) {
  23593. (0, _util.unreachable)("should not call mapBfRange");
  23594. }
  23595. mapBfRangeToArray(low, high, array) {
  23596. (0, _util.unreachable)("should not call mapBfRangeToArray");
  23597. }
  23598. mapOne(src, dst) {
  23599. (0, _util.unreachable)("should not call mapCidOne");
  23600. }
  23601. lookup(code) {
  23602. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  23603. }
  23604. contains(code) {
  23605. return Number.isInteger(code) && code <= 0xffff;
  23606. }
  23607. forEach(callback) {
  23608. for (let i = 0; i <= 0xffff; i++) {
  23609. callback(i, i);
  23610. }
  23611. }
  23612. charCodeOf(value) {
  23613. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  23614. }
  23615. getMap() {
  23616. const map = new Array(0x10000);
  23617. for (let i = 0; i <= 0xffff; i++) {
  23618. map[i] = i;
  23619. }
  23620. return map;
  23621. }
  23622. get length() {
  23623. return 0x10000;
  23624. }
  23625. get isIdentityCMap() {
  23626. (0, _util.unreachable)("should not access .isIdentityCMap");
  23627. }
  23628. }
  23629. exports.IdentityCMap = IdentityCMap;
  23630. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  23631. function hexToInt(a, size) {
  23632. let n = 0;
  23633. for (let i = 0; i <= size; i++) {
  23634. n = n << 8 | a[i];
  23635. }
  23636. return n >>> 0;
  23637. }
  23638. function hexToStr(a, size) {
  23639. if (size === 1) {
  23640. return String.fromCharCode(a[0], a[1]);
  23641. }
  23642. if (size === 3) {
  23643. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  23644. }
  23645. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  23646. }
  23647. function addHex(a, b, size) {
  23648. let c = 0;
  23649. for (let i = size; i >= 0; i--) {
  23650. c += a[i] + b[i];
  23651. a[i] = c & 255;
  23652. c >>= 8;
  23653. }
  23654. }
  23655. function incHex(a, size) {
  23656. let c = 1;
  23657. for (let i = size; i >= 0 && c > 0; i--) {
  23658. c += a[i];
  23659. a[i] = c & 255;
  23660. c >>= 8;
  23661. }
  23662. }
  23663. const MAX_NUM_SIZE = 16;
  23664. const MAX_ENCODED_NUM_SIZE = 19;
  23665. class BinaryCMapStream {
  23666. constructor(data) {
  23667. this.buffer = data;
  23668. this.pos = 0;
  23669. this.end = data.length;
  23670. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  23671. }
  23672. readByte() {
  23673. if (this.pos >= this.end) {
  23674. return -1;
  23675. }
  23676. return this.buffer[this.pos++];
  23677. }
  23678. readNumber() {
  23679. let n = 0;
  23680. let last;
  23681. do {
  23682. const b = this.readByte();
  23683. if (b < 0) {
  23684. throw new _util.FormatError("unexpected EOF in bcmap");
  23685. }
  23686. last = !(b & 0x80);
  23687. n = n << 7 | b & 0x7f;
  23688. } while (!last);
  23689. return n;
  23690. }
  23691. readSigned() {
  23692. const n = this.readNumber();
  23693. return n & 1 ? ~(n >>> 1) : n >>> 1;
  23694. }
  23695. readHex(num, size) {
  23696. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  23697. this.pos += size + 1;
  23698. }
  23699. readHexNumber(num, size) {
  23700. let last;
  23701. const stack = this.tmpBuf;
  23702. let sp = 0;
  23703. do {
  23704. const b = this.readByte();
  23705. if (b < 0) {
  23706. throw new _util.FormatError("unexpected EOF in bcmap");
  23707. }
  23708. last = !(b & 0x80);
  23709. stack[sp++] = b & 0x7f;
  23710. } while (!last);
  23711. let i = size,
  23712. buffer = 0,
  23713. bufferSize = 0;
  23714. while (i >= 0) {
  23715. while (bufferSize < 8 && stack.length > 0) {
  23716. buffer |= stack[--sp] << bufferSize;
  23717. bufferSize += 7;
  23718. }
  23719. num[i] = buffer & 255;
  23720. i--;
  23721. buffer >>= 8;
  23722. bufferSize -= 8;
  23723. }
  23724. }
  23725. readHexSigned(num, size) {
  23726. this.readHexNumber(num, size);
  23727. const sign = num[size] & 1 ? 255 : 0;
  23728. let c = 0;
  23729. for (let i = 0; i <= size; i++) {
  23730. c = (c & 1) << 8 | num[i];
  23731. num[i] = c >> 1 ^ sign;
  23732. }
  23733. }
  23734. readString() {
  23735. const len = this.readNumber();
  23736. let s = "";
  23737. for (let i = 0; i < len; i++) {
  23738. s += String.fromCharCode(this.readNumber());
  23739. }
  23740. return s;
  23741. }
  23742. }
  23743. class BinaryCMapReader {
  23744. async process(data, cMap, extend) {
  23745. const stream = new BinaryCMapStream(data);
  23746. const header = stream.readByte();
  23747. cMap.vertical = !!(header & 1);
  23748. let useCMap = null;
  23749. const start = new Uint8Array(MAX_NUM_SIZE);
  23750. const end = new Uint8Array(MAX_NUM_SIZE);
  23751. const char = new Uint8Array(MAX_NUM_SIZE);
  23752. const charCode = new Uint8Array(MAX_NUM_SIZE);
  23753. const tmp = new Uint8Array(MAX_NUM_SIZE);
  23754. let code;
  23755. let b;
  23756. while ((b = stream.readByte()) >= 0) {
  23757. const type = b >> 5;
  23758. if (type === 7) {
  23759. switch (b & 0x1f) {
  23760. case 0:
  23761. stream.readString();
  23762. break;
  23763. case 1:
  23764. useCMap = stream.readString();
  23765. break;
  23766. }
  23767. continue;
  23768. }
  23769. const sequence = !!(b & 0x10);
  23770. const dataSize = b & 15;
  23771. if (dataSize + 1 > MAX_NUM_SIZE) {
  23772. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  23773. }
  23774. const ucs2DataSize = 1;
  23775. const subitemsCount = stream.readNumber();
  23776. switch (type) {
  23777. case 0:
  23778. stream.readHex(start, dataSize);
  23779. stream.readHexNumber(end, dataSize);
  23780. addHex(end, start, dataSize);
  23781. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  23782. for (let i = 1; i < subitemsCount; i++) {
  23783. incHex(end, dataSize);
  23784. stream.readHexNumber(start, dataSize);
  23785. addHex(start, end, dataSize);
  23786. stream.readHexNumber(end, dataSize);
  23787. addHex(end, start, dataSize);
  23788. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  23789. }
  23790. break;
  23791. case 1:
  23792. stream.readHex(start, dataSize);
  23793. stream.readHexNumber(end, dataSize);
  23794. addHex(end, start, dataSize);
  23795. stream.readNumber();
  23796. for (let i = 1; i < subitemsCount; i++) {
  23797. incHex(end, dataSize);
  23798. stream.readHexNumber(start, dataSize);
  23799. addHex(start, end, dataSize);
  23800. stream.readHexNumber(end, dataSize);
  23801. addHex(end, start, dataSize);
  23802. stream.readNumber();
  23803. }
  23804. break;
  23805. case 2:
  23806. stream.readHex(char, dataSize);
  23807. code = stream.readNumber();
  23808. cMap.mapOne(hexToInt(char, dataSize), code);
  23809. for (let i = 1; i < subitemsCount; i++) {
  23810. incHex(char, dataSize);
  23811. if (!sequence) {
  23812. stream.readHexNumber(tmp, dataSize);
  23813. addHex(char, tmp, dataSize);
  23814. }
  23815. code = stream.readSigned() + (code + 1);
  23816. cMap.mapOne(hexToInt(char, dataSize), code);
  23817. }
  23818. break;
  23819. case 3:
  23820. stream.readHex(start, dataSize);
  23821. stream.readHexNumber(end, dataSize);
  23822. addHex(end, start, dataSize);
  23823. code = stream.readNumber();
  23824. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  23825. for (let i = 1; i < subitemsCount; i++) {
  23826. incHex(end, dataSize);
  23827. if (!sequence) {
  23828. stream.readHexNumber(start, dataSize);
  23829. addHex(start, end, dataSize);
  23830. } else {
  23831. start.set(end);
  23832. }
  23833. stream.readHexNumber(end, dataSize);
  23834. addHex(end, start, dataSize);
  23835. code = stream.readNumber();
  23836. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  23837. }
  23838. break;
  23839. case 4:
  23840. stream.readHex(char, ucs2DataSize);
  23841. stream.readHex(charCode, dataSize);
  23842. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  23843. for (let i = 1; i < subitemsCount; i++) {
  23844. incHex(char, ucs2DataSize);
  23845. if (!sequence) {
  23846. stream.readHexNumber(tmp, ucs2DataSize);
  23847. addHex(char, tmp, ucs2DataSize);
  23848. }
  23849. incHex(charCode, dataSize);
  23850. stream.readHexSigned(tmp, dataSize);
  23851. addHex(charCode, tmp, dataSize);
  23852. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  23853. }
  23854. break;
  23855. case 5:
  23856. stream.readHex(start, ucs2DataSize);
  23857. stream.readHexNumber(end, ucs2DataSize);
  23858. addHex(end, start, ucs2DataSize);
  23859. stream.readHex(charCode, dataSize);
  23860. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  23861. for (let i = 1; i < subitemsCount; i++) {
  23862. incHex(end, ucs2DataSize);
  23863. if (!sequence) {
  23864. stream.readHexNumber(start, ucs2DataSize);
  23865. addHex(start, end, ucs2DataSize);
  23866. } else {
  23867. start.set(end);
  23868. }
  23869. stream.readHexNumber(end, ucs2DataSize);
  23870. addHex(end, start, ucs2DataSize);
  23871. stream.readHex(charCode, dataSize);
  23872. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  23873. }
  23874. break;
  23875. default:
  23876. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  23877. }
  23878. }
  23879. if (useCMap) {
  23880. return extend(useCMap);
  23881. }
  23882. return cMap;
  23883. }
  23884. }
  23885. return BinaryCMapReader;
  23886. }();
  23887. const CMapFactory = function CMapFactoryClosure() {
  23888. function strToInt(str) {
  23889. let a = 0;
  23890. for (let i = 0; i < str.length; i++) {
  23891. a = a << 8 | str.charCodeAt(i);
  23892. }
  23893. return a >>> 0;
  23894. }
  23895. function expectString(obj) {
  23896. if (!(0, _util.isString)(obj)) {
  23897. throw new _util.FormatError("Malformed CMap: expected string.");
  23898. }
  23899. }
  23900. function expectInt(obj) {
  23901. if (!Number.isInteger(obj)) {
  23902. throw new _util.FormatError("Malformed CMap: expected int.");
  23903. }
  23904. }
  23905. function parseBfChar(cMap, lexer) {
  23906. while (true) {
  23907. let obj = lexer.getObj();
  23908. if (obj === _primitives.EOF) {
  23909. break;
  23910. }
  23911. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  23912. return;
  23913. }
  23914. expectString(obj);
  23915. const src = strToInt(obj);
  23916. obj = lexer.getObj();
  23917. expectString(obj);
  23918. const dst = obj;
  23919. cMap.mapOne(src, dst);
  23920. }
  23921. }
  23922. function parseBfRange(cMap, lexer) {
  23923. while (true) {
  23924. let obj = lexer.getObj();
  23925. if (obj === _primitives.EOF) {
  23926. break;
  23927. }
  23928. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  23929. return;
  23930. }
  23931. expectString(obj);
  23932. const low = strToInt(obj);
  23933. obj = lexer.getObj();
  23934. expectString(obj);
  23935. const high = strToInt(obj);
  23936. obj = lexer.getObj();
  23937. if (Number.isInteger(obj) || (0, _util.isString)(obj)) {
  23938. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  23939. cMap.mapBfRange(low, high, dstLow);
  23940. } else if ((0, _primitives.isCmd)(obj, "[")) {
  23941. obj = lexer.getObj();
  23942. const array = [];
  23943. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  23944. array.push(obj);
  23945. obj = lexer.getObj();
  23946. }
  23947. cMap.mapBfRangeToArray(low, high, array);
  23948. } else {
  23949. break;
  23950. }
  23951. }
  23952. throw new _util.FormatError("Invalid bf range.");
  23953. }
  23954. function parseCidChar(cMap, lexer) {
  23955. while (true) {
  23956. let obj = lexer.getObj();
  23957. if (obj === _primitives.EOF) {
  23958. break;
  23959. }
  23960. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  23961. return;
  23962. }
  23963. expectString(obj);
  23964. const src = strToInt(obj);
  23965. obj = lexer.getObj();
  23966. expectInt(obj);
  23967. const dst = obj;
  23968. cMap.mapOne(src, dst);
  23969. }
  23970. }
  23971. function parseCidRange(cMap, lexer) {
  23972. while (true) {
  23973. let obj = lexer.getObj();
  23974. if (obj === _primitives.EOF) {
  23975. break;
  23976. }
  23977. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  23978. return;
  23979. }
  23980. expectString(obj);
  23981. const low = strToInt(obj);
  23982. obj = lexer.getObj();
  23983. expectString(obj);
  23984. const high = strToInt(obj);
  23985. obj = lexer.getObj();
  23986. expectInt(obj);
  23987. const dstLow = obj;
  23988. cMap.mapCidRange(low, high, dstLow);
  23989. }
  23990. }
  23991. function parseCodespaceRange(cMap, lexer) {
  23992. while (true) {
  23993. let obj = lexer.getObj();
  23994. if (obj === _primitives.EOF) {
  23995. break;
  23996. }
  23997. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  23998. return;
  23999. }
  24000. if (!(0, _util.isString)(obj)) {
  24001. break;
  24002. }
  24003. const low = strToInt(obj);
  24004. obj = lexer.getObj();
  24005. if (!(0, _util.isString)(obj)) {
  24006. break;
  24007. }
  24008. const high = strToInt(obj);
  24009. cMap.addCodespaceRange(obj.length, low, high);
  24010. }
  24011. throw new _util.FormatError("Invalid codespace range.");
  24012. }
  24013. function parseWMode(cMap, lexer) {
  24014. const obj = lexer.getObj();
  24015. if (Number.isInteger(obj)) {
  24016. cMap.vertical = !!obj;
  24017. }
  24018. }
  24019. function parseCMapName(cMap, lexer) {
  24020. const obj = lexer.getObj();
  24021. if ((0, _primitives.isName)(obj) && (0, _util.isString)(obj.name)) {
  24022. cMap.name = obj.name;
  24023. }
  24024. }
  24025. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  24026. let previous, embeddedUseCMap;
  24027. objLoop: while (true) {
  24028. try {
  24029. const obj = lexer.getObj();
  24030. if (obj === _primitives.EOF) {
  24031. break;
  24032. } else if ((0, _primitives.isName)(obj)) {
  24033. if (obj.name === "WMode") {
  24034. parseWMode(cMap, lexer);
  24035. } else if (obj.name === "CMapName") {
  24036. parseCMapName(cMap, lexer);
  24037. }
  24038. previous = obj;
  24039. } else if ((0, _primitives.isCmd)(obj)) {
  24040. switch (obj.cmd) {
  24041. case "endcmap":
  24042. break objLoop;
  24043. case "usecmap":
  24044. if ((0, _primitives.isName)(previous)) {
  24045. embeddedUseCMap = previous.name;
  24046. }
  24047. break;
  24048. case "begincodespacerange":
  24049. parseCodespaceRange(cMap, lexer);
  24050. break;
  24051. case "beginbfchar":
  24052. parseBfChar(cMap, lexer);
  24053. break;
  24054. case "begincidchar":
  24055. parseCidChar(cMap, lexer);
  24056. break;
  24057. case "beginbfrange":
  24058. parseBfRange(cMap, lexer);
  24059. break;
  24060. case "begincidrange":
  24061. parseCidRange(cMap, lexer);
  24062. break;
  24063. }
  24064. }
  24065. } catch (ex) {
  24066. if (ex instanceof _core_utils.MissingDataException) {
  24067. throw ex;
  24068. }
  24069. (0, _util.warn)("Invalid cMap data: " + ex);
  24070. continue;
  24071. }
  24072. }
  24073. if (!useCMap && embeddedUseCMap) {
  24074. useCMap = embeddedUseCMap;
  24075. }
  24076. if (useCMap) {
  24077. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24078. }
  24079. return cMap;
  24080. }
  24081. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  24082. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  24083. if (cMap.numCodespaceRanges === 0) {
  24084. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  24085. for (let i = 0; i < useCodespaceRanges.length; i++) {
  24086. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  24087. }
  24088. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  24089. }
  24090. cMap.useCMap.forEach(function (key, value) {
  24091. if (!cMap.contains(key)) {
  24092. cMap.mapOne(key, cMap.useCMap.lookup(key));
  24093. }
  24094. });
  24095. return cMap;
  24096. }
  24097. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  24098. if (name === "Identity-H") {
  24099. return new IdentityCMap(false, 2);
  24100. } else if (name === "Identity-V") {
  24101. return new IdentityCMap(true, 2);
  24102. }
  24103. if (!BUILT_IN_CMAPS.includes(name)) {
  24104. throw new Error("Unknown CMap name: " + name);
  24105. }
  24106. if (!fetchBuiltInCMap) {
  24107. throw new Error("Built-in CMap parameters are not provided.");
  24108. }
  24109. const {
  24110. cMapData,
  24111. compressionType
  24112. } = await fetchBuiltInCMap(name);
  24113. const cMap = new CMap(true);
  24114. if (compressionType === _util.CMapCompressionType.BINARY) {
  24115. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  24116. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24117. });
  24118. }
  24119. if (compressionType === _util.CMapCompressionType.NONE) {
  24120. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  24121. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  24122. }
  24123. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  24124. }
  24125. return {
  24126. async create(params) {
  24127. const encoding = params.encoding;
  24128. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  24129. const useCMap = params.useCMap;
  24130. if ((0, _primitives.isName)(encoding)) {
  24131. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  24132. } else if ((0, _primitives.isStream)(encoding)) {
  24133. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  24134. if (parsedCMap.isIdentityCMap) {
  24135. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  24136. }
  24137. return parsedCMap;
  24138. }
  24139. throw new Error("Encoding required.");
  24140. }
  24141. };
  24142. }();
  24143. exports.CMapFactory = CMapFactory;
  24144. /***/ }),
  24145. /* 27 */
  24146. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24147. Object.defineProperty(exports, "__esModule", ({
  24148. value: true
  24149. }));
  24150. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  24151. var _util = __w_pdfjs_require__(2);
  24152. var _primitives = __w_pdfjs_require__(5);
  24153. var _core_utils = __w_pdfjs_require__(9);
  24154. var _ascii_85_stream = __w_pdfjs_require__(28);
  24155. var _ascii_hex_stream = __w_pdfjs_require__(30);
  24156. var _ccitt_stream = __w_pdfjs_require__(31);
  24157. var _flate_stream = __w_pdfjs_require__(33);
  24158. var _jbig2_stream = __w_pdfjs_require__(34);
  24159. var _jpeg_stream = __w_pdfjs_require__(37);
  24160. var _jpx_stream = __w_pdfjs_require__(39);
  24161. var _lzw_stream = __w_pdfjs_require__(41);
  24162. var _stream = __w_pdfjs_require__(10);
  24163. var _predictor_stream = __w_pdfjs_require__(42);
  24164. var _run_length_stream = __w_pdfjs_require__(43);
  24165. const MAX_LENGTH_TO_CACHE = 1000;
  24166. const MAX_ADLER32_LENGTH = 5552;
  24167. function computeAdler32(bytes) {
  24168. const bytesLength = bytes.length;
  24169. let a = 1,
  24170. b = 0;
  24171. for (let i = 0; i < bytesLength; ++i) {
  24172. a += bytes[i] & 0xff;
  24173. b += a;
  24174. }
  24175. return b % 65521 << 16 | a % 65521;
  24176. }
  24177. class Parser {
  24178. constructor({
  24179. lexer,
  24180. xref,
  24181. allowStreams = false,
  24182. recoveryMode = false
  24183. }) {
  24184. this.lexer = lexer;
  24185. this.xref = xref;
  24186. this.allowStreams = allowStreams;
  24187. this.recoveryMode = recoveryMode;
  24188. this.imageCache = Object.create(null);
  24189. this.refill();
  24190. }
  24191. refill() {
  24192. this.buf1 = this.lexer.getObj();
  24193. this.buf2 = this.lexer.getObj();
  24194. }
  24195. shift() {
  24196. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  24197. this.buf1 = this.buf2;
  24198. this.buf2 = null;
  24199. } else {
  24200. this.buf1 = this.buf2;
  24201. this.buf2 = this.lexer.getObj();
  24202. }
  24203. }
  24204. tryShift() {
  24205. try {
  24206. this.shift();
  24207. return true;
  24208. } catch (e) {
  24209. if (e instanceof _core_utils.MissingDataException) {
  24210. throw e;
  24211. }
  24212. return false;
  24213. }
  24214. }
  24215. getObj(cipherTransform = null) {
  24216. const buf1 = this.buf1;
  24217. this.shift();
  24218. if (buf1 instanceof _primitives.Cmd) {
  24219. switch (buf1.cmd) {
  24220. case "BI":
  24221. return this.makeInlineImage(cipherTransform);
  24222. case "[":
  24223. const array = [];
  24224. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  24225. array.push(this.getObj(cipherTransform));
  24226. }
  24227. if (this.buf1 === _primitives.EOF) {
  24228. if (this.recoveryMode) {
  24229. return array;
  24230. }
  24231. throw new _core_utils.ParserEOFException("End of file inside array.");
  24232. }
  24233. this.shift();
  24234. return array;
  24235. case "<<":
  24236. const dict = new _primitives.Dict(this.xref);
  24237. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  24238. if (!(0, _primitives.isName)(this.buf1)) {
  24239. (0, _util.info)("Malformed dictionary: key must be a name object");
  24240. this.shift();
  24241. continue;
  24242. }
  24243. const key = this.buf1.name;
  24244. this.shift();
  24245. if (this.buf1 === _primitives.EOF) {
  24246. break;
  24247. }
  24248. dict.set(key, this.getObj(cipherTransform));
  24249. }
  24250. if (this.buf1 === _primitives.EOF) {
  24251. if (this.recoveryMode) {
  24252. return dict;
  24253. }
  24254. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  24255. }
  24256. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  24257. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  24258. }
  24259. this.shift();
  24260. return dict;
  24261. default:
  24262. return buf1;
  24263. }
  24264. }
  24265. if (Number.isInteger(buf1)) {
  24266. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  24267. const ref = _primitives.Ref.get(buf1, this.buf1);
  24268. this.shift();
  24269. this.shift();
  24270. return ref;
  24271. }
  24272. return buf1;
  24273. }
  24274. if (typeof buf1 === "string") {
  24275. if (cipherTransform) {
  24276. return cipherTransform.decryptString(buf1);
  24277. }
  24278. return buf1;
  24279. }
  24280. return buf1;
  24281. }
  24282. findDefaultInlineStreamEnd(stream) {
  24283. const E = 0x45,
  24284. I = 0x49,
  24285. SPACE = 0x20,
  24286. LF = 0xa,
  24287. CR = 0xd,
  24288. NUL = 0x0;
  24289. const lexer = this.lexer,
  24290. startPos = stream.pos,
  24291. n = 10;
  24292. let state = 0,
  24293. ch,
  24294. maybeEIPos;
  24295. while ((ch = stream.getByte()) !== -1) {
  24296. if (state === 0) {
  24297. state = ch === E ? 1 : 0;
  24298. } else if (state === 1) {
  24299. state = ch === I ? 2 : 0;
  24300. } else {
  24301. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  24302. if (ch === SPACE || ch === LF || ch === CR) {
  24303. maybeEIPos = stream.pos;
  24304. const followingBytes = stream.peekBytes(n);
  24305. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  24306. ch = followingBytes[i];
  24307. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  24308. continue;
  24309. }
  24310. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  24311. state = 0;
  24312. break;
  24313. }
  24314. }
  24315. if (state !== 2) {
  24316. continue;
  24317. }
  24318. if (lexer.knownCommands) {
  24319. const nextObj = lexer.peekObj();
  24320. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  24321. state = 0;
  24322. }
  24323. } else {
  24324. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  24325. }
  24326. if (state === 2) {
  24327. break;
  24328. }
  24329. } else {
  24330. state = 0;
  24331. }
  24332. }
  24333. }
  24334. if (ch === -1) {
  24335. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  24336. if (maybeEIPos) {
  24337. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  24338. stream.skip(-(stream.pos - maybeEIPos));
  24339. }
  24340. }
  24341. let endOffset = 4;
  24342. stream.skip(-endOffset);
  24343. ch = stream.peekByte();
  24344. stream.skip(endOffset);
  24345. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  24346. endOffset--;
  24347. }
  24348. return stream.pos - endOffset - startPos;
  24349. }
  24350. findDCTDecodeInlineStreamEnd(stream) {
  24351. const startPos = stream.pos;
  24352. let foundEOI = false,
  24353. b,
  24354. markerLength;
  24355. while ((b = stream.getByte()) !== -1) {
  24356. if (b !== 0xff) {
  24357. continue;
  24358. }
  24359. switch (stream.getByte()) {
  24360. case 0x00:
  24361. break;
  24362. case 0xff:
  24363. stream.skip(-1);
  24364. break;
  24365. case 0xd9:
  24366. foundEOI = true;
  24367. break;
  24368. case 0xc0:
  24369. case 0xc1:
  24370. case 0xc2:
  24371. case 0xc3:
  24372. case 0xc5:
  24373. case 0xc6:
  24374. case 0xc7:
  24375. case 0xc9:
  24376. case 0xca:
  24377. case 0xcb:
  24378. case 0xcd:
  24379. case 0xce:
  24380. case 0xcf:
  24381. case 0xc4:
  24382. case 0xcc:
  24383. case 0xda:
  24384. case 0xdb:
  24385. case 0xdc:
  24386. case 0xdd:
  24387. case 0xde:
  24388. case 0xdf:
  24389. case 0xe0:
  24390. case 0xe1:
  24391. case 0xe2:
  24392. case 0xe3:
  24393. case 0xe4:
  24394. case 0xe5:
  24395. case 0xe6:
  24396. case 0xe7:
  24397. case 0xe8:
  24398. case 0xe9:
  24399. case 0xea:
  24400. case 0xeb:
  24401. case 0xec:
  24402. case 0xed:
  24403. case 0xee:
  24404. case 0xef:
  24405. case 0xfe:
  24406. markerLength = stream.getUint16();
  24407. if (markerLength > 2) {
  24408. stream.skip(markerLength - 2);
  24409. } else {
  24410. stream.skip(-2);
  24411. }
  24412. break;
  24413. }
  24414. if (foundEOI) {
  24415. break;
  24416. }
  24417. }
  24418. const length = stream.pos - startPos;
  24419. if (b === -1) {
  24420. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  24421. stream.skip(-length);
  24422. return this.findDefaultInlineStreamEnd(stream);
  24423. }
  24424. this.inlineStreamSkipEI(stream);
  24425. return length;
  24426. }
  24427. findASCII85DecodeInlineStreamEnd(stream) {
  24428. const TILDE = 0x7e,
  24429. GT = 0x3e;
  24430. const startPos = stream.pos;
  24431. let ch;
  24432. while ((ch = stream.getByte()) !== -1) {
  24433. if (ch === TILDE) {
  24434. const tildePos = stream.pos;
  24435. ch = stream.peekByte();
  24436. while ((0, _core_utils.isWhiteSpace)(ch)) {
  24437. stream.skip();
  24438. ch = stream.peekByte();
  24439. }
  24440. if (ch === GT) {
  24441. stream.skip();
  24442. break;
  24443. }
  24444. if (stream.pos > tildePos) {
  24445. const maybeEI = stream.peekBytes(2);
  24446. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  24447. break;
  24448. }
  24449. }
  24450. }
  24451. }
  24452. const length = stream.pos - startPos;
  24453. if (ch === -1) {
  24454. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24455. stream.skip(-length);
  24456. return this.findDefaultInlineStreamEnd(stream);
  24457. }
  24458. this.inlineStreamSkipEI(stream);
  24459. return length;
  24460. }
  24461. findASCIIHexDecodeInlineStreamEnd(stream) {
  24462. const GT = 0x3e;
  24463. const startPos = stream.pos;
  24464. let ch;
  24465. while ((ch = stream.getByte()) !== -1) {
  24466. if (ch === GT) {
  24467. break;
  24468. }
  24469. }
  24470. const length = stream.pos - startPos;
  24471. if (ch === -1) {
  24472. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24473. stream.skip(-length);
  24474. return this.findDefaultInlineStreamEnd(stream);
  24475. }
  24476. this.inlineStreamSkipEI(stream);
  24477. return length;
  24478. }
  24479. inlineStreamSkipEI(stream) {
  24480. const E = 0x45,
  24481. I = 0x49;
  24482. let state = 0,
  24483. ch;
  24484. while ((ch = stream.getByte()) !== -1) {
  24485. if (state === 0) {
  24486. state = ch === E ? 1 : 0;
  24487. } else if (state === 1) {
  24488. state = ch === I ? 2 : 0;
  24489. } else if (state === 2) {
  24490. break;
  24491. }
  24492. }
  24493. }
  24494. makeInlineImage(cipherTransform) {
  24495. const lexer = this.lexer;
  24496. const stream = lexer.stream;
  24497. const dict = new _primitives.Dict(this.xref);
  24498. let dictLength;
  24499. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  24500. if (!(0, _primitives.isName)(this.buf1)) {
  24501. throw new _util.FormatError("Dictionary key must be a name object");
  24502. }
  24503. const key = this.buf1.name;
  24504. this.shift();
  24505. if (this.buf1 === _primitives.EOF) {
  24506. break;
  24507. }
  24508. dict.set(key, this.getObj(cipherTransform));
  24509. }
  24510. if (lexer.beginInlineImagePos !== -1) {
  24511. dictLength = stream.pos - lexer.beginInlineImagePos;
  24512. }
  24513. const filter = dict.get("Filter", "F");
  24514. let filterName;
  24515. if ((0, _primitives.isName)(filter)) {
  24516. filterName = filter.name;
  24517. } else if (Array.isArray(filter)) {
  24518. const filterZero = this.xref.fetchIfRef(filter[0]);
  24519. if ((0, _primitives.isName)(filterZero)) {
  24520. filterName = filterZero.name;
  24521. }
  24522. }
  24523. const startPos = stream.pos;
  24524. let length;
  24525. if (filterName === "DCTDecode" || filterName === "DCT") {
  24526. length = this.findDCTDecodeInlineStreamEnd(stream);
  24527. } else if (filterName === "ASCII85Decode" || filterName === "A85") {
  24528. length = this.findASCII85DecodeInlineStreamEnd(stream);
  24529. } else if (filterName === "ASCIIHexDecode" || filterName === "AHx") {
  24530. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  24531. } else {
  24532. length = this.findDefaultInlineStreamEnd(stream);
  24533. }
  24534. let imageStream = stream.makeSubStream(startPos, length, dict);
  24535. let cacheKey;
  24536. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  24537. const imageBytes = imageStream.getBytes();
  24538. imageStream.reset();
  24539. const initialStreamPos = stream.pos;
  24540. stream.pos = lexer.beginInlineImagePos;
  24541. const dictBytes = stream.getBytes(dictLength);
  24542. stream.pos = initialStreamPos;
  24543. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  24544. const cacheEntry = this.imageCache[cacheKey];
  24545. if (cacheEntry !== undefined) {
  24546. this.buf2 = _primitives.Cmd.get("EI");
  24547. this.shift();
  24548. cacheEntry.reset();
  24549. return cacheEntry;
  24550. }
  24551. }
  24552. if (cipherTransform) {
  24553. imageStream = cipherTransform.createStream(imageStream, length);
  24554. }
  24555. imageStream = this.filter(imageStream, dict, length);
  24556. imageStream.dict = dict;
  24557. if (cacheKey !== undefined) {
  24558. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  24559. this.imageCache[cacheKey] = imageStream;
  24560. }
  24561. this.buf2 = _primitives.Cmd.get("EI");
  24562. this.shift();
  24563. return imageStream;
  24564. }
  24565. _findStreamLength(startPos, signature) {
  24566. const {
  24567. stream
  24568. } = this.lexer;
  24569. stream.pos = startPos;
  24570. const SCAN_BLOCK_LENGTH = 2048;
  24571. const signatureLength = signature.length;
  24572. while (stream.pos < stream.end) {
  24573. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  24574. const scanLength = scanBytes.length - signatureLength;
  24575. if (scanLength <= 0) {
  24576. break;
  24577. }
  24578. let pos = 0;
  24579. while (pos < scanLength) {
  24580. let j = 0;
  24581. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  24582. j++;
  24583. }
  24584. if (j >= signatureLength) {
  24585. stream.pos += pos;
  24586. return stream.pos - startPos;
  24587. }
  24588. pos++;
  24589. }
  24590. stream.pos += scanLength;
  24591. }
  24592. return -1;
  24593. }
  24594. makeStream(dict, cipherTransform) {
  24595. const lexer = this.lexer;
  24596. let stream = lexer.stream;
  24597. lexer.skipToNextLine();
  24598. const startPos = stream.pos - 1;
  24599. let length = dict.get("Length");
  24600. if (!Number.isInteger(length)) {
  24601. (0, _util.info)(`Bad length "${length}" in stream`);
  24602. length = 0;
  24603. }
  24604. stream.pos = startPos + length;
  24605. lexer.nextChar();
  24606. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  24607. this.shift();
  24608. } else {
  24609. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  24610. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  24611. if (actualLength < 0) {
  24612. const MAX_TRUNCATION = 1;
  24613. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  24614. const end = ENDSTREAM_SIGNATURE.length - i;
  24615. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  24616. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  24617. if (maybeLength >= 0) {
  24618. const lastByte = stream.peekBytes(end + 1)[end];
  24619. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  24620. break;
  24621. }
  24622. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  24623. actualLength = maybeLength;
  24624. break;
  24625. }
  24626. }
  24627. if (actualLength < 0) {
  24628. throw new _util.FormatError("Missing endstream command.");
  24629. }
  24630. }
  24631. length = actualLength;
  24632. lexer.nextChar();
  24633. this.shift();
  24634. this.shift();
  24635. }
  24636. this.shift();
  24637. stream = stream.makeSubStream(startPos, length, dict);
  24638. if (cipherTransform) {
  24639. stream = cipherTransform.createStream(stream, length);
  24640. }
  24641. stream = this.filter(stream, dict, length);
  24642. stream.dict = dict;
  24643. return stream;
  24644. }
  24645. filter(stream, dict, length) {
  24646. let filter = dict.get("Filter", "F");
  24647. let params = dict.get("DecodeParms", "DP");
  24648. if ((0, _primitives.isName)(filter)) {
  24649. if (Array.isArray(params)) {
  24650. (0, _util.warn)("/DecodeParms should not contain an Array, " + "when /Filter contains a Name.");
  24651. }
  24652. return this.makeFilter(stream, filter.name, length, params);
  24653. }
  24654. let maybeLength = length;
  24655. if (Array.isArray(filter)) {
  24656. const filterArray = filter;
  24657. const paramsArray = params;
  24658. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  24659. filter = this.xref.fetchIfRef(filterArray[i]);
  24660. if (!(0, _primitives.isName)(filter)) {
  24661. throw new _util.FormatError(`Bad filter name "${filter}"`);
  24662. }
  24663. params = null;
  24664. if (Array.isArray(paramsArray) && i in paramsArray) {
  24665. params = this.xref.fetchIfRef(paramsArray[i]);
  24666. }
  24667. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  24668. maybeLength = null;
  24669. }
  24670. }
  24671. return stream;
  24672. }
  24673. makeFilter(stream, name, maybeLength, params) {
  24674. if (maybeLength === 0) {
  24675. (0, _util.warn)(`Empty "${name}" stream.`);
  24676. return new _stream.NullStream();
  24677. }
  24678. try {
  24679. const xrefStreamStats = this.xref.stats.streamTypes;
  24680. if (name === "FlateDecode" || name === "Fl") {
  24681. xrefStreamStats[_util.StreamType.FLATE] = true;
  24682. if (params) {
  24683. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  24684. }
  24685. return new _flate_stream.FlateStream(stream, maybeLength);
  24686. }
  24687. if (name === "LZWDecode" || name === "LZW") {
  24688. xrefStreamStats[_util.StreamType.LZW] = true;
  24689. let earlyChange = 1;
  24690. if (params) {
  24691. if (params.has("EarlyChange")) {
  24692. earlyChange = params.get("EarlyChange");
  24693. }
  24694. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  24695. }
  24696. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  24697. }
  24698. if (name === "DCTDecode" || name === "DCT") {
  24699. xrefStreamStats[_util.StreamType.DCT] = true;
  24700. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  24701. }
  24702. if (name === "JPXDecode" || name === "JPX") {
  24703. xrefStreamStats[_util.StreamType.JPX] = true;
  24704. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  24705. }
  24706. if (name === "ASCII85Decode" || name === "A85") {
  24707. xrefStreamStats[_util.StreamType.A85] = true;
  24708. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  24709. }
  24710. if (name === "ASCIIHexDecode" || name === "AHx") {
  24711. xrefStreamStats[_util.StreamType.AHX] = true;
  24712. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  24713. }
  24714. if (name === "CCITTFaxDecode" || name === "CCF") {
  24715. xrefStreamStats[_util.StreamType.CCF] = true;
  24716. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  24717. }
  24718. if (name === "RunLengthDecode" || name === "RL") {
  24719. xrefStreamStats[_util.StreamType.RLX] = true;
  24720. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  24721. }
  24722. if (name === "JBIG2Decode") {
  24723. xrefStreamStats[_util.StreamType.JBIG] = true;
  24724. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  24725. }
  24726. (0, _util.warn)(`Filter "${name}" is not supported.`);
  24727. return stream;
  24728. } catch (ex) {
  24729. if (ex instanceof _core_utils.MissingDataException) {
  24730. throw ex;
  24731. }
  24732. (0, _util.warn)(`Invalid stream: "${ex}"`);
  24733. return new _stream.NullStream();
  24734. }
  24735. }
  24736. }
  24737. exports.Parser = Parser;
  24738. 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];
  24739. function toHexDigit(ch) {
  24740. if (ch >= 0x30 && ch <= 0x39) {
  24741. return ch & 0x0f;
  24742. }
  24743. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  24744. return (ch & 0x0f) + 9;
  24745. }
  24746. return -1;
  24747. }
  24748. class Lexer {
  24749. constructor(stream, knownCommands = null) {
  24750. this.stream = stream;
  24751. this.nextChar();
  24752. this.strBuf = [];
  24753. this.knownCommands = knownCommands;
  24754. this._hexStringNumWarn = 0;
  24755. this.beginInlineImagePos = -1;
  24756. }
  24757. nextChar() {
  24758. return this.currentChar = this.stream.getByte();
  24759. }
  24760. peekChar() {
  24761. return this.stream.peekByte();
  24762. }
  24763. getNumber() {
  24764. let ch = this.currentChar;
  24765. let eNotation = false;
  24766. let divideBy = 0;
  24767. let sign = 0;
  24768. if (ch === 0x2d) {
  24769. sign = -1;
  24770. ch = this.nextChar();
  24771. if (ch === 0x2d) {
  24772. ch = this.nextChar();
  24773. }
  24774. } else if (ch === 0x2b) {
  24775. sign = 1;
  24776. ch = this.nextChar();
  24777. }
  24778. if (ch === 0x0a || ch === 0x0d) {
  24779. do {
  24780. ch = this.nextChar();
  24781. } while (ch === 0x0a || ch === 0x0d);
  24782. }
  24783. if (ch === 0x2e) {
  24784. divideBy = 10;
  24785. ch = this.nextChar();
  24786. }
  24787. if (ch < 0x30 || ch > 0x39) {
  24788. if (divideBy === 10 && sign === 0 && ((0, _core_utils.isWhiteSpace)(ch) || ch === -1)) {
  24789. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  24790. return 0;
  24791. }
  24792. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  24793. }
  24794. sign = sign || 1;
  24795. let baseValue = ch - 0x30;
  24796. let powerValue = 0;
  24797. let powerValueSign = 1;
  24798. while ((ch = this.nextChar()) >= 0) {
  24799. if (ch >= 0x30 && ch <= 0x39) {
  24800. const currentDigit = ch - 0x30;
  24801. if (eNotation) {
  24802. powerValue = powerValue * 10 + currentDigit;
  24803. } else {
  24804. if (divideBy !== 0) {
  24805. divideBy *= 10;
  24806. }
  24807. baseValue = baseValue * 10 + currentDigit;
  24808. }
  24809. } else if (ch === 0x2e) {
  24810. if (divideBy === 0) {
  24811. divideBy = 1;
  24812. } else {
  24813. break;
  24814. }
  24815. } else if (ch === 0x2d) {
  24816. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  24817. } else if (ch === 0x45 || ch === 0x65) {
  24818. ch = this.peekChar();
  24819. if (ch === 0x2b || ch === 0x2d) {
  24820. powerValueSign = ch === 0x2d ? -1 : 1;
  24821. this.nextChar();
  24822. } else if (ch < 0x30 || ch > 0x39) {
  24823. break;
  24824. }
  24825. eNotation = true;
  24826. } else {
  24827. break;
  24828. }
  24829. }
  24830. if (divideBy !== 0) {
  24831. baseValue /= divideBy;
  24832. }
  24833. if (eNotation) {
  24834. baseValue *= 10 ** (powerValueSign * powerValue);
  24835. }
  24836. return sign * baseValue;
  24837. }
  24838. getString() {
  24839. let numParen = 1;
  24840. let done = false;
  24841. const strBuf = this.strBuf;
  24842. strBuf.length = 0;
  24843. let ch = this.nextChar();
  24844. while (true) {
  24845. let charBuffered = false;
  24846. switch (ch | 0) {
  24847. case -1:
  24848. (0, _util.warn)("Unterminated string");
  24849. done = true;
  24850. break;
  24851. case 0x28:
  24852. ++numParen;
  24853. strBuf.push("(");
  24854. break;
  24855. case 0x29:
  24856. if (--numParen === 0) {
  24857. this.nextChar();
  24858. done = true;
  24859. } else {
  24860. strBuf.push(")");
  24861. }
  24862. break;
  24863. case 0x5c:
  24864. ch = this.nextChar();
  24865. switch (ch) {
  24866. case -1:
  24867. (0, _util.warn)("Unterminated string");
  24868. done = true;
  24869. break;
  24870. case 0x6e:
  24871. strBuf.push("\n");
  24872. break;
  24873. case 0x72:
  24874. strBuf.push("\r");
  24875. break;
  24876. case 0x74:
  24877. strBuf.push("\t");
  24878. break;
  24879. case 0x62:
  24880. strBuf.push("\b");
  24881. break;
  24882. case 0x66:
  24883. strBuf.push("\f");
  24884. break;
  24885. case 0x5c:
  24886. case 0x28:
  24887. case 0x29:
  24888. strBuf.push(String.fromCharCode(ch));
  24889. break;
  24890. case 0x30:
  24891. case 0x31:
  24892. case 0x32:
  24893. case 0x33:
  24894. case 0x34:
  24895. case 0x35:
  24896. case 0x36:
  24897. case 0x37:
  24898. let x = ch & 0x0f;
  24899. ch = this.nextChar();
  24900. charBuffered = true;
  24901. if (ch >= 0x30 && ch <= 0x37) {
  24902. x = (x << 3) + (ch & 0x0f);
  24903. ch = this.nextChar();
  24904. if (ch >= 0x30 && ch <= 0x37) {
  24905. charBuffered = false;
  24906. x = (x << 3) + (ch & 0x0f);
  24907. }
  24908. }
  24909. strBuf.push(String.fromCharCode(x));
  24910. break;
  24911. case 0x0d:
  24912. if (this.peekChar() === 0x0a) {
  24913. this.nextChar();
  24914. }
  24915. break;
  24916. case 0x0a:
  24917. break;
  24918. default:
  24919. strBuf.push(String.fromCharCode(ch));
  24920. break;
  24921. }
  24922. break;
  24923. default:
  24924. strBuf.push(String.fromCharCode(ch));
  24925. break;
  24926. }
  24927. if (done) {
  24928. break;
  24929. }
  24930. if (!charBuffered) {
  24931. ch = this.nextChar();
  24932. }
  24933. }
  24934. return strBuf.join("");
  24935. }
  24936. getName() {
  24937. let ch, previousCh;
  24938. const strBuf = this.strBuf;
  24939. strBuf.length = 0;
  24940. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  24941. if (ch === 0x23) {
  24942. ch = this.nextChar();
  24943. if (specialChars[ch]) {
  24944. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  24945. strBuf.push("#");
  24946. break;
  24947. }
  24948. const x = toHexDigit(ch);
  24949. if (x !== -1) {
  24950. previousCh = ch;
  24951. ch = this.nextChar();
  24952. const x2 = toHexDigit(ch);
  24953. if (x2 === -1) {
  24954. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  24955. strBuf.push("#", String.fromCharCode(previousCh));
  24956. if (specialChars[ch]) {
  24957. break;
  24958. }
  24959. strBuf.push(String.fromCharCode(ch));
  24960. continue;
  24961. }
  24962. strBuf.push(String.fromCharCode(x << 4 | x2));
  24963. } else {
  24964. strBuf.push("#", String.fromCharCode(ch));
  24965. }
  24966. } else {
  24967. strBuf.push(String.fromCharCode(ch));
  24968. }
  24969. }
  24970. if (strBuf.length > 127) {
  24971. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  24972. } else if (strBuf.length === 0) {
  24973. (0, _util.warn)("Name token is empty.");
  24974. }
  24975. return _primitives.Name.get(strBuf.join(""));
  24976. }
  24977. _hexStringWarn(ch) {
  24978. const MAX_HEX_STRING_NUM_WARN = 5;
  24979. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  24980. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  24981. return;
  24982. }
  24983. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  24984. return;
  24985. }
  24986. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  24987. }
  24988. getHexString() {
  24989. const strBuf = this.strBuf;
  24990. strBuf.length = 0;
  24991. let ch = this.currentChar;
  24992. let isFirstHex = true;
  24993. let firstDigit, secondDigit;
  24994. this._hexStringNumWarn = 0;
  24995. while (true) {
  24996. if (ch < 0) {
  24997. (0, _util.warn)("Unterminated hex string");
  24998. break;
  24999. } else if (ch === 0x3e) {
  25000. this.nextChar();
  25001. break;
  25002. } else if (specialChars[ch] === 1) {
  25003. ch = this.nextChar();
  25004. continue;
  25005. } else {
  25006. if (isFirstHex) {
  25007. firstDigit = toHexDigit(ch);
  25008. if (firstDigit === -1) {
  25009. this._hexStringWarn(ch);
  25010. ch = this.nextChar();
  25011. continue;
  25012. }
  25013. } else {
  25014. secondDigit = toHexDigit(ch);
  25015. if (secondDigit === -1) {
  25016. this._hexStringWarn(ch);
  25017. ch = this.nextChar();
  25018. continue;
  25019. }
  25020. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  25021. }
  25022. isFirstHex = !isFirstHex;
  25023. ch = this.nextChar();
  25024. }
  25025. }
  25026. return strBuf.join("");
  25027. }
  25028. getObj() {
  25029. let comment = false;
  25030. let ch = this.currentChar;
  25031. while (true) {
  25032. if (ch < 0) {
  25033. return _primitives.EOF;
  25034. }
  25035. if (comment) {
  25036. if (ch === 0x0a || ch === 0x0d) {
  25037. comment = false;
  25038. }
  25039. } else if (ch === 0x25) {
  25040. comment = true;
  25041. } else if (specialChars[ch] !== 1) {
  25042. break;
  25043. }
  25044. ch = this.nextChar();
  25045. }
  25046. switch (ch | 0) {
  25047. case 0x30:
  25048. case 0x31:
  25049. case 0x32:
  25050. case 0x33:
  25051. case 0x34:
  25052. case 0x35:
  25053. case 0x36:
  25054. case 0x37:
  25055. case 0x38:
  25056. case 0x39:
  25057. case 0x2b:
  25058. case 0x2d:
  25059. case 0x2e:
  25060. return this.getNumber();
  25061. case 0x28:
  25062. return this.getString();
  25063. case 0x2f:
  25064. return this.getName();
  25065. case 0x5b:
  25066. this.nextChar();
  25067. return _primitives.Cmd.get("[");
  25068. case 0x5d:
  25069. this.nextChar();
  25070. return _primitives.Cmd.get("]");
  25071. case 0x3c:
  25072. ch = this.nextChar();
  25073. if (ch === 0x3c) {
  25074. this.nextChar();
  25075. return _primitives.Cmd.get("<<");
  25076. }
  25077. return this.getHexString();
  25078. case 0x3e:
  25079. ch = this.nextChar();
  25080. if (ch === 0x3e) {
  25081. this.nextChar();
  25082. return _primitives.Cmd.get(">>");
  25083. }
  25084. return _primitives.Cmd.get(">");
  25085. case 0x7b:
  25086. this.nextChar();
  25087. return _primitives.Cmd.get("{");
  25088. case 0x7d:
  25089. this.nextChar();
  25090. return _primitives.Cmd.get("}");
  25091. case 0x29:
  25092. this.nextChar();
  25093. throw new _util.FormatError(`Illegal character: ${ch}`);
  25094. }
  25095. let str = String.fromCharCode(ch);
  25096. if (ch < 0x20 || ch > 0x7f) {
  25097. const nextCh = this.peekChar();
  25098. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  25099. this.nextChar();
  25100. return _primitives.Cmd.get(str);
  25101. }
  25102. }
  25103. const knownCommands = this.knownCommands;
  25104. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25105. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  25106. const possibleCommand = str + String.fromCharCode(ch);
  25107. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  25108. break;
  25109. }
  25110. if (str.length === 128) {
  25111. throw new _util.FormatError(`Command token too long: ${str.length}`);
  25112. }
  25113. str = possibleCommand;
  25114. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25115. }
  25116. if (str === "true") {
  25117. return true;
  25118. }
  25119. if (str === "false") {
  25120. return false;
  25121. }
  25122. if (str === "null") {
  25123. return null;
  25124. }
  25125. if (str === "BI") {
  25126. this.beginInlineImagePos = this.stream.pos;
  25127. }
  25128. return _primitives.Cmd.get(str);
  25129. }
  25130. peekObj() {
  25131. const streamPos = this.stream.pos,
  25132. currentChar = this.currentChar,
  25133. beginInlineImagePos = this.beginInlineImagePos;
  25134. let nextObj;
  25135. try {
  25136. nextObj = this.getObj();
  25137. } catch (ex) {
  25138. if (ex instanceof _core_utils.MissingDataException) {
  25139. throw ex;
  25140. }
  25141. (0, _util.warn)(`peekObj: ${ex}`);
  25142. }
  25143. this.stream.pos = streamPos;
  25144. this.currentChar = currentChar;
  25145. this.beginInlineImagePos = beginInlineImagePos;
  25146. return nextObj;
  25147. }
  25148. skipToNextLine() {
  25149. let ch = this.currentChar;
  25150. while (ch >= 0) {
  25151. if (ch === 0x0d) {
  25152. ch = this.nextChar();
  25153. if (ch === 0x0a) {
  25154. this.nextChar();
  25155. }
  25156. break;
  25157. } else if (ch === 0x0a) {
  25158. this.nextChar();
  25159. break;
  25160. }
  25161. ch = this.nextChar();
  25162. }
  25163. }
  25164. }
  25165. exports.Lexer = Lexer;
  25166. class Linearization {
  25167. static create(stream) {
  25168. function getInt(linDict, name, allowZeroValue = false) {
  25169. const obj = linDict.get(name);
  25170. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  25171. return obj;
  25172. }
  25173. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  25174. }
  25175. function getHints(linDict) {
  25176. const hints = linDict.get("H");
  25177. let hintsLength;
  25178. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  25179. for (let index = 0; index < hintsLength; index++) {
  25180. const hint = hints[index];
  25181. if (!(Number.isInteger(hint) && hint > 0)) {
  25182. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  25183. }
  25184. }
  25185. return hints;
  25186. }
  25187. throw new Error("Hint array in the linearization dictionary is invalid.");
  25188. }
  25189. const parser = new Parser({
  25190. lexer: new Lexer(stream),
  25191. xref: null
  25192. });
  25193. const obj1 = parser.getObj();
  25194. const obj2 = parser.getObj();
  25195. const obj3 = parser.getObj();
  25196. const linDict = parser.getObj();
  25197. let obj, length;
  25198. 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)) {
  25199. return null;
  25200. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  25201. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  25202. }
  25203. return {
  25204. length,
  25205. hints: getHints(linDict),
  25206. objectNumberFirst: getInt(linDict, "O"),
  25207. endFirst: getInt(linDict, "E"),
  25208. numPages: getInt(linDict, "N"),
  25209. mainXRefEntriesOffset: getInt(linDict, "T"),
  25210. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  25211. };
  25212. }
  25213. }
  25214. exports.Linearization = Linearization;
  25215. /***/ }),
  25216. /* 28 */
  25217. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25218. Object.defineProperty(exports, "__esModule", ({
  25219. value: true
  25220. }));
  25221. exports.Ascii85Stream = void 0;
  25222. var _decode_stream = __w_pdfjs_require__(29);
  25223. var _core_utils = __w_pdfjs_require__(9);
  25224. class Ascii85Stream extends _decode_stream.DecodeStream {
  25225. constructor(str, maybeLength) {
  25226. if (maybeLength) {
  25227. maybeLength *= 0.8;
  25228. }
  25229. super(maybeLength);
  25230. this.str = str;
  25231. this.dict = str.dict;
  25232. this.input = new Uint8Array(5);
  25233. }
  25234. readBlock() {
  25235. const TILDA_CHAR = 0x7e;
  25236. const Z_LOWER_CHAR = 0x7a;
  25237. const EOF = -1;
  25238. const str = this.str;
  25239. let c = str.getByte();
  25240. while ((0, _core_utils.isWhiteSpace)(c)) {
  25241. c = str.getByte();
  25242. }
  25243. if (c === EOF || c === TILDA_CHAR) {
  25244. this.eof = true;
  25245. return;
  25246. }
  25247. const bufferLength = this.bufferLength;
  25248. let buffer, i;
  25249. if (c === Z_LOWER_CHAR) {
  25250. buffer = this.ensureBuffer(bufferLength + 4);
  25251. for (i = 0; i < 4; ++i) {
  25252. buffer[bufferLength + i] = 0;
  25253. }
  25254. this.bufferLength += 4;
  25255. } else {
  25256. const input = this.input;
  25257. input[0] = c;
  25258. for (i = 1; i < 5; ++i) {
  25259. c = str.getByte();
  25260. while ((0, _core_utils.isWhiteSpace)(c)) {
  25261. c = str.getByte();
  25262. }
  25263. input[i] = c;
  25264. if (c === EOF || c === TILDA_CHAR) {
  25265. break;
  25266. }
  25267. }
  25268. buffer = this.ensureBuffer(bufferLength + i - 1);
  25269. this.bufferLength += i - 1;
  25270. if (i < 5) {
  25271. for (; i < 5; ++i) {
  25272. input[i] = 0x21 + 84;
  25273. }
  25274. this.eof = true;
  25275. }
  25276. let t = 0;
  25277. for (i = 0; i < 5; ++i) {
  25278. t = t * 85 + (input[i] - 0x21);
  25279. }
  25280. for (i = 3; i >= 0; --i) {
  25281. buffer[bufferLength + i] = t & 0xff;
  25282. t >>= 8;
  25283. }
  25284. }
  25285. }
  25286. }
  25287. exports.Ascii85Stream = Ascii85Stream;
  25288. /***/ }),
  25289. /* 29 */
  25290. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25291. Object.defineProperty(exports, "__esModule", ({
  25292. value: true
  25293. }));
  25294. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  25295. var _base_stream = __w_pdfjs_require__(6);
  25296. var _stream = __w_pdfjs_require__(10);
  25297. const emptyBuffer = new Uint8Array(0);
  25298. class DecodeStream extends _base_stream.BaseStream {
  25299. constructor(maybeMinBufferLength) {
  25300. super();
  25301. this._rawMinBufferLength = maybeMinBufferLength || 0;
  25302. this.pos = 0;
  25303. this.bufferLength = 0;
  25304. this.eof = false;
  25305. this.buffer = emptyBuffer;
  25306. this.minBufferLength = 512;
  25307. if (maybeMinBufferLength) {
  25308. while (this.minBufferLength < maybeMinBufferLength) {
  25309. this.minBufferLength *= 2;
  25310. }
  25311. }
  25312. }
  25313. get isEmpty() {
  25314. while (!this.eof && this.bufferLength === 0) {
  25315. this.readBlock();
  25316. }
  25317. return this.bufferLength === 0;
  25318. }
  25319. ensureBuffer(requested) {
  25320. const buffer = this.buffer;
  25321. if (requested <= buffer.byteLength) {
  25322. return buffer;
  25323. }
  25324. let size = this.minBufferLength;
  25325. while (size < requested) {
  25326. size *= 2;
  25327. }
  25328. const buffer2 = new Uint8Array(size);
  25329. buffer2.set(buffer);
  25330. return this.buffer = buffer2;
  25331. }
  25332. getByte() {
  25333. const pos = this.pos;
  25334. while (this.bufferLength <= pos) {
  25335. if (this.eof) {
  25336. return -1;
  25337. }
  25338. this.readBlock();
  25339. }
  25340. return this.buffer[this.pos++];
  25341. }
  25342. getBytes(length, forceClamped = false) {
  25343. const pos = this.pos;
  25344. let end;
  25345. if (length) {
  25346. this.ensureBuffer(pos + length);
  25347. end = pos + length;
  25348. while (!this.eof && this.bufferLength < end) {
  25349. this.readBlock();
  25350. }
  25351. const bufEnd = this.bufferLength;
  25352. if (end > bufEnd) {
  25353. end = bufEnd;
  25354. }
  25355. } else {
  25356. while (!this.eof) {
  25357. this.readBlock();
  25358. }
  25359. end = this.bufferLength;
  25360. }
  25361. this.pos = end;
  25362. const subarray = this.buffer.subarray(pos, end);
  25363. return forceClamped && !(subarray instanceof Uint8ClampedArray) ? new Uint8ClampedArray(subarray) : subarray;
  25364. }
  25365. reset() {
  25366. this.pos = 0;
  25367. }
  25368. makeSubStream(start, length, dict = null) {
  25369. if (length === undefined) {
  25370. while (!this.eof) {
  25371. this.readBlock();
  25372. }
  25373. } else {
  25374. const end = start + length;
  25375. while (this.bufferLength <= end && !this.eof) {
  25376. this.readBlock();
  25377. }
  25378. }
  25379. return new _stream.Stream(this.buffer, start, length, dict);
  25380. }
  25381. getBaseStreams() {
  25382. return this.str ? this.str.getBaseStreams() : null;
  25383. }
  25384. }
  25385. exports.DecodeStream = DecodeStream;
  25386. class StreamsSequenceStream extends DecodeStream {
  25387. constructor(streams, onError = null) {
  25388. let maybeLength = 0;
  25389. for (const stream of streams) {
  25390. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  25391. }
  25392. super(maybeLength);
  25393. this.streams = streams;
  25394. this._onError = onError;
  25395. }
  25396. readBlock() {
  25397. const streams = this.streams;
  25398. if (streams.length === 0) {
  25399. this.eof = true;
  25400. return;
  25401. }
  25402. const stream = streams.shift();
  25403. let chunk;
  25404. try {
  25405. chunk = stream.getBytes();
  25406. } catch (reason) {
  25407. if (this._onError) {
  25408. this._onError(reason, stream.dict && stream.dict.objId);
  25409. return;
  25410. }
  25411. throw reason;
  25412. }
  25413. const bufferLength = this.bufferLength;
  25414. const newLength = bufferLength + chunk.length;
  25415. const buffer = this.ensureBuffer(newLength);
  25416. buffer.set(chunk, bufferLength);
  25417. this.bufferLength = newLength;
  25418. }
  25419. getBaseStreams() {
  25420. const baseStreamsBuf = [];
  25421. for (const stream of this.streams) {
  25422. const baseStreams = stream.getBaseStreams();
  25423. if (baseStreams) {
  25424. baseStreamsBuf.push(...baseStreams);
  25425. }
  25426. }
  25427. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  25428. }
  25429. }
  25430. exports.StreamsSequenceStream = StreamsSequenceStream;
  25431. /***/ }),
  25432. /* 30 */
  25433. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25434. Object.defineProperty(exports, "__esModule", ({
  25435. value: true
  25436. }));
  25437. exports.AsciiHexStream = void 0;
  25438. var _decode_stream = __w_pdfjs_require__(29);
  25439. class AsciiHexStream extends _decode_stream.DecodeStream {
  25440. constructor(str, maybeLength) {
  25441. if (maybeLength) {
  25442. maybeLength *= 0.5;
  25443. }
  25444. super(maybeLength);
  25445. this.str = str;
  25446. this.dict = str.dict;
  25447. this.firstDigit = -1;
  25448. }
  25449. readBlock() {
  25450. const UPSTREAM_BLOCK_SIZE = 8000;
  25451. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  25452. if (!bytes.length) {
  25453. this.eof = true;
  25454. return;
  25455. }
  25456. const maxDecodeLength = bytes.length + 1 >> 1;
  25457. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  25458. let bufferLength = this.bufferLength;
  25459. let firstDigit = this.firstDigit;
  25460. for (const ch of bytes) {
  25461. let digit;
  25462. if (ch >= 0x30 && ch <= 0x39) {
  25463. digit = ch & 0x0f;
  25464. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  25465. digit = (ch & 0x0f) + 9;
  25466. } else if (ch === 0x3e) {
  25467. this.eof = true;
  25468. break;
  25469. } else {
  25470. continue;
  25471. }
  25472. if (firstDigit < 0) {
  25473. firstDigit = digit;
  25474. } else {
  25475. buffer[bufferLength++] = firstDigit << 4 | digit;
  25476. firstDigit = -1;
  25477. }
  25478. }
  25479. if (firstDigit >= 0 && this.eof) {
  25480. buffer[bufferLength++] = firstDigit << 4;
  25481. firstDigit = -1;
  25482. }
  25483. this.firstDigit = firstDigit;
  25484. this.bufferLength = bufferLength;
  25485. }
  25486. }
  25487. exports.AsciiHexStream = AsciiHexStream;
  25488. /***/ }),
  25489. /* 31 */
  25490. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25491. Object.defineProperty(exports, "__esModule", ({
  25492. value: true
  25493. }));
  25494. exports.CCITTFaxStream = void 0;
  25495. var _primitives = __w_pdfjs_require__(5);
  25496. var _ccitt = __w_pdfjs_require__(32);
  25497. var _decode_stream = __w_pdfjs_require__(29);
  25498. class CCITTFaxStream extends _decode_stream.DecodeStream {
  25499. constructor(str, maybeLength, params) {
  25500. super(maybeLength);
  25501. this.str = str;
  25502. this.dict = str.dict;
  25503. if (!(0, _primitives.isDict)(params)) {
  25504. params = _primitives.Dict.empty;
  25505. }
  25506. const source = {
  25507. next() {
  25508. return str.getByte();
  25509. }
  25510. };
  25511. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  25512. K: params.get("K"),
  25513. EndOfLine: params.get("EndOfLine"),
  25514. EncodedByteAlign: params.get("EncodedByteAlign"),
  25515. Columns: params.get("Columns"),
  25516. Rows: params.get("Rows"),
  25517. EndOfBlock: params.get("EndOfBlock"),
  25518. BlackIs1: params.get("BlackIs1")
  25519. });
  25520. }
  25521. readBlock() {
  25522. while (!this.eof) {
  25523. const c = this.ccittFaxDecoder.readNextChar();
  25524. if (c === -1) {
  25525. this.eof = true;
  25526. return;
  25527. }
  25528. this.ensureBuffer(this.bufferLength + 1);
  25529. this.buffer[this.bufferLength++] = c;
  25530. }
  25531. }
  25532. }
  25533. exports.CCITTFaxStream = CCITTFaxStream;
  25534. /***/ }),
  25535. /* 32 */
  25536. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25537. Object.defineProperty(exports, "__esModule", ({
  25538. value: true
  25539. }));
  25540. exports.CCITTFaxDecoder = void 0;
  25541. var _util = __w_pdfjs_require__(2);
  25542. const ccittEOL = -2;
  25543. const ccittEOF = -1;
  25544. const twoDimPass = 0;
  25545. const twoDimHoriz = 1;
  25546. const twoDimVert0 = 2;
  25547. const twoDimVertR1 = 3;
  25548. const twoDimVertL1 = 4;
  25549. const twoDimVertR2 = 5;
  25550. const twoDimVertL2 = 6;
  25551. const twoDimVertR3 = 7;
  25552. const twoDimVertL3 = 8;
  25553. 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]];
  25554. 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]];
  25555. 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]];
  25556. 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]];
  25557. 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]];
  25558. 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]];
  25559. class CCITTFaxDecoder {
  25560. constructor(source, options = {}) {
  25561. if (!source || typeof source.next !== "function") {
  25562. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  25563. }
  25564. this.source = source;
  25565. this.eof = false;
  25566. this.encoding = options.K || 0;
  25567. this.eoline = options.EndOfLine || false;
  25568. this.byteAlign = options.EncodedByteAlign || false;
  25569. this.columns = options.Columns || 1728;
  25570. this.rows = options.Rows || 0;
  25571. let eoblock = options.EndOfBlock;
  25572. if (eoblock === null || eoblock === undefined) {
  25573. eoblock = true;
  25574. }
  25575. this.eoblock = eoblock;
  25576. this.black = options.BlackIs1 || false;
  25577. this.codingLine = new Uint32Array(this.columns + 1);
  25578. this.refLine = new Uint32Array(this.columns + 2);
  25579. this.codingLine[0] = this.columns;
  25580. this.codingPos = 0;
  25581. this.row = 0;
  25582. this.nextLine2D = this.encoding < 0;
  25583. this.inputBits = 0;
  25584. this.inputBuf = 0;
  25585. this.outputBits = 0;
  25586. this.rowsDone = false;
  25587. let code1;
  25588. while ((code1 = this._lookBits(12)) === 0) {
  25589. this._eatBits(1);
  25590. }
  25591. if (code1 === 1) {
  25592. this._eatBits(12);
  25593. }
  25594. if (this.encoding > 0) {
  25595. this.nextLine2D = !this._lookBits(1);
  25596. this._eatBits(1);
  25597. }
  25598. }
  25599. readNextChar() {
  25600. if (this.eof) {
  25601. return -1;
  25602. }
  25603. const refLine = this.refLine;
  25604. const codingLine = this.codingLine;
  25605. const columns = this.columns;
  25606. let refPos, blackPixels, bits, i;
  25607. if (this.outputBits === 0) {
  25608. if (this.rowsDone) {
  25609. this.eof = true;
  25610. }
  25611. if (this.eof) {
  25612. return -1;
  25613. }
  25614. this.err = false;
  25615. let code1, code2, code3;
  25616. if (this.nextLine2D) {
  25617. for (i = 0; codingLine[i] < columns; ++i) {
  25618. refLine[i] = codingLine[i];
  25619. }
  25620. refLine[i++] = columns;
  25621. refLine[i] = columns;
  25622. codingLine[0] = 0;
  25623. this.codingPos = 0;
  25624. refPos = 0;
  25625. blackPixels = 0;
  25626. while (codingLine[this.codingPos] < columns) {
  25627. code1 = this._getTwoDimCode();
  25628. switch (code1) {
  25629. case twoDimPass:
  25630. this._addPixels(refLine[refPos + 1], blackPixels);
  25631. if (refLine[refPos + 1] < columns) {
  25632. refPos += 2;
  25633. }
  25634. break;
  25635. case twoDimHoriz:
  25636. code1 = code2 = 0;
  25637. if (blackPixels) {
  25638. do {
  25639. code1 += code3 = this._getBlackCode();
  25640. } while (code3 >= 64);
  25641. do {
  25642. code2 += code3 = this._getWhiteCode();
  25643. } while (code3 >= 64);
  25644. } else {
  25645. do {
  25646. code1 += code3 = this._getWhiteCode();
  25647. } while (code3 >= 64);
  25648. do {
  25649. code2 += code3 = this._getBlackCode();
  25650. } while (code3 >= 64);
  25651. }
  25652. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  25653. if (codingLine[this.codingPos] < columns) {
  25654. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  25655. }
  25656. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25657. refPos += 2;
  25658. }
  25659. break;
  25660. case twoDimVertR3:
  25661. this._addPixels(refLine[refPos] + 3, blackPixels);
  25662. blackPixels ^= 1;
  25663. if (codingLine[this.codingPos] < columns) {
  25664. ++refPos;
  25665. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25666. refPos += 2;
  25667. }
  25668. }
  25669. break;
  25670. case twoDimVertR2:
  25671. this._addPixels(refLine[refPos] + 2, blackPixels);
  25672. blackPixels ^= 1;
  25673. if (codingLine[this.codingPos] < columns) {
  25674. ++refPos;
  25675. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25676. refPos += 2;
  25677. }
  25678. }
  25679. break;
  25680. case twoDimVertR1:
  25681. this._addPixels(refLine[refPos] + 1, blackPixels);
  25682. blackPixels ^= 1;
  25683. if (codingLine[this.codingPos] < columns) {
  25684. ++refPos;
  25685. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25686. refPos += 2;
  25687. }
  25688. }
  25689. break;
  25690. case twoDimVert0:
  25691. this._addPixels(refLine[refPos], blackPixels);
  25692. blackPixels ^= 1;
  25693. if (codingLine[this.codingPos] < columns) {
  25694. ++refPos;
  25695. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25696. refPos += 2;
  25697. }
  25698. }
  25699. break;
  25700. case twoDimVertL3:
  25701. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  25702. blackPixels ^= 1;
  25703. if (codingLine[this.codingPos] < columns) {
  25704. if (refPos > 0) {
  25705. --refPos;
  25706. } else {
  25707. ++refPos;
  25708. }
  25709. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25710. refPos += 2;
  25711. }
  25712. }
  25713. break;
  25714. case twoDimVertL2:
  25715. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  25716. blackPixels ^= 1;
  25717. if (codingLine[this.codingPos] < columns) {
  25718. if (refPos > 0) {
  25719. --refPos;
  25720. } else {
  25721. ++refPos;
  25722. }
  25723. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25724. refPos += 2;
  25725. }
  25726. }
  25727. break;
  25728. case twoDimVertL1:
  25729. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  25730. blackPixels ^= 1;
  25731. if (codingLine[this.codingPos] < columns) {
  25732. if (refPos > 0) {
  25733. --refPos;
  25734. } else {
  25735. ++refPos;
  25736. }
  25737. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  25738. refPos += 2;
  25739. }
  25740. }
  25741. break;
  25742. case ccittEOF:
  25743. this._addPixels(columns, 0);
  25744. this.eof = true;
  25745. break;
  25746. default:
  25747. (0, _util.info)("bad 2d code");
  25748. this._addPixels(columns, 0);
  25749. this.err = true;
  25750. }
  25751. }
  25752. } else {
  25753. codingLine[0] = 0;
  25754. this.codingPos = 0;
  25755. blackPixels = 0;
  25756. while (codingLine[this.codingPos] < columns) {
  25757. code1 = 0;
  25758. if (blackPixels) {
  25759. do {
  25760. code1 += code3 = this._getBlackCode();
  25761. } while (code3 >= 64);
  25762. } else {
  25763. do {
  25764. code1 += code3 = this._getWhiteCode();
  25765. } while (code3 >= 64);
  25766. }
  25767. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  25768. blackPixels ^= 1;
  25769. }
  25770. }
  25771. let gotEOL = false;
  25772. if (this.byteAlign) {
  25773. this.inputBits &= ~7;
  25774. }
  25775. if (!this.eoblock && this.row === this.rows - 1) {
  25776. this.rowsDone = true;
  25777. } else {
  25778. code1 = this._lookBits(12);
  25779. if (this.eoline) {
  25780. while (code1 !== ccittEOF && code1 !== 1) {
  25781. this._eatBits(1);
  25782. code1 = this._lookBits(12);
  25783. }
  25784. } else {
  25785. while (code1 === 0) {
  25786. this._eatBits(1);
  25787. code1 = this._lookBits(12);
  25788. }
  25789. }
  25790. if (code1 === 1) {
  25791. this._eatBits(12);
  25792. gotEOL = true;
  25793. } else if (code1 === ccittEOF) {
  25794. this.eof = true;
  25795. }
  25796. }
  25797. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  25798. this.nextLine2D = !this._lookBits(1);
  25799. this._eatBits(1);
  25800. }
  25801. if (this.eoblock && gotEOL && this.byteAlign) {
  25802. code1 = this._lookBits(12);
  25803. if (code1 === 1) {
  25804. this._eatBits(12);
  25805. if (this.encoding > 0) {
  25806. this._lookBits(1);
  25807. this._eatBits(1);
  25808. }
  25809. if (this.encoding >= 0) {
  25810. for (i = 0; i < 4; ++i) {
  25811. code1 = this._lookBits(12);
  25812. if (code1 !== 1) {
  25813. (0, _util.info)("bad rtc code: " + code1);
  25814. }
  25815. this._eatBits(12);
  25816. if (this.encoding > 0) {
  25817. this._lookBits(1);
  25818. this._eatBits(1);
  25819. }
  25820. }
  25821. }
  25822. this.eof = true;
  25823. }
  25824. } else if (this.err && this.eoline) {
  25825. while (true) {
  25826. code1 = this._lookBits(13);
  25827. if (code1 === ccittEOF) {
  25828. this.eof = true;
  25829. return -1;
  25830. }
  25831. if (code1 >> 1 === 1) {
  25832. break;
  25833. }
  25834. this._eatBits(1);
  25835. }
  25836. this._eatBits(12);
  25837. if (this.encoding > 0) {
  25838. this._eatBits(1);
  25839. this.nextLine2D = !(code1 & 1);
  25840. }
  25841. }
  25842. if (codingLine[0] > 0) {
  25843. this.outputBits = codingLine[this.codingPos = 0];
  25844. } else {
  25845. this.outputBits = codingLine[this.codingPos = 1];
  25846. }
  25847. this.row++;
  25848. }
  25849. let c;
  25850. if (this.outputBits >= 8) {
  25851. c = this.codingPos & 1 ? 0 : 0xff;
  25852. this.outputBits -= 8;
  25853. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  25854. this.codingPos++;
  25855. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  25856. }
  25857. } else {
  25858. bits = 8;
  25859. c = 0;
  25860. do {
  25861. if (this.outputBits > bits) {
  25862. c <<= bits;
  25863. if (!(this.codingPos & 1)) {
  25864. c |= 0xff >> 8 - bits;
  25865. }
  25866. this.outputBits -= bits;
  25867. bits = 0;
  25868. } else {
  25869. c <<= this.outputBits;
  25870. if (!(this.codingPos & 1)) {
  25871. c |= 0xff >> 8 - this.outputBits;
  25872. }
  25873. bits -= this.outputBits;
  25874. this.outputBits = 0;
  25875. if (codingLine[this.codingPos] < columns) {
  25876. this.codingPos++;
  25877. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  25878. } else if (bits > 0) {
  25879. c <<= bits;
  25880. bits = 0;
  25881. }
  25882. }
  25883. } while (bits);
  25884. }
  25885. if (this.black) {
  25886. c ^= 0xff;
  25887. }
  25888. return c;
  25889. }
  25890. _addPixels(a1, blackPixels) {
  25891. const codingLine = this.codingLine;
  25892. let codingPos = this.codingPos;
  25893. if (a1 > codingLine[codingPos]) {
  25894. if (a1 > this.columns) {
  25895. (0, _util.info)("row is wrong length");
  25896. this.err = true;
  25897. a1 = this.columns;
  25898. }
  25899. if (codingPos & 1 ^ blackPixels) {
  25900. ++codingPos;
  25901. }
  25902. codingLine[codingPos] = a1;
  25903. }
  25904. this.codingPos = codingPos;
  25905. }
  25906. _addPixelsNeg(a1, blackPixels) {
  25907. const codingLine = this.codingLine;
  25908. let codingPos = this.codingPos;
  25909. if (a1 > codingLine[codingPos]) {
  25910. if (a1 > this.columns) {
  25911. (0, _util.info)("row is wrong length");
  25912. this.err = true;
  25913. a1 = this.columns;
  25914. }
  25915. if (codingPos & 1 ^ blackPixels) {
  25916. ++codingPos;
  25917. }
  25918. codingLine[codingPos] = a1;
  25919. } else if (a1 < codingLine[codingPos]) {
  25920. if (a1 < 0) {
  25921. (0, _util.info)("invalid code");
  25922. this.err = true;
  25923. a1 = 0;
  25924. }
  25925. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  25926. --codingPos;
  25927. }
  25928. codingLine[codingPos] = a1;
  25929. }
  25930. this.codingPos = codingPos;
  25931. }
  25932. _findTableCode(start, end, table, limit) {
  25933. const limitValue = limit || 0;
  25934. for (let i = start; i <= end; ++i) {
  25935. let code = this._lookBits(i);
  25936. if (code === ccittEOF) {
  25937. return [true, 1, false];
  25938. }
  25939. if (i < end) {
  25940. code <<= end - i;
  25941. }
  25942. if (!limitValue || code >= limitValue) {
  25943. const p = table[code - limitValue];
  25944. if (p[0] === i) {
  25945. this._eatBits(i);
  25946. return [true, p[1], true];
  25947. }
  25948. }
  25949. }
  25950. return [false, 0, false];
  25951. }
  25952. _getTwoDimCode() {
  25953. let code = 0;
  25954. let p;
  25955. if (this.eoblock) {
  25956. code = this._lookBits(7);
  25957. p = twoDimTable[code];
  25958. if (p && p[0] > 0) {
  25959. this._eatBits(p[0]);
  25960. return p[1];
  25961. }
  25962. } else {
  25963. const result = this._findTableCode(1, 7, twoDimTable);
  25964. if (result[0] && result[2]) {
  25965. return result[1];
  25966. }
  25967. }
  25968. (0, _util.info)("Bad two dim code");
  25969. return ccittEOF;
  25970. }
  25971. _getWhiteCode() {
  25972. let code = 0;
  25973. let p;
  25974. if (this.eoblock) {
  25975. code = this._lookBits(12);
  25976. if (code === ccittEOF) {
  25977. return 1;
  25978. }
  25979. if (code >> 5 === 0) {
  25980. p = whiteTable1[code];
  25981. } else {
  25982. p = whiteTable2[code >> 3];
  25983. }
  25984. if (p[0] > 0) {
  25985. this._eatBits(p[0]);
  25986. return p[1];
  25987. }
  25988. } else {
  25989. let result = this._findTableCode(1, 9, whiteTable2);
  25990. if (result[0]) {
  25991. return result[1];
  25992. }
  25993. result = this._findTableCode(11, 12, whiteTable1);
  25994. if (result[0]) {
  25995. return result[1];
  25996. }
  25997. }
  25998. (0, _util.info)("bad white code");
  25999. this._eatBits(1);
  26000. return 1;
  26001. }
  26002. _getBlackCode() {
  26003. let code, p;
  26004. if (this.eoblock) {
  26005. code = this._lookBits(13);
  26006. if (code === ccittEOF) {
  26007. return 1;
  26008. }
  26009. if (code >> 7 === 0) {
  26010. p = blackTable1[code];
  26011. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  26012. p = blackTable2[(code >> 1) - 64];
  26013. } else {
  26014. p = blackTable3[code >> 7];
  26015. }
  26016. if (p[0] > 0) {
  26017. this._eatBits(p[0]);
  26018. return p[1];
  26019. }
  26020. } else {
  26021. let result = this._findTableCode(2, 6, blackTable3);
  26022. if (result[0]) {
  26023. return result[1];
  26024. }
  26025. result = this._findTableCode(7, 12, blackTable2, 64);
  26026. if (result[0]) {
  26027. return result[1];
  26028. }
  26029. result = this._findTableCode(10, 13, blackTable1);
  26030. if (result[0]) {
  26031. return result[1];
  26032. }
  26033. }
  26034. (0, _util.info)("bad black code");
  26035. this._eatBits(1);
  26036. return 1;
  26037. }
  26038. _lookBits(n) {
  26039. let c;
  26040. while (this.inputBits < n) {
  26041. if ((c = this.source.next()) === -1) {
  26042. if (this.inputBits === 0) {
  26043. return ccittEOF;
  26044. }
  26045. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  26046. }
  26047. this.inputBuf = this.inputBuf << 8 | c;
  26048. this.inputBits += 8;
  26049. }
  26050. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  26051. }
  26052. _eatBits(n) {
  26053. if ((this.inputBits -= n) < 0) {
  26054. this.inputBits = 0;
  26055. }
  26056. }
  26057. }
  26058. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  26059. /***/ }),
  26060. /* 33 */
  26061. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26062. Object.defineProperty(exports, "__esModule", ({
  26063. value: true
  26064. }));
  26065. exports.FlateStream = void 0;
  26066. var _decode_stream = __w_pdfjs_require__(29);
  26067. var _util = __w_pdfjs_require__(2);
  26068. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  26069. const 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]);
  26070. const 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]);
  26071. const 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];
  26072. const 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];
  26073. class FlateStream extends _decode_stream.DecodeStream {
  26074. constructor(str, maybeLength) {
  26075. super(maybeLength);
  26076. this.str = str;
  26077. this.dict = str.dict;
  26078. const cmf = str.getByte();
  26079. const flg = str.getByte();
  26080. if (cmf === -1 || flg === -1) {
  26081. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  26082. }
  26083. if ((cmf & 0x0f) !== 0x08) {
  26084. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  26085. }
  26086. if (((cmf << 8) + flg) % 31 !== 0) {
  26087. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  26088. }
  26089. if (flg & 0x20) {
  26090. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  26091. }
  26092. this.codeSize = 0;
  26093. this.codeBuf = 0;
  26094. }
  26095. getBits(bits) {
  26096. const str = this.str;
  26097. let codeSize = this.codeSize;
  26098. let codeBuf = this.codeBuf;
  26099. let b;
  26100. while (codeSize < bits) {
  26101. if ((b = str.getByte()) === -1) {
  26102. throw new _util.FormatError("Bad encoding in flate stream");
  26103. }
  26104. codeBuf |= b << codeSize;
  26105. codeSize += 8;
  26106. }
  26107. b = codeBuf & (1 << bits) - 1;
  26108. this.codeBuf = codeBuf >> bits;
  26109. this.codeSize = codeSize -= bits;
  26110. return b;
  26111. }
  26112. getCode(table) {
  26113. const str = this.str;
  26114. const codes = table[0];
  26115. const maxLen = table[1];
  26116. let codeSize = this.codeSize;
  26117. let codeBuf = this.codeBuf;
  26118. let b;
  26119. while (codeSize < maxLen) {
  26120. if ((b = str.getByte()) === -1) {
  26121. break;
  26122. }
  26123. codeBuf |= b << codeSize;
  26124. codeSize += 8;
  26125. }
  26126. const code = codes[codeBuf & (1 << maxLen) - 1];
  26127. const codeLen = code >> 16;
  26128. const codeVal = code & 0xffff;
  26129. if (codeLen < 1 || codeSize < codeLen) {
  26130. throw new _util.FormatError("Bad encoding in flate stream");
  26131. }
  26132. this.codeBuf = codeBuf >> codeLen;
  26133. this.codeSize = codeSize - codeLen;
  26134. return codeVal;
  26135. }
  26136. generateHuffmanTable(lengths) {
  26137. const n = lengths.length;
  26138. let maxLen = 0;
  26139. let i;
  26140. for (i = 0; i < n; ++i) {
  26141. if (lengths[i] > maxLen) {
  26142. maxLen = lengths[i];
  26143. }
  26144. }
  26145. const size = 1 << maxLen;
  26146. const codes = new Int32Array(size);
  26147. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  26148. for (let val = 0; val < n; ++val) {
  26149. if (lengths[val] === len) {
  26150. let code2 = 0;
  26151. let t = code;
  26152. for (i = 0; i < len; ++i) {
  26153. code2 = code2 << 1 | t & 1;
  26154. t >>= 1;
  26155. }
  26156. for (i = code2; i < size; i += skip) {
  26157. codes[i] = len << 16 | val;
  26158. }
  26159. ++code;
  26160. }
  26161. }
  26162. }
  26163. return [codes, maxLen];
  26164. }
  26165. readBlock() {
  26166. let buffer, len;
  26167. const str = this.str;
  26168. let hdr = this.getBits(3);
  26169. if (hdr & 1) {
  26170. this.eof = true;
  26171. }
  26172. hdr >>= 1;
  26173. if (hdr === 0) {
  26174. let b;
  26175. if ((b = str.getByte()) === -1) {
  26176. throw new _util.FormatError("Bad block header in flate stream");
  26177. }
  26178. let blockLen = b;
  26179. if ((b = str.getByte()) === -1) {
  26180. throw new _util.FormatError("Bad block header in flate stream");
  26181. }
  26182. blockLen |= b << 8;
  26183. if ((b = str.getByte()) === -1) {
  26184. throw new _util.FormatError("Bad block header in flate stream");
  26185. }
  26186. let check = b;
  26187. if ((b = str.getByte()) === -1) {
  26188. throw new _util.FormatError("Bad block header in flate stream");
  26189. }
  26190. check |= b << 8;
  26191. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  26192. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  26193. }
  26194. this.codeBuf = 0;
  26195. this.codeSize = 0;
  26196. const bufferLength = this.bufferLength,
  26197. end = bufferLength + blockLen;
  26198. buffer = this.ensureBuffer(end);
  26199. this.bufferLength = end;
  26200. if (blockLen === 0) {
  26201. if (str.peekByte() === -1) {
  26202. this.eof = true;
  26203. }
  26204. } else {
  26205. const block = str.getBytes(blockLen);
  26206. buffer.set(block, bufferLength);
  26207. if (block.length < blockLen) {
  26208. this.eof = true;
  26209. }
  26210. }
  26211. return;
  26212. }
  26213. let litCodeTable;
  26214. let distCodeTable;
  26215. if (hdr === 1) {
  26216. litCodeTable = fixedLitCodeTab;
  26217. distCodeTable = fixedDistCodeTab;
  26218. } else if (hdr === 2) {
  26219. const numLitCodes = this.getBits(5) + 257;
  26220. const numDistCodes = this.getBits(5) + 1;
  26221. const numCodeLenCodes = this.getBits(4) + 4;
  26222. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  26223. let i;
  26224. for (i = 0; i < numCodeLenCodes; ++i) {
  26225. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  26226. }
  26227. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  26228. len = 0;
  26229. i = 0;
  26230. const codes = numLitCodes + numDistCodes;
  26231. const codeLengths = new Uint8Array(codes);
  26232. let bitsLength, bitsOffset, what;
  26233. while (i < codes) {
  26234. const code = this.getCode(codeLenCodeTab);
  26235. if (code === 16) {
  26236. bitsLength = 2;
  26237. bitsOffset = 3;
  26238. what = len;
  26239. } else if (code === 17) {
  26240. bitsLength = 3;
  26241. bitsOffset = 3;
  26242. what = len = 0;
  26243. } else if (code === 18) {
  26244. bitsLength = 7;
  26245. bitsOffset = 11;
  26246. what = len = 0;
  26247. } else {
  26248. codeLengths[i++] = len = code;
  26249. continue;
  26250. }
  26251. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  26252. while (repeatLength-- > 0) {
  26253. codeLengths[i++] = what;
  26254. }
  26255. }
  26256. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  26257. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  26258. } else {
  26259. throw new _util.FormatError("Unknown block type in flate stream");
  26260. }
  26261. buffer = this.buffer;
  26262. let limit = buffer ? buffer.length : 0;
  26263. let pos = this.bufferLength;
  26264. while (true) {
  26265. let code1 = this.getCode(litCodeTable);
  26266. if (code1 < 256) {
  26267. if (pos + 1 >= limit) {
  26268. buffer = this.ensureBuffer(pos + 1);
  26269. limit = buffer.length;
  26270. }
  26271. buffer[pos++] = code1;
  26272. continue;
  26273. }
  26274. if (code1 === 256) {
  26275. this.bufferLength = pos;
  26276. return;
  26277. }
  26278. code1 -= 257;
  26279. code1 = lengthDecode[code1];
  26280. let code2 = code1 >> 16;
  26281. if (code2 > 0) {
  26282. code2 = this.getBits(code2);
  26283. }
  26284. len = (code1 & 0xffff) + code2;
  26285. code1 = this.getCode(distCodeTable);
  26286. code1 = distDecode[code1];
  26287. code2 = code1 >> 16;
  26288. if (code2 > 0) {
  26289. code2 = this.getBits(code2);
  26290. }
  26291. const dist = (code1 & 0xffff) + code2;
  26292. if (pos + len >= limit) {
  26293. buffer = this.ensureBuffer(pos + len);
  26294. limit = buffer.length;
  26295. }
  26296. for (let k = 0; k < len; ++k, ++pos) {
  26297. buffer[pos] = buffer[pos - dist];
  26298. }
  26299. }
  26300. }
  26301. }
  26302. exports.FlateStream = FlateStream;
  26303. /***/ }),
  26304. /* 34 */
  26305. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26306. Object.defineProperty(exports, "__esModule", ({
  26307. value: true
  26308. }));
  26309. exports.Jbig2Stream = void 0;
  26310. var _primitives = __w_pdfjs_require__(5);
  26311. var _decode_stream = __w_pdfjs_require__(29);
  26312. var _jbig = __w_pdfjs_require__(35);
  26313. var _util = __w_pdfjs_require__(2);
  26314. class Jbig2Stream extends _decode_stream.DecodeStream {
  26315. constructor(stream, maybeLength, params) {
  26316. super(maybeLength);
  26317. this.stream = stream;
  26318. this.dict = stream.dict;
  26319. this.maybeLength = maybeLength;
  26320. this.params = params;
  26321. }
  26322. get bytes() {
  26323. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  26324. }
  26325. ensureBuffer(requested) {}
  26326. readBlock() {
  26327. if (this.eof) {
  26328. return;
  26329. }
  26330. const jbig2Image = new _jbig.Jbig2Image();
  26331. const chunks = [];
  26332. if ((0, _primitives.isDict)(this.params)) {
  26333. const globalsStream = this.params.get("JBIG2Globals");
  26334. if ((0, _primitives.isStream)(globalsStream)) {
  26335. const globals = globalsStream.getBytes();
  26336. chunks.push({
  26337. data: globals,
  26338. start: 0,
  26339. end: globals.length
  26340. });
  26341. }
  26342. }
  26343. chunks.push({
  26344. data: this.bytes,
  26345. start: 0,
  26346. end: this.bytes.length
  26347. });
  26348. const data = jbig2Image.parseChunks(chunks);
  26349. const dataLength = data.length;
  26350. for (let i = 0; i < dataLength; i++) {
  26351. data[i] ^= 0xff;
  26352. }
  26353. this.buffer = data;
  26354. this.bufferLength = dataLength;
  26355. this.eof = true;
  26356. }
  26357. }
  26358. exports.Jbig2Stream = Jbig2Stream;
  26359. /***/ }),
  26360. /* 35 */
  26361. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26362. Object.defineProperty(exports, "__esModule", ({
  26363. value: true
  26364. }));
  26365. exports.Jbig2Image = void 0;
  26366. var _util = __w_pdfjs_require__(2);
  26367. var _core_utils = __w_pdfjs_require__(9);
  26368. var _arithmetic_decoder = __w_pdfjs_require__(36);
  26369. var _ccitt = __w_pdfjs_require__(32);
  26370. class Jbig2Error extends _util.BaseException {
  26371. constructor(msg) {
  26372. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  26373. }
  26374. }
  26375. class ContextCache {
  26376. getContexts(id) {
  26377. if (id in this) {
  26378. return this[id];
  26379. }
  26380. return this[id] = new Int8Array(1 << 16);
  26381. }
  26382. }
  26383. class DecodingContext {
  26384. constructor(data, start, end) {
  26385. this.data = data;
  26386. this.start = start;
  26387. this.end = end;
  26388. }
  26389. get decoder() {
  26390. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  26391. return (0, _util.shadow)(this, "decoder", decoder);
  26392. }
  26393. get contextCache() {
  26394. const cache = new ContextCache();
  26395. return (0, _util.shadow)(this, "contextCache", cache);
  26396. }
  26397. }
  26398. function decodeInteger(contextCache, procedure, decoder) {
  26399. const contexts = contextCache.getContexts(procedure);
  26400. let prev = 1;
  26401. function readBits(length) {
  26402. let v = 0;
  26403. for (let i = 0; i < length; i++) {
  26404. const bit = decoder.readBit(contexts, prev);
  26405. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  26406. v = v << 1 | bit;
  26407. }
  26408. return v >>> 0;
  26409. }
  26410. const sign = readBits(1);
  26411. const 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);
  26412. if (sign === 0) {
  26413. return value;
  26414. } else if (value > 0) {
  26415. return -value;
  26416. }
  26417. return null;
  26418. }
  26419. function decodeIAID(contextCache, decoder, codeLength) {
  26420. const contexts = contextCache.getContexts("IAID");
  26421. let prev = 1;
  26422. for (let i = 0; i < codeLength; i++) {
  26423. const bit = decoder.readBit(contexts, prev);
  26424. prev = prev << 1 | bit;
  26425. }
  26426. if (codeLength < 31) {
  26427. return prev & (1 << codeLength) - 1;
  26428. }
  26429. return prev & 0x7fffffff;
  26430. }
  26431. const 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"];
  26432. const CodingTemplates = [[{
  26433. x: -1,
  26434. y: -2
  26435. }, {
  26436. x: 0,
  26437. y: -2
  26438. }, {
  26439. x: 1,
  26440. y: -2
  26441. }, {
  26442. x: -2,
  26443. y: -1
  26444. }, {
  26445. x: -1,
  26446. y: -1
  26447. }, {
  26448. x: 0,
  26449. y: -1
  26450. }, {
  26451. x: 1,
  26452. y: -1
  26453. }, {
  26454. x: 2,
  26455. y: -1
  26456. }, {
  26457. x: -4,
  26458. y: 0
  26459. }, {
  26460. x: -3,
  26461. y: 0
  26462. }, {
  26463. x: -2,
  26464. y: 0
  26465. }, {
  26466. x: -1,
  26467. y: 0
  26468. }], [{
  26469. x: -1,
  26470. y: -2
  26471. }, {
  26472. x: 0,
  26473. y: -2
  26474. }, {
  26475. x: 1,
  26476. y: -2
  26477. }, {
  26478. x: 2,
  26479. y: -2
  26480. }, {
  26481. x: -2,
  26482. y: -1
  26483. }, {
  26484. x: -1,
  26485. y: -1
  26486. }, {
  26487. x: 0,
  26488. y: -1
  26489. }, {
  26490. x: 1,
  26491. y: -1
  26492. }, {
  26493. x: 2,
  26494. y: -1
  26495. }, {
  26496. x: -3,
  26497. y: 0
  26498. }, {
  26499. x: -2,
  26500. y: 0
  26501. }, {
  26502. x: -1,
  26503. y: 0
  26504. }], [{
  26505. x: -1,
  26506. y: -2
  26507. }, {
  26508. x: 0,
  26509. y: -2
  26510. }, {
  26511. x: 1,
  26512. y: -2
  26513. }, {
  26514. x: -2,
  26515. y: -1
  26516. }, {
  26517. x: -1,
  26518. y: -1
  26519. }, {
  26520. x: 0,
  26521. y: -1
  26522. }, {
  26523. x: 1,
  26524. y: -1
  26525. }, {
  26526. x: -2,
  26527. y: 0
  26528. }, {
  26529. x: -1,
  26530. y: 0
  26531. }], [{
  26532. x: -3,
  26533. y: -1
  26534. }, {
  26535. x: -2,
  26536. y: -1
  26537. }, {
  26538. x: -1,
  26539. y: -1
  26540. }, {
  26541. x: 0,
  26542. y: -1
  26543. }, {
  26544. x: 1,
  26545. y: -1
  26546. }, {
  26547. x: -4,
  26548. y: 0
  26549. }, {
  26550. x: -3,
  26551. y: 0
  26552. }, {
  26553. x: -2,
  26554. y: 0
  26555. }, {
  26556. x: -1,
  26557. y: 0
  26558. }]];
  26559. const RefinementTemplates = [{
  26560. coding: [{
  26561. x: 0,
  26562. y: -1
  26563. }, {
  26564. x: 1,
  26565. y: -1
  26566. }, {
  26567. x: -1,
  26568. y: 0
  26569. }],
  26570. reference: [{
  26571. x: 0,
  26572. y: -1
  26573. }, {
  26574. x: 1,
  26575. y: -1
  26576. }, {
  26577. x: -1,
  26578. y: 0
  26579. }, {
  26580. x: 0,
  26581. y: 0
  26582. }, {
  26583. x: 1,
  26584. y: 0
  26585. }, {
  26586. x: -1,
  26587. y: 1
  26588. }, {
  26589. x: 0,
  26590. y: 1
  26591. }, {
  26592. x: 1,
  26593. y: 1
  26594. }]
  26595. }, {
  26596. coding: [{
  26597. x: -1,
  26598. y: -1
  26599. }, {
  26600. x: 0,
  26601. y: -1
  26602. }, {
  26603. x: 1,
  26604. y: -1
  26605. }, {
  26606. x: -1,
  26607. y: 0
  26608. }],
  26609. reference: [{
  26610. x: 0,
  26611. y: -1
  26612. }, {
  26613. x: -1,
  26614. y: 0
  26615. }, {
  26616. x: 0,
  26617. y: 0
  26618. }, {
  26619. x: 1,
  26620. y: 0
  26621. }, {
  26622. x: 0,
  26623. y: 1
  26624. }, {
  26625. x: 1,
  26626. y: 1
  26627. }]
  26628. }];
  26629. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  26630. const RefinementReusedContexts = [0x0020, 0x0008];
  26631. function decodeBitmapTemplate0(width, height, decodingContext) {
  26632. const decoder = decodingContext.decoder;
  26633. const contexts = decodingContext.contextCache.getContexts("GB");
  26634. const bitmap = [];
  26635. let contextLabel, i, j, pixel, row, row1, row2;
  26636. const OLD_PIXEL_MASK = 0x7bf7;
  26637. for (i = 0; i < height; i++) {
  26638. row = bitmap[i] = new Uint8Array(width);
  26639. row1 = i < 1 ? row : bitmap[i - 1];
  26640. row2 = i < 2 ? row : bitmap[i - 2];
  26641. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  26642. for (j = 0; j < width; j++) {
  26643. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  26644. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  26645. }
  26646. }
  26647. return bitmap;
  26648. }
  26649. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  26650. if (mmr) {
  26651. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  26652. return decodeMMRBitmap(input, width, height, false);
  26653. }
  26654. 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) {
  26655. return decodeBitmapTemplate0(width, height, decodingContext);
  26656. }
  26657. const useskip = !!skip;
  26658. const template = CodingTemplates[templateIndex].concat(at);
  26659. template.sort(function (a, b) {
  26660. return a.y - b.y || a.x - b.x;
  26661. });
  26662. const templateLength = template.length;
  26663. const templateX = new Int8Array(templateLength);
  26664. const templateY = new Int8Array(templateLength);
  26665. const changingTemplateEntries = [];
  26666. let reuseMask = 0,
  26667. minX = 0,
  26668. maxX = 0,
  26669. minY = 0;
  26670. let c, k;
  26671. for (k = 0; k < templateLength; k++) {
  26672. templateX[k] = template[k].x;
  26673. templateY[k] = template[k].y;
  26674. minX = Math.min(minX, template[k].x);
  26675. maxX = Math.max(maxX, template[k].x);
  26676. minY = Math.min(minY, template[k].y);
  26677. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  26678. reuseMask |= 1 << templateLength - 1 - k;
  26679. } else {
  26680. changingTemplateEntries.push(k);
  26681. }
  26682. }
  26683. const changingEntriesLength = changingTemplateEntries.length;
  26684. const changingTemplateX = new Int8Array(changingEntriesLength);
  26685. const changingTemplateY = new Int8Array(changingEntriesLength);
  26686. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  26687. for (c = 0; c < changingEntriesLength; c++) {
  26688. k = changingTemplateEntries[c];
  26689. changingTemplateX[c] = template[k].x;
  26690. changingTemplateY[c] = template[k].y;
  26691. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  26692. }
  26693. const sbb_left = -minX;
  26694. const sbb_top = -minY;
  26695. const sbb_right = width - maxX;
  26696. const pseudoPixelContext = ReusedContexts[templateIndex];
  26697. let row = new Uint8Array(width);
  26698. const bitmap = [];
  26699. const decoder = decodingContext.decoder;
  26700. const contexts = decodingContext.contextCache.getContexts("GB");
  26701. let ltp = 0,
  26702. j,
  26703. i0,
  26704. j0,
  26705. contextLabel = 0,
  26706. bit,
  26707. shift;
  26708. for (let i = 0; i < height; i++) {
  26709. if (prediction) {
  26710. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  26711. ltp ^= sltp;
  26712. if (ltp) {
  26713. bitmap.push(row);
  26714. continue;
  26715. }
  26716. }
  26717. row = new Uint8Array(row);
  26718. bitmap.push(row);
  26719. for (j = 0; j < width; j++) {
  26720. if (useskip && skip[i][j]) {
  26721. row[j] = 0;
  26722. continue;
  26723. }
  26724. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  26725. contextLabel = contextLabel << 1 & reuseMask;
  26726. for (k = 0; k < changingEntriesLength; k++) {
  26727. i0 = i + changingTemplateY[k];
  26728. j0 = j + changingTemplateX[k];
  26729. bit = bitmap[i0][j0];
  26730. if (bit) {
  26731. bit = changingTemplateBit[k];
  26732. contextLabel |= bit;
  26733. }
  26734. }
  26735. } else {
  26736. contextLabel = 0;
  26737. shift = templateLength - 1;
  26738. for (k = 0; k < templateLength; k++, shift--) {
  26739. j0 = j + templateX[k];
  26740. if (j0 >= 0 && j0 < width) {
  26741. i0 = i + templateY[k];
  26742. if (i0 >= 0) {
  26743. bit = bitmap[i0][j0];
  26744. if (bit) {
  26745. contextLabel |= bit << shift;
  26746. }
  26747. }
  26748. }
  26749. }
  26750. }
  26751. const pixel = decoder.readBit(contexts, contextLabel);
  26752. row[j] = pixel;
  26753. }
  26754. }
  26755. return bitmap;
  26756. }
  26757. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  26758. let codingTemplate = RefinementTemplates[templateIndex].coding;
  26759. if (templateIndex === 0) {
  26760. codingTemplate = codingTemplate.concat([at[0]]);
  26761. }
  26762. const codingTemplateLength = codingTemplate.length;
  26763. const codingTemplateX = new Int32Array(codingTemplateLength);
  26764. const codingTemplateY = new Int32Array(codingTemplateLength);
  26765. let k;
  26766. for (k = 0; k < codingTemplateLength; k++) {
  26767. codingTemplateX[k] = codingTemplate[k].x;
  26768. codingTemplateY[k] = codingTemplate[k].y;
  26769. }
  26770. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  26771. if (templateIndex === 0) {
  26772. referenceTemplate = referenceTemplate.concat([at[1]]);
  26773. }
  26774. const referenceTemplateLength = referenceTemplate.length;
  26775. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  26776. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  26777. for (k = 0; k < referenceTemplateLength; k++) {
  26778. referenceTemplateX[k] = referenceTemplate[k].x;
  26779. referenceTemplateY[k] = referenceTemplate[k].y;
  26780. }
  26781. const referenceWidth = referenceBitmap[0].length;
  26782. const referenceHeight = referenceBitmap.length;
  26783. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  26784. const bitmap = [];
  26785. const decoder = decodingContext.decoder;
  26786. const contexts = decodingContext.contextCache.getContexts("GR");
  26787. let ltp = 0;
  26788. for (let i = 0; i < height; i++) {
  26789. if (prediction) {
  26790. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  26791. ltp ^= sltp;
  26792. if (ltp) {
  26793. throw new Jbig2Error("prediction is not supported");
  26794. }
  26795. }
  26796. const row = new Uint8Array(width);
  26797. bitmap.push(row);
  26798. for (let j = 0; j < width; j++) {
  26799. let i0, j0;
  26800. let contextLabel = 0;
  26801. for (k = 0; k < codingTemplateLength; k++) {
  26802. i0 = i + codingTemplateY[k];
  26803. j0 = j + codingTemplateX[k];
  26804. if (i0 < 0 || j0 < 0 || j0 >= width) {
  26805. contextLabel <<= 1;
  26806. } else {
  26807. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  26808. }
  26809. }
  26810. for (k = 0; k < referenceTemplateLength; k++) {
  26811. i0 = i + referenceTemplateY[k] - offsetY;
  26812. j0 = j + referenceTemplateX[k] - offsetX;
  26813. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  26814. contextLabel <<= 1;
  26815. } else {
  26816. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  26817. }
  26818. }
  26819. const pixel = decoder.readBit(contexts, contextLabel);
  26820. row[j] = pixel;
  26821. }
  26822. }
  26823. return bitmap;
  26824. }
  26825. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  26826. if (huffman && refinement) {
  26827. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  26828. }
  26829. const newSymbols = [];
  26830. let currentHeight = 0;
  26831. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  26832. const decoder = decodingContext.decoder;
  26833. const contextCache = decodingContext.contextCache;
  26834. let tableB1, symbolWidths;
  26835. if (huffman) {
  26836. tableB1 = getStandardTable(1);
  26837. symbolWidths = [];
  26838. symbolCodeLength = Math.max(symbolCodeLength, 1);
  26839. }
  26840. while (newSymbols.length < numberOfNewSymbols) {
  26841. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  26842. currentHeight += deltaHeight;
  26843. let currentWidth = 0,
  26844. totalWidth = 0;
  26845. const firstSymbol = huffman ? symbolWidths.length : 0;
  26846. while (true) {
  26847. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  26848. if (deltaWidth === null) {
  26849. break;
  26850. }
  26851. currentWidth += deltaWidth;
  26852. totalWidth += currentWidth;
  26853. let bitmap;
  26854. if (refinement) {
  26855. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  26856. if (numberOfInstances > 1) {
  26857. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  26858. } else {
  26859. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  26860. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  26861. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  26862. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  26863. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  26864. }
  26865. newSymbols.push(bitmap);
  26866. } else if (huffman) {
  26867. symbolWidths.push(currentWidth);
  26868. } else {
  26869. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  26870. newSymbols.push(bitmap);
  26871. }
  26872. }
  26873. if (huffman && !refinement) {
  26874. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  26875. huffmanInput.byteAlign();
  26876. let collectiveBitmap;
  26877. if (bitmapSize === 0) {
  26878. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  26879. } else {
  26880. const originalEnd = huffmanInput.end;
  26881. const bitmapEnd = huffmanInput.position + bitmapSize;
  26882. huffmanInput.end = bitmapEnd;
  26883. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  26884. huffmanInput.end = originalEnd;
  26885. huffmanInput.position = bitmapEnd;
  26886. }
  26887. const numberOfSymbolsDecoded = symbolWidths.length;
  26888. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  26889. newSymbols.push(collectiveBitmap);
  26890. } else {
  26891. let i,
  26892. y,
  26893. xMin = 0,
  26894. xMax,
  26895. bitmapWidth,
  26896. symbolBitmap;
  26897. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  26898. bitmapWidth = symbolWidths[i];
  26899. xMax = xMin + bitmapWidth;
  26900. symbolBitmap = [];
  26901. for (y = 0; y < currentHeight; y++) {
  26902. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  26903. }
  26904. newSymbols.push(symbolBitmap);
  26905. xMin = xMax;
  26906. }
  26907. }
  26908. }
  26909. }
  26910. const exportedSymbols = [],
  26911. flags = [];
  26912. let currentFlag = false,
  26913. i,
  26914. ii;
  26915. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  26916. while (flags.length < totalSymbolsLength) {
  26917. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  26918. while (runLength--) {
  26919. flags.push(currentFlag);
  26920. }
  26921. currentFlag = !currentFlag;
  26922. }
  26923. for (i = 0, ii = symbols.length; i < ii; i++) {
  26924. if (flags[i]) {
  26925. exportedSymbols.push(symbols[i]);
  26926. }
  26927. }
  26928. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  26929. if (flags[i]) {
  26930. exportedSymbols.push(newSymbols[j]);
  26931. }
  26932. }
  26933. return exportedSymbols;
  26934. }
  26935. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  26936. if (huffman && refinement) {
  26937. throw new Jbig2Error("refinement with Huffman is not supported");
  26938. }
  26939. const bitmap = [];
  26940. let i, row;
  26941. for (i = 0; i < height; i++) {
  26942. row = new Uint8Array(width);
  26943. if (defaultPixelValue) {
  26944. for (let j = 0; j < width; j++) {
  26945. row[j] = defaultPixelValue;
  26946. }
  26947. }
  26948. bitmap.push(row);
  26949. }
  26950. const decoder = decodingContext.decoder;
  26951. const contextCache = decodingContext.contextCache;
  26952. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  26953. let firstS = 0;
  26954. i = 0;
  26955. while (i < numberOfSymbolInstances) {
  26956. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  26957. stripT += deltaT;
  26958. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  26959. firstS += deltaFirstS;
  26960. let currentS = firstS;
  26961. do {
  26962. let currentT = 0;
  26963. if (stripSize > 1) {
  26964. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  26965. }
  26966. const t = stripSize * stripT + currentT;
  26967. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  26968. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  26969. let symbolBitmap = inputSymbols[symbolId];
  26970. let symbolWidth = symbolBitmap[0].length;
  26971. let symbolHeight = symbolBitmap.length;
  26972. if (applyRefinement) {
  26973. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  26974. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  26975. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  26976. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  26977. symbolWidth += rdw;
  26978. symbolHeight += rdh;
  26979. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  26980. }
  26981. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  26982. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  26983. let s2, t2, symbolRow;
  26984. if (transposed) {
  26985. for (s2 = 0; s2 < symbolHeight; s2++) {
  26986. row = bitmap[offsetS + s2];
  26987. if (!row) {
  26988. continue;
  26989. }
  26990. symbolRow = symbolBitmap[s2];
  26991. const maxWidth = Math.min(width - offsetT, symbolWidth);
  26992. switch (combinationOperator) {
  26993. case 0:
  26994. for (t2 = 0; t2 < maxWidth; t2++) {
  26995. row[offsetT + t2] |= symbolRow[t2];
  26996. }
  26997. break;
  26998. case 2:
  26999. for (t2 = 0; t2 < maxWidth; t2++) {
  27000. row[offsetT + t2] ^= symbolRow[t2];
  27001. }
  27002. break;
  27003. default:
  27004. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27005. }
  27006. }
  27007. currentS += symbolHeight - 1;
  27008. } else {
  27009. for (t2 = 0; t2 < symbolHeight; t2++) {
  27010. row = bitmap[offsetT + t2];
  27011. if (!row) {
  27012. continue;
  27013. }
  27014. symbolRow = symbolBitmap[t2];
  27015. switch (combinationOperator) {
  27016. case 0:
  27017. for (s2 = 0; s2 < symbolWidth; s2++) {
  27018. row[offsetS + s2] |= symbolRow[s2];
  27019. }
  27020. break;
  27021. case 2:
  27022. for (s2 = 0; s2 < symbolWidth; s2++) {
  27023. row[offsetS + s2] ^= symbolRow[s2];
  27024. }
  27025. break;
  27026. default:
  27027. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27028. }
  27029. }
  27030. currentS += symbolWidth - 1;
  27031. }
  27032. i++;
  27033. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  27034. if (deltaS === null) {
  27035. break;
  27036. }
  27037. currentS += deltaS + dsOffset;
  27038. } while (true);
  27039. }
  27040. return bitmap;
  27041. }
  27042. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  27043. const at = [];
  27044. if (!mmr) {
  27045. at.push({
  27046. x: -patternWidth,
  27047. y: 0
  27048. });
  27049. if (template === 0) {
  27050. at.push({
  27051. x: -3,
  27052. y: -1
  27053. }, {
  27054. x: 2,
  27055. y: -2
  27056. }, {
  27057. x: -2,
  27058. y: -2
  27059. });
  27060. }
  27061. }
  27062. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  27063. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  27064. const patterns = [];
  27065. for (let i = 0; i <= maxPatternIndex; i++) {
  27066. const patternBitmap = [];
  27067. const xMin = patternWidth * i;
  27068. const xMax = xMin + patternWidth;
  27069. for (let y = 0; y < patternHeight; y++) {
  27070. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  27071. }
  27072. patterns.push(patternBitmap);
  27073. }
  27074. return patterns;
  27075. }
  27076. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  27077. const skip = null;
  27078. if (enableSkip) {
  27079. throw new Jbig2Error("skip is not supported");
  27080. }
  27081. if (combinationOperator !== 0) {
  27082. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  27083. }
  27084. const regionBitmap = [];
  27085. let i, j, row;
  27086. for (i = 0; i < regionHeight; i++) {
  27087. row = new Uint8Array(regionWidth);
  27088. if (defaultPixelValue) {
  27089. for (j = 0; j < regionWidth; j++) {
  27090. row[j] = defaultPixelValue;
  27091. }
  27092. }
  27093. regionBitmap.push(row);
  27094. }
  27095. const numberOfPatterns = patterns.length;
  27096. const pattern0 = patterns[0];
  27097. const patternWidth = pattern0[0].length,
  27098. patternHeight = pattern0.length;
  27099. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  27100. const at = [];
  27101. if (!mmr) {
  27102. at.push({
  27103. x: template <= 1 ? 3 : 2,
  27104. y: -1
  27105. });
  27106. if (template === 0) {
  27107. at.push({
  27108. x: -3,
  27109. y: -1
  27110. }, {
  27111. x: 2,
  27112. y: -2
  27113. }, {
  27114. x: -2,
  27115. y: -2
  27116. });
  27117. }
  27118. }
  27119. const grayScaleBitPlanes = [];
  27120. let mmrInput, bitmap;
  27121. if (mmr) {
  27122. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  27123. }
  27124. for (i = bitsPerValue - 1; i >= 0; i--) {
  27125. if (mmr) {
  27126. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  27127. } else {
  27128. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  27129. }
  27130. grayScaleBitPlanes[i] = bitmap;
  27131. }
  27132. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  27133. for (mg = 0; mg < gridHeight; mg++) {
  27134. for (ng = 0; ng < gridWidth; ng++) {
  27135. bit = 0;
  27136. patternIndex = 0;
  27137. for (j = bitsPerValue - 1; j >= 0; j--) {
  27138. bit ^= grayScaleBitPlanes[j][mg][ng];
  27139. patternIndex |= bit << j;
  27140. }
  27141. patternBitmap = patterns[patternIndex];
  27142. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  27143. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  27144. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  27145. for (i = 0; i < patternHeight; i++) {
  27146. regionRow = regionBitmap[y + i];
  27147. patternRow = patternBitmap[i];
  27148. for (j = 0; j < patternWidth; j++) {
  27149. regionRow[x + j] |= patternRow[j];
  27150. }
  27151. }
  27152. } else {
  27153. let regionX, regionY;
  27154. for (i = 0; i < patternHeight; i++) {
  27155. regionY = y + i;
  27156. if (regionY < 0 || regionY >= regionHeight) {
  27157. continue;
  27158. }
  27159. regionRow = regionBitmap[regionY];
  27160. patternRow = patternBitmap[i];
  27161. for (j = 0; j < patternWidth; j++) {
  27162. regionX = x + j;
  27163. if (regionX >= 0 && regionX < regionWidth) {
  27164. regionRow[regionX] |= patternRow[j];
  27165. }
  27166. }
  27167. }
  27168. }
  27169. }
  27170. }
  27171. return regionBitmap;
  27172. }
  27173. function readSegmentHeader(data, start) {
  27174. const segmentHeader = {};
  27175. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  27176. const flags = data[start + 4];
  27177. const segmentType = flags & 0x3f;
  27178. if (!SegmentTypes[segmentType]) {
  27179. throw new Jbig2Error("invalid segment type: " + segmentType);
  27180. }
  27181. segmentHeader.type = segmentType;
  27182. segmentHeader.typeName = SegmentTypes[segmentType];
  27183. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  27184. const pageAssociationFieldSize = !!(flags & 0x40);
  27185. const referredFlags = data[start + 5];
  27186. let referredToCount = referredFlags >> 5 & 7;
  27187. const retainBits = [referredFlags & 31];
  27188. let position = start + 6;
  27189. if (referredFlags === 7) {
  27190. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  27191. position += 3;
  27192. let bytes = referredToCount + 7 >> 3;
  27193. retainBits[0] = data[position++];
  27194. while (--bytes > 0) {
  27195. retainBits.push(data[position++]);
  27196. }
  27197. } else if (referredFlags === 5 || referredFlags === 6) {
  27198. throw new Jbig2Error("invalid referred-to flags");
  27199. }
  27200. segmentHeader.retainBits = retainBits;
  27201. let referredToSegmentNumberSize = 4;
  27202. if (segmentHeader.number <= 256) {
  27203. referredToSegmentNumberSize = 1;
  27204. } else if (segmentHeader.number <= 65536) {
  27205. referredToSegmentNumberSize = 2;
  27206. }
  27207. const referredTo = [];
  27208. let i, ii;
  27209. for (i = 0; i < referredToCount; i++) {
  27210. let number;
  27211. if (referredToSegmentNumberSize === 1) {
  27212. number = data[position];
  27213. } else if (referredToSegmentNumberSize === 2) {
  27214. number = (0, _core_utils.readUint16)(data, position);
  27215. } else {
  27216. number = (0, _core_utils.readUint32)(data, position);
  27217. }
  27218. referredTo.push(number);
  27219. position += referredToSegmentNumberSize;
  27220. }
  27221. segmentHeader.referredTo = referredTo;
  27222. if (!pageAssociationFieldSize) {
  27223. segmentHeader.pageAssociation = data[position++];
  27224. } else {
  27225. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  27226. position += 4;
  27227. }
  27228. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  27229. position += 4;
  27230. if (segmentHeader.length === 0xffffffff) {
  27231. if (segmentType === 38) {
  27232. const genericRegionInfo = readRegionSegmentInformation(data, position);
  27233. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  27234. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  27235. const searchPatternLength = 6;
  27236. const searchPattern = new Uint8Array(searchPatternLength);
  27237. if (!genericRegionMmr) {
  27238. searchPattern[0] = 0xff;
  27239. searchPattern[1] = 0xac;
  27240. }
  27241. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  27242. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  27243. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  27244. searchPattern[5] = genericRegionInfo.height & 0xff;
  27245. for (i = position, ii = data.length; i < ii; i++) {
  27246. let j = 0;
  27247. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  27248. j++;
  27249. }
  27250. if (j === searchPatternLength) {
  27251. segmentHeader.length = i + searchPatternLength;
  27252. break;
  27253. }
  27254. }
  27255. if (segmentHeader.length === 0xffffffff) {
  27256. throw new Jbig2Error("segment end was not found");
  27257. }
  27258. } else {
  27259. throw new Jbig2Error("invalid unknown segment length");
  27260. }
  27261. }
  27262. segmentHeader.headerEnd = position;
  27263. return segmentHeader;
  27264. }
  27265. function readSegments(header, data, start, end) {
  27266. const segments = [];
  27267. let position = start;
  27268. while (position < end) {
  27269. const segmentHeader = readSegmentHeader(data, position);
  27270. position = segmentHeader.headerEnd;
  27271. const segment = {
  27272. header: segmentHeader,
  27273. data
  27274. };
  27275. if (!header.randomAccess) {
  27276. segment.start = position;
  27277. position += segmentHeader.length;
  27278. segment.end = position;
  27279. }
  27280. segments.push(segment);
  27281. if (segmentHeader.type === 51) {
  27282. break;
  27283. }
  27284. }
  27285. if (header.randomAccess) {
  27286. for (let i = 0, ii = segments.length; i < ii; i++) {
  27287. segments[i].start = position;
  27288. position += segments[i].header.length;
  27289. segments[i].end = position;
  27290. }
  27291. }
  27292. return segments;
  27293. }
  27294. function readRegionSegmentInformation(data, start) {
  27295. return {
  27296. width: (0, _core_utils.readUint32)(data, start),
  27297. height: (0, _core_utils.readUint32)(data, start + 4),
  27298. x: (0, _core_utils.readUint32)(data, start + 8),
  27299. y: (0, _core_utils.readUint32)(data, start + 12),
  27300. combinationOperator: data[start + 16] & 7
  27301. };
  27302. }
  27303. const RegionSegmentInformationFieldLength = 17;
  27304. function processSegment(segment, visitor) {
  27305. const header = segment.header;
  27306. const data = segment.data,
  27307. end = segment.end;
  27308. let position = segment.start;
  27309. let args, at, i, atLength;
  27310. switch (header.type) {
  27311. case 0:
  27312. const dictionary = {};
  27313. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  27314. dictionary.huffman = !!(dictionaryFlags & 1);
  27315. dictionary.refinement = !!(dictionaryFlags & 2);
  27316. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  27317. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  27318. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  27319. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  27320. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  27321. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  27322. dictionary.template = dictionaryFlags >> 10 & 3;
  27323. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  27324. position += 2;
  27325. if (!dictionary.huffman) {
  27326. atLength = dictionary.template === 0 ? 4 : 1;
  27327. at = [];
  27328. for (i = 0; i < atLength; i++) {
  27329. at.push({
  27330. x: (0, _core_utils.readInt8)(data, position),
  27331. y: (0, _core_utils.readInt8)(data, position + 1)
  27332. });
  27333. position += 2;
  27334. }
  27335. dictionary.at = at;
  27336. }
  27337. if (dictionary.refinement && !dictionary.refinementTemplate) {
  27338. at = [];
  27339. for (i = 0; i < 2; i++) {
  27340. at.push({
  27341. x: (0, _core_utils.readInt8)(data, position),
  27342. y: (0, _core_utils.readInt8)(data, position + 1)
  27343. });
  27344. position += 2;
  27345. }
  27346. dictionary.refinementAt = at;
  27347. }
  27348. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  27349. position += 4;
  27350. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  27351. position += 4;
  27352. args = [dictionary, header.number, header.referredTo, data, position, end];
  27353. break;
  27354. case 6:
  27355. case 7:
  27356. const textRegion = {};
  27357. textRegion.info = readRegionSegmentInformation(data, position);
  27358. position += RegionSegmentInformationFieldLength;
  27359. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  27360. position += 2;
  27361. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  27362. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  27363. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  27364. textRegion.stripSize = 1 << textRegion.logStripSize;
  27365. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  27366. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  27367. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  27368. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  27369. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  27370. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  27371. if (textRegion.huffman) {
  27372. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  27373. position += 2;
  27374. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  27375. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  27376. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  27377. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  27378. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  27379. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  27380. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  27381. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  27382. }
  27383. if (textRegion.refinement && !textRegion.refinementTemplate) {
  27384. at = [];
  27385. for (i = 0; i < 2; i++) {
  27386. at.push({
  27387. x: (0, _core_utils.readInt8)(data, position),
  27388. y: (0, _core_utils.readInt8)(data, position + 1)
  27389. });
  27390. position += 2;
  27391. }
  27392. textRegion.refinementAt = at;
  27393. }
  27394. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  27395. position += 4;
  27396. args = [textRegion, header.referredTo, data, position, end];
  27397. break;
  27398. case 16:
  27399. const patternDictionary = {};
  27400. const patternDictionaryFlags = data[position++];
  27401. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  27402. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  27403. patternDictionary.patternWidth = data[position++];
  27404. patternDictionary.patternHeight = data[position++];
  27405. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  27406. position += 4;
  27407. args = [patternDictionary, header.number, data, position, end];
  27408. break;
  27409. case 22:
  27410. case 23:
  27411. const halftoneRegion = {};
  27412. halftoneRegion.info = readRegionSegmentInformation(data, position);
  27413. position += RegionSegmentInformationFieldLength;
  27414. const halftoneRegionFlags = data[position++];
  27415. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  27416. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  27417. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  27418. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  27419. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  27420. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  27421. position += 4;
  27422. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  27423. position += 4;
  27424. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27425. position += 4;
  27426. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27427. position += 4;
  27428. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  27429. position += 2;
  27430. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  27431. position += 2;
  27432. args = [halftoneRegion, header.referredTo, data, position, end];
  27433. break;
  27434. case 38:
  27435. case 39:
  27436. const genericRegion = {};
  27437. genericRegion.info = readRegionSegmentInformation(data, position);
  27438. position += RegionSegmentInformationFieldLength;
  27439. const genericRegionSegmentFlags = data[position++];
  27440. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  27441. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  27442. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  27443. if (!genericRegion.mmr) {
  27444. atLength = genericRegion.template === 0 ? 4 : 1;
  27445. at = [];
  27446. for (i = 0; i < atLength; i++) {
  27447. at.push({
  27448. x: (0, _core_utils.readInt8)(data, position),
  27449. y: (0, _core_utils.readInt8)(data, position + 1)
  27450. });
  27451. position += 2;
  27452. }
  27453. genericRegion.at = at;
  27454. }
  27455. args = [genericRegion, data, position, end];
  27456. break;
  27457. case 48:
  27458. const pageInfo = {
  27459. width: (0, _core_utils.readUint32)(data, position),
  27460. height: (0, _core_utils.readUint32)(data, position + 4),
  27461. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  27462. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  27463. };
  27464. if (pageInfo.height === 0xffffffff) {
  27465. delete pageInfo.height;
  27466. }
  27467. const pageSegmentFlags = data[position + 16];
  27468. (0, _core_utils.readUint16)(data, position + 17);
  27469. pageInfo.lossless = !!(pageSegmentFlags & 1);
  27470. pageInfo.refinement = !!(pageSegmentFlags & 2);
  27471. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  27472. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  27473. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  27474. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  27475. args = [pageInfo];
  27476. break;
  27477. case 49:
  27478. break;
  27479. case 50:
  27480. break;
  27481. case 51:
  27482. break;
  27483. case 53:
  27484. args = [header.number, data, position, end];
  27485. break;
  27486. case 62:
  27487. break;
  27488. default:
  27489. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  27490. }
  27491. const callbackName = "on" + header.typeName;
  27492. if (callbackName in visitor) {
  27493. visitor[callbackName].apply(visitor, args);
  27494. }
  27495. }
  27496. function processSegments(segments, visitor) {
  27497. for (let i = 0, ii = segments.length; i < ii; i++) {
  27498. processSegment(segments[i], visitor);
  27499. }
  27500. }
  27501. function parseJbig2Chunks(chunks) {
  27502. const visitor = new SimpleSegmentVisitor();
  27503. for (let i = 0, ii = chunks.length; i < ii; i++) {
  27504. const chunk = chunks[i];
  27505. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  27506. processSegments(segments, visitor);
  27507. }
  27508. return visitor.buffer;
  27509. }
  27510. function parseJbig2(data) {
  27511. const end = data.length;
  27512. let position = 0;
  27513. 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) {
  27514. throw new Jbig2Error("parseJbig2 - invalid header.");
  27515. }
  27516. const header = Object.create(null);
  27517. position += 8;
  27518. const flags = data[position++];
  27519. header.randomAccess = !(flags & 1);
  27520. if (!(flags & 2)) {
  27521. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  27522. position += 4;
  27523. }
  27524. const segments = readSegments(header, data, position, end);
  27525. const visitor = new SimpleSegmentVisitor();
  27526. processSegments(segments, visitor);
  27527. const {
  27528. width,
  27529. height
  27530. } = visitor.currentPageInfo;
  27531. const bitPacked = visitor.buffer;
  27532. const imgData = new Uint8ClampedArray(width * height);
  27533. let q = 0,
  27534. k = 0;
  27535. for (let i = 0; i < height; i++) {
  27536. let mask = 0,
  27537. buffer;
  27538. for (let j = 0; j < width; j++) {
  27539. if (!mask) {
  27540. mask = 128;
  27541. buffer = bitPacked[k++];
  27542. }
  27543. imgData[q++] = buffer & mask ? 0 : 255;
  27544. mask >>= 1;
  27545. }
  27546. }
  27547. return {
  27548. imgData,
  27549. width,
  27550. height
  27551. };
  27552. }
  27553. class SimpleSegmentVisitor {
  27554. onPageInformation(info) {
  27555. this.currentPageInfo = info;
  27556. const rowSize = info.width + 7 >> 3;
  27557. const buffer = new Uint8ClampedArray(rowSize * info.height);
  27558. if (info.defaultPixelValue) {
  27559. for (let i = 0, ii = buffer.length; i < ii; i++) {
  27560. buffer[i] = 0xff;
  27561. }
  27562. }
  27563. this.buffer = buffer;
  27564. }
  27565. drawBitmap(regionInfo, bitmap) {
  27566. const pageInfo = this.currentPageInfo;
  27567. const width = regionInfo.width,
  27568. height = regionInfo.height;
  27569. const rowSize = pageInfo.width + 7 >> 3;
  27570. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  27571. const buffer = this.buffer;
  27572. const mask0 = 128 >> (regionInfo.x & 7);
  27573. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  27574. let i, j, mask, offset;
  27575. switch (combinationOperator) {
  27576. case 0:
  27577. for (i = 0; i < height; i++) {
  27578. mask = mask0;
  27579. offset = offset0;
  27580. for (j = 0; j < width; j++) {
  27581. if (bitmap[i][j]) {
  27582. buffer[offset] |= mask;
  27583. }
  27584. mask >>= 1;
  27585. if (!mask) {
  27586. mask = 128;
  27587. offset++;
  27588. }
  27589. }
  27590. offset0 += rowSize;
  27591. }
  27592. break;
  27593. case 2:
  27594. for (i = 0; i < height; i++) {
  27595. mask = mask0;
  27596. offset = offset0;
  27597. for (j = 0; j < width; j++) {
  27598. if (bitmap[i][j]) {
  27599. buffer[offset] ^= mask;
  27600. }
  27601. mask >>= 1;
  27602. if (!mask) {
  27603. mask = 128;
  27604. offset++;
  27605. }
  27606. }
  27607. offset0 += rowSize;
  27608. }
  27609. break;
  27610. default:
  27611. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27612. }
  27613. }
  27614. onImmediateGenericRegion(region, data, start, end) {
  27615. const regionInfo = region.info;
  27616. const decodingContext = new DecodingContext(data, start, end);
  27617. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  27618. this.drawBitmap(regionInfo, bitmap);
  27619. }
  27620. onImmediateLosslessGenericRegion() {
  27621. this.onImmediateGenericRegion.apply(this, arguments);
  27622. }
  27623. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  27624. let huffmanTables, huffmanInput;
  27625. if (dictionary.huffman) {
  27626. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  27627. huffmanInput = new Reader(data, start, end);
  27628. }
  27629. let symbols = this.symbols;
  27630. if (!symbols) {
  27631. this.symbols = symbols = {};
  27632. }
  27633. let inputSymbols = [];
  27634. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  27635. const referredSymbols = symbols[referredSegments[i]];
  27636. if (referredSymbols) {
  27637. inputSymbols = inputSymbols.concat(referredSymbols);
  27638. }
  27639. }
  27640. const decodingContext = new DecodingContext(data, start, end);
  27641. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  27642. }
  27643. onImmediateTextRegion(region, referredSegments, data, start, end) {
  27644. const regionInfo = region.info;
  27645. let huffmanTables, huffmanInput;
  27646. const symbols = this.symbols;
  27647. let inputSymbols = [];
  27648. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  27649. const referredSymbols = symbols[referredSegments[i]];
  27650. if (referredSymbols) {
  27651. inputSymbols = inputSymbols.concat(referredSymbols);
  27652. }
  27653. }
  27654. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  27655. if (region.huffman) {
  27656. huffmanInput = new Reader(data, start, end);
  27657. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  27658. }
  27659. const decodingContext = new DecodingContext(data, start, end);
  27660. const 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);
  27661. this.drawBitmap(regionInfo, bitmap);
  27662. }
  27663. onImmediateLosslessTextRegion() {
  27664. this.onImmediateTextRegion.apply(this, arguments);
  27665. }
  27666. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  27667. let patterns = this.patterns;
  27668. if (!patterns) {
  27669. this.patterns = patterns = {};
  27670. }
  27671. const decodingContext = new DecodingContext(data, start, end);
  27672. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  27673. }
  27674. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  27675. const patterns = this.patterns[referredSegments[0]];
  27676. const regionInfo = region.info;
  27677. const decodingContext = new DecodingContext(data, start, end);
  27678. 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);
  27679. this.drawBitmap(regionInfo, bitmap);
  27680. }
  27681. onImmediateLosslessHalftoneRegion() {
  27682. this.onImmediateHalftoneRegion.apply(this, arguments);
  27683. }
  27684. onTables(currentSegment, data, start, end) {
  27685. let customTables = this.customTables;
  27686. if (!customTables) {
  27687. this.customTables = customTables = {};
  27688. }
  27689. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  27690. }
  27691. }
  27692. class HuffmanLine {
  27693. constructor(lineData) {
  27694. if (lineData.length === 2) {
  27695. this.isOOB = true;
  27696. this.rangeLow = 0;
  27697. this.prefixLength = lineData[0];
  27698. this.rangeLength = 0;
  27699. this.prefixCode = lineData[1];
  27700. this.isLowerRange = false;
  27701. } else {
  27702. this.isOOB = false;
  27703. this.rangeLow = lineData[0];
  27704. this.prefixLength = lineData[1];
  27705. this.rangeLength = lineData[2];
  27706. this.prefixCode = lineData[3];
  27707. this.isLowerRange = lineData[4] === "lower";
  27708. }
  27709. }
  27710. }
  27711. class HuffmanTreeNode {
  27712. constructor(line) {
  27713. this.children = [];
  27714. if (line) {
  27715. this.isLeaf = true;
  27716. this.rangeLength = line.rangeLength;
  27717. this.rangeLow = line.rangeLow;
  27718. this.isLowerRange = line.isLowerRange;
  27719. this.isOOB = line.isOOB;
  27720. } else {
  27721. this.isLeaf = false;
  27722. }
  27723. }
  27724. buildTree(line, shift) {
  27725. const bit = line.prefixCode >> shift & 1;
  27726. if (shift <= 0) {
  27727. this.children[bit] = new HuffmanTreeNode(line);
  27728. } else {
  27729. let node = this.children[bit];
  27730. if (!node) {
  27731. this.children[bit] = node = new HuffmanTreeNode(null);
  27732. }
  27733. node.buildTree(line, shift - 1);
  27734. }
  27735. }
  27736. decodeNode(reader) {
  27737. if (this.isLeaf) {
  27738. if (this.isOOB) {
  27739. return null;
  27740. }
  27741. const htOffset = reader.readBits(this.rangeLength);
  27742. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  27743. }
  27744. const node = this.children[reader.readBit()];
  27745. if (!node) {
  27746. throw new Jbig2Error("invalid Huffman data");
  27747. }
  27748. return node.decodeNode(reader);
  27749. }
  27750. }
  27751. class HuffmanTable {
  27752. constructor(lines, prefixCodesDone) {
  27753. if (!prefixCodesDone) {
  27754. this.assignPrefixCodes(lines);
  27755. }
  27756. this.rootNode = new HuffmanTreeNode(null);
  27757. for (let i = 0, ii = lines.length; i < ii; i++) {
  27758. const line = lines[i];
  27759. if (line.prefixLength > 0) {
  27760. this.rootNode.buildTree(line, line.prefixLength - 1);
  27761. }
  27762. }
  27763. }
  27764. decode(reader) {
  27765. return this.rootNode.decodeNode(reader);
  27766. }
  27767. assignPrefixCodes(lines) {
  27768. const linesLength = lines.length;
  27769. let prefixLengthMax = 0;
  27770. for (let i = 0; i < linesLength; i++) {
  27771. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  27772. }
  27773. const histogram = new Uint32Array(prefixLengthMax + 1);
  27774. for (let i = 0; i < linesLength; i++) {
  27775. histogram[lines[i].prefixLength]++;
  27776. }
  27777. let currentLength = 1,
  27778. firstCode = 0,
  27779. currentCode,
  27780. currentTemp,
  27781. line;
  27782. histogram[0] = 0;
  27783. while (currentLength <= prefixLengthMax) {
  27784. firstCode = firstCode + histogram[currentLength - 1] << 1;
  27785. currentCode = firstCode;
  27786. currentTemp = 0;
  27787. while (currentTemp < linesLength) {
  27788. line = lines[currentTemp];
  27789. if (line.prefixLength === currentLength) {
  27790. line.prefixCode = currentCode;
  27791. currentCode++;
  27792. }
  27793. currentTemp++;
  27794. }
  27795. currentLength++;
  27796. }
  27797. }
  27798. }
  27799. function decodeTablesSegment(data, start, end) {
  27800. const flags = data[start];
  27801. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  27802. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  27803. const reader = new Reader(data, start + 9, end);
  27804. const prefixSizeBits = (flags >> 1 & 7) + 1;
  27805. const rangeSizeBits = (flags >> 4 & 7) + 1;
  27806. const lines = [];
  27807. let prefixLength,
  27808. rangeLength,
  27809. currentRangeLow = lowestValue;
  27810. do {
  27811. prefixLength = reader.readBits(prefixSizeBits);
  27812. rangeLength = reader.readBits(rangeSizeBits);
  27813. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  27814. currentRangeLow += 1 << rangeLength;
  27815. } while (currentRangeLow < highestValue);
  27816. prefixLength = reader.readBits(prefixSizeBits);
  27817. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  27818. prefixLength = reader.readBits(prefixSizeBits);
  27819. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  27820. if (flags & 1) {
  27821. prefixLength = reader.readBits(prefixSizeBits);
  27822. lines.push(new HuffmanLine([prefixLength, 0]));
  27823. }
  27824. return new HuffmanTable(lines, false);
  27825. }
  27826. const standardTablesCache = {};
  27827. function getStandardTable(number) {
  27828. let table = standardTablesCache[number];
  27829. if (table) {
  27830. return table;
  27831. }
  27832. let lines;
  27833. switch (number) {
  27834. case 1:
  27835. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  27836. break;
  27837. case 2:
  27838. 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]];
  27839. break;
  27840. case 3:
  27841. 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]];
  27842. break;
  27843. case 4:
  27844. 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]];
  27845. break;
  27846. case 5:
  27847. 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]];
  27848. break;
  27849. case 6:
  27850. 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]];
  27851. break;
  27852. case 7:
  27853. 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]];
  27854. break;
  27855. case 8:
  27856. 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]];
  27857. break;
  27858. case 9:
  27859. 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]];
  27860. break;
  27861. case 10:
  27862. 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]];
  27863. break;
  27864. case 11:
  27865. 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]];
  27866. break;
  27867. case 12:
  27868. 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]];
  27869. break;
  27870. case 13:
  27871. 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]];
  27872. break;
  27873. case 14:
  27874. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  27875. break;
  27876. case 15:
  27877. 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]];
  27878. break;
  27879. default:
  27880. throw new Jbig2Error(`standard table B.${number} does not exist`);
  27881. }
  27882. for (let i = 0, ii = lines.length; i < ii; i++) {
  27883. lines[i] = new HuffmanLine(lines[i]);
  27884. }
  27885. table = new HuffmanTable(lines, true);
  27886. standardTablesCache[number] = table;
  27887. return table;
  27888. }
  27889. class Reader {
  27890. constructor(data, start, end) {
  27891. this.data = data;
  27892. this.start = start;
  27893. this.end = end;
  27894. this.position = start;
  27895. this.shift = -1;
  27896. this.currentByte = 0;
  27897. }
  27898. readBit() {
  27899. if (this.shift < 0) {
  27900. if (this.position >= this.end) {
  27901. throw new Jbig2Error("end of data while reading bit");
  27902. }
  27903. this.currentByte = this.data[this.position++];
  27904. this.shift = 7;
  27905. }
  27906. const bit = this.currentByte >> this.shift & 1;
  27907. this.shift--;
  27908. return bit;
  27909. }
  27910. readBits(numBits) {
  27911. let result = 0,
  27912. i;
  27913. for (i = numBits - 1; i >= 0; i--) {
  27914. result |= this.readBit() << i;
  27915. }
  27916. return result;
  27917. }
  27918. byteAlign() {
  27919. this.shift = -1;
  27920. }
  27921. next() {
  27922. if (this.position >= this.end) {
  27923. return -1;
  27924. }
  27925. return this.data[this.position++];
  27926. }
  27927. }
  27928. function getCustomHuffmanTable(index, referredTo, customTables) {
  27929. let currentIndex = 0;
  27930. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  27931. const table = customTables[referredTo[i]];
  27932. if (table) {
  27933. if (index === currentIndex) {
  27934. return table;
  27935. }
  27936. currentIndex++;
  27937. }
  27938. }
  27939. throw new Jbig2Error("can't find custom Huffman table");
  27940. }
  27941. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  27942. const codes = [];
  27943. for (let i = 0; i <= 34; i++) {
  27944. const codeLength = reader.readBits(4);
  27945. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  27946. }
  27947. const runCodesTable = new HuffmanTable(codes, false);
  27948. codes.length = 0;
  27949. for (let i = 0; i < numberOfSymbols;) {
  27950. const codeLength = runCodesTable.decode(reader);
  27951. if (codeLength >= 32) {
  27952. let repeatedLength, numberOfRepeats, j;
  27953. switch (codeLength) {
  27954. case 32:
  27955. if (i === 0) {
  27956. throw new Jbig2Error("no previous value in symbol ID table");
  27957. }
  27958. numberOfRepeats = reader.readBits(2) + 3;
  27959. repeatedLength = codes[i - 1].prefixLength;
  27960. break;
  27961. case 33:
  27962. numberOfRepeats = reader.readBits(3) + 3;
  27963. repeatedLength = 0;
  27964. break;
  27965. case 34:
  27966. numberOfRepeats = reader.readBits(7) + 11;
  27967. repeatedLength = 0;
  27968. break;
  27969. default:
  27970. throw new Jbig2Error("invalid code length in symbol ID table");
  27971. }
  27972. for (j = 0; j < numberOfRepeats; j++) {
  27973. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  27974. i++;
  27975. }
  27976. } else {
  27977. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  27978. i++;
  27979. }
  27980. }
  27981. reader.byteAlign();
  27982. const symbolIDTable = new HuffmanTable(codes, false);
  27983. let customIndex = 0,
  27984. tableFirstS,
  27985. tableDeltaS,
  27986. tableDeltaT;
  27987. switch (textRegion.huffmanFS) {
  27988. case 0:
  27989. case 1:
  27990. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  27991. break;
  27992. case 3:
  27993. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  27994. customIndex++;
  27995. break;
  27996. default:
  27997. throw new Jbig2Error("invalid Huffman FS selector");
  27998. }
  27999. switch (textRegion.huffmanDS) {
  28000. case 0:
  28001. case 1:
  28002. case 2:
  28003. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  28004. break;
  28005. case 3:
  28006. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28007. customIndex++;
  28008. break;
  28009. default:
  28010. throw new Jbig2Error("invalid Huffman DS selector");
  28011. }
  28012. switch (textRegion.huffmanDT) {
  28013. case 0:
  28014. case 1:
  28015. case 2:
  28016. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  28017. break;
  28018. case 3:
  28019. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28020. customIndex++;
  28021. break;
  28022. default:
  28023. throw new Jbig2Error("invalid Huffman DT selector");
  28024. }
  28025. if (textRegion.refinement) {
  28026. throw new Jbig2Error("refinement with Huffman is not supported");
  28027. }
  28028. return {
  28029. symbolIDTable,
  28030. tableFirstS,
  28031. tableDeltaS,
  28032. tableDeltaT
  28033. };
  28034. }
  28035. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  28036. let customIndex = 0,
  28037. tableDeltaHeight,
  28038. tableDeltaWidth;
  28039. switch (dictionary.huffmanDHSelector) {
  28040. case 0:
  28041. case 1:
  28042. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  28043. break;
  28044. case 3:
  28045. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28046. customIndex++;
  28047. break;
  28048. default:
  28049. throw new Jbig2Error("invalid Huffman DH selector");
  28050. }
  28051. switch (dictionary.huffmanDWSelector) {
  28052. case 0:
  28053. case 1:
  28054. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  28055. break;
  28056. case 3:
  28057. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28058. customIndex++;
  28059. break;
  28060. default:
  28061. throw new Jbig2Error("invalid Huffman DW selector");
  28062. }
  28063. let tableBitmapSize, tableAggregateInstances;
  28064. if (dictionary.bitmapSizeSelector) {
  28065. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28066. customIndex++;
  28067. } else {
  28068. tableBitmapSize = getStandardTable(1);
  28069. }
  28070. if (dictionary.aggregationInstancesSelector) {
  28071. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28072. } else {
  28073. tableAggregateInstances = getStandardTable(1);
  28074. }
  28075. return {
  28076. tableDeltaHeight,
  28077. tableDeltaWidth,
  28078. tableBitmapSize,
  28079. tableAggregateInstances
  28080. };
  28081. }
  28082. function readUncompressedBitmap(reader, width, height) {
  28083. const bitmap = [];
  28084. for (let y = 0; y < height; y++) {
  28085. const row = new Uint8Array(width);
  28086. bitmap.push(row);
  28087. for (let x = 0; x < width; x++) {
  28088. row[x] = reader.readBit();
  28089. }
  28090. reader.byteAlign();
  28091. }
  28092. return bitmap;
  28093. }
  28094. function decodeMMRBitmap(input, width, height, endOfBlock) {
  28095. const params = {
  28096. K: -1,
  28097. Columns: width,
  28098. Rows: height,
  28099. BlackIs1: true,
  28100. EndOfBlock: endOfBlock
  28101. };
  28102. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  28103. const bitmap = [];
  28104. let currentByte,
  28105. eof = false;
  28106. for (let y = 0; y < height; y++) {
  28107. const row = new Uint8Array(width);
  28108. bitmap.push(row);
  28109. let shift = -1;
  28110. for (let x = 0; x < width; x++) {
  28111. if (shift < 0) {
  28112. currentByte = decoder.readNextChar();
  28113. if (currentByte === -1) {
  28114. currentByte = 0;
  28115. eof = true;
  28116. }
  28117. shift = 7;
  28118. }
  28119. row[x] = currentByte >> shift & 1;
  28120. shift--;
  28121. }
  28122. }
  28123. if (endOfBlock && !eof) {
  28124. const lookForEOFLimit = 5;
  28125. for (let i = 0; i < lookForEOFLimit; i++) {
  28126. if (decoder.readNextChar() === -1) {
  28127. break;
  28128. }
  28129. }
  28130. }
  28131. return bitmap;
  28132. }
  28133. class Jbig2Image {
  28134. parseChunks(chunks) {
  28135. return parseJbig2Chunks(chunks);
  28136. }
  28137. parse(data) {
  28138. const {
  28139. imgData,
  28140. width,
  28141. height
  28142. } = parseJbig2(data);
  28143. this.width = width;
  28144. this.height = height;
  28145. return imgData;
  28146. }
  28147. }
  28148. exports.Jbig2Image = Jbig2Image;
  28149. /***/ }),
  28150. /* 36 */
  28151. /***/ ((__unused_webpack_module, exports) => {
  28152. Object.defineProperty(exports, "__esModule", ({
  28153. value: true
  28154. }));
  28155. exports.ArithmeticDecoder = void 0;
  28156. const QeTable = [{
  28157. qe: 0x5601,
  28158. nmps: 1,
  28159. nlps: 1,
  28160. switchFlag: 1
  28161. }, {
  28162. qe: 0x3401,
  28163. nmps: 2,
  28164. nlps: 6,
  28165. switchFlag: 0
  28166. }, {
  28167. qe: 0x1801,
  28168. nmps: 3,
  28169. nlps: 9,
  28170. switchFlag: 0
  28171. }, {
  28172. qe: 0x0ac1,
  28173. nmps: 4,
  28174. nlps: 12,
  28175. switchFlag: 0
  28176. }, {
  28177. qe: 0x0521,
  28178. nmps: 5,
  28179. nlps: 29,
  28180. switchFlag: 0
  28181. }, {
  28182. qe: 0x0221,
  28183. nmps: 38,
  28184. nlps: 33,
  28185. switchFlag: 0
  28186. }, {
  28187. qe: 0x5601,
  28188. nmps: 7,
  28189. nlps: 6,
  28190. switchFlag: 1
  28191. }, {
  28192. qe: 0x5401,
  28193. nmps: 8,
  28194. nlps: 14,
  28195. switchFlag: 0
  28196. }, {
  28197. qe: 0x4801,
  28198. nmps: 9,
  28199. nlps: 14,
  28200. switchFlag: 0
  28201. }, {
  28202. qe: 0x3801,
  28203. nmps: 10,
  28204. nlps: 14,
  28205. switchFlag: 0
  28206. }, {
  28207. qe: 0x3001,
  28208. nmps: 11,
  28209. nlps: 17,
  28210. switchFlag: 0
  28211. }, {
  28212. qe: 0x2401,
  28213. nmps: 12,
  28214. nlps: 18,
  28215. switchFlag: 0
  28216. }, {
  28217. qe: 0x1c01,
  28218. nmps: 13,
  28219. nlps: 20,
  28220. switchFlag: 0
  28221. }, {
  28222. qe: 0x1601,
  28223. nmps: 29,
  28224. nlps: 21,
  28225. switchFlag: 0
  28226. }, {
  28227. qe: 0x5601,
  28228. nmps: 15,
  28229. nlps: 14,
  28230. switchFlag: 1
  28231. }, {
  28232. qe: 0x5401,
  28233. nmps: 16,
  28234. nlps: 14,
  28235. switchFlag: 0
  28236. }, {
  28237. qe: 0x5101,
  28238. nmps: 17,
  28239. nlps: 15,
  28240. switchFlag: 0
  28241. }, {
  28242. qe: 0x4801,
  28243. nmps: 18,
  28244. nlps: 16,
  28245. switchFlag: 0
  28246. }, {
  28247. qe: 0x3801,
  28248. nmps: 19,
  28249. nlps: 17,
  28250. switchFlag: 0
  28251. }, {
  28252. qe: 0x3401,
  28253. nmps: 20,
  28254. nlps: 18,
  28255. switchFlag: 0
  28256. }, {
  28257. qe: 0x3001,
  28258. nmps: 21,
  28259. nlps: 19,
  28260. switchFlag: 0
  28261. }, {
  28262. qe: 0x2801,
  28263. nmps: 22,
  28264. nlps: 19,
  28265. switchFlag: 0
  28266. }, {
  28267. qe: 0x2401,
  28268. nmps: 23,
  28269. nlps: 20,
  28270. switchFlag: 0
  28271. }, {
  28272. qe: 0x2201,
  28273. nmps: 24,
  28274. nlps: 21,
  28275. switchFlag: 0
  28276. }, {
  28277. qe: 0x1c01,
  28278. nmps: 25,
  28279. nlps: 22,
  28280. switchFlag: 0
  28281. }, {
  28282. qe: 0x1801,
  28283. nmps: 26,
  28284. nlps: 23,
  28285. switchFlag: 0
  28286. }, {
  28287. qe: 0x1601,
  28288. nmps: 27,
  28289. nlps: 24,
  28290. switchFlag: 0
  28291. }, {
  28292. qe: 0x1401,
  28293. nmps: 28,
  28294. nlps: 25,
  28295. switchFlag: 0
  28296. }, {
  28297. qe: 0x1201,
  28298. nmps: 29,
  28299. nlps: 26,
  28300. switchFlag: 0
  28301. }, {
  28302. qe: 0x1101,
  28303. nmps: 30,
  28304. nlps: 27,
  28305. switchFlag: 0
  28306. }, {
  28307. qe: 0x0ac1,
  28308. nmps: 31,
  28309. nlps: 28,
  28310. switchFlag: 0
  28311. }, {
  28312. qe: 0x09c1,
  28313. nmps: 32,
  28314. nlps: 29,
  28315. switchFlag: 0
  28316. }, {
  28317. qe: 0x08a1,
  28318. nmps: 33,
  28319. nlps: 30,
  28320. switchFlag: 0
  28321. }, {
  28322. qe: 0x0521,
  28323. nmps: 34,
  28324. nlps: 31,
  28325. switchFlag: 0
  28326. }, {
  28327. qe: 0x0441,
  28328. nmps: 35,
  28329. nlps: 32,
  28330. switchFlag: 0
  28331. }, {
  28332. qe: 0x02a1,
  28333. nmps: 36,
  28334. nlps: 33,
  28335. switchFlag: 0
  28336. }, {
  28337. qe: 0x0221,
  28338. nmps: 37,
  28339. nlps: 34,
  28340. switchFlag: 0
  28341. }, {
  28342. qe: 0x0141,
  28343. nmps: 38,
  28344. nlps: 35,
  28345. switchFlag: 0
  28346. }, {
  28347. qe: 0x0111,
  28348. nmps: 39,
  28349. nlps: 36,
  28350. switchFlag: 0
  28351. }, {
  28352. qe: 0x0085,
  28353. nmps: 40,
  28354. nlps: 37,
  28355. switchFlag: 0
  28356. }, {
  28357. qe: 0x0049,
  28358. nmps: 41,
  28359. nlps: 38,
  28360. switchFlag: 0
  28361. }, {
  28362. qe: 0x0025,
  28363. nmps: 42,
  28364. nlps: 39,
  28365. switchFlag: 0
  28366. }, {
  28367. qe: 0x0015,
  28368. nmps: 43,
  28369. nlps: 40,
  28370. switchFlag: 0
  28371. }, {
  28372. qe: 0x0009,
  28373. nmps: 44,
  28374. nlps: 41,
  28375. switchFlag: 0
  28376. }, {
  28377. qe: 0x0005,
  28378. nmps: 45,
  28379. nlps: 42,
  28380. switchFlag: 0
  28381. }, {
  28382. qe: 0x0001,
  28383. nmps: 45,
  28384. nlps: 43,
  28385. switchFlag: 0
  28386. }, {
  28387. qe: 0x5601,
  28388. nmps: 46,
  28389. nlps: 46,
  28390. switchFlag: 0
  28391. }];
  28392. class ArithmeticDecoder {
  28393. constructor(data, start, end) {
  28394. this.data = data;
  28395. this.bp = start;
  28396. this.dataEnd = end;
  28397. this.chigh = data[start];
  28398. this.clow = 0;
  28399. this.byteIn();
  28400. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  28401. this.clow = this.clow << 7 & 0xffff;
  28402. this.ct -= 7;
  28403. this.a = 0x8000;
  28404. }
  28405. byteIn() {
  28406. const data = this.data;
  28407. let bp = this.bp;
  28408. if (data[bp] === 0xff) {
  28409. if (data[bp + 1] > 0x8f) {
  28410. this.clow += 0xff00;
  28411. this.ct = 8;
  28412. } else {
  28413. bp++;
  28414. this.clow += data[bp] << 9;
  28415. this.ct = 7;
  28416. this.bp = bp;
  28417. }
  28418. } else {
  28419. bp++;
  28420. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  28421. this.ct = 8;
  28422. this.bp = bp;
  28423. }
  28424. if (this.clow > 0xffff) {
  28425. this.chigh += this.clow >> 16;
  28426. this.clow &= 0xffff;
  28427. }
  28428. }
  28429. readBit(contexts, pos) {
  28430. let cx_index = contexts[pos] >> 1,
  28431. cx_mps = contexts[pos] & 1;
  28432. const qeTableIcx = QeTable[cx_index];
  28433. const qeIcx = qeTableIcx.qe;
  28434. let d;
  28435. let a = this.a - qeIcx;
  28436. if (this.chigh < qeIcx) {
  28437. if (a < qeIcx) {
  28438. a = qeIcx;
  28439. d = cx_mps;
  28440. cx_index = qeTableIcx.nmps;
  28441. } else {
  28442. a = qeIcx;
  28443. d = 1 ^ cx_mps;
  28444. if (qeTableIcx.switchFlag === 1) {
  28445. cx_mps = d;
  28446. }
  28447. cx_index = qeTableIcx.nlps;
  28448. }
  28449. } else {
  28450. this.chigh -= qeIcx;
  28451. if ((a & 0x8000) !== 0) {
  28452. this.a = a;
  28453. return cx_mps;
  28454. }
  28455. if (a < qeIcx) {
  28456. d = 1 ^ cx_mps;
  28457. if (qeTableIcx.switchFlag === 1) {
  28458. cx_mps = d;
  28459. }
  28460. cx_index = qeTableIcx.nlps;
  28461. } else {
  28462. d = cx_mps;
  28463. cx_index = qeTableIcx.nmps;
  28464. }
  28465. }
  28466. do {
  28467. if (this.ct === 0) {
  28468. this.byteIn();
  28469. }
  28470. a <<= 1;
  28471. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  28472. this.clow = this.clow << 1 & 0xffff;
  28473. this.ct--;
  28474. } while ((a & 0x8000) === 0);
  28475. this.a = a;
  28476. contexts[pos] = cx_index << 1 | cx_mps;
  28477. return d;
  28478. }
  28479. }
  28480. exports.ArithmeticDecoder = ArithmeticDecoder;
  28481. /***/ }),
  28482. /* 37 */
  28483. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  28484. Object.defineProperty(exports, "__esModule", ({
  28485. value: true
  28486. }));
  28487. exports.JpegStream = void 0;
  28488. var _decode_stream = __w_pdfjs_require__(29);
  28489. var _primitives = __w_pdfjs_require__(5);
  28490. var _jpg = __w_pdfjs_require__(38);
  28491. var _util = __w_pdfjs_require__(2);
  28492. class JpegStream extends _decode_stream.DecodeStream {
  28493. constructor(stream, maybeLength, params) {
  28494. let ch;
  28495. while ((ch = stream.getByte()) !== -1) {
  28496. if (ch === 0xff) {
  28497. stream.skip(-1);
  28498. break;
  28499. }
  28500. }
  28501. super(maybeLength);
  28502. this.stream = stream;
  28503. this.dict = stream.dict;
  28504. this.maybeLength = maybeLength;
  28505. this.params = params;
  28506. }
  28507. get bytes() {
  28508. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  28509. }
  28510. ensureBuffer(requested) {}
  28511. readBlock() {
  28512. if (this.eof) {
  28513. return;
  28514. }
  28515. const jpegOptions = {
  28516. decodeTransform: undefined,
  28517. colorTransform: undefined
  28518. };
  28519. const decodeArr = this.dict.getArray("Decode", "D");
  28520. if (this.forceRGB && Array.isArray(decodeArr)) {
  28521. const bitsPerComponent = this.dict.get("BitsPerComponent") || 8;
  28522. const decodeArrLength = decodeArr.length;
  28523. const transform = new Int32Array(decodeArrLength);
  28524. let transformNeeded = false;
  28525. const maxValue = (1 << bitsPerComponent) - 1;
  28526. for (let i = 0; i < decodeArrLength; i += 2) {
  28527. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  28528. transform[i + 1] = decodeArr[i] * maxValue | 0;
  28529. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  28530. transformNeeded = true;
  28531. }
  28532. }
  28533. if (transformNeeded) {
  28534. jpegOptions.decodeTransform = transform;
  28535. }
  28536. }
  28537. if ((0, _primitives.isDict)(this.params)) {
  28538. const colorTransform = this.params.get("ColorTransform");
  28539. if (Number.isInteger(colorTransform)) {
  28540. jpegOptions.colorTransform = colorTransform;
  28541. }
  28542. }
  28543. const jpegImage = new _jpg.JpegImage(jpegOptions);
  28544. jpegImage.parse(this.bytes);
  28545. const data = jpegImage.getData({
  28546. width: this.drawWidth,
  28547. height: this.drawHeight,
  28548. forceRGB: this.forceRGB,
  28549. isSourcePDF: true
  28550. });
  28551. this.buffer = data;
  28552. this.bufferLength = data.length;
  28553. this.eof = true;
  28554. }
  28555. }
  28556. exports.JpegStream = JpegStream;
  28557. /***/ }),
  28558. /* 38 */
  28559. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  28560. Object.defineProperty(exports, "__esModule", ({
  28561. value: true
  28562. }));
  28563. exports.JpegImage = void 0;
  28564. var _util = __w_pdfjs_require__(2);
  28565. var _core_utils = __w_pdfjs_require__(9);
  28566. class JpegError extends _util.BaseException {
  28567. constructor(msg) {
  28568. super(`JPEG error: ${msg}`, "JpegError");
  28569. }
  28570. }
  28571. class DNLMarkerError extends _util.BaseException {
  28572. constructor(message, scanLines) {
  28573. super(message, "DNLMarkerError");
  28574. this.scanLines = scanLines;
  28575. }
  28576. }
  28577. class EOIMarkerError extends _util.BaseException {
  28578. constructor(msg) {
  28579. super(msg, "EOIMarkerError");
  28580. }
  28581. }
  28582. const 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]);
  28583. const dctCos1 = 4017;
  28584. const dctSin1 = 799;
  28585. const dctCos3 = 3406;
  28586. const dctSin3 = 2276;
  28587. const dctCos6 = 1567;
  28588. const dctSin6 = 3784;
  28589. const dctSqrt2 = 5793;
  28590. const dctSqrt1d2 = 2896;
  28591. function buildHuffmanTable(codeLengths, values) {
  28592. let k = 0,
  28593. i,
  28594. j,
  28595. length = 16;
  28596. while (length > 0 && !codeLengths[length - 1]) {
  28597. length--;
  28598. }
  28599. const code = [{
  28600. children: [],
  28601. index: 0
  28602. }];
  28603. let p = code[0],
  28604. q;
  28605. for (i = 0; i < length; i++) {
  28606. for (j = 0; j < codeLengths[i]; j++) {
  28607. p = code.pop();
  28608. p.children[p.index] = values[k];
  28609. while (p.index > 0) {
  28610. p = code.pop();
  28611. }
  28612. p.index++;
  28613. code.push(p);
  28614. while (code.length <= i) {
  28615. code.push(q = {
  28616. children: [],
  28617. index: 0
  28618. });
  28619. p.children[p.index] = q.children;
  28620. p = q;
  28621. }
  28622. k++;
  28623. }
  28624. if (i + 1 < length) {
  28625. code.push(q = {
  28626. children: [],
  28627. index: 0
  28628. });
  28629. p.children[p.index] = q.children;
  28630. p = q;
  28631. }
  28632. }
  28633. return code[0].children;
  28634. }
  28635. function getBlockBufferOffset(component, row, col) {
  28636. return 64 * ((component.blocksPerLine + 1) * row + col);
  28637. }
  28638. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  28639. const mcusPerLine = frame.mcusPerLine;
  28640. const progressive = frame.progressive;
  28641. const startOffset = offset;
  28642. let bitsData = 0,
  28643. bitsCount = 0;
  28644. function readBit() {
  28645. if (bitsCount > 0) {
  28646. bitsCount--;
  28647. return bitsData >> bitsCount & 1;
  28648. }
  28649. bitsData = data[offset++];
  28650. if (bitsData === 0xff) {
  28651. const nextByte = data[offset++];
  28652. if (nextByte) {
  28653. if (nextByte === 0xdc && parseDNLMarker) {
  28654. offset += 2;
  28655. const scanLines = (0, _core_utils.readUint16)(data, offset);
  28656. offset += 2;
  28657. if (scanLines > 0 && scanLines !== frame.scanLines) {
  28658. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  28659. }
  28660. } else if (nextByte === 0xd9) {
  28661. if (parseDNLMarker) {
  28662. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  28663. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  28664. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  28665. }
  28666. }
  28667. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  28668. }
  28669. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  28670. }
  28671. }
  28672. bitsCount = 7;
  28673. return bitsData >>> 7;
  28674. }
  28675. function decodeHuffman(tree) {
  28676. let node = tree;
  28677. while (true) {
  28678. node = node[readBit()];
  28679. switch (typeof node) {
  28680. case "number":
  28681. return node;
  28682. case "object":
  28683. continue;
  28684. }
  28685. throw new JpegError("invalid huffman sequence");
  28686. }
  28687. }
  28688. function receive(length) {
  28689. let n = 0;
  28690. while (length > 0) {
  28691. n = n << 1 | readBit();
  28692. length--;
  28693. }
  28694. return n;
  28695. }
  28696. function receiveAndExtend(length) {
  28697. if (length === 1) {
  28698. return readBit() === 1 ? 1 : -1;
  28699. }
  28700. const n = receive(length);
  28701. if (n >= 1 << length - 1) {
  28702. return n;
  28703. }
  28704. return n + (-1 << length) + 1;
  28705. }
  28706. function decodeBaseline(component, blockOffset) {
  28707. const t = decodeHuffman(component.huffmanTableDC);
  28708. const diff = t === 0 ? 0 : receiveAndExtend(t);
  28709. component.blockData[blockOffset] = component.pred += diff;
  28710. let k = 1;
  28711. while (k < 64) {
  28712. const rs = decodeHuffman(component.huffmanTableAC);
  28713. const s = rs & 15,
  28714. r = rs >> 4;
  28715. if (s === 0) {
  28716. if (r < 15) {
  28717. break;
  28718. }
  28719. k += 16;
  28720. continue;
  28721. }
  28722. k += r;
  28723. const z = dctZigZag[k];
  28724. component.blockData[blockOffset + z] = receiveAndExtend(s);
  28725. k++;
  28726. }
  28727. }
  28728. function decodeDCFirst(component, blockOffset) {
  28729. const t = decodeHuffman(component.huffmanTableDC);
  28730. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  28731. component.blockData[blockOffset] = component.pred += diff;
  28732. }
  28733. function decodeDCSuccessive(component, blockOffset) {
  28734. component.blockData[blockOffset] |= readBit() << successive;
  28735. }
  28736. let eobrun = 0;
  28737. function decodeACFirst(component, blockOffset) {
  28738. if (eobrun > 0) {
  28739. eobrun--;
  28740. return;
  28741. }
  28742. let k = spectralStart;
  28743. const e = spectralEnd;
  28744. while (k <= e) {
  28745. const rs = decodeHuffman(component.huffmanTableAC);
  28746. const s = rs & 15,
  28747. r = rs >> 4;
  28748. if (s === 0) {
  28749. if (r < 15) {
  28750. eobrun = receive(r) + (1 << r) - 1;
  28751. break;
  28752. }
  28753. k += 16;
  28754. continue;
  28755. }
  28756. k += r;
  28757. const z = dctZigZag[k];
  28758. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  28759. k++;
  28760. }
  28761. }
  28762. let successiveACState = 0,
  28763. successiveACNextValue;
  28764. function decodeACSuccessive(component, blockOffset) {
  28765. let k = spectralStart;
  28766. const e = spectralEnd;
  28767. let r = 0;
  28768. let s;
  28769. let rs;
  28770. while (k <= e) {
  28771. const offsetZ = blockOffset + dctZigZag[k];
  28772. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  28773. switch (successiveACState) {
  28774. case 0:
  28775. rs = decodeHuffman(component.huffmanTableAC);
  28776. s = rs & 15;
  28777. r = rs >> 4;
  28778. if (s === 0) {
  28779. if (r < 15) {
  28780. eobrun = receive(r) + (1 << r);
  28781. successiveACState = 4;
  28782. } else {
  28783. r = 16;
  28784. successiveACState = 1;
  28785. }
  28786. } else {
  28787. if (s !== 1) {
  28788. throw new JpegError("invalid ACn encoding");
  28789. }
  28790. successiveACNextValue = receiveAndExtend(s);
  28791. successiveACState = r ? 2 : 3;
  28792. }
  28793. continue;
  28794. case 1:
  28795. case 2:
  28796. if (component.blockData[offsetZ]) {
  28797. component.blockData[offsetZ] += sign * (readBit() << successive);
  28798. } else {
  28799. r--;
  28800. if (r === 0) {
  28801. successiveACState = successiveACState === 2 ? 3 : 0;
  28802. }
  28803. }
  28804. break;
  28805. case 3:
  28806. if (component.blockData[offsetZ]) {
  28807. component.blockData[offsetZ] += sign * (readBit() << successive);
  28808. } else {
  28809. component.blockData[offsetZ] = successiveACNextValue << successive;
  28810. successiveACState = 0;
  28811. }
  28812. break;
  28813. case 4:
  28814. if (component.blockData[offsetZ]) {
  28815. component.blockData[offsetZ] += sign * (readBit() << successive);
  28816. }
  28817. break;
  28818. }
  28819. k++;
  28820. }
  28821. if (successiveACState === 4) {
  28822. eobrun--;
  28823. if (eobrun === 0) {
  28824. successiveACState = 0;
  28825. }
  28826. }
  28827. }
  28828. let blockRow = 0;
  28829. function decodeMcu(component, decode, mcu, row, col) {
  28830. const mcuRow = mcu / mcusPerLine | 0;
  28831. const mcuCol = mcu % mcusPerLine;
  28832. blockRow = mcuRow * component.v + row;
  28833. const blockCol = mcuCol * component.h + col;
  28834. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  28835. decode(component, blockOffset);
  28836. }
  28837. function decodeBlock(component, decode, mcu) {
  28838. blockRow = mcu / component.blocksPerLine | 0;
  28839. const blockCol = mcu % component.blocksPerLine;
  28840. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  28841. decode(component, blockOffset);
  28842. }
  28843. const componentsLength = components.length;
  28844. let component, i, j, k, n;
  28845. let decodeFn;
  28846. if (progressive) {
  28847. if (spectralStart === 0) {
  28848. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  28849. } else {
  28850. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  28851. }
  28852. } else {
  28853. decodeFn = decodeBaseline;
  28854. }
  28855. let mcu = 0,
  28856. fileMarker;
  28857. let mcuExpected;
  28858. if (componentsLength === 1) {
  28859. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  28860. } else {
  28861. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  28862. }
  28863. let h, v;
  28864. while (mcu <= mcuExpected) {
  28865. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  28866. if (mcuToRead > 0) {
  28867. for (i = 0; i < componentsLength; i++) {
  28868. components[i].pred = 0;
  28869. }
  28870. eobrun = 0;
  28871. if (componentsLength === 1) {
  28872. component = components[0];
  28873. for (n = 0; n < mcuToRead; n++) {
  28874. decodeBlock(component, decodeFn, mcu);
  28875. mcu++;
  28876. }
  28877. } else {
  28878. for (n = 0; n < mcuToRead; n++) {
  28879. for (i = 0; i < componentsLength; i++) {
  28880. component = components[i];
  28881. h = component.h;
  28882. v = component.v;
  28883. for (j = 0; j < v; j++) {
  28884. for (k = 0; k < h; k++) {
  28885. decodeMcu(component, decodeFn, mcu, j, k);
  28886. }
  28887. }
  28888. }
  28889. mcu++;
  28890. }
  28891. }
  28892. }
  28893. bitsCount = 0;
  28894. fileMarker = findNextFileMarker(data, offset);
  28895. if (!fileMarker) {
  28896. break;
  28897. }
  28898. if (fileMarker.invalid) {
  28899. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  28900. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  28901. offset = fileMarker.offset;
  28902. }
  28903. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  28904. offset += 2;
  28905. } else {
  28906. break;
  28907. }
  28908. }
  28909. return offset - startOffset;
  28910. }
  28911. function quantizeAndInverse(component, blockBufferOffset, p) {
  28912. const qt = component.quantizationTable,
  28913. blockData = component.blockData;
  28914. let v0, v1, v2, v3, v4, v5, v6, v7;
  28915. let p0, p1, p2, p3, p4, p5, p6, p7;
  28916. let t;
  28917. if (!qt) {
  28918. throw new JpegError("missing required Quantization Table.");
  28919. }
  28920. for (let row = 0; row < 64; row += 8) {
  28921. p0 = blockData[blockBufferOffset + row];
  28922. p1 = blockData[blockBufferOffset + row + 1];
  28923. p2 = blockData[blockBufferOffset + row + 2];
  28924. p3 = blockData[blockBufferOffset + row + 3];
  28925. p4 = blockData[blockBufferOffset + row + 4];
  28926. p5 = blockData[blockBufferOffset + row + 5];
  28927. p6 = blockData[blockBufferOffset + row + 6];
  28928. p7 = blockData[blockBufferOffset + row + 7];
  28929. p0 *= qt[row];
  28930. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  28931. t = dctSqrt2 * p0 + 512 >> 10;
  28932. p[row] = t;
  28933. p[row + 1] = t;
  28934. p[row + 2] = t;
  28935. p[row + 3] = t;
  28936. p[row + 4] = t;
  28937. p[row + 5] = t;
  28938. p[row + 6] = t;
  28939. p[row + 7] = t;
  28940. continue;
  28941. }
  28942. p1 *= qt[row + 1];
  28943. p2 *= qt[row + 2];
  28944. p3 *= qt[row + 3];
  28945. p4 *= qt[row + 4];
  28946. p5 *= qt[row + 5];
  28947. p6 *= qt[row + 6];
  28948. p7 *= qt[row + 7];
  28949. v0 = dctSqrt2 * p0 + 128 >> 8;
  28950. v1 = dctSqrt2 * p4 + 128 >> 8;
  28951. v2 = p2;
  28952. v3 = p6;
  28953. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  28954. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  28955. v5 = p3 << 4;
  28956. v6 = p5 << 4;
  28957. v0 = v0 + v1 + 1 >> 1;
  28958. v1 = v0 - v1;
  28959. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  28960. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  28961. v3 = t;
  28962. v4 = v4 + v6 + 1 >> 1;
  28963. v6 = v4 - v6;
  28964. v7 = v7 + v5 + 1 >> 1;
  28965. v5 = v7 - v5;
  28966. v0 = v0 + v3 + 1 >> 1;
  28967. v3 = v0 - v3;
  28968. v1 = v1 + v2 + 1 >> 1;
  28969. v2 = v1 - v2;
  28970. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  28971. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  28972. v7 = t;
  28973. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  28974. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  28975. v6 = t;
  28976. p[row] = v0 + v7;
  28977. p[row + 7] = v0 - v7;
  28978. p[row + 1] = v1 + v6;
  28979. p[row + 6] = v1 - v6;
  28980. p[row + 2] = v2 + v5;
  28981. p[row + 5] = v2 - v5;
  28982. p[row + 3] = v3 + v4;
  28983. p[row + 4] = v3 - v4;
  28984. }
  28985. for (let col = 0; col < 8; ++col) {
  28986. p0 = p[col];
  28987. p1 = p[col + 8];
  28988. p2 = p[col + 16];
  28989. p3 = p[col + 24];
  28990. p4 = p[col + 32];
  28991. p5 = p[col + 40];
  28992. p6 = p[col + 48];
  28993. p7 = p[col + 56];
  28994. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  28995. t = dctSqrt2 * p0 + 8192 >> 14;
  28996. if (t < -2040) {
  28997. t = 0;
  28998. } else if (t >= 2024) {
  28999. t = 255;
  29000. } else {
  29001. t = t + 2056 >> 4;
  29002. }
  29003. blockData[blockBufferOffset + col] = t;
  29004. blockData[blockBufferOffset + col + 8] = t;
  29005. blockData[blockBufferOffset + col + 16] = t;
  29006. blockData[blockBufferOffset + col + 24] = t;
  29007. blockData[blockBufferOffset + col + 32] = t;
  29008. blockData[blockBufferOffset + col + 40] = t;
  29009. blockData[blockBufferOffset + col + 48] = t;
  29010. blockData[blockBufferOffset + col + 56] = t;
  29011. continue;
  29012. }
  29013. v0 = dctSqrt2 * p0 + 2048 >> 12;
  29014. v1 = dctSqrt2 * p4 + 2048 >> 12;
  29015. v2 = p2;
  29016. v3 = p6;
  29017. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  29018. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  29019. v5 = p3;
  29020. v6 = p5;
  29021. v0 = (v0 + v1 + 1 >> 1) + 4112;
  29022. v1 = v0 - v1;
  29023. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  29024. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  29025. v3 = t;
  29026. v4 = v4 + v6 + 1 >> 1;
  29027. v6 = v4 - v6;
  29028. v7 = v7 + v5 + 1 >> 1;
  29029. v5 = v7 - v5;
  29030. v0 = v0 + v3 + 1 >> 1;
  29031. v3 = v0 - v3;
  29032. v1 = v1 + v2 + 1 >> 1;
  29033. v2 = v1 - v2;
  29034. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  29035. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  29036. v7 = t;
  29037. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  29038. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  29039. v6 = t;
  29040. p0 = v0 + v7;
  29041. p7 = v0 - v7;
  29042. p1 = v1 + v6;
  29043. p6 = v1 - v6;
  29044. p2 = v2 + v5;
  29045. p5 = v2 - v5;
  29046. p3 = v3 + v4;
  29047. p4 = v3 - v4;
  29048. if (p0 < 16) {
  29049. p0 = 0;
  29050. } else if (p0 >= 4080) {
  29051. p0 = 255;
  29052. } else {
  29053. p0 >>= 4;
  29054. }
  29055. if (p1 < 16) {
  29056. p1 = 0;
  29057. } else if (p1 >= 4080) {
  29058. p1 = 255;
  29059. } else {
  29060. p1 >>= 4;
  29061. }
  29062. if (p2 < 16) {
  29063. p2 = 0;
  29064. } else if (p2 >= 4080) {
  29065. p2 = 255;
  29066. } else {
  29067. p2 >>= 4;
  29068. }
  29069. if (p3 < 16) {
  29070. p3 = 0;
  29071. } else if (p3 >= 4080) {
  29072. p3 = 255;
  29073. } else {
  29074. p3 >>= 4;
  29075. }
  29076. if (p4 < 16) {
  29077. p4 = 0;
  29078. } else if (p4 >= 4080) {
  29079. p4 = 255;
  29080. } else {
  29081. p4 >>= 4;
  29082. }
  29083. if (p5 < 16) {
  29084. p5 = 0;
  29085. } else if (p5 >= 4080) {
  29086. p5 = 255;
  29087. } else {
  29088. p5 >>= 4;
  29089. }
  29090. if (p6 < 16) {
  29091. p6 = 0;
  29092. } else if (p6 >= 4080) {
  29093. p6 = 255;
  29094. } else {
  29095. p6 >>= 4;
  29096. }
  29097. if (p7 < 16) {
  29098. p7 = 0;
  29099. } else if (p7 >= 4080) {
  29100. p7 = 255;
  29101. } else {
  29102. p7 >>= 4;
  29103. }
  29104. blockData[blockBufferOffset + col] = p0;
  29105. blockData[blockBufferOffset + col + 8] = p1;
  29106. blockData[blockBufferOffset + col + 16] = p2;
  29107. blockData[blockBufferOffset + col + 24] = p3;
  29108. blockData[blockBufferOffset + col + 32] = p4;
  29109. blockData[blockBufferOffset + col + 40] = p5;
  29110. blockData[blockBufferOffset + col + 48] = p6;
  29111. blockData[blockBufferOffset + col + 56] = p7;
  29112. }
  29113. }
  29114. function buildComponentData(frame, component) {
  29115. const blocksPerLine = component.blocksPerLine;
  29116. const blocksPerColumn = component.blocksPerColumn;
  29117. const computationBuffer = new Int16Array(64);
  29118. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  29119. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  29120. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  29121. quantizeAndInverse(component, offset, computationBuffer);
  29122. }
  29123. }
  29124. return component.blockData;
  29125. }
  29126. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  29127. const maxPos = data.length - 1;
  29128. let newPos = startPos < currentPos ? startPos : currentPos;
  29129. if (currentPos >= maxPos) {
  29130. return null;
  29131. }
  29132. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  29133. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  29134. return {
  29135. invalid: null,
  29136. marker: currentMarker,
  29137. offset: currentPos
  29138. };
  29139. }
  29140. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  29141. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  29142. if (++newPos >= maxPos) {
  29143. return null;
  29144. }
  29145. newMarker = (0, _core_utils.readUint16)(data, newPos);
  29146. }
  29147. return {
  29148. invalid: currentMarker.toString(16),
  29149. marker: newMarker,
  29150. offset: newPos
  29151. };
  29152. }
  29153. class JpegImage {
  29154. constructor({
  29155. decodeTransform = null,
  29156. colorTransform = -1
  29157. } = {}) {
  29158. this._decodeTransform = decodeTransform;
  29159. this._colorTransform = colorTransform;
  29160. }
  29161. parse(data, {
  29162. dnlScanLines = null
  29163. } = {}) {
  29164. function readDataBlock() {
  29165. const length = (0, _core_utils.readUint16)(data, offset);
  29166. offset += 2;
  29167. let endOffset = offset + length - 2;
  29168. const fileMarker = findNextFileMarker(data, endOffset, offset);
  29169. if (fileMarker && fileMarker.invalid) {
  29170. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  29171. endOffset = fileMarker.offset;
  29172. }
  29173. const array = data.subarray(offset, endOffset);
  29174. offset += array.length;
  29175. return array;
  29176. }
  29177. function prepareComponents(frame) {
  29178. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  29179. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  29180. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29181. const component = frame.components[i];
  29182. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  29183. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  29184. const blocksPerLineForMcu = mcusPerLine * component.h;
  29185. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  29186. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  29187. component.blockData = new Int16Array(blocksBufferSize);
  29188. component.blocksPerLine = blocksPerLine;
  29189. component.blocksPerColumn = blocksPerColumn;
  29190. }
  29191. frame.mcusPerLine = mcusPerLine;
  29192. frame.mcusPerColumn = mcusPerColumn;
  29193. }
  29194. let offset = 0;
  29195. let jfif = null;
  29196. let adobe = null;
  29197. let frame, resetInterval;
  29198. let numSOSMarkers = 0;
  29199. const quantizationTables = [];
  29200. const huffmanTablesAC = [],
  29201. huffmanTablesDC = [];
  29202. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  29203. offset += 2;
  29204. if (fileMarker !== 0xffd8) {
  29205. throw new JpegError("SOI not found");
  29206. }
  29207. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29208. offset += 2;
  29209. markerLoop: while (fileMarker !== 0xffd9) {
  29210. let i, j, l;
  29211. switch (fileMarker) {
  29212. case 0xffe0:
  29213. case 0xffe1:
  29214. case 0xffe2:
  29215. case 0xffe3:
  29216. case 0xffe4:
  29217. case 0xffe5:
  29218. case 0xffe6:
  29219. case 0xffe7:
  29220. case 0xffe8:
  29221. case 0xffe9:
  29222. case 0xffea:
  29223. case 0xffeb:
  29224. case 0xffec:
  29225. case 0xffed:
  29226. case 0xffee:
  29227. case 0xffef:
  29228. case 0xfffe:
  29229. const appData = readDataBlock();
  29230. if (fileMarker === 0xffe0) {
  29231. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  29232. jfif = {
  29233. version: {
  29234. major: appData[5],
  29235. minor: appData[6]
  29236. },
  29237. densityUnits: appData[7],
  29238. xDensity: appData[8] << 8 | appData[9],
  29239. yDensity: appData[10] << 8 | appData[11],
  29240. thumbWidth: appData[12],
  29241. thumbHeight: appData[13],
  29242. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  29243. };
  29244. }
  29245. }
  29246. if (fileMarker === 0xffee) {
  29247. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  29248. adobe = {
  29249. version: appData[5] << 8 | appData[6],
  29250. flags0: appData[7] << 8 | appData[8],
  29251. flags1: appData[9] << 8 | appData[10],
  29252. transformCode: appData[11]
  29253. };
  29254. }
  29255. }
  29256. break;
  29257. case 0xffdb:
  29258. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  29259. offset += 2;
  29260. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  29261. let z;
  29262. while (offset < quantizationTablesEnd) {
  29263. const quantizationTableSpec = data[offset++];
  29264. const tableData = new Uint16Array(64);
  29265. if (quantizationTableSpec >> 4 === 0) {
  29266. for (j = 0; j < 64; j++) {
  29267. z = dctZigZag[j];
  29268. tableData[z] = data[offset++];
  29269. }
  29270. } else if (quantizationTableSpec >> 4 === 1) {
  29271. for (j = 0; j < 64; j++) {
  29272. z = dctZigZag[j];
  29273. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  29274. offset += 2;
  29275. }
  29276. } else {
  29277. throw new JpegError("DQT - invalid table spec");
  29278. }
  29279. quantizationTables[quantizationTableSpec & 15] = tableData;
  29280. }
  29281. break;
  29282. case 0xffc0:
  29283. case 0xffc1:
  29284. case 0xffc2:
  29285. if (frame) {
  29286. throw new JpegError("Only single frame JPEGs supported");
  29287. }
  29288. offset += 2;
  29289. frame = {};
  29290. frame.extended = fileMarker === 0xffc1;
  29291. frame.progressive = fileMarker === 0xffc2;
  29292. frame.precision = data[offset++];
  29293. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  29294. offset += 2;
  29295. frame.scanLines = dnlScanLines || sofScanLines;
  29296. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  29297. offset += 2;
  29298. frame.components = [];
  29299. frame.componentIds = {};
  29300. const componentsCount = data[offset++];
  29301. let maxH = 0,
  29302. maxV = 0;
  29303. for (i = 0; i < componentsCount; i++) {
  29304. const componentId = data[offset];
  29305. const h = data[offset + 1] >> 4;
  29306. const v = data[offset + 1] & 15;
  29307. if (maxH < h) {
  29308. maxH = h;
  29309. }
  29310. if (maxV < v) {
  29311. maxV = v;
  29312. }
  29313. const qId = data[offset + 2];
  29314. l = frame.components.push({
  29315. h,
  29316. v,
  29317. quantizationId: qId,
  29318. quantizationTable: null
  29319. });
  29320. frame.componentIds[componentId] = l - 1;
  29321. offset += 3;
  29322. }
  29323. frame.maxH = maxH;
  29324. frame.maxV = maxV;
  29325. prepareComponents(frame);
  29326. break;
  29327. case 0xffc4:
  29328. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  29329. offset += 2;
  29330. for (i = 2; i < huffmanLength;) {
  29331. const huffmanTableSpec = data[offset++];
  29332. const codeLengths = new Uint8Array(16);
  29333. let codeLengthSum = 0;
  29334. for (j = 0; j < 16; j++, offset++) {
  29335. codeLengthSum += codeLengths[j] = data[offset];
  29336. }
  29337. const huffmanValues = new Uint8Array(codeLengthSum);
  29338. for (j = 0; j < codeLengthSum; j++, offset++) {
  29339. huffmanValues[j] = data[offset];
  29340. }
  29341. i += 17 + codeLengthSum;
  29342. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  29343. }
  29344. break;
  29345. case 0xffdd:
  29346. offset += 2;
  29347. resetInterval = (0, _core_utils.readUint16)(data, offset);
  29348. offset += 2;
  29349. break;
  29350. case 0xffda:
  29351. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  29352. offset += 2;
  29353. const selectorsCount = data[offset++],
  29354. components = [];
  29355. for (i = 0; i < selectorsCount; i++) {
  29356. const index = data[offset++];
  29357. const componentIndex = frame.componentIds[index];
  29358. const component = frame.components[componentIndex];
  29359. component.index = index;
  29360. const tableSpec = data[offset++];
  29361. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  29362. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  29363. components.push(component);
  29364. }
  29365. const spectralStart = data[offset++],
  29366. spectralEnd = data[offset++],
  29367. successiveApproximation = data[offset++];
  29368. try {
  29369. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  29370. offset += processed;
  29371. } catch (ex) {
  29372. if (ex instanceof DNLMarkerError) {
  29373. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  29374. return this.parse(data, {
  29375. dnlScanLines: ex.scanLines
  29376. });
  29377. } else if (ex instanceof EOIMarkerError) {
  29378. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  29379. break markerLoop;
  29380. }
  29381. throw ex;
  29382. }
  29383. break;
  29384. case 0xffdc:
  29385. offset += 4;
  29386. break;
  29387. case 0xffff:
  29388. if (data[offset] !== 0xff) {
  29389. offset--;
  29390. }
  29391. break;
  29392. default:
  29393. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  29394. if (nextFileMarker && nextFileMarker.invalid) {
  29395. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  29396. offset = nextFileMarker.offset;
  29397. break;
  29398. }
  29399. if (!nextFileMarker || offset >= data.length - 1) {
  29400. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  29401. break markerLoop;
  29402. }
  29403. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  29404. }
  29405. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29406. offset += 2;
  29407. }
  29408. this.width = frame.samplesPerLine;
  29409. this.height = frame.scanLines;
  29410. this.jfif = jfif;
  29411. this.adobe = adobe;
  29412. this.components = [];
  29413. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29414. const component = frame.components[i];
  29415. const quantizationTable = quantizationTables[component.quantizationId];
  29416. if (quantizationTable) {
  29417. component.quantizationTable = quantizationTable;
  29418. }
  29419. this.components.push({
  29420. index: component.index,
  29421. output: buildComponentData(frame, component),
  29422. scaleX: component.h / frame.maxH,
  29423. scaleY: component.v / frame.maxV,
  29424. blocksPerLine: component.blocksPerLine,
  29425. blocksPerColumn: component.blocksPerColumn
  29426. });
  29427. }
  29428. this.numComponents = this.components.length;
  29429. return undefined;
  29430. }
  29431. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  29432. const scaleX = this.width / width,
  29433. scaleY = this.height / height;
  29434. let component, componentScaleX, componentScaleY, blocksPerScanline;
  29435. let x, y, i, j, k;
  29436. let index;
  29437. let offset = 0;
  29438. let output;
  29439. const numComponents = this.components.length;
  29440. const dataLength = width * height * numComponents;
  29441. const data = new Uint8ClampedArray(dataLength);
  29442. const xScaleBlockOffset = new Uint32Array(width);
  29443. const mask3LSB = 0xfffffff8;
  29444. let lastComponentScaleX;
  29445. for (i = 0; i < numComponents; i++) {
  29446. component = this.components[i];
  29447. componentScaleX = component.scaleX * scaleX;
  29448. componentScaleY = component.scaleY * scaleY;
  29449. offset = i;
  29450. output = component.output;
  29451. blocksPerScanline = component.blocksPerLine + 1 << 3;
  29452. if (componentScaleX !== lastComponentScaleX) {
  29453. for (x = 0; x < width; x++) {
  29454. j = 0 | x * componentScaleX;
  29455. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  29456. }
  29457. lastComponentScaleX = componentScaleX;
  29458. }
  29459. for (y = 0; y < height; y++) {
  29460. j = 0 | y * componentScaleY;
  29461. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  29462. for (x = 0; x < width; x++) {
  29463. data[offset] = output[index + xScaleBlockOffset[x]];
  29464. offset += numComponents;
  29465. }
  29466. }
  29467. }
  29468. let transform = this._decodeTransform;
  29469. if (!isSourcePDF && numComponents === 4 && !transform) {
  29470. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  29471. }
  29472. if (transform) {
  29473. for (i = 0; i < dataLength;) {
  29474. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  29475. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  29476. }
  29477. }
  29478. }
  29479. return data;
  29480. }
  29481. get _isColorConversionNeeded() {
  29482. if (this.adobe) {
  29483. return !!this.adobe.transformCode;
  29484. }
  29485. if (this.numComponents === 3) {
  29486. if (this._colorTransform === 0) {
  29487. return false;
  29488. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  29489. return false;
  29490. }
  29491. return true;
  29492. }
  29493. if (this._colorTransform === 1) {
  29494. return true;
  29495. }
  29496. return false;
  29497. }
  29498. _convertYccToRgb(data) {
  29499. let Y, Cb, Cr;
  29500. for (let i = 0, length = data.length; i < length; i += 3) {
  29501. Y = data[i];
  29502. Cb = data[i + 1];
  29503. Cr = data[i + 2];
  29504. data[i] = Y - 179.456 + 1.402 * Cr;
  29505. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  29506. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  29507. }
  29508. return data;
  29509. }
  29510. _convertYcckToRgb(data) {
  29511. let Y, Cb, Cr, k;
  29512. let offset = 0;
  29513. for (let i = 0, length = data.length; i < length; i += 4) {
  29514. Y = data[i];
  29515. Cb = data[i + 1];
  29516. Cr = data[i + 2];
  29517. k = data[i + 3];
  29518. 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);
  29519. 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);
  29520. 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);
  29521. }
  29522. return data.subarray(0, offset);
  29523. }
  29524. _convertYcckToCmyk(data) {
  29525. let Y, Cb, Cr;
  29526. for (let i = 0, length = data.length; i < length; i += 4) {
  29527. Y = data[i];
  29528. Cb = data[i + 1];
  29529. Cr = data[i + 2];
  29530. data[i] = 434.456 - Y - 1.402 * Cr;
  29531. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  29532. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  29533. }
  29534. return data;
  29535. }
  29536. _convertCmykToRgb(data) {
  29537. let c, m, y, k;
  29538. let offset = 0;
  29539. for (let i = 0, length = data.length; i < length; i += 4) {
  29540. c = data[i];
  29541. m = data[i + 1];
  29542. y = data[i + 2];
  29543. k = data[i + 3];
  29544. 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);
  29545. 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);
  29546. 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);
  29547. }
  29548. return data.subarray(0, offset);
  29549. }
  29550. getData({
  29551. width,
  29552. height,
  29553. forceRGB = false,
  29554. isSourcePDF = false
  29555. }) {
  29556. if (this.numComponents > 4) {
  29557. throw new JpegError("Unsupported color mode");
  29558. }
  29559. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  29560. if (this.numComponents === 1 && forceRGB) {
  29561. const dataLength = data.length;
  29562. const rgbData = new Uint8ClampedArray(dataLength * 3);
  29563. let offset = 0;
  29564. for (let i = 0; i < dataLength; i++) {
  29565. const grayColor = data[i];
  29566. rgbData[offset++] = grayColor;
  29567. rgbData[offset++] = grayColor;
  29568. rgbData[offset++] = grayColor;
  29569. }
  29570. return rgbData;
  29571. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  29572. return this._convertYccToRgb(data);
  29573. } else if (this.numComponents === 4) {
  29574. if (this._isColorConversionNeeded) {
  29575. if (forceRGB) {
  29576. return this._convertYcckToRgb(data);
  29577. }
  29578. return this._convertYcckToCmyk(data);
  29579. } else if (forceRGB) {
  29580. return this._convertCmykToRgb(data);
  29581. }
  29582. }
  29583. return data;
  29584. }
  29585. }
  29586. exports.JpegImage = JpegImage;
  29587. /***/ }),
  29588. /* 39 */
  29589. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29590. Object.defineProperty(exports, "__esModule", ({
  29591. value: true
  29592. }));
  29593. exports.JpxStream = void 0;
  29594. var _decode_stream = __w_pdfjs_require__(29);
  29595. var _jpx = __w_pdfjs_require__(40);
  29596. var _util = __w_pdfjs_require__(2);
  29597. class JpxStream extends _decode_stream.DecodeStream {
  29598. constructor(stream, maybeLength, params) {
  29599. super(maybeLength);
  29600. this.stream = stream;
  29601. this.dict = stream.dict;
  29602. this.maybeLength = maybeLength;
  29603. this.params = params;
  29604. }
  29605. get bytes() {
  29606. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  29607. }
  29608. ensureBuffer(requested) {}
  29609. readBlock() {
  29610. if (this.eof) {
  29611. return;
  29612. }
  29613. const jpxImage = new _jpx.JpxImage();
  29614. jpxImage.parse(this.bytes);
  29615. const width = jpxImage.width;
  29616. const height = jpxImage.height;
  29617. const componentsCount = jpxImage.componentsCount;
  29618. const tileCount = jpxImage.tiles.length;
  29619. if (tileCount === 1) {
  29620. this.buffer = jpxImage.tiles[0].items;
  29621. } else {
  29622. const data = new Uint8ClampedArray(width * height * componentsCount);
  29623. for (let k = 0; k < tileCount; k++) {
  29624. const tileComponents = jpxImage.tiles[k];
  29625. const tileWidth = tileComponents.width;
  29626. const tileHeight = tileComponents.height;
  29627. const tileLeft = tileComponents.left;
  29628. const tileTop = tileComponents.top;
  29629. const src = tileComponents.items;
  29630. let srcPosition = 0;
  29631. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  29632. const imgRowSize = width * componentsCount;
  29633. const tileRowSize = tileWidth * componentsCount;
  29634. for (let j = 0; j < tileHeight; j++) {
  29635. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  29636. data.set(rowBytes, dataPosition);
  29637. srcPosition += tileRowSize;
  29638. dataPosition += imgRowSize;
  29639. }
  29640. }
  29641. this.buffer = data;
  29642. }
  29643. this.bufferLength = this.buffer.length;
  29644. this.eof = true;
  29645. }
  29646. }
  29647. exports.JpxStream = JpxStream;
  29648. /***/ }),
  29649. /* 40 */
  29650. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29651. Object.defineProperty(exports, "__esModule", ({
  29652. value: true
  29653. }));
  29654. exports.JpxImage = void 0;
  29655. var _util = __w_pdfjs_require__(2);
  29656. var _core_utils = __w_pdfjs_require__(9);
  29657. var _arithmetic_decoder = __w_pdfjs_require__(36);
  29658. class JpxError extends _util.BaseException {
  29659. constructor(msg) {
  29660. super(`JPX error: ${msg}`, "JpxError");
  29661. }
  29662. }
  29663. const SubbandsGainLog2 = {
  29664. LL: 0,
  29665. LH: 1,
  29666. HL: 1,
  29667. HH: 2
  29668. };
  29669. class JpxImage {
  29670. constructor() {
  29671. this.failOnCorruptedImage = false;
  29672. }
  29673. parse(data) {
  29674. const head = (0, _core_utils.readUint16)(data, 0);
  29675. if (head === 0xff4f) {
  29676. this.parseCodestream(data, 0, data.length);
  29677. return;
  29678. }
  29679. const length = data.length;
  29680. let position = 0;
  29681. while (position < length) {
  29682. let headerSize = 8;
  29683. let lbox = (0, _core_utils.readUint32)(data, position);
  29684. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  29685. position += headerSize;
  29686. if (lbox === 1) {
  29687. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  29688. position += 8;
  29689. headerSize += 8;
  29690. }
  29691. if (lbox === 0) {
  29692. lbox = length - position + headerSize;
  29693. }
  29694. if (lbox < headerSize) {
  29695. throw new JpxError("Invalid box field size");
  29696. }
  29697. const dataLength = lbox - headerSize;
  29698. let jumpDataLength = true;
  29699. switch (tbox) {
  29700. case 0x6a703268:
  29701. jumpDataLength = false;
  29702. break;
  29703. case 0x636f6c72:
  29704. const method = data[position];
  29705. if (method === 1) {
  29706. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  29707. switch (colorspace) {
  29708. case 16:
  29709. case 17:
  29710. case 18:
  29711. break;
  29712. default:
  29713. (0, _util.warn)("Unknown colorspace " + colorspace);
  29714. break;
  29715. }
  29716. } else if (method === 2) {
  29717. (0, _util.info)("ICC profile not supported");
  29718. }
  29719. break;
  29720. case 0x6a703263:
  29721. this.parseCodestream(data, position, position + dataLength);
  29722. break;
  29723. case 0x6a502020:
  29724. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  29725. (0, _util.warn)("Invalid JP2 signature");
  29726. }
  29727. break;
  29728. case 0x6a501a1a:
  29729. case 0x66747970:
  29730. case 0x72726571:
  29731. case 0x72657320:
  29732. case 0x69686472:
  29733. break;
  29734. default:
  29735. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  29736. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  29737. break;
  29738. }
  29739. if (jumpDataLength) {
  29740. position += dataLength;
  29741. }
  29742. }
  29743. }
  29744. parseImageProperties(stream) {
  29745. let newByte = stream.getByte();
  29746. while (newByte >= 0) {
  29747. const oldByte = newByte;
  29748. newByte = stream.getByte();
  29749. const code = oldByte << 8 | newByte;
  29750. if (code === 0xff51) {
  29751. stream.skip(4);
  29752. const Xsiz = stream.getInt32() >>> 0;
  29753. const Ysiz = stream.getInt32() >>> 0;
  29754. const XOsiz = stream.getInt32() >>> 0;
  29755. const YOsiz = stream.getInt32() >>> 0;
  29756. stream.skip(16);
  29757. const Csiz = stream.getUint16();
  29758. this.width = Xsiz - XOsiz;
  29759. this.height = Ysiz - YOsiz;
  29760. this.componentsCount = Csiz;
  29761. this.bitsPerComponent = 8;
  29762. return;
  29763. }
  29764. }
  29765. throw new JpxError("No size marker found in JPX stream");
  29766. }
  29767. parseCodestream(data, start, end) {
  29768. const context = {};
  29769. let doNotRecover = false;
  29770. try {
  29771. let position = start;
  29772. while (position + 1 < end) {
  29773. const code = (0, _core_utils.readUint16)(data, position);
  29774. position += 2;
  29775. let length = 0,
  29776. j,
  29777. sqcd,
  29778. spqcds,
  29779. spqcdSize,
  29780. scalarExpounded,
  29781. tile;
  29782. switch (code) {
  29783. case 0xff4f:
  29784. context.mainHeader = true;
  29785. break;
  29786. case 0xffd9:
  29787. break;
  29788. case 0xff51:
  29789. length = (0, _core_utils.readUint16)(data, position);
  29790. const siz = {};
  29791. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  29792. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  29793. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  29794. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  29795. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  29796. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  29797. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  29798. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  29799. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  29800. siz.Csiz = componentsCount;
  29801. const components = [];
  29802. j = position + 38;
  29803. for (let i = 0; i < componentsCount; i++) {
  29804. const component = {
  29805. precision: (data[j] & 0x7f) + 1,
  29806. isSigned: !!(data[j] & 0x80),
  29807. XRsiz: data[j + 1],
  29808. YRsiz: data[j + 2]
  29809. };
  29810. j += 3;
  29811. calculateComponentDimensions(component, siz);
  29812. components.push(component);
  29813. }
  29814. context.SIZ = siz;
  29815. context.components = components;
  29816. calculateTileGrids(context, components);
  29817. context.QCC = [];
  29818. context.COC = [];
  29819. break;
  29820. case 0xff5c:
  29821. length = (0, _core_utils.readUint16)(data, position);
  29822. const qcd = {};
  29823. j = position + 2;
  29824. sqcd = data[j++];
  29825. switch (sqcd & 0x1f) {
  29826. case 0:
  29827. spqcdSize = 8;
  29828. scalarExpounded = true;
  29829. break;
  29830. case 1:
  29831. spqcdSize = 16;
  29832. scalarExpounded = false;
  29833. break;
  29834. case 2:
  29835. spqcdSize = 16;
  29836. scalarExpounded = true;
  29837. break;
  29838. default:
  29839. throw new Error("Invalid SQcd value " + sqcd);
  29840. }
  29841. qcd.noQuantization = spqcdSize === 8;
  29842. qcd.scalarExpounded = scalarExpounded;
  29843. qcd.guardBits = sqcd >> 5;
  29844. spqcds = [];
  29845. while (j < length + position) {
  29846. const spqcd = {};
  29847. if (spqcdSize === 8) {
  29848. spqcd.epsilon = data[j++] >> 3;
  29849. spqcd.mu = 0;
  29850. } else {
  29851. spqcd.epsilon = data[j] >> 3;
  29852. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29853. j += 2;
  29854. }
  29855. spqcds.push(spqcd);
  29856. }
  29857. qcd.SPqcds = spqcds;
  29858. if (context.mainHeader) {
  29859. context.QCD = qcd;
  29860. } else {
  29861. context.currentTile.QCD = qcd;
  29862. context.currentTile.QCC = [];
  29863. }
  29864. break;
  29865. case 0xff5d:
  29866. length = (0, _core_utils.readUint16)(data, position);
  29867. const qcc = {};
  29868. j = position + 2;
  29869. let cqcc;
  29870. if (context.SIZ.Csiz < 257) {
  29871. cqcc = data[j++];
  29872. } else {
  29873. cqcc = (0, _core_utils.readUint16)(data, j);
  29874. j += 2;
  29875. }
  29876. sqcd = data[j++];
  29877. switch (sqcd & 0x1f) {
  29878. case 0:
  29879. spqcdSize = 8;
  29880. scalarExpounded = true;
  29881. break;
  29882. case 1:
  29883. spqcdSize = 16;
  29884. scalarExpounded = false;
  29885. break;
  29886. case 2:
  29887. spqcdSize = 16;
  29888. scalarExpounded = true;
  29889. break;
  29890. default:
  29891. throw new Error("Invalid SQcd value " + sqcd);
  29892. }
  29893. qcc.noQuantization = spqcdSize === 8;
  29894. qcc.scalarExpounded = scalarExpounded;
  29895. qcc.guardBits = sqcd >> 5;
  29896. spqcds = [];
  29897. while (j < length + position) {
  29898. const spqcd = {};
  29899. if (spqcdSize === 8) {
  29900. spqcd.epsilon = data[j++] >> 3;
  29901. spqcd.mu = 0;
  29902. } else {
  29903. spqcd.epsilon = data[j] >> 3;
  29904. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  29905. j += 2;
  29906. }
  29907. spqcds.push(spqcd);
  29908. }
  29909. qcc.SPqcds = spqcds;
  29910. if (context.mainHeader) {
  29911. context.QCC[cqcc] = qcc;
  29912. } else {
  29913. context.currentTile.QCC[cqcc] = qcc;
  29914. }
  29915. break;
  29916. case 0xff52:
  29917. length = (0, _core_utils.readUint16)(data, position);
  29918. const cod = {};
  29919. j = position + 2;
  29920. const scod = data[j++];
  29921. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  29922. cod.sopMarkerUsed = !!(scod & 2);
  29923. cod.ephMarkerUsed = !!(scod & 4);
  29924. cod.progressionOrder = data[j++];
  29925. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  29926. j += 2;
  29927. cod.multipleComponentTransform = data[j++];
  29928. cod.decompositionLevelsCount = data[j++];
  29929. cod.xcb = (data[j++] & 0xf) + 2;
  29930. cod.ycb = (data[j++] & 0xf) + 2;
  29931. const blockStyle = data[j++];
  29932. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  29933. cod.resetContextProbabilities = !!(blockStyle & 2);
  29934. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  29935. cod.verticallyStripe = !!(blockStyle & 8);
  29936. cod.predictableTermination = !!(blockStyle & 16);
  29937. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  29938. cod.reversibleTransformation = data[j++];
  29939. if (cod.entropyCoderWithCustomPrecincts) {
  29940. const precinctsSizes = [];
  29941. while (j < length + position) {
  29942. const precinctsSize = data[j++];
  29943. precinctsSizes.push({
  29944. PPx: precinctsSize & 0xf,
  29945. PPy: precinctsSize >> 4
  29946. });
  29947. }
  29948. cod.precinctsSizes = precinctsSizes;
  29949. }
  29950. const unsupported = [];
  29951. if (cod.selectiveArithmeticCodingBypass) {
  29952. unsupported.push("selectiveArithmeticCodingBypass");
  29953. }
  29954. if (cod.resetContextProbabilities) {
  29955. unsupported.push("resetContextProbabilities");
  29956. }
  29957. if (cod.terminationOnEachCodingPass) {
  29958. unsupported.push("terminationOnEachCodingPass");
  29959. }
  29960. if (cod.verticallyStripe) {
  29961. unsupported.push("verticallyStripe");
  29962. }
  29963. if (cod.predictableTermination) {
  29964. unsupported.push("predictableTermination");
  29965. }
  29966. if (unsupported.length > 0) {
  29967. doNotRecover = true;
  29968. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  29969. }
  29970. if (context.mainHeader) {
  29971. context.COD = cod;
  29972. } else {
  29973. context.currentTile.COD = cod;
  29974. context.currentTile.COC = [];
  29975. }
  29976. break;
  29977. case 0xff90:
  29978. length = (0, _core_utils.readUint16)(data, position);
  29979. tile = {};
  29980. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  29981. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  29982. tile.dataEnd = tile.length + position - 2;
  29983. tile.partIndex = data[position + 8];
  29984. tile.partsCount = data[position + 9];
  29985. context.mainHeader = false;
  29986. if (tile.partIndex === 0) {
  29987. tile.COD = context.COD;
  29988. tile.COC = context.COC.slice(0);
  29989. tile.QCD = context.QCD;
  29990. tile.QCC = context.QCC.slice(0);
  29991. }
  29992. context.currentTile = tile;
  29993. break;
  29994. case 0xff93:
  29995. tile = context.currentTile;
  29996. if (tile.partIndex === 0) {
  29997. initializeTile(context, tile.index);
  29998. buildPackets(context);
  29999. }
  30000. length = tile.dataEnd - position;
  30001. parseTilePackets(context, data, position, length);
  30002. break;
  30003. case 0xff53:
  30004. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  30005. case 0xff55:
  30006. case 0xff57:
  30007. case 0xff58:
  30008. case 0xff64:
  30009. length = (0, _core_utils.readUint16)(data, position);
  30010. break;
  30011. default:
  30012. throw new Error("Unknown codestream code: " + code.toString(16));
  30013. }
  30014. position += length;
  30015. }
  30016. } catch (e) {
  30017. if (doNotRecover || this.failOnCorruptedImage) {
  30018. throw new JpxError(e.message);
  30019. } else {
  30020. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  30021. }
  30022. }
  30023. this.tiles = transformComponents(context);
  30024. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  30025. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  30026. this.componentsCount = context.SIZ.Csiz;
  30027. }
  30028. }
  30029. exports.JpxImage = JpxImage;
  30030. function calculateComponentDimensions(component, siz) {
  30031. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  30032. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  30033. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  30034. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  30035. component.width = component.x1 - component.x0;
  30036. component.height = component.y1 - component.y0;
  30037. }
  30038. function calculateTileGrids(context, components) {
  30039. const siz = context.SIZ;
  30040. const tiles = [];
  30041. let tile;
  30042. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  30043. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  30044. for (let q = 0; q < numYtiles; q++) {
  30045. for (let p = 0; p < numXtiles; p++) {
  30046. tile = {};
  30047. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  30048. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  30049. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  30050. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  30051. tile.width = tile.tx1 - tile.tx0;
  30052. tile.height = tile.ty1 - tile.ty0;
  30053. tile.components = [];
  30054. tiles.push(tile);
  30055. }
  30056. }
  30057. context.tiles = tiles;
  30058. const componentsCount = siz.Csiz;
  30059. for (let i = 0, ii = componentsCount; i < ii; i++) {
  30060. const component = components[i];
  30061. for (let j = 0, jj = tiles.length; j < jj; j++) {
  30062. const tileComponent = {};
  30063. tile = tiles[j];
  30064. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  30065. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  30066. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  30067. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  30068. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  30069. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  30070. tile.components[i] = tileComponent;
  30071. }
  30072. }
  30073. }
  30074. function getBlocksDimensions(context, component, r) {
  30075. const codOrCoc = component.codingStyleParameters;
  30076. const result = {};
  30077. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  30078. result.PPx = 15;
  30079. result.PPy = 15;
  30080. } else {
  30081. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  30082. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  30083. }
  30084. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  30085. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  30086. return result;
  30087. }
  30088. function buildPrecincts(context, resolution, dimensions) {
  30089. const precinctWidth = 1 << dimensions.PPx;
  30090. const precinctHeight = 1 << dimensions.PPy;
  30091. const isZeroRes = resolution.resLevel === 0;
  30092. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  30093. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  30094. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  30095. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  30096. const numprecincts = numprecinctswide * numprecinctshigh;
  30097. resolution.precinctParameters = {
  30098. precinctWidth,
  30099. precinctHeight,
  30100. numprecinctswide,
  30101. numprecinctshigh,
  30102. numprecincts,
  30103. precinctWidthInSubband,
  30104. precinctHeightInSubband
  30105. };
  30106. }
  30107. function buildCodeblocks(context, subband, dimensions) {
  30108. const xcb_ = dimensions.xcb_;
  30109. const ycb_ = dimensions.ycb_;
  30110. const codeblockWidth = 1 << xcb_;
  30111. const codeblockHeight = 1 << ycb_;
  30112. const cbx0 = subband.tbx0 >> xcb_;
  30113. const cby0 = subband.tby0 >> ycb_;
  30114. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  30115. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  30116. const precinctParameters = subband.resolution.precinctParameters;
  30117. const codeblocks = [];
  30118. const precincts = [];
  30119. let i, j, codeblock, precinctNumber;
  30120. for (j = cby0; j < cby1; j++) {
  30121. for (i = cbx0; i < cbx1; i++) {
  30122. codeblock = {
  30123. cbx: i,
  30124. cby: j,
  30125. tbx0: codeblockWidth * i,
  30126. tby0: codeblockHeight * j,
  30127. tbx1: codeblockWidth * (i + 1),
  30128. tby1: codeblockHeight * (j + 1)
  30129. };
  30130. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  30131. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  30132. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  30133. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  30134. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  30135. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  30136. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  30137. codeblock.precinctNumber = precinctNumber;
  30138. codeblock.subbandType = subband.type;
  30139. codeblock.Lblock = 3;
  30140. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  30141. continue;
  30142. }
  30143. codeblocks.push(codeblock);
  30144. let precinct = precincts[precinctNumber];
  30145. if (precinct !== undefined) {
  30146. if (i < precinct.cbxMin) {
  30147. precinct.cbxMin = i;
  30148. } else if (i > precinct.cbxMax) {
  30149. precinct.cbxMax = i;
  30150. }
  30151. if (j < precinct.cbyMin) {
  30152. precinct.cbxMin = j;
  30153. } else if (j > precinct.cbyMax) {
  30154. precinct.cbyMax = j;
  30155. }
  30156. } else {
  30157. precincts[precinctNumber] = precinct = {
  30158. cbxMin: i,
  30159. cbyMin: j,
  30160. cbxMax: i,
  30161. cbyMax: j
  30162. };
  30163. }
  30164. codeblock.precinct = precinct;
  30165. }
  30166. }
  30167. subband.codeblockParameters = {
  30168. codeblockWidth: xcb_,
  30169. codeblockHeight: ycb_,
  30170. numcodeblockwide: cbx1 - cbx0 + 1,
  30171. numcodeblockhigh: cby1 - cby0 + 1
  30172. };
  30173. subband.codeblocks = codeblocks;
  30174. subband.precincts = precincts;
  30175. }
  30176. function createPacket(resolution, precinctNumber, layerNumber) {
  30177. const precinctCodeblocks = [];
  30178. const subbands = resolution.subbands;
  30179. for (let i = 0, ii = subbands.length; i < ii; i++) {
  30180. const subband = subbands[i];
  30181. const codeblocks = subband.codeblocks;
  30182. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  30183. const codeblock = codeblocks[j];
  30184. if (codeblock.precinctNumber !== precinctNumber) {
  30185. continue;
  30186. }
  30187. precinctCodeblocks.push(codeblock);
  30188. }
  30189. }
  30190. return {
  30191. layerNumber,
  30192. codeblocks: precinctCodeblocks
  30193. };
  30194. }
  30195. function LayerResolutionComponentPositionIterator(context) {
  30196. const siz = context.SIZ;
  30197. const tileIndex = context.currentTile.index;
  30198. const tile = context.tiles[tileIndex];
  30199. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30200. const componentsCount = siz.Csiz;
  30201. let maxDecompositionLevelsCount = 0;
  30202. for (let q = 0; q < componentsCount; q++) {
  30203. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30204. }
  30205. let l = 0,
  30206. r = 0,
  30207. i = 0,
  30208. k = 0;
  30209. this.nextPacket = function JpxImage_nextPacket() {
  30210. for (; l < layersCount; l++) {
  30211. for (; r <= maxDecompositionLevelsCount; r++) {
  30212. for (; i < componentsCount; i++) {
  30213. const component = tile.components[i];
  30214. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30215. continue;
  30216. }
  30217. const resolution = component.resolutions[r];
  30218. const numprecincts = resolution.precinctParameters.numprecincts;
  30219. for (; k < numprecincts;) {
  30220. const packet = createPacket(resolution, k, l);
  30221. k++;
  30222. return packet;
  30223. }
  30224. k = 0;
  30225. }
  30226. i = 0;
  30227. }
  30228. r = 0;
  30229. }
  30230. throw new JpxError("Out of packets");
  30231. };
  30232. }
  30233. function ResolutionLayerComponentPositionIterator(context) {
  30234. const siz = context.SIZ;
  30235. const tileIndex = context.currentTile.index;
  30236. const tile = context.tiles[tileIndex];
  30237. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30238. const componentsCount = siz.Csiz;
  30239. let maxDecompositionLevelsCount = 0;
  30240. for (let q = 0; q < componentsCount; q++) {
  30241. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30242. }
  30243. let r = 0,
  30244. l = 0,
  30245. i = 0,
  30246. k = 0;
  30247. this.nextPacket = function JpxImage_nextPacket() {
  30248. for (; r <= maxDecompositionLevelsCount; r++) {
  30249. for (; l < layersCount; l++) {
  30250. for (; i < componentsCount; i++) {
  30251. const component = tile.components[i];
  30252. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30253. continue;
  30254. }
  30255. const resolution = component.resolutions[r];
  30256. const numprecincts = resolution.precinctParameters.numprecincts;
  30257. for (; k < numprecincts;) {
  30258. const packet = createPacket(resolution, k, l);
  30259. k++;
  30260. return packet;
  30261. }
  30262. k = 0;
  30263. }
  30264. i = 0;
  30265. }
  30266. l = 0;
  30267. }
  30268. throw new JpxError("Out of packets");
  30269. };
  30270. }
  30271. function ResolutionPositionComponentLayerIterator(context) {
  30272. const siz = context.SIZ;
  30273. const tileIndex = context.currentTile.index;
  30274. const tile = context.tiles[tileIndex];
  30275. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30276. const componentsCount = siz.Csiz;
  30277. let l, r, c, p;
  30278. let maxDecompositionLevelsCount = 0;
  30279. for (c = 0; c < componentsCount; c++) {
  30280. const component = tile.components[c];
  30281. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  30282. }
  30283. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  30284. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  30285. let maxNumPrecincts = 0;
  30286. for (c = 0; c < componentsCount; ++c) {
  30287. const resolutions = tile.components[c].resolutions;
  30288. if (r < resolutions.length) {
  30289. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  30290. }
  30291. }
  30292. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  30293. }
  30294. l = 0;
  30295. r = 0;
  30296. c = 0;
  30297. p = 0;
  30298. this.nextPacket = function JpxImage_nextPacket() {
  30299. for (; r <= maxDecompositionLevelsCount; r++) {
  30300. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  30301. for (; c < componentsCount; c++) {
  30302. const component = tile.components[c];
  30303. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30304. continue;
  30305. }
  30306. const resolution = component.resolutions[r];
  30307. const numprecincts = resolution.precinctParameters.numprecincts;
  30308. if (p >= numprecincts) {
  30309. continue;
  30310. }
  30311. for (; l < layersCount;) {
  30312. const packet = createPacket(resolution, p, l);
  30313. l++;
  30314. return packet;
  30315. }
  30316. l = 0;
  30317. }
  30318. c = 0;
  30319. }
  30320. p = 0;
  30321. }
  30322. throw new JpxError("Out of packets");
  30323. };
  30324. }
  30325. function PositionComponentResolutionLayerIterator(context) {
  30326. const siz = context.SIZ;
  30327. const tileIndex = context.currentTile.index;
  30328. const tile = context.tiles[tileIndex];
  30329. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30330. const componentsCount = siz.Csiz;
  30331. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30332. const precinctsIterationSizes = precinctsSizes;
  30333. let l = 0,
  30334. r = 0,
  30335. c = 0,
  30336. px = 0,
  30337. py = 0;
  30338. this.nextPacket = function JpxImage_nextPacket() {
  30339. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30340. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30341. for (; c < componentsCount; c++) {
  30342. const component = tile.components[c];
  30343. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30344. for (; r <= decompositionLevelsCount; r++) {
  30345. const resolution = component.resolutions[r];
  30346. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  30347. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30348. if (k === null) {
  30349. continue;
  30350. }
  30351. for (; l < layersCount;) {
  30352. const packet = createPacket(resolution, k, l);
  30353. l++;
  30354. return packet;
  30355. }
  30356. l = 0;
  30357. }
  30358. r = 0;
  30359. }
  30360. c = 0;
  30361. }
  30362. px = 0;
  30363. }
  30364. throw new JpxError("Out of packets");
  30365. };
  30366. }
  30367. function ComponentPositionResolutionLayerIterator(context) {
  30368. const siz = context.SIZ;
  30369. const tileIndex = context.currentTile.index;
  30370. const tile = context.tiles[tileIndex];
  30371. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30372. const componentsCount = siz.Csiz;
  30373. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30374. let l = 0,
  30375. r = 0,
  30376. c = 0,
  30377. px = 0,
  30378. py = 0;
  30379. this.nextPacket = function JpxImage_nextPacket() {
  30380. for (; c < componentsCount; ++c) {
  30381. const component = tile.components[c];
  30382. const precinctsIterationSizes = precinctsSizes.components[c];
  30383. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30384. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30385. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30386. for (; r <= decompositionLevelsCount; r++) {
  30387. const resolution = component.resolutions[r];
  30388. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  30389. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30390. if (k === null) {
  30391. continue;
  30392. }
  30393. for (; l < layersCount;) {
  30394. const packet = createPacket(resolution, k, l);
  30395. l++;
  30396. return packet;
  30397. }
  30398. l = 0;
  30399. }
  30400. r = 0;
  30401. }
  30402. px = 0;
  30403. }
  30404. py = 0;
  30405. }
  30406. throw new JpxError("Out of packets");
  30407. };
  30408. }
  30409. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  30410. const posX = pxIndex * precinctIterationSizes.minWidth;
  30411. const posY = pyIndex * precinctIterationSizes.minHeight;
  30412. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  30413. return null;
  30414. }
  30415. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  30416. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  30417. }
  30418. function getPrecinctSizesInImageScale(tile) {
  30419. const componentsCount = tile.components.length;
  30420. let minWidth = Number.MAX_VALUE;
  30421. let minHeight = Number.MAX_VALUE;
  30422. let maxNumWide = 0;
  30423. let maxNumHigh = 0;
  30424. const sizePerComponent = new Array(componentsCount);
  30425. for (let c = 0; c < componentsCount; c++) {
  30426. const component = tile.components[c];
  30427. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30428. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  30429. let minWidthCurrentComponent = Number.MAX_VALUE;
  30430. let minHeightCurrentComponent = Number.MAX_VALUE;
  30431. let maxNumWideCurrentComponent = 0;
  30432. let maxNumHighCurrentComponent = 0;
  30433. let scale = 1;
  30434. for (let r = decompositionLevelsCount; r >= 0; --r) {
  30435. const resolution = component.resolutions[r];
  30436. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  30437. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  30438. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  30439. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  30440. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  30441. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  30442. sizePerResolution[r] = {
  30443. width: widthCurrentResolution,
  30444. height: heightCurrentResolution
  30445. };
  30446. scale <<= 1;
  30447. }
  30448. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  30449. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  30450. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  30451. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  30452. sizePerComponent[c] = {
  30453. resolutions: sizePerResolution,
  30454. minWidth: minWidthCurrentComponent,
  30455. minHeight: minHeightCurrentComponent,
  30456. maxNumWide: maxNumWideCurrentComponent,
  30457. maxNumHigh: maxNumHighCurrentComponent
  30458. };
  30459. }
  30460. return {
  30461. components: sizePerComponent,
  30462. minWidth,
  30463. minHeight,
  30464. maxNumWide,
  30465. maxNumHigh
  30466. };
  30467. }
  30468. function buildPackets(context) {
  30469. const siz = context.SIZ;
  30470. const tileIndex = context.currentTile.index;
  30471. const tile = context.tiles[tileIndex];
  30472. const componentsCount = siz.Csiz;
  30473. for (let c = 0; c < componentsCount; c++) {
  30474. const component = tile.components[c];
  30475. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30476. const resolutions = [];
  30477. const subbands = [];
  30478. for (let r = 0; r <= decompositionLevelsCount; r++) {
  30479. const blocksDimensions = getBlocksDimensions(context, component, r);
  30480. const resolution = {};
  30481. const scale = 1 << decompositionLevelsCount - r;
  30482. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  30483. resolution.try0 = Math.ceil(component.tcy0 / scale);
  30484. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  30485. resolution.try1 = Math.ceil(component.tcy1 / scale);
  30486. resolution.resLevel = r;
  30487. buildPrecincts(context, resolution, blocksDimensions);
  30488. resolutions.push(resolution);
  30489. let subband;
  30490. if (r === 0) {
  30491. subband = {};
  30492. subband.type = "LL";
  30493. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  30494. subband.tby0 = Math.ceil(component.tcy0 / scale);
  30495. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  30496. subband.tby1 = Math.ceil(component.tcy1 / scale);
  30497. subband.resolution = resolution;
  30498. buildCodeblocks(context, subband, blocksDimensions);
  30499. subbands.push(subband);
  30500. resolution.subbands = [subband];
  30501. } else {
  30502. const bscale = 1 << decompositionLevelsCount - r + 1;
  30503. const resolutionSubbands = [];
  30504. subband = {};
  30505. subband.type = "HL";
  30506. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30507. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  30508. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30509. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  30510. subband.resolution = resolution;
  30511. buildCodeblocks(context, subband, blocksDimensions);
  30512. subbands.push(subband);
  30513. resolutionSubbands.push(subband);
  30514. subband = {};
  30515. subband.type = "LH";
  30516. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  30517. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30518. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  30519. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30520. subband.resolution = resolution;
  30521. buildCodeblocks(context, subband, blocksDimensions);
  30522. subbands.push(subband);
  30523. resolutionSubbands.push(subband);
  30524. subband = {};
  30525. subband.type = "HH";
  30526. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  30527. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  30528. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  30529. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  30530. subband.resolution = resolution;
  30531. buildCodeblocks(context, subband, blocksDimensions);
  30532. subbands.push(subband);
  30533. resolutionSubbands.push(subband);
  30534. resolution.subbands = resolutionSubbands;
  30535. }
  30536. }
  30537. component.resolutions = resolutions;
  30538. component.subbands = subbands;
  30539. }
  30540. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  30541. switch (progressionOrder) {
  30542. case 0:
  30543. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  30544. break;
  30545. case 1:
  30546. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  30547. break;
  30548. case 2:
  30549. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  30550. break;
  30551. case 3:
  30552. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  30553. break;
  30554. case 4:
  30555. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  30556. break;
  30557. default:
  30558. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  30559. }
  30560. }
  30561. function parseTilePackets(context, data, offset, dataLength) {
  30562. let position = 0;
  30563. let buffer,
  30564. bufferSize = 0,
  30565. skipNextBit = false;
  30566. function readBits(count) {
  30567. while (bufferSize < count) {
  30568. const b = data[offset + position];
  30569. position++;
  30570. if (skipNextBit) {
  30571. buffer = buffer << 7 | b;
  30572. bufferSize += 7;
  30573. skipNextBit = false;
  30574. } else {
  30575. buffer = buffer << 8 | b;
  30576. bufferSize += 8;
  30577. }
  30578. if (b === 0xff) {
  30579. skipNextBit = true;
  30580. }
  30581. }
  30582. bufferSize -= count;
  30583. return buffer >>> bufferSize & (1 << count) - 1;
  30584. }
  30585. function skipMarkerIfEqual(value) {
  30586. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  30587. skipBytes(1);
  30588. return true;
  30589. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  30590. skipBytes(2);
  30591. return true;
  30592. }
  30593. return false;
  30594. }
  30595. function skipBytes(count) {
  30596. position += count;
  30597. }
  30598. function alignToByte() {
  30599. bufferSize = 0;
  30600. if (skipNextBit) {
  30601. position++;
  30602. skipNextBit = false;
  30603. }
  30604. }
  30605. function readCodingpasses() {
  30606. if (readBits(1) === 0) {
  30607. return 1;
  30608. }
  30609. if (readBits(1) === 0) {
  30610. return 2;
  30611. }
  30612. let value = readBits(2);
  30613. if (value < 3) {
  30614. return value + 3;
  30615. }
  30616. value = readBits(5);
  30617. if (value < 31) {
  30618. return value + 6;
  30619. }
  30620. value = readBits(7);
  30621. return value + 37;
  30622. }
  30623. const tileIndex = context.currentTile.index;
  30624. const tile = context.tiles[tileIndex];
  30625. const sopMarkerUsed = context.COD.sopMarkerUsed;
  30626. const ephMarkerUsed = context.COD.ephMarkerUsed;
  30627. const packetsIterator = tile.packetsIterator;
  30628. while (position < dataLength) {
  30629. alignToByte();
  30630. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  30631. skipBytes(4);
  30632. }
  30633. const packet = packetsIterator.nextPacket();
  30634. if (!readBits(1)) {
  30635. continue;
  30636. }
  30637. const layerNumber = packet.layerNumber,
  30638. queue = [];
  30639. let codeblock;
  30640. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  30641. codeblock = packet.codeblocks[i];
  30642. let precinct = codeblock.precinct;
  30643. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  30644. const codeblockRow = codeblock.cby - precinct.cbyMin;
  30645. let codeblockIncluded = false;
  30646. let firstTimeInclusion = false;
  30647. let valueReady, zeroBitPlanesTree;
  30648. if (codeblock.included !== undefined) {
  30649. codeblockIncluded = !!readBits(1);
  30650. } else {
  30651. precinct = codeblock.precinct;
  30652. let inclusionTree;
  30653. if (precinct.inclusionTree !== undefined) {
  30654. inclusionTree = precinct.inclusionTree;
  30655. } else {
  30656. const width = precinct.cbxMax - precinct.cbxMin + 1;
  30657. const height = precinct.cbyMax - precinct.cbyMin + 1;
  30658. inclusionTree = new InclusionTree(width, height, layerNumber);
  30659. zeroBitPlanesTree = new TagTree(width, height);
  30660. precinct.inclusionTree = inclusionTree;
  30661. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  30662. for (let l = 0; l < layerNumber; l++) {
  30663. if (readBits(1) !== 0) {
  30664. throw new JpxError("Invalid tag tree");
  30665. }
  30666. }
  30667. }
  30668. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  30669. while (true) {
  30670. if (readBits(1)) {
  30671. valueReady = !inclusionTree.nextLevel();
  30672. if (valueReady) {
  30673. codeblock.included = true;
  30674. codeblockIncluded = firstTimeInclusion = true;
  30675. break;
  30676. }
  30677. } else {
  30678. inclusionTree.incrementValue(layerNumber);
  30679. break;
  30680. }
  30681. }
  30682. }
  30683. }
  30684. if (!codeblockIncluded) {
  30685. continue;
  30686. }
  30687. if (firstTimeInclusion) {
  30688. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  30689. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  30690. while (true) {
  30691. if (readBits(1)) {
  30692. valueReady = !zeroBitPlanesTree.nextLevel();
  30693. if (valueReady) {
  30694. break;
  30695. }
  30696. } else {
  30697. zeroBitPlanesTree.incrementValue();
  30698. }
  30699. }
  30700. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  30701. }
  30702. const codingpasses = readCodingpasses();
  30703. while (readBits(1)) {
  30704. codeblock.Lblock++;
  30705. }
  30706. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  30707. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  30708. const codedDataLength = readBits(bits);
  30709. queue.push({
  30710. codeblock,
  30711. codingpasses,
  30712. dataLength: codedDataLength
  30713. });
  30714. }
  30715. alignToByte();
  30716. if (ephMarkerUsed) {
  30717. skipMarkerIfEqual(0x92);
  30718. }
  30719. while (queue.length > 0) {
  30720. const packetItem = queue.shift();
  30721. codeblock = packetItem.codeblock;
  30722. if (codeblock.data === undefined) {
  30723. codeblock.data = [];
  30724. }
  30725. codeblock.data.push({
  30726. data,
  30727. start: offset + position,
  30728. end: offset + position + packetItem.dataLength,
  30729. codingpasses: packetItem.codingpasses
  30730. });
  30731. position += packetItem.dataLength;
  30732. }
  30733. }
  30734. return position;
  30735. }
  30736. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed) {
  30737. const x0 = subband.tbx0;
  30738. const y0 = subband.tby0;
  30739. const width = subband.tbx1 - subband.tbx0;
  30740. const codeblocks = subband.codeblocks;
  30741. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  30742. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  30743. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  30744. const codeblock = codeblocks[i];
  30745. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  30746. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  30747. if (blockWidth === 0 || blockHeight === 0) {
  30748. continue;
  30749. }
  30750. if (codeblock.data === undefined) {
  30751. continue;
  30752. }
  30753. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  30754. let currentCodingpassType = 2;
  30755. const data = codeblock.data;
  30756. let totalLength = 0,
  30757. codingpasses = 0;
  30758. let j, jj, dataItem;
  30759. for (j = 0, jj = data.length; j < jj; j++) {
  30760. dataItem = data[j];
  30761. totalLength += dataItem.end - dataItem.start;
  30762. codingpasses += dataItem.codingpasses;
  30763. }
  30764. const encodedData = new Uint8Array(totalLength);
  30765. let position = 0;
  30766. for (j = 0, jj = data.length; j < jj; j++) {
  30767. dataItem = data[j];
  30768. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  30769. encodedData.set(chunk, position);
  30770. position += chunk.length;
  30771. }
  30772. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  30773. bitModel.setDecoder(decoder);
  30774. for (j = 0; j < codingpasses; j++) {
  30775. switch (currentCodingpassType) {
  30776. case 0:
  30777. bitModel.runSignificancePropagationPass();
  30778. break;
  30779. case 1:
  30780. bitModel.runMagnitudeRefinementPass();
  30781. break;
  30782. case 2:
  30783. bitModel.runCleanupPass();
  30784. if (segmentationSymbolUsed) {
  30785. bitModel.checkSegmentationSymbol();
  30786. }
  30787. break;
  30788. }
  30789. currentCodingpassType = (currentCodingpassType + 1) % 3;
  30790. }
  30791. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  30792. const sign = bitModel.coefficentsSign;
  30793. const magnitude = bitModel.coefficentsMagnitude;
  30794. const bitsDecoded = bitModel.bitsDecoded;
  30795. const magnitudeCorrection = reversible ? 0 : 0.5;
  30796. let k, n, nb;
  30797. position = 0;
  30798. const interleave = subband.type !== "LL";
  30799. for (j = 0; j < blockHeight; j++) {
  30800. const row = offset / width | 0;
  30801. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  30802. for (k = 0; k < blockWidth; k++) {
  30803. n = magnitude[position];
  30804. if (n !== 0) {
  30805. n = (n + magnitudeCorrection) * delta;
  30806. if (sign[position] !== 0) {
  30807. n = -n;
  30808. }
  30809. nb = bitsDecoded[position];
  30810. const pos = interleave ? levelOffset + (offset << 1) : offset;
  30811. if (reversible && nb >= mb) {
  30812. coefficients[pos] = n;
  30813. } else {
  30814. coefficients[pos] = n * (1 << mb - nb);
  30815. }
  30816. }
  30817. offset++;
  30818. position++;
  30819. }
  30820. offset += width - blockWidth;
  30821. }
  30822. }
  30823. }
  30824. function transformTile(context, tile, c) {
  30825. const component = tile.components[c];
  30826. const codingStyleParameters = component.codingStyleParameters;
  30827. const quantizationParameters = component.quantizationParameters;
  30828. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  30829. const spqcds = quantizationParameters.SPqcds;
  30830. const scalarExpounded = quantizationParameters.scalarExpounded;
  30831. const guardBits = quantizationParameters.guardBits;
  30832. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  30833. const precision = context.components[c].precision;
  30834. const reversible = codingStyleParameters.reversibleTransformation;
  30835. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  30836. const subbandCoefficients = [];
  30837. let b = 0;
  30838. for (let i = 0; i <= decompositionLevelsCount; i++) {
  30839. const resolution = component.resolutions[i];
  30840. const width = resolution.trx1 - resolution.trx0;
  30841. const height = resolution.try1 - resolution.try0;
  30842. const coefficients = new Float32Array(width * height);
  30843. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  30844. let mu, epsilon;
  30845. if (!scalarExpounded) {
  30846. mu = spqcds[0].mu;
  30847. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  30848. } else {
  30849. mu = spqcds[b].mu;
  30850. epsilon = spqcds[b].epsilon;
  30851. b++;
  30852. }
  30853. const subband = resolution.subbands[j];
  30854. const gainLog2 = SubbandsGainLog2[subband.type];
  30855. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  30856. const mb = guardBits + epsilon - 1;
  30857. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed);
  30858. }
  30859. subbandCoefficients.push({
  30860. width,
  30861. height,
  30862. items: coefficients
  30863. });
  30864. }
  30865. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  30866. return {
  30867. left: component.tcx0,
  30868. top: component.tcy0,
  30869. width: result.width,
  30870. height: result.height,
  30871. items: result.items
  30872. };
  30873. }
  30874. function transformComponents(context) {
  30875. const siz = context.SIZ;
  30876. const components = context.components;
  30877. const componentsCount = siz.Csiz;
  30878. const resultImages = [];
  30879. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  30880. const tile = context.tiles[i];
  30881. const transformedTiles = [];
  30882. for (let c = 0; c < componentsCount; c++) {
  30883. transformedTiles[c] = transformTile(context, tile, c);
  30884. }
  30885. const tile0 = transformedTiles[0];
  30886. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  30887. const result = {
  30888. left: tile0.left,
  30889. top: tile0.top,
  30890. width: tile0.width,
  30891. height: tile0.height,
  30892. items: out
  30893. };
  30894. let shift, offset;
  30895. let pos = 0,
  30896. j,
  30897. jj,
  30898. y0,
  30899. y1,
  30900. y2;
  30901. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  30902. const fourComponents = componentsCount === 4;
  30903. const y0items = transformedTiles[0].items;
  30904. const y1items = transformedTiles[1].items;
  30905. const y2items = transformedTiles[2].items;
  30906. const y3items = fourComponents ? transformedTiles[3].items : null;
  30907. shift = components[0].precision - 8;
  30908. offset = (128 << shift) + 0.5;
  30909. const component0 = tile.components[0];
  30910. const alpha01 = componentsCount - 3;
  30911. jj = y0items.length;
  30912. if (!component0.codingStyleParameters.reversibleTransformation) {
  30913. for (j = 0; j < jj; j++, pos += alpha01) {
  30914. y0 = y0items[j] + offset;
  30915. y1 = y1items[j];
  30916. y2 = y2items[j];
  30917. out[pos++] = y0 + 1.402 * y2 >> shift;
  30918. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  30919. out[pos++] = y0 + 1.772 * y1 >> shift;
  30920. }
  30921. } else {
  30922. for (j = 0; j < jj; j++, pos += alpha01) {
  30923. y0 = y0items[j] + offset;
  30924. y1 = y1items[j];
  30925. y2 = y2items[j];
  30926. const g = y0 - (y2 + y1 >> 2);
  30927. out[pos++] = g + y2 >> shift;
  30928. out[pos++] = g >> shift;
  30929. out[pos++] = g + y1 >> shift;
  30930. }
  30931. }
  30932. if (fourComponents) {
  30933. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  30934. out[pos] = y3items[j] + offset >> shift;
  30935. }
  30936. }
  30937. } else {
  30938. for (let c = 0; c < componentsCount; c++) {
  30939. const items = transformedTiles[c].items;
  30940. shift = components[c].precision - 8;
  30941. offset = (128 << shift) + 0.5;
  30942. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  30943. out[pos] = items[j] + offset >> shift;
  30944. pos += componentsCount;
  30945. }
  30946. }
  30947. }
  30948. resultImages.push(result);
  30949. }
  30950. return resultImages;
  30951. }
  30952. function initializeTile(context, tileIndex) {
  30953. const siz = context.SIZ;
  30954. const componentsCount = siz.Csiz;
  30955. const tile = context.tiles[tileIndex];
  30956. for (let c = 0; c < componentsCount; c++) {
  30957. const component = tile.components[c];
  30958. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  30959. component.quantizationParameters = qcdOrQcc;
  30960. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  30961. component.codingStyleParameters = codOrCoc;
  30962. }
  30963. tile.codingStyleDefaultParameters = context.currentTile.COD;
  30964. }
  30965. class TagTree {
  30966. constructor(width, height) {
  30967. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  30968. this.levels = [];
  30969. for (let i = 0; i < levelsLength; i++) {
  30970. const level = {
  30971. width,
  30972. height,
  30973. items: []
  30974. };
  30975. this.levels.push(level);
  30976. width = Math.ceil(width / 2);
  30977. height = Math.ceil(height / 2);
  30978. }
  30979. }
  30980. reset(i, j) {
  30981. let currentLevel = 0,
  30982. value = 0,
  30983. level;
  30984. while (currentLevel < this.levels.length) {
  30985. level = this.levels[currentLevel];
  30986. const index = i + j * level.width;
  30987. if (level.items[index] !== undefined) {
  30988. value = level.items[index];
  30989. break;
  30990. }
  30991. level.index = index;
  30992. i >>= 1;
  30993. j >>= 1;
  30994. currentLevel++;
  30995. }
  30996. currentLevel--;
  30997. level = this.levels[currentLevel];
  30998. level.items[level.index] = value;
  30999. this.currentLevel = currentLevel;
  31000. delete this.value;
  31001. }
  31002. incrementValue() {
  31003. const level = this.levels[this.currentLevel];
  31004. level.items[level.index]++;
  31005. }
  31006. nextLevel() {
  31007. let currentLevel = this.currentLevel;
  31008. let level = this.levels[currentLevel];
  31009. const value = level.items[level.index];
  31010. currentLevel--;
  31011. if (currentLevel < 0) {
  31012. this.value = value;
  31013. return false;
  31014. }
  31015. this.currentLevel = currentLevel;
  31016. level = this.levels[currentLevel];
  31017. level.items[level.index] = value;
  31018. return true;
  31019. }
  31020. }
  31021. class InclusionTree {
  31022. constructor(width, height, defaultValue) {
  31023. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  31024. this.levels = [];
  31025. for (let i = 0; i < levelsLength; i++) {
  31026. const items = new Uint8Array(width * height);
  31027. for (let j = 0, jj = items.length; j < jj; j++) {
  31028. items[j] = defaultValue;
  31029. }
  31030. const level = {
  31031. width,
  31032. height,
  31033. items
  31034. };
  31035. this.levels.push(level);
  31036. width = Math.ceil(width / 2);
  31037. height = Math.ceil(height / 2);
  31038. }
  31039. }
  31040. reset(i, j, stopValue) {
  31041. let currentLevel = 0;
  31042. while (currentLevel < this.levels.length) {
  31043. const level = this.levels[currentLevel];
  31044. const index = i + j * level.width;
  31045. level.index = index;
  31046. const value = level.items[index];
  31047. if (value === 0xff) {
  31048. break;
  31049. }
  31050. if (value > stopValue) {
  31051. this.currentLevel = currentLevel;
  31052. this.propagateValues();
  31053. return false;
  31054. }
  31055. i >>= 1;
  31056. j >>= 1;
  31057. currentLevel++;
  31058. }
  31059. this.currentLevel = currentLevel - 1;
  31060. return true;
  31061. }
  31062. incrementValue(stopValue) {
  31063. const level = this.levels[this.currentLevel];
  31064. level.items[level.index] = stopValue + 1;
  31065. this.propagateValues();
  31066. }
  31067. propagateValues() {
  31068. let levelIndex = this.currentLevel;
  31069. let level = this.levels[levelIndex];
  31070. const currentValue = level.items[level.index];
  31071. while (--levelIndex >= 0) {
  31072. level = this.levels[levelIndex];
  31073. level.items[level.index] = currentValue;
  31074. }
  31075. }
  31076. nextLevel() {
  31077. let currentLevel = this.currentLevel;
  31078. let level = this.levels[currentLevel];
  31079. const value = level.items[level.index];
  31080. level.items[level.index] = 0xff;
  31081. currentLevel--;
  31082. if (currentLevel < 0) {
  31083. return false;
  31084. }
  31085. this.currentLevel = currentLevel;
  31086. level = this.levels[currentLevel];
  31087. level.items[level.index] = value;
  31088. return true;
  31089. }
  31090. }
  31091. const BitModel = function BitModelClosure() {
  31092. const UNIFORM_CONTEXT = 17;
  31093. const RUNLENGTH_CONTEXT = 18;
  31094. const 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]);
  31095. const 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]);
  31096. const 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]);
  31097. class BitModel {
  31098. constructor(width, height, subband, zeroBitPlanes, mb) {
  31099. this.width = width;
  31100. this.height = height;
  31101. let contextLabelTable;
  31102. if (subband === "HH") {
  31103. contextLabelTable = HHContextLabel;
  31104. } else if (subband === "HL") {
  31105. contextLabelTable = HLContextLabel;
  31106. } else {
  31107. contextLabelTable = LLAndLHContextsLabel;
  31108. }
  31109. this.contextLabelTable = contextLabelTable;
  31110. const coefficientCount = width * height;
  31111. this.neighborsSignificance = new Uint8Array(coefficientCount);
  31112. this.coefficentsSign = new Uint8Array(coefficientCount);
  31113. let coefficentsMagnitude;
  31114. if (mb > 14) {
  31115. coefficentsMagnitude = new Uint32Array(coefficientCount);
  31116. } else if (mb > 6) {
  31117. coefficentsMagnitude = new Uint16Array(coefficientCount);
  31118. } else {
  31119. coefficentsMagnitude = new Uint8Array(coefficientCount);
  31120. }
  31121. this.coefficentsMagnitude = coefficentsMagnitude;
  31122. this.processingFlags = new Uint8Array(coefficientCount);
  31123. const bitsDecoded = new Uint8Array(coefficientCount);
  31124. if (zeroBitPlanes !== 0) {
  31125. for (let i = 0; i < coefficientCount; i++) {
  31126. bitsDecoded[i] = zeroBitPlanes;
  31127. }
  31128. }
  31129. this.bitsDecoded = bitsDecoded;
  31130. this.reset();
  31131. }
  31132. setDecoder(decoder) {
  31133. this.decoder = decoder;
  31134. }
  31135. reset() {
  31136. this.contexts = new Int8Array(19);
  31137. this.contexts[0] = 4 << 1 | 0;
  31138. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  31139. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  31140. }
  31141. setNeighborsSignificance(row, column, index) {
  31142. const neighborsSignificance = this.neighborsSignificance;
  31143. const width = this.width,
  31144. height = this.height;
  31145. const left = column > 0;
  31146. const right = column + 1 < width;
  31147. let i;
  31148. if (row > 0) {
  31149. i = index - width;
  31150. if (left) {
  31151. neighborsSignificance[i - 1] += 0x10;
  31152. }
  31153. if (right) {
  31154. neighborsSignificance[i + 1] += 0x10;
  31155. }
  31156. neighborsSignificance[i] += 0x04;
  31157. }
  31158. if (row + 1 < height) {
  31159. i = index + width;
  31160. if (left) {
  31161. neighborsSignificance[i - 1] += 0x10;
  31162. }
  31163. if (right) {
  31164. neighborsSignificance[i + 1] += 0x10;
  31165. }
  31166. neighborsSignificance[i] += 0x04;
  31167. }
  31168. if (left) {
  31169. neighborsSignificance[index - 1] += 0x01;
  31170. }
  31171. if (right) {
  31172. neighborsSignificance[index + 1] += 0x01;
  31173. }
  31174. neighborsSignificance[index] |= 0x80;
  31175. }
  31176. runSignificancePropagationPass() {
  31177. const decoder = this.decoder;
  31178. const width = this.width,
  31179. height = this.height;
  31180. const coefficentsMagnitude = this.coefficentsMagnitude;
  31181. const coefficentsSign = this.coefficentsSign;
  31182. const neighborsSignificance = this.neighborsSignificance;
  31183. const processingFlags = this.processingFlags;
  31184. const contexts = this.contexts;
  31185. const labels = this.contextLabelTable;
  31186. const bitsDecoded = this.bitsDecoded;
  31187. const processedInverseMask = ~1;
  31188. const processedMask = 1;
  31189. const firstMagnitudeBitMask = 2;
  31190. for (let i0 = 0; i0 < height; i0 += 4) {
  31191. for (let j = 0; j < width; j++) {
  31192. let index = i0 * width + j;
  31193. for (let i1 = 0; i1 < 4; i1++, index += width) {
  31194. const i = i0 + i1;
  31195. if (i >= height) {
  31196. break;
  31197. }
  31198. processingFlags[index] &= processedInverseMask;
  31199. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  31200. continue;
  31201. }
  31202. const contextLabel = labels[neighborsSignificance[index]];
  31203. const decision = decoder.readBit(contexts, contextLabel);
  31204. if (decision) {
  31205. const sign = this.decodeSignBit(i, j, index);
  31206. coefficentsSign[index] = sign;
  31207. coefficentsMagnitude[index] = 1;
  31208. this.setNeighborsSignificance(i, j, index);
  31209. processingFlags[index] |= firstMagnitudeBitMask;
  31210. }
  31211. bitsDecoded[index]++;
  31212. processingFlags[index] |= processedMask;
  31213. }
  31214. }
  31215. }
  31216. }
  31217. decodeSignBit(row, column, index) {
  31218. const width = this.width,
  31219. height = this.height;
  31220. const coefficentsMagnitude = this.coefficentsMagnitude;
  31221. const coefficentsSign = this.coefficentsSign;
  31222. let contribution, sign0, sign1, significance1;
  31223. let contextLabel, decoded;
  31224. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  31225. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  31226. sign1 = coefficentsSign[index + 1];
  31227. if (significance1) {
  31228. sign0 = coefficentsSign[index - 1];
  31229. contribution = 1 - sign1 - sign0;
  31230. } else {
  31231. contribution = 1 - sign1 - sign1;
  31232. }
  31233. } else if (significance1) {
  31234. sign0 = coefficentsSign[index - 1];
  31235. contribution = 1 - sign0 - sign0;
  31236. } else {
  31237. contribution = 0;
  31238. }
  31239. const horizontalContribution = 3 * contribution;
  31240. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  31241. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  31242. sign1 = coefficentsSign[index + width];
  31243. if (significance1) {
  31244. sign0 = coefficentsSign[index - width];
  31245. contribution = 1 - sign1 - sign0 + horizontalContribution;
  31246. } else {
  31247. contribution = 1 - sign1 - sign1 + horizontalContribution;
  31248. }
  31249. } else if (significance1) {
  31250. sign0 = coefficentsSign[index - width];
  31251. contribution = 1 - sign0 - sign0 + horizontalContribution;
  31252. } else {
  31253. contribution = horizontalContribution;
  31254. }
  31255. if (contribution >= 0) {
  31256. contextLabel = 9 + contribution;
  31257. decoded = this.decoder.readBit(this.contexts, contextLabel);
  31258. } else {
  31259. contextLabel = 9 - contribution;
  31260. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31261. }
  31262. return decoded;
  31263. }
  31264. runMagnitudeRefinementPass() {
  31265. const decoder = this.decoder;
  31266. const width = this.width,
  31267. height = this.height;
  31268. const coefficentsMagnitude = this.coefficentsMagnitude;
  31269. const neighborsSignificance = this.neighborsSignificance;
  31270. const contexts = this.contexts;
  31271. const bitsDecoded = this.bitsDecoded;
  31272. const processingFlags = this.processingFlags;
  31273. const processedMask = 1;
  31274. const firstMagnitudeBitMask = 2;
  31275. const length = width * height;
  31276. const width4 = width * 4;
  31277. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31278. indexNext = Math.min(length, index0 + width4);
  31279. for (let j = 0; j < width; j++) {
  31280. for (let index = index0 + j; index < indexNext; index += width) {
  31281. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31282. continue;
  31283. }
  31284. let contextLabel = 16;
  31285. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31286. processingFlags[index] ^= firstMagnitudeBitMask;
  31287. const significance = neighborsSignificance[index] & 127;
  31288. contextLabel = significance === 0 ? 15 : 14;
  31289. }
  31290. const bit = decoder.readBit(contexts, contextLabel);
  31291. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31292. bitsDecoded[index]++;
  31293. processingFlags[index] |= processedMask;
  31294. }
  31295. }
  31296. }
  31297. }
  31298. runCleanupPass() {
  31299. const decoder = this.decoder;
  31300. const width = this.width,
  31301. height = this.height;
  31302. const neighborsSignificance = this.neighborsSignificance;
  31303. const coefficentsMagnitude = this.coefficentsMagnitude;
  31304. const coefficentsSign = this.coefficentsSign;
  31305. const contexts = this.contexts;
  31306. const labels = this.contextLabelTable;
  31307. const bitsDecoded = this.bitsDecoded;
  31308. const processingFlags = this.processingFlags;
  31309. const processedMask = 1;
  31310. const firstMagnitudeBitMask = 2;
  31311. const oneRowDown = width;
  31312. const twoRowsDown = width * 2;
  31313. const threeRowsDown = width * 3;
  31314. let iNext;
  31315. for (let i0 = 0; i0 < height; i0 = iNext) {
  31316. iNext = Math.min(i0 + 4, height);
  31317. const indexBase = i0 * width;
  31318. const checkAllEmpty = i0 + 3 < height;
  31319. for (let j = 0; j < width; j++) {
  31320. const index0 = indexBase + j;
  31321. const 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;
  31322. let i1 = 0,
  31323. index = index0;
  31324. let i = i0,
  31325. sign;
  31326. if (allEmpty) {
  31327. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31328. if (!hasSignificantCoefficent) {
  31329. bitsDecoded[index0]++;
  31330. bitsDecoded[index0 + oneRowDown]++;
  31331. bitsDecoded[index0 + twoRowsDown]++;
  31332. bitsDecoded[index0 + threeRowsDown]++;
  31333. continue;
  31334. }
  31335. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31336. if (i1 !== 0) {
  31337. i = i0 + i1;
  31338. index += i1 * width;
  31339. }
  31340. sign = this.decodeSignBit(i, j, index);
  31341. coefficentsSign[index] = sign;
  31342. coefficentsMagnitude[index] = 1;
  31343. this.setNeighborsSignificance(i, j, index);
  31344. processingFlags[index] |= firstMagnitudeBitMask;
  31345. index = index0;
  31346. for (let i2 = i0; i2 <= i; i2++, index += width) {
  31347. bitsDecoded[index]++;
  31348. }
  31349. i1++;
  31350. }
  31351. for (i = i0 + i1; i < iNext; i++, index += width) {
  31352. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31353. continue;
  31354. }
  31355. const contextLabel = labels[neighborsSignificance[index]];
  31356. const decision = decoder.readBit(contexts, contextLabel);
  31357. if (decision === 1) {
  31358. sign = this.decodeSignBit(i, j, index);
  31359. coefficentsSign[index] = sign;
  31360. coefficentsMagnitude[index] = 1;
  31361. this.setNeighborsSignificance(i, j, index);
  31362. processingFlags[index] |= firstMagnitudeBitMask;
  31363. }
  31364. bitsDecoded[index]++;
  31365. }
  31366. }
  31367. }
  31368. }
  31369. checkSegmentationSymbol() {
  31370. const decoder = this.decoder;
  31371. const contexts = this.contexts;
  31372. const symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31373. if (symbol !== 0xa) {
  31374. throw new JpxError("Invalid segmentation symbol");
  31375. }
  31376. }
  31377. }
  31378. return BitModel;
  31379. }();
  31380. class Transform {
  31381. constructor() {
  31382. if (this.constructor === Transform) {
  31383. (0, _util.unreachable)("Cannot initialize Transform.");
  31384. }
  31385. }
  31386. calculate(subbands, u0, v0) {
  31387. let ll = subbands[0];
  31388. for (let i = 1, ii = subbands.length; i < ii; i++) {
  31389. ll = this.iterate(ll, subbands[i], u0, v0);
  31390. }
  31391. return ll;
  31392. }
  31393. extend(buffer, offset, size) {
  31394. let i1 = offset - 1,
  31395. j1 = offset + 1;
  31396. let i2 = offset + size - 2,
  31397. j2 = offset + size;
  31398. buffer[i1--] = buffer[j1++];
  31399. buffer[j2++] = buffer[i2--];
  31400. buffer[i1--] = buffer[j1++];
  31401. buffer[j2++] = buffer[i2--];
  31402. buffer[i1--] = buffer[j1++];
  31403. buffer[j2++] = buffer[i2--];
  31404. buffer[i1] = buffer[j1];
  31405. buffer[j2] = buffer[i2];
  31406. }
  31407. filter(x, offset, length) {
  31408. (0, _util.unreachable)("Abstract method `filter` called");
  31409. }
  31410. iterate(ll, hl_lh_hh, u0, v0) {
  31411. const llWidth = ll.width,
  31412. llHeight = ll.height;
  31413. let llItems = ll.items;
  31414. const width = hl_lh_hh.width;
  31415. const height = hl_lh_hh.height;
  31416. const items = hl_lh_hh.items;
  31417. let i, j, k, l, u, v;
  31418. for (k = 0, i = 0; i < llHeight; i++) {
  31419. l = i * 2 * width;
  31420. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31421. items[l] = llItems[k];
  31422. }
  31423. }
  31424. llItems = ll.items = null;
  31425. const bufferPadding = 4;
  31426. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31427. if (width === 1) {
  31428. if ((u0 & 1) !== 0) {
  31429. for (v = 0, k = 0; v < height; v++, k += width) {
  31430. items[k] *= 0.5;
  31431. }
  31432. }
  31433. } else {
  31434. for (v = 0, k = 0; v < height; v++, k += width) {
  31435. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31436. this.extend(rowBuffer, bufferPadding, width);
  31437. this.filter(rowBuffer, bufferPadding, width);
  31438. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31439. }
  31440. }
  31441. let numBuffers = 16;
  31442. const colBuffers = [];
  31443. for (i = 0; i < numBuffers; i++) {
  31444. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31445. }
  31446. let b,
  31447. currentBuffer = 0;
  31448. ll = bufferPadding + height;
  31449. if (height === 1) {
  31450. if ((v0 & 1) !== 0) {
  31451. for (u = 0; u < width; u++) {
  31452. items[u] *= 0.5;
  31453. }
  31454. }
  31455. } else {
  31456. for (u = 0; u < width; u++) {
  31457. if (currentBuffer === 0) {
  31458. numBuffers = Math.min(width - u, numBuffers);
  31459. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31460. for (b = 0; b < numBuffers; b++) {
  31461. colBuffers[b][l] = items[k + b];
  31462. }
  31463. }
  31464. currentBuffer = numBuffers;
  31465. }
  31466. currentBuffer--;
  31467. const buffer = colBuffers[currentBuffer];
  31468. this.extend(buffer, bufferPadding, height);
  31469. this.filter(buffer, bufferPadding, height);
  31470. if (currentBuffer === 0) {
  31471. k = u - numBuffers + 1;
  31472. for (l = bufferPadding; l < ll; k += width, l++) {
  31473. for (b = 0; b < numBuffers; b++) {
  31474. items[k + b] = colBuffers[b][l];
  31475. }
  31476. }
  31477. }
  31478. }
  31479. }
  31480. return {
  31481. width,
  31482. height,
  31483. items
  31484. };
  31485. }
  31486. }
  31487. class IrreversibleTransform extends Transform {
  31488. filter(x, offset, length) {
  31489. const len = length >> 1;
  31490. offset |= 0;
  31491. let j, n, current, next;
  31492. const alpha = -1.586134342059924;
  31493. const beta = -0.052980118572961;
  31494. const gamma = 0.882911075530934;
  31495. const delta = 0.443506852043971;
  31496. const K = 1.230174104914001;
  31497. const K_ = 1 / K;
  31498. j = offset - 3;
  31499. for (n = len + 4; n--; j += 2) {
  31500. x[j] *= K_;
  31501. }
  31502. j = offset - 2;
  31503. current = delta * x[j - 1];
  31504. for (n = len + 3; n--; j += 2) {
  31505. next = delta * x[j + 1];
  31506. x[j] = K * x[j] - current - next;
  31507. if (n--) {
  31508. j += 2;
  31509. current = delta * x[j + 1];
  31510. x[j] = K * x[j] - current - next;
  31511. } else {
  31512. break;
  31513. }
  31514. }
  31515. j = offset - 1;
  31516. current = gamma * x[j - 1];
  31517. for (n = len + 2; n--; j += 2) {
  31518. next = gamma * x[j + 1];
  31519. x[j] -= current + next;
  31520. if (n--) {
  31521. j += 2;
  31522. current = gamma * x[j + 1];
  31523. x[j] -= current + next;
  31524. } else {
  31525. break;
  31526. }
  31527. }
  31528. j = offset;
  31529. current = beta * x[j - 1];
  31530. for (n = len + 1; n--; j += 2) {
  31531. next = beta * x[j + 1];
  31532. x[j] -= current + next;
  31533. if (n--) {
  31534. j += 2;
  31535. current = beta * x[j + 1];
  31536. x[j] -= current + next;
  31537. } else {
  31538. break;
  31539. }
  31540. }
  31541. if (len !== 0) {
  31542. j = offset + 1;
  31543. current = alpha * x[j - 1];
  31544. for (n = len; n--; j += 2) {
  31545. next = alpha * x[j + 1];
  31546. x[j] -= current + next;
  31547. if (n--) {
  31548. j += 2;
  31549. current = alpha * x[j + 1];
  31550. x[j] -= current + next;
  31551. } else {
  31552. break;
  31553. }
  31554. }
  31555. }
  31556. }
  31557. }
  31558. class ReversibleTransform extends Transform {
  31559. filter(x, offset, length) {
  31560. const len = length >> 1;
  31561. offset |= 0;
  31562. let j, n;
  31563. for (j = offset, n = len + 1; n--; j += 2) {
  31564. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  31565. }
  31566. for (j = offset + 1, n = len; n--; j += 2) {
  31567. x[j] += x[j - 1] + x[j + 1] >> 1;
  31568. }
  31569. }
  31570. }
  31571. /***/ }),
  31572. /* 41 */
  31573. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  31574. Object.defineProperty(exports, "__esModule", ({
  31575. value: true
  31576. }));
  31577. exports.LZWStream = void 0;
  31578. var _decode_stream = __w_pdfjs_require__(29);
  31579. class LZWStream extends _decode_stream.DecodeStream {
  31580. constructor(str, maybeLength, earlyChange) {
  31581. super(maybeLength);
  31582. this.str = str;
  31583. this.dict = str.dict;
  31584. this.cachedData = 0;
  31585. this.bitsCached = 0;
  31586. const maxLzwDictionarySize = 4096;
  31587. const lzwState = {
  31588. earlyChange,
  31589. codeLength: 9,
  31590. nextCode: 258,
  31591. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  31592. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  31593. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  31594. currentSequence: new Uint8Array(maxLzwDictionarySize),
  31595. currentSequenceLength: 0
  31596. };
  31597. for (let i = 0; i < 256; ++i) {
  31598. lzwState.dictionaryValues[i] = i;
  31599. lzwState.dictionaryLengths[i] = 1;
  31600. }
  31601. this.lzwState = lzwState;
  31602. }
  31603. readBits(n) {
  31604. let bitsCached = this.bitsCached;
  31605. let cachedData = this.cachedData;
  31606. while (bitsCached < n) {
  31607. const c = this.str.getByte();
  31608. if (c === -1) {
  31609. this.eof = true;
  31610. return null;
  31611. }
  31612. cachedData = cachedData << 8 | c;
  31613. bitsCached += 8;
  31614. }
  31615. this.bitsCached = bitsCached -= n;
  31616. this.cachedData = cachedData;
  31617. this.lastCode = null;
  31618. return cachedData >>> bitsCached & (1 << n) - 1;
  31619. }
  31620. readBlock() {
  31621. const blockSize = 512,
  31622. decodedSizeDelta = blockSize;
  31623. let estimatedDecodedSize = blockSize * 2;
  31624. let i, j, q;
  31625. const lzwState = this.lzwState;
  31626. if (!lzwState) {
  31627. return;
  31628. }
  31629. const earlyChange = lzwState.earlyChange;
  31630. let nextCode = lzwState.nextCode;
  31631. const dictionaryValues = lzwState.dictionaryValues;
  31632. const dictionaryLengths = lzwState.dictionaryLengths;
  31633. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  31634. let codeLength = lzwState.codeLength;
  31635. let prevCode = lzwState.prevCode;
  31636. const currentSequence = lzwState.currentSequence;
  31637. let currentSequenceLength = lzwState.currentSequenceLength;
  31638. let decodedLength = 0;
  31639. let currentBufferLength = this.bufferLength;
  31640. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  31641. for (i = 0; i < blockSize; i++) {
  31642. const code = this.readBits(codeLength);
  31643. const hasPrev = currentSequenceLength > 0;
  31644. if (code < 256) {
  31645. currentSequence[0] = code;
  31646. currentSequenceLength = 1;
  31647. } else if (code >= 258) {
  31648. if (code < nextCode) {
  31649. currentSequenceLength = dictionaryLengths[code];
  31650. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  31651. currentSequence[j] = dictionaryValues[q];
  31652. q = dictionaryPrevCodes[q];
  31653. }
  31654. } else {
  31655. currentSequence[currentSequenceLength++] = currentSequence[0];
  31656. }
  31657. } else if (code === 256) {
  31658. codeLength = 9;
  31659. nextCode = 258;
  31660. currentSequenceLength = 0;
  31661. continue;
  31662. } else {
  31663. this.eof = true;
  31664. delete this.lzwState;
  31665. break;
  31666. }
  31667. if (hasPrev) {
  31668. dictionaryPrevCodes[nextCode] = prevCode;
  31669. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  31670. dictionaryValues[nextCode] = currentSequence[0];
  31671. nextCode++;
  31672. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  31673. }
  31674. prevCode = code;
  31675. decodedLength += currentSequenceLength;
  31676. if (estimatedDecodedSize < decodedLength) {
  31677. do {
  31678. estimatedDecodedSize += decodedSizeDelta;
  31679. } while (estimatedDecodedSize < decodedLength);
  31680. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  31681. }
  31682. for (j = 0; j < currentSequenceLength; j++) {
  31683. buffer[currentBufferLength++] = currentSequence[j];
  31684. }
  31685. }
  31686. lzwState.nextCode = nextCode;
  31687. lzwState.codeLength = codeLength;
  31688. lzwState.prevCode = prevCode;
  31689. lzwState.currentSequenceLength = currentSequenceLength;
  31690. this.bufferLength = currentBufferLength;
  31691. }
  31692. }
  31693. exports.LZWStream = LZWStream;
  31694. /***/ }),
  31695. /* 42 */
  31696. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  31697. Object.defineProperty(exports, "__esModule", ({
  31698. value: true
  31699. }));
  31700. exports.PredictorStream = void 0;
  31701. var _decode_stream = __w_pdfjs_require__(29);
  31702. var _util = __w_pdfjs_require__(2);
  31703. var _primitives = __w_pdfjs_require__(5);
  31704. class PredictorStream extends _decode_stream.DecodeStream {
  31705. constructor(str, maybeLength, params) {
  31706. super(maybeLength);
  31707. if (!(0, _primitives.isDict)(params)) {
  31708. return str;
  31709. }
  31710. const predictor = this.predictor = params.get("Predictor") || 1;
  31711. if (predictor <= 1) {
  31712. return str;
  31713. }
  31714. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  31715. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  31716. }
  31717. if (predictor === 2) {
  31718. this.readBlock = this.readBlockTiff;
  31719. } else {
  31720. this.readBlock = this.readBlockPng;
  31721. }
  31722. this.str = str;
  31723. this.dict = str.dict;
  31724. const colors = this.colors = params.get("Colors") || 1;
  31725. const bits = this.bits = params.get("BitsPerComponent") || 8;
  31726. const columns = this.columns = params.get("Columns") || 1;
  31727. this.pixBytes = colors * bits + 7 >> 3;
  31728. this.rowBytes = columns * colors * bits + 7 >> 3;
  31729. return this;
  31730. }
  31731. readBlockTiff() {
  31732. const rowBytes = this.rowBytes;
  31733. const bufferLength = this.bufferLength;
  31734. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  31735. const bits = this.bits;
  31736. const colors = this.colors;
  31737. const rawBytes = this.str.getBytes(rowBytes);
  31738. this.eof = !rawBytes.length;
  31739. if (this.eof) {
  31740. return;
  31741. }
  31742. let inbuf = 0,
  31743. outbuf = 0;
  31744. let inbits = 0,
  31745. outbits = 0;
  31746. let pos = bufferLength;
  31747. let i;
  31748. if (bits === 1 && colors === 1) {
  31749. for (i = 0; i < rowBytes; ++i) {
  31750. let c = rawBytes[i] ^ inbuf;
  31751. c ^= c >> 1;
  31752. c ^= c >> 2;
  31753. c ^= c >> 4;
  31754. inbuf = (c & 1) << 7;
  31755. buffer[pos++] = c;
  31756. }
  31757. } else if (bits === 8) {
  31758. for (i = 0; i < colors; ++i) {
  31759. buffer[pos++] = rawBytes[i];
  31760. }
  31761. for (; i < rowBytes; ++i) {
  31762. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  31763. pos++;
  31764. }
  31765. } else if (bits === 16) {
  31766. const bytesPerPixel = colors * 2;
  31767. for (i = 0; i < bytesPerPixel; ++i) {
  31768. buffer[pos++] = rawBytes[i];
  31769. }
  31770. for (; i < rowBytes; i += 2) {
  31771. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  31772. buffer[pos++] = sum >> 8 & 0xff;
  31773. buffer[pos++] = sum & 0xff;
  31774. }
  31775. } else {
  31776. const compArray = new Uint8Array(colors + 1);
  31777. const bitMask = (1 << bits) - 1;
  31778. let j = 0,
  31779. k = bufferLength;
  31780. const columns = this.columns;
  31781. for (i = 0; i < columns; ++i) {
  31782. for (let kk = 0; kk < colors; ++kk) {
  31783. if (inbits < bits) {
  31784. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  31785. inbits += 8;
  31786. }
  31787. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  31788. inbits -= bits;
  31789. outbuf = outbuf << bits | compArray[kk];
  31790. outbits += bits;
  31791. if (outbits >= 8) {
  31792. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  31793. outbits -= 8;
  31794. }
  31795. }
  31796. }
  31797. if (outbits > 0) {
  31798. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  31799. }
  31800. }
  31801. this.bufferLength += rowBytes;
  31802. }
  31803. readBlockPng() {
  31804. const rowBytes = this.rowBytes;
  31805. const pixBytes = this.pixBytes;
  31806. const predictor = this.str.getByte();
  31807. const rawBytes = this.str.getBytes(rowBytes);
  31808. this.eof = !rawBytes.length;
  31809. if (this.eof) {
  31810. return;
  31811. }
  31812. const bufferLength = this.bufferLength;
  31813. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  31814. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  31815. if (prevRow.length === 0) {
  31816. prevRow = new Uint8Array(rowBytes);
  31817. }
  31818. let i,
  31819. j = bufferLength,
  31820. up,
  31821. c;
  31822. switch (predictor) {
  31823. case 0:
  31824. for (i = 0; i < rowBytes; ++i) {
  31825. buffer[j++] = rawBytes[i];
  31826. }
  31827. break;
  31828. case 1:
  31829. for (i = 0; i < pixBytes; ++i) {
  31830. buffer[j++] = rawBytes[i];
  31831. }
  31832. for (; i < rowBytes; ++i) {
  31833. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  31834. j++;
  31835. }
  31836. break;
  31837. case 2:
  31838. for (i = 0; i < rowBytes; ++i) {
  31839. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  31840. }
  31841. break;
  31842. case 3:
  31843. for (i = 0; i < pixBytes; ++i) {
  31844. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  31845. }
  31846. for (; i < rowBytes; ++i) {
  31847. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  31848. j++;
  31849. }
  31850. break;
  31851. case 4:
  31852. for (i = 0; i < pixBytes; ++i) {
  31853. up = prevRow[i];
  31854. c = rawBytes[i];
  31855. buffer[j++] = up + c;
  31856. }
  31857. for (; i < rowBytes; ++i) {
  31858. up = prevRow[i];
  31859. const upLeft = prevRow[i - pixBytes];
  31860. const left = buffer[j - pixBytes];
  31861. const p = left + up - upLeft;
  31862. let pa = p - left;
  31863. if (pa < 0) {
  31864. pa = -pa;
  31865. }
  31866. let pb = p - up;
  31867. if (pb < 0) {
  31868. pb = -pb;
  31869. }
  31870. let pc = p - upLeft;
  31871. if (pc < 0) {
  31872. pc = -pc;
  31873. }
  31874. c = rawBytes[i];
  31875. if (pa <= pb && pa <= pc) {
  31876. buffer[j++] = left + c;
  31877. } else if (pb <= pc) {
  31878. buffer[j++] = up + c;
  31879. } else {
  31880. buffer[j++] = upLeft + c;
  31881. }
  31882. }
  31883. break;
  31884. default:
  31885. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  31886. }
  31887. this.bufferLength += rowBytes;
  31888. }
  31889. }
  31890. exports.PredictorStream = PredictorStream;
  31891. /***/ }),
  31892. /* 43 */
  31893. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  31894. Object.defineProperty(exports, "__esModule", ({
  31895. value: true
  31896. }));
  31897. exports.RunLengthStream = void 0;
  31898. var _decode_stream = __w_pdfjs_require__(29);
  31899. class RunLengthStream extends _decode_stream.DecodeStream {
  31900. constructor(str, maybeLength) {
  31901. super(maybeLength);
  31902. this.str = str;
  31903. this.dict = str.dict;
  31904. }
  31905. readBlock() {
  31906. const repeatHeader = this.str.getBytes(2);
  31907. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  31908. this.eof = true;
  31909. return;
  31910. }
  31911. let buffer;
  31912. let bufferLength = this.bufferLength;
  31913. let n = repeatHeader[0];
  31914. if (n < 128) {
  31915. buffer = this.ensureBuffer(bufferLength + n + 1);
  31916. buffer[bufferLength++] = repeatHeader[1];
  31917. if (n > 0) {
  31918. const source = this.str.getBytes(n);
  31919. buffer.set(source, bufferLength);
  31920. bufferLength += n;
  31921. }
  31922. } else {
  31923. n = 257 - n;
  31924. const b = repeatHeader[1];
  31925. buffer = this.ensureBuffer(bufferLength + n + 1);
  31926. for (let i = 0; i < n; i++) {
  31927. buffer[bufferLength++] = b;
  31928. }
  31929. }
  31930. this.bufferLength = bufferLength;
  31931. }
  31932. }
  31933. exports.RunLengthStream = RunLengthStream;
  31934. /***/ }),
  31935. /* 44 */
  31936. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  31937. Object.defineProperty(exports, "__esModule", ({
  31938. value: true
  31939. }));
  31940. exports.Font = exports.ErrorFont = void 0;
  31941. var _util = __w_pdfjs_require__(2);
  31942. var _cff_parser = __w_pdfjs_require__(45);
  31943. var _fonts_utils = __w_pdfjs_require__(18);
  31944. var _glyphlist = __w_pdfjs_require__(20);
  31945. var _encodings = __w_pdfjs_require__(19);
  31946. var _standard_fonts = __w_pdfjs_require__(47);
  31947. var _unicode = __w_pdfjs_require__(21);
  31948. var _to_unicode_map = __w_pdfjs_require__(48);
  31949. var _cff_font = __w_pdfjs_require__(49);
  31950. var _font_renderer = __w_pdfjs_require__(50);
  31951. var _glyf = __w_pdfjs_require__(51);
  31952. var _cmap = __w_pdfjs_require__(26);
  31953. var _opentype_file_builder = __w_pdfjs_require__(52);
  31954. var _core_utils = __w_pdfjs_require__(9);
  31955. var _stream = __w_pdfjs_require__(10);
  31956. var _type1_font = __w_pdfjs_require__(53);
  31957. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  31958. const PDF_GLYPH_SPACE_UNITS = 1000;
  31959. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  31960. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  31961. function adjustWidths(properties) {
  31962. if (!properties.fontMatrix) {
  31963. return;
  31964. }
  31965. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  31966. return;
  31967. }
  31968. const scale = 0.001 / properties.fontMatrix[0];
  31969. const glyphsWidths = properties.widths;
  31970. for (const glyph in glyphsWidths) {
  31971. glyphsWidths[glyph] *= scale;
  31972. }
  31973. properties.defaultWidth *= scale;
  31974. }
  31975. function adjustToUnicode(properties, builtInEncoding) {
  31976. if (properties.isInternalFont) {
  31977. return;
  31978. }
  31979. if (builtInEncoding === properties.defaultEncoding) {
  31980. return;
  31981. }
  31982. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  31983. return;
  31984. }
  31985. const toUnicode = [],
  31986. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  31987. for (const charCode in builtInEncoding) {
  31988. if (properties.hasIncludedToUnicodeMap) {
  31989. if (properties.toUnicode.has(charCode)) {
  31990. continue;
  31991. }
  31992. } else if (properties.hasEncoding) {
  31993. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  31994. continue;
  31995. }
  31996. }
  31997. const glyphName = builtInEncoding[charCode];
  31998. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  31999. if (unicode !== -1) {
  32000. toUnicode[charCode] = String.fromCharCode(unicode);
  32001. }
  32002. }
  32003. if (toUnicode.length > 0) {
  32004. properties.toUnicode.amend(toUnicode);
  32005. }
  32006. }
  32007. function amendFallbackToUnicode(properties) {
  32008. if (!properties.fallbackToUnicode) {
  32009. return;
  32010. }
  32011. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32012. return;
  32013. }
  32014. const toUnicode = [];
  32015. for (const charCode in properties.fallbackToUnicode) {
  32016. if (properties.toUnicode.has(charCode)) {
  32017. continue;
  32018. }
  32019. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  32020. }
  32021. if (toUnicode.length > 0) {
  32022. properties.toUnicode.amend(toUnicode);
  32023. }
  32024. }
  32025. class Glyph {
  32026. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32027. this.originalCharCode = originalCharCode;
  32028. this.fontChar = fontChar;
  32029. this.unicode = unicode;
  32030. this.accent = accent;
  32031. this.width = width;
  32032. this.vmetric = vmetric;
  32033. this.operatorListId = operatorListId;
  32034. this.isSpace = isSpace;
  32035. this.isInFont = isInFont;
  32036. }
  32037. matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32038. return this.originalCharCode === originalCharCode && this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont;
  32039. }
  32040. }
  32041. function int16(b0, b1) {
  32042. return (b0 << 8) + b1;
  32043. }
  32044. function writeSignedInt16(bytes, index, value) {
  32045. bytes[index + 1] = value;
  32046. bytes[index] = value >>> 8;
  32047. }
  32048. function signedInt16(b0, b1) {
  32049. const value = (b0 << 8) + b1;
  32050. return value & 1 << 15 ? value - 0x10000 : value;
  32051. }
  32052. function int32(b0, b1, b2, b3) {
  32053. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  32054. }
  32055. function string16(value) {
  32056. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32057. }
  32058. function safeString16(value) {
  32059. if (value > 0x7fff) {
  32060. value = 0x7fff;
  32061. } else if (value < -0x8000) {
  32062. value = -0x8000;
  32063. }
  32064. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32065. }
  32066. function isTrueTypeFile(file) {
  32067. const header = file.peekBytes(4);
  32068. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  32069. }
  32070. function isTrueTypeCollectionFile(file) {
  32071. const header = file.peekBytes(4);
  32072. return (0, _util.bytesToString)(header) === "ttcf";
  32073. }
  32074. function isOpenTypeFile(file) {
  32075. const header = file.peekBytes(4);
  32076. return (0, _util.bytesToString)(header) === "OTTO";
  32077. }
  32078. function isType1File(file) {
  32079. const header = file.peekBytes(2);
  32080. if (header[0] === 0x25 && header[1] === 0x21) {
  32081. return true;
  32082. }
  32083. if (header[0] === 0x80 && header[1] === 0x01) {
  32084. return true;
  32085. }
  32086. return false;
  32087. }
  32088. function isCFFFile(file) {
  32089. const header = file.peekBytes(4);
  32090. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  32091. return true;
  32092. }
  32093. return false;
  32094. }
  32095. function getFontFileType(file, {
  32096. type,
  32097. subtype,
  32098. composite
  32099. }) {
  32100. let fileType, fileSubtype;
  32101. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  32102. if (composite) {
  32103. fileType = "CIDFontType2";
  32104. } else {
  32105. fileType = "TrueType";
  32106. }
  32107. } else if (isOpenTypeFile(file)) {
  32108. if (composite) {
  32109. fileType = "CIDFontType2";
  32110. } else {
  32111. fileType = "OpenType";
  32112. }
  32113. } else if (isType1File(file)) {
  32114. if (composite) {
  32115. fileType = "CIDFontType0";
  32116. } else {
  32117. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32118. }
  32119. } else if (isCFFFile(file)) {
  32120. if (composite) {
  32121. fileType = "CIDFontType0";
  32122. fileSubtype = "CIDFontType0C";
  32123. } else {
  32124. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32125. fileSubtype = "Type1C";
  32126. }
  32127. } else {
  32128. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  32129. fileType = type;
  32130. fileSubtype = subtype;
  32131. }
  32132. return [fileType, fileSubtype];
  32133. }
  32134. function applyStandardFontGlyphMap(map, glyphMap) {
  32135. for (const charCode in glyphMap) {
  32136. map[+charCode] = glyphMap[charCode];
  32137. }
  32138. }
  32139. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  32140. const toFontChar = [];
  32141. let unicode;
  32142. for (let i = 0, ii = encoding.length; i < ii; i++) {
  32143. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  32144. if (unicode !== -1) {
  32145. toFontChar[i] = unicode;
  32146. }
  32147. }
  32148. for (const charCode in differences) {
  32149. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  32150. if (unicode !== -1) {
  32151. toFontChar[+charCode] = unicode;
  32152. }
  32153. }
  32154. return toFontChar;
  32155. }
  32156. function convertCidString(charCode, cid, shouldThrow = false) {
  32157. switch (cid.length) {
  32158. case 1:
  32159. return cid.charCodeAt(0);
  32160. case 2:
  32161. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  32162. }
  32163. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  32164. if (shouldThrow) {
  32165. throw new _util.FormatError(msg);
  32166. }
  32167. (0, _util.warn)(msg);
  32168. return cid;
  32169. }
  32170. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  32171. const newMap = Object.create(null);
  32172. const toFontChar = [];
  32173. let privateUseAreaIndex = 0;
  32174. let nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32175. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32176. for (let originalCharCode in charCodeToGlyphId) {
  32177. originalCharCode |= 0;
  32178. let glyphId = charCodeToGlyphId[originalCharCode];
  32179. if (!hasGlyph(glyphId)) {
  32180. continue;
  32181. }
  32182. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  32183. privateUseAreaIndex++;
  32184. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  32185. (0, _util.warn)("Ran out of space in font private use area.");
  32186. break;
  32187. }
  32188. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32189. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32190. }
  32191. const fontCharCode = nextAvailableFontCharCode++;
  32192. if (glyphId === 0) {
  32193. glyphId = newGlyphZeroId;
  32194. }
  32195. newMap[fontCharCode] = glyphId;
  32196. toFontChar[originalCharCode] = fontCharCode;
  32197. }
  32198. return {
  32199. toFontChar,
  32200. charCodeToGlyphId: newMap,
  32201. nextAvailableFontCharCode
  32202. };
  32203. }
  32204. function getRanges(glyphs, numGlyphs) {
  32205. const codes = [];
  32206. for (const charCode in glyphs) {
  32207. if (glyphs[charCode] >= numGlyphs) {
  32208. continue;
  32209. }
  32210. codes.push({
  32211. fontCharCode: charCode | 0,
  32212. glyphId: glyphs[charCode]
  32213. });
  32214. }
  32215. if (codes.length === 0) {
  32216. codes.push({
  32217. fontCharCode: 0,
  32218. glyphId: 0
  32219. });
  32220. }
  32221. codes.sort(function fontGetRangesSort(a, b) {
  32222. return a.fontCharCode - b.fontCharCode;
  32223. });
  32224. const ranges = [];
  32225. const length = codes.length;
  32226. for (let n = 0; n < length;) {
  32227. const start = codes[n].fontCharCode;
  32228. const codeIndices = [codes[n].glyphId];
  32229. ++n;
  32230. let end = start;
  32231. while (n < length && end + 1 === codes[n].fontCharCode) {
  32232. codeIndices.push(codes[n].glyphId);
  32233. ++end;
  32234. ++n;
  32235. if (end === 0xffff) {
  32236. break;
  32237. }
  32238. }
  32239. ranges.push([start, end, codeIndices]);
  32240. }
  32241. return ranges;
  32242. }
  32243. function createCmapTable(glyphs, numGlyphs) {
  32244. const ranges = getRanges(glyphs, numGlyphs);
  32245. const numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  32246. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  32247. let i, ii, j, jj;
  32248. for (i = ranges.length - 1; i >= 0; --i) {
  32249. if (ranges[i][0] <= 0xffff) {
  32250. break;
  32251. }
  32252. }
  32253. const bmpLength = i + 1;
  32254. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  32255. ranges[i][1] = 0xfffe;
  32256. }
  32257. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  32258. const segCount = bmpLength + trailingRangesCount;
  32259. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  32260. let startCount = "";
  32261. let endCount = "";
  32262. let idDeltas = "";
  32263. let idRangeOffsets = "";
  32264. let glyphsIds = "";
  32265. let bias = 0;
  32266. let range, start, end, codes;
  32267. for (i = 0, ii = bmpLength; i < ii; i++) {
  32268. range = ranges[i];
  32269. start = range[0];
  32270. end = range[1];
  32271. startCount += string16(start);
  32272. endCount += string16(end);
  32273. codes = range[2];
  32274. let contiguous = true;
  32275. for (j = 1, jj = codes.length; j < jj; ++j) {
  32276. if (codes[j] !== codes[j - 1] + 1) {
  32277. contiguous = false;
  32278. break;
  32279. }
  32280. }
  32281. if (!contiguous) {
  32282. const offset = (segCount - i) * 2 + bias * 2;
  32283. bias += end - start + 1;
  32284. idDeltas += string16(0);
  32285. idRangeOffsets += string16(offset);
  32286. for (j = 0, jj = codes.length; j < jj; ++j) {
  32287. glyphsIds += string16(codes[j]);
  32288. }
  32289. } else {
  32290. const startCode = codes[0];
  32291. idDeltas += string16(startCode - start & 0xffff);
  32292. idRangeOffsets += string16(0);
  32293. }
  32294. }
  32295. if (trailingRangesCount > 0) {
  32296. endCount += "\xFF\xFF";
  32297. startCount += "\xFF\xFF";
  32298. idDeltas += "\x00\x01";
  32299. idRangeOffsets += "\x00\x00";
  32300. }
  32301. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  32302. let format31012 = "";
  32303. let header31012 = "";
  32304. if (numTables > 1) {
  32305. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  32306. format31012 = "";
  32307. for (i = 0, ii = ranges.length; i < ii; i++) {
  32308. range = ranges[i];
  32309. start = range[0];
  32310. codes = range[2];
  32311. let code = codes[0];
  32312. for (j = 1, jj = codes.length; j < jj; ++j) {
  32313. if (codes[j] !== codes[j - 1] + 1) {
  32314. end = range[0] + j - 1;
  32315. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  32316. start = end + 1;
  32317. code = codes[j];
  32318. }
  32319. }
  32320. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  32321. }
  32322. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  32323. }
  32324. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  32325. }
  32326. function validateOS2Table(os2, file) {
  32327. file.pos = (file.start || 0) + os2.offset;
  32328. const version = file.getUint16();
  32329. file.skip(60);
  32330. const selection = file.getUint16();
  32331. if (version < 4 && selection & 0x0300) {
  32332. return false;
  32333. }
  32334. const firstChar = file.getUint16();
  32335. const lastChar = file.getUint16();
  32336. if (firstChar > lastChar) {
  32337. return false;
  32338. }
  32339. file.skip(6);
  32340. const usWinAscent = file.getUint16();
  32341. if (usWinAscent === 0) {
  32342. return false;
  32343. }
  32344. os2.data[8] = os2.data[9] = 0;
  32345. return true;
  32346. }
  32347. function createOS2Table(properties, charstrings, override) {
  32348. override = override || {
  32349. unitsPerEm: 0,
  32350. yMax: 0,
  32351. yMin: 0,
  32352. ascent: 0,
  32353. descent: 0
  32354. };
  32355. let ulUnicodeRange1 = 0;
  32356. let ulUnicodeRange2 = 0;
  32357. let ulUnicodeRange3 = 0;
  32358. let ulUnicodeRange4 = 0;
  32359. let firstCharIndex = null;
  32360. let lastCharIndex = 0;
  32361. if (charstrings) {
  32362. for (let code in charstrings) {
  32363. code |= 0;
  32364. if (firstCharIndex > code || !firstCharIndex) {
  32365. firstCharIndex = code;
  32366. }
  32367. if (lastCharIndex < code) {
  32368. lastCharIndex = code;
  32369. }
  32370. const position = (0, _unicode.getUnicodeRangeFor)(code);
  32371. if (position < 32) {
  32372. ulUnicodeRange1 |= 1 << position;
  32373. } else if (position < 64) {
  32374. ulUnicodeRange2 |= 1 << position - 32;
  32375. } else if (position < 96) {
  32376. ulUnicodeRange3 |= 1 << position - 64;
  32377. } else if (position < 123) {
  32378. ulUnicodeRange4 |= 1 << position - 96;
  32379. } else {
  32380. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  32381. }
  32382. }
  32383. if (lastCharIndex > 0xffff) {
  32384. lastCharIndex = 0xffff;
  32385. }
  32386. } else {
  32387. firstCharIndex = 0;
  32388. lastCharIndex = 255;
  32389. }
  32390. const bbox = properties.bbox || [0, 0, 0, 0];
  32391. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  32392. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  32393. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  32394. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  32395. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  32396. typoDescent = -typoDescent;
  32397. }
  32398. const winAscent = override.yMax || typoAscent;
  32399. const winDescent = -override.yMin || -typoDescent;
  32400. 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";
  32401. }
  32402. function createPostTable(properties) {
  32403. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  32404. return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch ? 1 : 0) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
  32405. }
  32406. function createPostscriptName(name) {
  32407. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  32408. }
  32409. function createNameTable(name, proto) {
  32410. if (!proto) {
  32411. proto = [[], []];
  32412. }
  32413. const 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] || createPostscriptName(name), proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"];
  32414. const stringsUnicode = [];
  32415. let i, ii, j, jj, str;
  32416. for (i = 0, ii = strings.length; i < ii; i++) {
  32417. str = proto[1][i] || strings[i];
  32418. const strBufUnicode = [];
  32419. for (j = 0, jj = str.length; j < jj; j++) {
  32420. strBufUnicode.push(string16(str.charCodeAt(j)));
  32421. }
  32422. stringsUnicode.push(strBufUnicode.join(""));
  32423. }
  32424. const names = [strings, stringsUnicode];
  32425. const platforms = ["\x00\x01", "\x00\x03"];
  32426. const encodings = ["\x00\x00", "\x00\x01"];
  32427. const languages = ["\x00\x00", "\x04\x09"];
  32428. const namesRecordCount = strings.length * platforms.length;
  32429. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  32430. let strOffset = 0;
  32431. for (i = 0, ii = platforms.length; i < ii; i++) {
  32432. const strs = names[i];
  32433. for (j = 0, jj = strs.length; j < jj; j++) {
  32434. str = strs[j];
  32435. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  32436. nameTable += nameRecord;
  32437. strOffset += str.length;
  32438. }
  32439. }
  32440. nameTable += strings.join("") + stringsUnicode.join("");
  32441. return nameTable;
  32442. }
  32443. class Font {
  32444. constructor(name, file, properties) {
  32445. this.name = name;
  32446. this.psName = null;
  32447. this.mimetype = null;
  32448. this.disableFontFace = false;
  32449. this.loadedName = properties.loadedName;
  32450. this.isType3Font = properties.isType3Font;
  32451. this.missingFile = false;
  32452. this.cssFontInfo = properties.cssFontInfo;
  32453. this._charsCache = Object.create(null);
  32454. this._glyphCache = Object.create(null);
  32455. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  32456. if (!isSerifFont && !properties.isSimulatedFlags) {
  32457. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  32458. serifFonts = (0, _standard_fonts.getSerifFonts)();
  32459. for (const namePart of baseName.split("+")) {
  32460. if (serifFonts[namePart]) {
  32461. isSerifFont = true;
  32462. break;
  32463. }
  32464. }
  32465. }
  32466. this.isSerifFont = isSerifFont;
  32467. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  32468. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  32469. let type = properties.type;
  32470. let subtype = properties.subtype;
  32471. this.type = type;
  32472. this.subtype = subtype;
  32473. let fallbackName = "sans-serif";
  32474. if (this.isMonospace) {
  32475. fallbackName = "monospace";
  32476. } else if (this.isSerifFont) {
  32477. fallbackName = "serif";
  32478. }
  32479. this.fallbackName = fallbackName;
  32480. this.differences = properties.differences;
  32481. this.widths = properties.widths;
  32482. this.defaultWidth = properties.defaultWidth;
  32483. this.composite = properties.composite;
  32484. this.cMap = properties.cMap;
  32485. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  32486. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  32487. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  32488. this.lineHeight = this.ascent - this.descent;
  32489. this.fontMatrix = properties.fontMatrix;
  32490. this.bbox = properties.bbox;
  32491. this.defaultEncoding = properties.defaultEncoding;
  32492. this.toUnicode = properties.toUnicode;
  32493. this.toFontChar = [];
  32494. if (properties.type === "Type3") {
  32495. for (let charCode = 0; charCode < 256; charCode++) {
  32496. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  32497. }
  32498. this.fontType = _util.FontType.TYPE3;
  32499. return;
  32500. }
  32501. this.cidEncoding = properties.cidEncoding || "";
  32502. this.vertical = !!properties.vertical;
  32503. if (this.vertical) {
  32504. this.vmetrics = properties.vmetrics;
  32505. this.defaultVMetrics = properties.defaultVMetrics;
  32506. }
  32507. if (!file || file.isEmpty) {
  32508. if (file) {
  32509. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  32510. }
  32511. this.fallbackToSystemFont(properties);
  32512. return;
  32513. }
  32514. [type, subtype] = getFontFileType(file, properties);
  32515. if (type !== this.type || subtype !== this.subtype) {
  32516. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  32517. }
  32518. let data;
  32519. try {
  32520. switch (type) {
  32521. case "MMType1":
  32522. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  32523. case "Type1":
  32524. case "CIDFontType0":
  32525. this.mimetype = "font/opentype";
  32526. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  32527. adjustWidths(properties);
  32528. data = this.convert(name, cff, properties);
  32529. break;
  32530. case "OpenType":
  32531. case "TrueType":
  32532. case "CIDFontType2":
  32533. this.mimetype = "font/opentype";
  32534. data = this.checkAndRepair(name, file, properties);
  32535. if (this.isOpenType) {
  32536. adjustWidths(properties);
  32537. type = "OpenType";
  32538. }
  32539. break;
  32540. default:
  32541. throw new _util.FormatError(`Font ${type} is not supported`);
  32542. }
  32543. } catch (e) {
  32544. (0, _util.warn)(e);
  32545. this.fallbackToSystemFont(properties);
  32546. return;
  32547. }
  32548. amendFallbackToUnicode(properties);
  32549. this.data = data;
  32550. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  32551. this.fontMatrix = properties.fontMatrix;
  32552. this.widths = properties.widths;
  32553. this.defaultWidth = properties.defaultWidth;
  32554. this.toUnicode = properties.toUnicode;
  32555. this.seacMap = properties.seacMap;
  32556. }
  32557. get renderer() {
  32558. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  32559. return (0, _util.shadow)(this, "renderer", renderer);
  32560. }
  32561. exportData(extraProperties = false) {
  32562. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  32563. const data = Object.create(null);
  32564. let property, value;
  32565. for (property of exportDataProperties) {
  32566. value = this[property];
  32567. if (value !== undefined) {
  32568. data[property] = value;
  32569. }
  32570. }
  32571. return data;
  32572. }
  32573. fallbackToSystemFont(properties) {
  32574. this.missingFile = true;
  32575. const name = this.name;
  32576. const type = this.type;
  32577. const subtype = this.subtype;
  32578. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  32579. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  32580. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  32581. const isStandardFont = !!stdFontMap[fontName];
  32582. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  32583. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  32584. this.bold = fontName.search(/bold/gi) !== -1;
  32585. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  32586. this.black = name.search(/Black/g) !== -1;
  32587. const isNarrow = name.search(/Narrow/g) !== -1;
  32588. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  32589. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  32590. const cidToGidMap = properties.cidToGidMap;
  32591. const map = [];
  32592. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  32593. if (/Arial-?Black/i.test(name)) {
  32594. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  32595. } else if (/Calibri/i.test(name)) {
  32596. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  32597. }
  32598. if (cidToGidMap) {
  32599. for (const charCode in map) {
  32600. const cid = map[charCode];
  32601. if (cidToGidMap[cid] !== undefined) {
  32602. map[+charCode] = cidToGidMap[cid];
  32603. }
  32604. }
  32605. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32606. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  32607. const cid = map[charCode];
  32608. if (cidToGidMap[cid] === undefined) {
  32609. map[+charCode] = unicodeCharCode;
  32610. }
  32611. });
  32612. }
  32613. }
  32614. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  32615. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  32616. map[+charCode] = unicodeCharCode;
  32617. });
  32618. }
  32619. this.toFontChar = map;
  32620. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  32621. } else if (/Symbol/i.test(fontName)) {
  32622. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  32623. } else if (/Dingbats/i.test(fontName)) {
  32624. if (/Wingdings/i.test(name)) {
  32625. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  32626. }
  32627. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  32628. } else if (isStandardFont) {
  32629. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  32630. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  32631. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  32632. map[+charCode] = unicodeCharCode;
  32633. });
  32634. }
  32635. this.toFontChar = map;
  32636. } else {
  32637. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  32638. const map = [];
  32639. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  32640. if (!this.composite) {
  32641. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  32642. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  32643. if (unicode !== -1) {
  32644. unicodeCharCode = unicode;
  32645. }
  32646. }
  32647. map[+charCode] = unicodeCharCode;
  32648. });
  32649. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32650. if (/Verdana/i.test(name)) {
  32651. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  32652. }
  32653. }
  32654. this.toFontChar = map;
  32655. }
  32656. amendFallbackToUnicode(properties);
  32657. this.loadedName = fontName.split("-")[0];
  32658. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  32659. }
  32660. checkAndRepair(name, font, properties) {
  32661. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  32662. function readTables(file, numTables) {
  32663. const tables = Object.create(null);
  32664. tables["OS/2"] = null;
  32665. tables.cmap = null;
  32666. tables.head = null;
  32667. tables.hhea = null;
  32668. tables.hmtx = null;
  32669. tables.maxp = null;
  32670. tables.name = null;
  32671. tables.post = null;
  32672. for (let i = 0; i < numTables; i++) {
  32673. const table = readTableEntry(file);
  32674. if (!VALID_TABLES.includes(table.tag)) {
  32675. continue;
  32676. }
  32677. if (table.length === 0) {
  32678. continue;
  32679. }
  32680. tables[table.tag] = table;
  32681. }
  32682. return tables;
  32683. }
  32684. function readTableEntry(file) {
  32685. const tag = file.getString(4);
  32686. const checksum = file.getInt32() >>> 0;
  32687. const offset = file.getInt32() >>> 0;
  32688. const length = file.getInt32() >>> 0;
  32689. const previousPosition = file.pos;
  32690. file.pos = file.start ? file.start : 0;
  32691. file.skip(offset);
  32692. const data = file.getBytes(length);
  32693. file.pos = previousPosition;
  32694. if (tag === "head") {
  32695. data[8] = data[9] = data[10] = data[11] = 0;
  32696. data[17] |= 0x20;
  32697. }
  32698. return {
  32699. tag,
  32700. checksum,
  32701. length,
  32702. offset,
  32703. data
  32704. };
  32705. }
  32706. function readOpenTypeHeader(ttf) {
  32707. return {
  32708. version: ttf.getString(4),
  32709. numTables: ttf.getUint16(),
  32710. searchRange: ttf.getUint16(),
  32711. entrySelector: ttf.getUint16(),
  32712. rangeShift: ttf.getUint16()
  32713. };
  32714. }
  32715. function readTrueTypeCollectionHeader(ttc) {
  32716. const ttcTag = ttc.getString(4);
  32717. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  32718. const majorVersion = ttc.getUint16();
  32719. const minorVersion = ttc.getUint16();
  32720. const numFonts = ttc.getInt32() >>> 0;
  32721. const offsetTable = [];
  32722. for (let i = 0; i < numFonts; i++) {
  32723. offsetTable.push(ttc.getInt32() >>> 0);
  32724. }
  32725. const header = {
  32726. ttcTag,
  32727. majorVersion,
  32728. minorVersion,
  32729. numFonts,
  32730. offsetTable
  32731. };
  32732. switch (majorVersion) {
  32733. case 1:
  32734. return header;
  32735. case 2:
  32736. header.dsigTag = ttc.getInt32() >>> 0;
  32737. header.dsigLength = ttc.getInt32() >>> 0;
  32738. header.dsigOffset = ttc.getInt32() >>> 0;
  32739. return header;
  32740. }
  32741. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  32742. }
  32743. function readTrueTypeCollectionData(ttc, fontName) {
  32744. const {
  32745. numFonts,
  32746. offsetTable
  32747. } = readTrueTypeCollectionHeader(ttc);
  32748. const fontNameParts = fontName.split("+");
  32749. let fallbackData;
  32750. for (let i = 0; i < numFonts; i++) {
  32751. ttc.pos = (ttc.start || 0) + offsetTable[i];
  32752. const potentialHeader = readOpenTypeHeader(ttc);
  32753. const potentialTables = readTables(ttc, potentialHeader.numTables);
  32754. if (!potentialTables.name) {
  32755. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  32756. }
  32757. const nameTable = readNameTable(potentialTables.name);
  32758. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  32759. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  32760. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  32761. if (!nameEntry) {
  32762. continue;
  32763. }
  32764. if (nameEntry === fontName) {
  32765. return {
  32766. header: potentialHeader,
  32767. tables: potentialTables
  32768. };
  32769. }
  32770. if (fontNameParts.length < 2) {
  32771. continue;
  32772. }
  32773. for (const part of fontNameParts) {
  32774. if (nameEntry === part) {
  32775. fallbackData = {
  32776. name: part,
  32777. header: potentialHeader,
  32778. tables: potentialTables
  32779. };
  32780. }
  32781. }
  32782. }
  32783. }
  32784. }
  32785. if (fallbackData) {
  32786. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  32787. return {
  32788. header: fallbackData.header,
  32789. tables: fallbackData.tables
  32790. };
  32791. }
  32792. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  32793. }
  32794. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  32795. if (!cmap) {
  32796. (0, _util.warn)("No cmap table available.");
  32797. return {
  32798. platformId: -1,
  32799. encodingId: -1,
  32800. mappings: [],
  32801. hasShortCmap: false
  32802. };
  32803. }
  32804. let segment;
  32805. let start = (file.start ? file.start : 0) + cmap.offset;
  32806. file.pos = start;
  32807. file.skip(2);
  32808. const numTables = file.getUint16();
  32809. let potentialTable;
  32810. let canBreak = false;
  32811. for (let i = 0; i < numTables; i++) {
  32812. const platformId = file.getUint16();
  32813. const encodingId = file.getUint16();
  32814. const offset = file.getInt32() >>> 0;
  32815. let useTable = false;
  32816. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  32817. continue;
  32818. }
  32819. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  32820. useTable = true;
  32821. } else if (platformId === 1 && encodingId === 0) {
  32822. useTable = true;
  32823. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  32824. useTable = true;
  32825. if (!isSymbolicFont) {
  32826. canBreak = true;
  32827. }
  32828. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  32829. useTable = true;
  32830. let correctlySorted = true;
  32831. if (i < numTables - 1) {
  32832. const nextBytes = file.peekBytes(2),
  32833. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  32834. if (nextPlatformId < platformId) {
  32835. correctlySorted = false;
  32836. }
  32837. }
  32838. if (correctlySorted) {
  32839. canBreak = true;
  32840. }
  32841. }
  32842. if (useTable) {
  32843. potentialTable = {
  32844. platformId,
  32845. encodingId,
  32846. offset
  32847. };
  32848. }
  32849. if (canBreak) {
  32850. break;
  32851. }
  32852. }
  32853. if (potentialTable) {
  32854. file.pos = start + potentialTable.offset;
  32855. }
  32856. if (!potentialTable || file.peekByte() === -1) {
  32857. (0, _util.warn)("Could not find a preferred cmap table.");
  32858. return {
  32859. platformId: -1,
  32860. encodingId: -1,
  32861. mappings: [],
  32862. hasShortCmap: false
  32863. };
  32864. }
  32865. const format = file.getUint16();
  32866. file.skip(2 + 2);
  32867. let hasShortCmap = false;
  32868. const mappings = [];
  32869. let j, glyphId;
  32870. if (format === 0) {
  32871. for (j = 0; j < 256; j++) {
  32872. const index = file.getByte();
  32873. if (!index) {
  32874. continue;
  32875. }
  32876. mappings.push({
  32877. charCode: j,
  32878. glyphId: index
  32879. });
  32880. }
  32881. hasShortCmap = true;
  32882. } else if (format === 4) {
  32883. const segCount = file.getUint16() >> 1;
  32884. file.skip(6);
  32885. const segments = [];
  32886. let segIndex;
  32887. for (segIndex = 0; segIndex < segCount; segIndex++) {
  32888. segments.push({
  32889. end: file.getUint16()
  32890. });
  32891. }
  32892. file.skip(2);
  32893. for (segIndex = 0; segIndex < segCount; segIndex++) {
  32894. segments[segIndex].start = file.getUint16();
  32895. }
  32896. for (segIndex = 0; segIndex < segCount; segIndex++) {
  32897. segments[segIndex].delta = file.getUint16();
  32898. }
  32899. let offsetsCount = 0,
  32900. offsetIndex;
  32901. for (segIndex = 0; segIndex < segCount; segIndex++) {
  32902. segment = segments[segIndex];
  32903. const rangeOffset = file.getUint16();
  32904. if (!rangeOffset) {
  32905. segment.offsetIndex = -1;
  32906. continue;
  32907. }
  32908. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  32909. segment.offsetIndex = offsetIndex;
  32910. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  32911. }
  32912. const offsets = [];
  32913. for (j = 0; j < offsetsCount; j++) {
  32914. offsets.push(file.getUint16());
  32915. }
  32916. for (segIndex = 0; segIndex < segCount; segIndex++) {
  32917. segment = segments[segIndex];
  32918. start = segment.start;
  32919. const end = segment.end;
  32920. const delta = segment.delta;
  32921. offsetIndex = segment.offsetIndex;
  32922. for (j = start; j <= end; j++) {
  32923. if (j === 0xffff) {
  32924. continue;
  32925. }
  32926. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  32927. glyphId = glyphId + delta & 0xffff;
  32928. mappings.push({
  32929. charCode: j,
  32930. glyphId
  32931. });
  32932. }
  32933. }
  32934. } else if (format === 6) {
  32935. const firstCode = file.getUint16();
  32936. const entryCount = file.getUint16();
  32937. for (j = 0; j < entryCount; j++) {
  32938. glyphId = file.getUint16();
  32939. const charCode = firstCode + j;
  32940. mappings.push({
  32941. charCode,
  32942. glyphId
  32943. });
  32944. }
  32945. } else {
  32946. (0, _util.warn)("cmap table has unsupported format: " + format);
  32947. return {
  32948. platformId: -1,
  32949. encodingId: -1,
  32950. mappings: [],
  32951. hasShortCmap: false
  32952. };
  32953. }
  32954. mappings.sort(function (a, b) {
  32955. return a.charCode - b.charCode;
  32956. });
  32957. for (let i = 1; i < mappings.length; i++) {
  32958. if (mappings[i - 1].charCode === mappings[i].charCode) {
  32959. mappings.splice(i, 1);
  32960. i--;
  32961. }
  32962. }
  32963. return {
  32964. platformId: potentialTable.platformId,
  32965. encodingId: potentialTable.encodingId,
  32966. mappings,
  32967. hasShortCmap
  32968. };
  32969. }
  32970. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  32971. if (!header) {
  32972. if (metrics) {
  32973. metrics.data = null;
  32974. }
  32975. return;
  32976. }
  32977. file.pos = (file.start ? file.start : 0) + header.offset;
  32978. file.pos += 4;
  32979. file.pos += 2;
  32980. file.pos += 2;
  32981. file.pos += 2;
  32982. file.pos += 2;
  32983. file.pos += 2;
  32984. file.pos += 2;
  32985. file.pos += 2;
  32986. file.pos += 2;
  32987. file.pos += 2;
  32988. const caretOffset = file.getUint16();
  32989. file.pos += 8;
  32990. file.pos += 2;
  32991. let numOfMetrics = file.getUint16();
  32992. if (caretOffset !== 0) {
  32993. const macStyle = int16(headTable.data[44], headTable.data[45]);
  32994. if (!(macStyle & 2)) {
  32995. header.data[22] = 0;
  32996. header.data[23] = 0;
  32997. }
  32998. }
  32999. if (numOfMetrics > numGlyphs) {
  33000. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  33001. numOfMetrics = numGlyphs;
  33002. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  33003. header.data[35] = numOfMetrics & 0x00ff;
  33004. }
  33005. const numOfSidebearings = numGlyphs - numOfMetrics;
  33006. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  33007. if (numMissing > 0) {
  33008. const entries = new Uint8Array(metrics.length + numMissing * 2);
  33009. entries.set(metrics.data);
  33010. if (dupFirstEntry) {
  33011. entries[metrics.length] = metrics.data[2];
  33012. entries[metrics.length + 1] = metrics.data[3];
  33013. }
  33014. metrics.data = entries;
  33015. }
  33016. }
  33017. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  33018. const glyphProfile = {
  33019. length: 0,
  33020. sizeOfInstructions: 0
  33021. };
  33022. if (sourceEnd - sourceStart <= 12) {
  33023. return glyphProfile;
  33024. }
  33025. const glyf = source.subarray(sourceStart, sourceEnd);
  33026. let contoursCount = signedInt16(glyf[0], glyf[1]);
  33027. if (contoursCount < 0) {
  33028. contoursCount = -1;
  33029. writeSignedInt16(glyf, 0, contoursCount);
  33030. dest.set(glyf, destStart);
  33031. glyphProfile.length = glyf.length;
  33032. return glyphProfile;
  33033. }
  33034. let i,
  33035. j = 10,
  33036. flagsCount = 0;
  33037. for (i = 0; i < contoursCount; i++) {
  33038. const endPoint = glyf[j] << 8 | glyf[j + 1];
  33039. flagsCount = endPoint + 1;
  33040. j += 2;
  33041. }
  33042. const instructionsStart = j;
  33043. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  33044. glyphProfile.sizeOfInstructions = instructionsLength;
  33045. j += 2 + instructionsLength;
  33046. const instructionsEnd = j;
  33047. let coordinatesLength = 0;
  33048. for (i = 0; i < flagsCount; i++) {
  33049. const flag = glyf[j++];
  33050. if (flag & 0xc0) {
  33051. glyf[j - 1] = flag & 0x3f;
  33052. }
  33053. let xLength = 2;
  33054. if (flag & 2) {
  33055. xLength = 1;
  33056. } else if (flag & 16) {
  33057. xLength = 0;
  33058. }
  33059. let yLength = 2;
  33060. if (flag & 4) {
  33061. yLength = 1;
  33062. } else if (flag & 32) {
  33063. yLength = 0;
  33064. }
  33065. const xyLength = xLength + yLength;
  33066. coordinatesLength += xyLength;
  33067. if (flag & 8) {
  33068. const repeat = glyf[j++];
  33069. i += repeat;
  33070. coordinatesLength += repeat * xyLength;
  33071. }
  33072. }
  33073. if (coordinatesLength === 0) {
  33074. return glyphProfile;
  33075. }
  33076. let glyphDataLength = j + coordinatesLength;
  33077. if (glyphDataLength > glyf.length) {
  33078. return glyphProfile;
  33079. }
  33080. if (!hintsValid && instructionsLength > 0) {
  33081. dest.set(glyf.subarray(0, instructionsStart), destStart);
  33082. dest.set([0, 0], destStart + instructionsStart);
  33083. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  33084. glyphDataLength -= instructionsLength;
  33085. if (glyf.length - glyphDataLength > 3) {
  33086. glyphDataLength = glyphDataLength + 3 & ~3;
  33087. }
  33088. glyphProfile.length = glyphDataLength;
  33089. return glyphProfile;
  33090. }
  33091. if (glyf.length - glyphDataLength > 3) {
  33092. glyphDataLength = glyphDataLength + 3 & ~3;
  33093. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  33094. glyphProfile.length = glyphDataLength;
  33095. return glyphProfile;
  33096. }
  33097. dest.set(glyf, destStart);
  33098. glyphProfile.length = glyf.length;
  33099. return glyphProfile;
  33100. }
  33101. function sanitizeHead(head, numGlyphs, locaLength) {
  33102. const data = head.data;
  33103. const version = int32(data[0], data[1], data[2], data[3]);
  33104. if (version >> 16 !== 1) {
  33105. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  33106. data[0] = 0;
  33107. data[1] = 1;
  33108. data[2] = 0;
  33109. data[3] = 0;
  33110. }
  33111. const indexToLocFormat = int16(data[50], data[51]);
  33112. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  33113. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  33114. const numGlyphsPlusOne = numGlyphs + 1;
  33115. if (locaLength === numGlyphsPlusOne << 1) {
  33116. data[50] = 0;
  33117. data[51] = 0;
  33118. } else if (locaLength === numGlyphsPlusOne << 2) {
  33119. data[50] = 0;
  33120. data[51] = 1;
  33121. } else {
  33122. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  33123. }
  33124. }
  33125. }
  33126. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  33127. let itemSize, itemDecode, itemEncode;
  33128. if (isGlyphLocationsLong) {
  33129. itemSize = 4;
  33130. itemDecode = function fontItemDecodeLong(data, offset) {
  33131. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  33132. };
  33133. itemEncode = function fontItemEncodeLong(data, offset, value) {
  33134. data[offset] = value >>> 24 & 0xff;
  33135. data[offset + 1] = value >> 16 & 0xff;
  33136. data[offset + 2] = value >> 8 & 0xff;
  33137. data[offset + 3] = value & 0xff;
  33138. };
  33139. } else {
  33140. itemSize = 2;
  33141. itemDecode = function fontItemDecode(data, offset) {
  33142. return data[offset] << 9 | data[offset + 1] << 1;
  33143. };
  33144. itemEncode = function fontItemEncode(data, offset, value) {
  33145. data[offset] = value >> 9 & 0xff;
  33146. data[offset + 1] = value >> 1 & 0xff;
  33147. };
  33148. }
  33149. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  33150. const locaDataSize = itemSize * (1 + numGlyphsOut);
  33151. const locaData = new Uint8Array(locaDataSize);
  33152. locaData.set(loca.data.subarray(0, locaDataSize));
  33153. loca.data = locaData;
  33154. const oldGlyfData = glyf.data;
  33155. const oldGlyfDataLength = oldGlyfData.length;
  33156. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  33157. let i, j;
  33158. const locaEntries = [];
  33159. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  33160. let offset = itemDecode(locaData, j);
  33161. if (offset > oldGlyfDataLength) {
  33162. offset = oldGlyfDataLength;
  33163. }
  33164. locaEntries.push({
  33165. index: i,
  33166. offset,
  33167. endOffset: 0
  33168. });
  33169. }
  33170. locaEntries.sort((a, b) => {
  33171. return a.offset - b.offset;
  33172. });
  33173. for (i = 0; i < numGlyphs; i++) {
  33174. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  33175. }
  33176. locaEntries.sort((a, b) => {
  33177. return a.index - b.index;
  33178. });
  33179. const missingGlyphs = Object.create(null);
  33180. let writeOffset = 0;
  33181. itemEncode(locaData, 0, writeOffset);
  33182. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  33183. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  33184. const newLength = glyphProfile.length;
  33185. if (newLength === 0) {
  33186. missingGlyphs[i] = true;
  33187. }
  33188. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  33189. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  33190. }
  33191. writeOffset += newLength;
  33192. itemEncode(locaData, j, writeOffset);
  33193. }
  33194. if (writeOffset === 0) {
  33195. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  33196. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  33197. itemEncode(locaData, j, simpleGlyph.length);
  33198. }
  33199. glyf.data = simpleGlyph;
  33200. } else if (dupFirstEntry) {
  33201. const firstEntryLength = itemDecode(locaData, itemSize);
  33202. if (newGlyfData.length > firstEntryLength + writeOffset) {
  33203. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  33204. } else {
  33205. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  33206. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  33207. }
  33208. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  33209. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  33210. } else {
  33211. glyf.data = newGlyfData.subarray(0, writeOffset);
  33212. }
  33213. return {
  33214. missingGlyphs,
  33215. maxSizeOfInstructions
  33216. };
  33217. }
  33218. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  33219. const start = (font.start ? font.start : 0) + post.offset;
  33220. font.pos = start;
  33221. const length = post.length,
  33222. end = start + length;
  33223. const version = font.getInt32();
  33224. font.skip(28);
  33225. let glyphNames;
  33226. let valid = true;
  33227. let i;
  33228. switch (version) {
  33229. case 0x00010000:
  33230. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  33231. break;
  33232. case 0x00020000:
  33233. const numGlyphs = font.getUint16();
  33234. if (numGlyphs !== maxpNumGlyphs) {
  33235. valid = false;
  33236. break;
  33237. }
  33238. const glyphNameIndexes = [];
  33239. for (i = 0; i < numGlyphs; ++i) {
  33240. const index = font.getUint16();
  33241. if (index >= 32768) {
  33242. valid = false;
  33243. break;
  33244. }
  33245. glyphNameIndexes.push(index);
  33246. }
  33247. if (!valid) {
  33248. break;
  33249. }
  33250. const customNames = [],
  33251. strBuf = [];
  33252. while (font.pos < end) {
  33253. const stringLength = font.getByte();
  33254. strBuf.length = stringLength;
  33255. for (i = 0; i < stringLength; ++i) {
  33256. strBuf[i] = String.fromCharCode(font.getByte());
  33257. }
  33258. customNames.push(strBuf.join(""));
  33259. }
  33260. glyphNames = [];
  33261. for (i = 0; i < numGlyphs; ++i) {
  33262. const j = glyphNameIndexes[i];
  33263. if (j < 258) {
  33264. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  33265. continue;
  33266. }
  33267. glyphNames.push(customNames[j - 258]);
  33268. }
  33269. break;
  33270. case 0x00030000:
  33271. break;
  33272. default:
  33273. (0, _util.warn)("Unknown/unsupported post table version " + version);
  33274. valid = false;
  33275. if (propertiesObj.defaultEncoding) {
  33276. glyphNames = propertiesObj.defaultEncoding;
  33277. }
  33278. break;
  33279. }
  33280. propertiesObj.glyphNames = glyphNames;
  33281. return valid;
  33282. }
  33283. function readNameTable(nameTable) {
  33284. const start = (font.start ? font.start : 0) + nameTable.offset;
  33285. font.pos = start;
  33286. const names = [[], []];
  33287. const length = nameTable.length,
  33288. end = start + length;
  33289. const format = font.getUint16();
  33290. const FORMAT_0_HEADER_LENGTH = 6;
  33291. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  33292. return names;
  33293. }
  33294. const numRecords = font.getUint16();
  33295. const stringsStart = font.getUint16();
  33296. const records = [];
  33297. const NAME_RECORD_LENGTH = 12;
  33298. let i, ii;
  33299. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  33300. const r = {
  33301. platform: font.getUint16(),
  33302. encoding: font.getUint16(),
  33303. language: font.getUint16(),
  33304. name: font.getUint16(),
  33305. length: font.getUint16(),
  33306. offset: font.getUint16()
  33307. };
  33308. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  33309. records.push(r);
  33310. }
  33311. }
  33312. for (i = 0, ii = records.length; i < ii; i++) {
  33313. const record = records[i];
  33314. if (record.length <= 0) {
  33315. continue;
  33316. }
  33317. const pos = start + stringsStart + record.offset;
  33318. if (pos + record.length > end) {
  33319. continue;
  33320. }
  33321. font.pos = pos;
  33322. const nameIndex = record.name;
  33323. if (record.encoding) {
  33324. let str = "";
  33325. for (let j = 0, jj = record.length; j < jj; j += 2) {
  33326. str += String.fromCharCode(font.getUint16());
  33327. }
  33328. names[1][nameIndex] = str;
  33329. } else {
  33330. names[0][nameIndex] = font.getString(record.length);
  33331. }
  33332. }
  33333. return names;
  33334. }
  33335. const 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];
  33336. function sanitizeTTProgram(table, ttContext) {
  33337. let data = table.data;
  33338. let i = 0,
  33339. j,
  33340. n,
  33341. b,
  33342. funcId,
  33343. pc,
  33344. lastEndf = 0,
  33345. lastDeff = 0;
  33346. const stack = [];
  33347. const callstack = [];
  33348. const functionsCalled = [];
  33349. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  33350. let inFDEF = false,
  33351. ifLevel = 0,
  33352. inELSE = 0;
  33353. for (let ii = data.length; i < ii;) {
  33354. const op = data[i++];
  33355. if (op === 0x40) {
  33356. n = data[i++];
  33357. if (inFDEF || inELSE) {
  33358. i += n;
  33359. } else {
  33360. for (j = 0; j < n; j++) {
  33361. stack.push(data[i++]);
  33362. }
  33363. }
  33364. } else if (op === 0x41) {
  33365. n = data[i++];
  33366. if (inFDEF || inELSE) {
  33367. i += n * 2;
  33368. } else {
  33369. for (j = 0; j < n; j++) {
  33370. b = data[i++];
  33371. stack.push(b << 8 | data[i++]);
  33372. }
  33373. }
  33374. } else if ((op & 0xf8) === 0xb0) {
  33375. n = op - 0xb0 + 1;
  33376. if (inFDEF || inELSE) {
  33377. i += n;
  33378. } else {
  33379. for (j = 0; j < n; j++) {
  33380. stack.push(data[i++]);
  33381. }
  33382. }
  33383. } else if ((op & 0xf8) === 0xb8) {
  33384. n = op - 0xb8 + 1;
  33385. if (inFDEF || inELSE) {
  33386. i += n * 2;
  33387. } else {
  33388. for (j = 0; j < n; j++) {
  33389. b = data[i++];
  33390. stack.push(b << 8 | data[i++]);
  33391. }
  33392. }
  33393. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  33394. if (!inFDEF && !inELSE) {
  33395. funcId = stack[stack.length - 1];
  33396. if (isNaN(funcId)) {
  33397. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  33398. } else {
  33399. ttContext.functionsUsed[funcId] = true;
  33400. if (funcId in ttContext.functionsStackDeltas) {
  33401. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  33402. if (newStackLength < 0) {
  33403. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  33404. ttContext.hintsValid = false;
  33405. return;
  33406. }
  33407. stack.length = newStackLength;
  33408. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  33409. callstack.push({
  33410. data,
  33411. i,
  33412. stackTop: stack.length - 1
  33413. });
  33414. functionsCalled.push(funcId);
  33415. pc = ttContext.functionsDefined[funcId];
  33416. if (!pc) {
  33417. (0, _util.warn)("TT: CALL non-existent function");
  33418. ttContext.hintsValid = false;
  33419. return;
  33420. }
  33421. data = pc.data;
  33422. i = pc.i;
  33423. }
  33424. }
  33425. }
  33426. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  33427. if (inFDEF || inELSE) {
  33428. (0, _util.warn)("TT: nested FDEFs not allowed");
  33429. tooComplexToFollowFunctions = true;
  33430. }
  33431. inFDEF = true;
  33432. lastDeff = i;
  33433. funcId = stack.pop();
  33434. ttContext.functionsDefined[funcId] = {
  33435. data,
  33436. i
  33437. };
  33438. } else if (op === 0x2d) {
  33439. if (inFDEF) {
  33440. inFDEF = false;
  33441. lastEndf = i;
  33442. } else {
  33443. pc = callstack.pop();
  33444. if (!pc) {
  33445. (0, _util.warn)("TT: ENDF bad stack");
  33446. ttContext.hintsValid = false;
  33447. return;
  33448. }
  33449. funcId = functionsCalled.pop();
  33450. data = pc.data;
  33451. i = pc.i;
  33452. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  33453. }
  33454. } else if (op === 0x89) {
  33455. if (inFDEF || inELSE) {
  33456. (0, _util.warn)("TT: nested IDEFs not allowed");
  33457. tooComplexToFollowFunctions = true;
  33458. }
  33459. inFDEF = true;
  33460. lastDeff = i;
  33461. } else if (op === 0x58) {
  33462. ++ifLevel;
  33463. } else if (op === 0x1b) {
  33464. inELSE = ifLevel;
  33465. } else if (op === 0x59) {
  33466. if (inELSE === ifLevel) {
  33467. inELSE = 0;
  33468. }
  33469. --ifLevel;
  33470. } else if (op === 0x1c) {
  33471. if (!inFDEF && !inELSE) {
  33472. const offset = stack[stack.length - 1];
  33473. if (offset > 0) {
  33474. i += offset - 1;
  33475. }
  33476. }
  33477. }
  33478. if (!inFDEF && !inELSE) {
  33479. let stackDelta = 0;
  33480. if (op <= 0x8e) {
  33481. stackDelta = TTOpsStackDeltas[op];
  33482. } else if (op >= 0xc0 && op <= 0xdf) {
  33483. stackDelta = -1;
  33484. } else if (op >= 0xe0) {
  33485. stackDelta = -2;
  33486. }
  33487. if (op >= 0x71 && op <= 0x75) {
  33488. n = stack.pop();
  33489. if (!isNaN(n)) {
  33490. stackDelta = -n * 2;
  33491. }
  33492. }
  33493. while (stackDelta < 0 && stack.length > 0) {
  33494. stack.pop();
  33495. stackDelta++;
  33496. }
  33497. while (stackDelta > 0) {
  33498. stack.push(NaN);
  33499. stackDelta--;
  33500. }
  33501. }
  33502. }
  33503. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  33504. const content = [data];
  33505. if (i > data.length) {
  33506. content.push(new Uint8Array(i - data.length));
  33507. }
  33508. if (lastDeff > lastEndf) {
  33509. (0, _util.warn)("TT: complementing a missing function tail");
  33510. content.push(new Uint8Array([0x22, 0x2d]));
  33511. }
  33512. foldTTTable(table, content);
  33513. }
  33514. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  33515. if (ttContext.tooComplexToFollowFunctions) {
  33516. return;
  33517. }
  33518. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  33519. (0, _util.warn)("TT: more functions defined than expected");
  33520. ttContext.hintsValid = false;
  33521. return;
  33522. }
  33523. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  33524. if (j > maxFunctionDefs) {
  33525. (0, _util.warn)("TT: invalid function id: " + j);
  33526. ttContext.hintsValid = false;
  33527. return;
  33528. }
  33529. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  33530. (0, _util.warn)("TT: undefined function: " + j);
  33531. ttContext.hintsValid = false;
  33532. return;
  33533. }
  33534. }
  33535. }
  33536. function foldTTTable(table, content) {
  33537. if (content.length > 1) {
  33538. let newLength = 0;
  33539. let j, jj;
  33540. for (j = 0, jj = content.length; j < jj; j++) {
  33541. newLength += content[j].length;
  33542. }
  33543. newLength = newLength + 3 & ~3;
  33544. const result = new Uint8Array(newLength);
  33545. let pos = 0;
  33546. for (j = 0, jj = content.length; j < jj; j++) {
  33547. result.set(content[j], pos);
  33548. pos += content[j].length;
  33549. }
  33550. table.data = result;
  33551. table.length = newLength;
  33552. }
  33553. }
  33554. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  33555. const ttContext = {
  33556. functionsDefined: [],
  33557. functionsUsed: [],
  33558. functionsStackDeltas: [],
  33559. tooComplexToFollowFunctions: false,
  33560. hintsValid: true
  33561. };
  33562. if (fpgm) {
  33563. sanitizeTTProgram(fpgm, ttContext);
  33564. }
  33565. if (prep) {
  33566. sanitizeTTProgram(prep, ttContext);
  33567. }
  33568. if (fpgm) {
  33569. checkInvalidFunctions(ttContext, maxFunctionDefs);
  33570. }
  33571. if (cvt && cvt.length & 1) {
  33572. const cvtData = new Uint8Array(cvt.length + 1);
  33573. cvtData.set(cvt.data);
  33574. cvt.data = cvtData;
  33575. }
  33576. return ttContext.hintsValid;
  33577. }
  33578. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  33579. let header, tables;
  33580. if (isTrueTypeCollectionFile(font)) {
  33581. const ttcData = readTrueTypeCollectionData(font, this.name);
  33582. header = ttcData.header;
  33583. tables = ttcData.tables;
  33584. } else {
  33585. header = readOpenTypeHeader(font);
  33586. tables = readTables(font, header.numTables);
  33587. }
  33588. let cff, cffFile;
  33589. const isTrueType = !tables["CFF "];
  33590. if (!isTrueType) {
  33591. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  33592. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  33593. cffFile = new _stream.Stream(tables["CFF "].data);
  33594. cff = new _cff_font.CFFFont(cffFile, properties);
  33595. adjustWidths(properties);
  33596. return this.convert(name, cff, properties);
  33597. }
  33598. delete tables.glyf;
  33599. delete tables.loca;
  33600. delete tables.fpgm;
  33601. delete tables.prep;
  33602. delete tables["cvt "];
  33603. this.isOpenType = true;
  33604. } else {
  33605. if (!tables.loca) {
  33606. throw new _util.FormatError('Required "loca" table is not found');
  33607. }
  33608. if (!tables.glyf) {
  33609. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  33610. tables.glyf = {
  33611. tag: "glyf",
  33612. data: new Uint8Array(0)
  33613. };
  33614. }
  33615. this.isOpenType = false;
  33616. }
  33617. if (!tables.maxp) {
  33618. throw new _util.FormatError('Required "maxp" table is not found');
  33619. }
  33620. font.pos = (font.start || 0) + tables.maxp.offset;
  33621. const version = font.getInt32();
  33622. const numGlyphs = font.getUint16();
  33623. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  33624. const {
  33625. scaleFactors
  33626. } = properties;
  33627. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  33628. const glyphs = new _glyf.GlyfTable({
  33629. glyfTable: tables.glyf.data,
  33630. isGlyphLocationsLong,
  33631. locaTable: tables.loca.data,
  33632. numGlyphs
  33633. });
  33634. glyphs.scale(scaleFactors);
  33635. const {
  33636. glyf,
  33637. loca,
  33638. isLocationLong
  33639. } = glyphs.write();
  33640. tables.glyf.data = glyf;
  33641. tables.loca.data = loca;
  33642. if (isLocationLong !== !!isGlyphLocationsLong) {
  33643. tables.head.data[50] = 0;
  33644. tables.head.data[51] = isLocationLong ? 1 : 0;
  33645. }
  33646. const metrics = tables.hmtx.data;
  33647. for (let i = 0; i < numGlyphs; i++) {
  33648. const j = 4 * i;
  33649. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  33650. metrics[j] = advanceWidth >> 8 & 0xff;
  33651. metrics[j + 1] = advanceWidth & 0xff;
  33652. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  33653. writeSignedInt16(metrics, j + 2, lsb);
  33654. }
  33655. }
  33656. let numGlyphsOut = numGlyphs + 1;
  33657. let dupFirstEntry = true;
  33658. if (numGlyphsOut > 0xffff) {
  33659. dupFirstEntry = false;
  33660. numGlyphsOut = numGlyphs;
  33661. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  33662. }
  33663. let maxFunctionDefs = 0;
  33664. let maxSizeOfInstructions = 0;
  33665. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  33666. font.pos += 8;
  33667. const maxZones = font.getUint16();
  33668. if (maxZones > 2) {
  33669. tables.maxp.data[14] = 0;
  33670. tables.maxp.data[15] = 2;
  33671. }
  33672. font.pos += 4;
  33673. maxFunctionDefs = font.getUint16();
  33674. font.pos += 4;
  33675. maxSizeOfInstructions = font.getUint16();
  33676. }
  33677. tables.maxp.data[4] = numGlyphsOut >> 8;
  33678. tables.maxp.data[5] = numGlyphsOut & 255;
  33679. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  33680. if (!hintsValid) {
  33681. delete tables.fpgm;
  33682. delete tables.prep;
  33683. delete tables["cvt "];
  33684. }
  33685. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  33686. if (!tables.head) {
  33687. throw new _util.FormatError('Required "head" table is not found');
  33688. }
  33689. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  33690. let missingGlyphs = Object.create(null);
  33691. if (isTrueType) {
  33692. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  33693. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  33694. missingGlyphs = glyphsInfo.missingGlyphs;
  33695. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  33696. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  33697. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  33698. }
  33699. }
  33700. if (!tables.hhea) {
  33701. throw new _util.FormatError('Required "hhea" table is not found');
  33702. }
  33703. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  33704. tables.hhea.data[10] = 0xff;
  33705. tables.hhea.data[11] = 0xff;
  33706. }
  33707. const metricsOverride = {
  33708. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  33709. yMax: int16(tables.head.data[42], tables.head.data[43]),
  33710. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  33711. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  33712. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  33713. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  33714. };
  33715. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  33716. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  33717. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  33718. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  33719. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  33720. this.lineGap = this.cssFontInfo.metrics.lineGap;
  33721. } else {
  33722. this.lineHeight = this.ascent - this.descent + this.lineGap;
  33723. }
  33724. if (tables.post) {
  33725. readPostScriptTable(tables.post, properties, numGlyphs);
  33726. }
  33727. tables.post = {
  33728. tag: "post",
  33729. data: createPostTable(properties)
  33730. };
  33731. const charCodeToGlyphId = [];
  33732. function hasGlyph(glyphId) {
  33733. return !missingGlyphs[glyphId];
  33734. }
  33735. if (properties.composite) {
  33736. const cidToGidMap = properties.cidToGidMap || [];
  33737. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  33738. properties.cMap.forEach(function (charCode, cid) {
  33739. if (typeof cid === "string") {
  33740. cid = convertCidString(charCode, cid, true);
  33741. }
  33742. if (cid > 0xffff) {
  33743. throw new _util.FormatError("Max size of CID is 65,535");
  33744. }
  33745. let glyphId = -1;
  33746. if (isCidToGidMapEmpty) {
  33747. glyphId = cid;
  33748. } else if (cidToGidMap[cid] !== undefined) {
  33749. glyphId = cidToGidMap[cid];
  33750. }
  33751. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  33752. charCodeToGlyphId[charCode] = glyphId;
  33753. }
  33754. });
  33755. } else {
  33756. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  33757. const cmapPlatformId = cmapTable.platformId;
  33758. const cmapEncodingId = cmapTable.encodingId;
  33759. const cmapMappings = cmapTable.mappings;
  33760. const cmapMappingsLength = cmapMappings.length;
  33761. let baseEncoding = [],
  33762. forcePostTable = false;
  33763. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  33764. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  33765. }
  33766. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  33767. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  33768. for (let charCode = 0; charCode < 256; charCode++) {
  33769. let glyphName;
  33770. if (this.differences[charCode] !== undefined) {
  33771. glyphName = this.differences[charCode];
  33772. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  33773. glyphName = baseEncoding[charCode];
  33774. } else {
  33775. glyphName = _encodings.StandardEncoding[charCode];
  33776. }
  33777. if (!glyphName) {
  33778. continue;
  33779. }
  33780. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  33781. let unicodeOrCharCode;
  33782. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  33783. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  33784. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  33785. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  33786. }
  33787. if (unicodeOrCharCode === undefined) {
  33788. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  33789. const unicode = this.toUnicode.get(charCode);
  33790. if (unicode) {
  33791. unicodeOrCharCode = unicode.codePointAt(0);
  33792. }
  33793. }
  33794. if (unicodeOrCharCode === undefined) {
  33795. continue;
  33796. }
  33797. }
  33798. for (let i = 0; i < cmapMappingsLength; ++i) {
  33799. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  33800. continue;
  33801. }
  33802. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  33803. break;
  33804. }
  33805. }
  33806. } else if (cmapPlatformId === 0) {
  33807. for (let i = 0; i < cmapMappingsLength; ++i) {
  33808. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  33809. }
  33810. forcePostTable = true;
  33811. } else {
  33812. for (let i = 0; i < cmapMappingsLength; ++i) {
  33813. let charCode = cmapMappings[i].charCode;
  33814. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  33815. charCode &= 0xff;
  33816. }
  33817. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  33818. }
  33819. }
  33820. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  33821. for (let i = 0; i < 256; ++i) {
  33822. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  33823. continue;
  33824. }
  33825. const glyphName = this.differences[i] || baseEncoding[i];
  33826. if (!glyphName) {
  33827. continue;
  33828. }
  33829. const glyphId = properties.glyphNames.indexOf(glyphName);
  33830. if (glyphId > 0 && hasGlyph(glyphId)) {
  33831. charCodeToGlyphId[i] = glyphId;
  33832. }
  33833. }
  33834. }
  33835. }
  33836. if (charCodeToGlyphId.length === 0) {
  33837. charCodeToGlyphId[0] = 0;
  33838. }
  33839. let glyphZeroId = numGlyphsOut - 1;
  33840. if (!dupFirstEntry) {
  33841. glyphZeroId = 0;
  33842. }
  33843. if (!properties.cssFontInfo) {
  33844. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  33845. this.toFontChar = newMapping.toFontChar;
  33846. tables.cmap = {
  33847. tag: "cmap",
  33848. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  33849. };
  33850. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  33851. tables["OS/2"] = {
  33852. tag: "OS/2",
  33853. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  33854. };
  33855. }
  33856. }
  33857. if (!isTrueType) {
  33858. try {
  33859. cffFile = new _stream.Stream(tables["CFF "].data);
  33860. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  33861. cff = parser.parse();
  33862. cff.duplicateFirstGlyph();
  33863. const compiler = new _cff_parser.CFFCompiler(cff);
  33864. tables["CFF "].data = compiler.compile();
  33865. } catch (e) {
  33866. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  33867. }
  33868. }
  33869. if (!tables.name) {
  33870. tables.name = {
  33871. tag: "name",
  33872. data: createNameTable(this.name)
  33873. };
  33874. } else {
  33875. const namePrototype = readNameTable(tables.name);
  33876. tables.name.data = createNameTable(name, namePrototype);
  33877. this.psName = namePrototype[0][6] || null;
  33878. }
  33879. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  33880. for (const tableTag in tables) {
  33881. builder.addTable(tableTag, tables[tableTag].data);
  33882. }
  33883. return builder.toArray();
  33884. }
  33885. convert(fontName, font, properties) {
  33886. properties.fixedPitch = false;
  33887. if (properties.builtInEncoding) {
  33888. adjustToUnicode(properties, properties.builtInEncoding);
  33889. }
  33890. let glyphZeroId = 1;
  33891. if (font instanceof _cff_font.CFFFont) {
  33892. glyphZeroId = font.numGlyphs - 1;
  33893. }
  33894. const mapping = font.getGlyphMapping(properties);
  33895. let newMapping = null;
  33896. let newCharCodeToGlyphId = mapping;
  33897. if (!properties.cssFontInfo) {
  33898. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  33899. this.toFontChar = newMapping.toFontChar;
  33900. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  33901. }
  33902. const numGlyphs = font.numGlyphs;
  33903. function getCharCodes(charCodeToGlyphId, glyphId) {
  33904. let charCodes = null;
  33905. for (const charCode in charCodeToGlyphId) {
  33906. if (glyphId === charCodeToGlyphId[charCode]) {
  33907. if (!charCodes) {
  33908. charCodes = [];
  33909. }
  33910. charCodes.push(charCode | 0);
  33911. }
  33912. }
  33913. return charCodes;
  33914. }
  33915. function createCharCode(charCodeToGlyphId, glyphId) {
  33916. for (const charCode in charCodeToGlyphId) {
  33917. if (glyphId === charCodeToGlyphId[charCode]) {
  33918. return charCode | 0;
  33919. }
  33920. }
  33921. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  33922. return newMapping.nextAvailableFontCharCode++;
  33923. }
  33924. const seacs = font.seacs;
  33925. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  33926. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  33927. const charset = font.getCharset();
  33928. const seacMap = Object.create(null);
  33929. for (let glyphId in seacs) {
  33930. glyphId |= 0;
  33931. const seac = seacs[glyphId];
  33932. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  33933. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  33934. const baseGlyphId = charset.indexOf(baseGlyphName);
  33935. const accentGlyphId = charset.indexOf(accentGlyphName);
  33936. if (baseGlyphId < 0 || accentGlyphId < 0) {
  33937. continue;
  33938. }
  33939. const accentOffset = {
  33940. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  33941. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  33942. };
  33943. const charCodes = getCharCodes(mapping, glyphId);
  33944. if (!charCodes) {
  33945. continue;
  33946. }
  33947. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  33948. const charCode = charCodes[i];
  33949. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  33950. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  33951. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  33952. seacMap[charCode] = {
  33953. baseFontCharCode,
  33954. accentFontCharCode,
  33955. accentOffset
  33956. };
  33957. }
  33958. }
  33959. properties.seacMap = seacMap;
  33960. }
  33961. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  33962. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  33963. builder.addTable("CFF ", font.data);
  33964. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  33965. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, numGlyphs));
  33966. 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");
  33967. 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));
  33968. builder.addTable("hmtx", function fontFieldsHmtx() {
  33969. const charstrings = font.charstrings;
  33970. const cffWidths = font.cff ? font.cff.widths : null;
  33971. let hmtx = "\x00\x00\x00\x00";
  33972. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  33973. let width = 0;
  33974. if (charstrings) {
  33975. const charstring = charstrings[i - 1];
  33976. width = "width" in charstring ? charstring.width : 0;
  33977. } else if (cffWidths) {
  33978. width = Math.ceil(cffWidths[i] || 0);
  33979. }
  33980. hmtx += string16(width) + string16(0);
  33981. }
  33982. return hmtx;
  33983. }());
  33984. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  33985. builder.addTable("name", createNameTable(fontName));
  33986. builder.addTable("post", createPostTable(properties));
  33987. return builder.toArray();
  33988. }
  33989. get spaceWidth() {
  33990. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  33991. let width;
  33992. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  33993. const glyphName = possibleSpaceReplacements[i];
  33994. if (glyphName in this.widths) {
  33995. width = this.widths[glyphName];
  33996. break;
  33997. }
  33998. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  33999. const glyphUnicode = glyphsUnicodeMap[glyphName];
  34000. let charcode = 0;
  34001. if (this.composite && this.cMap.contains(glyphUnicode)) {
  34002. charcode = this.cMap.lookup(glyphUnicode);
  34003. if (typeof charcode === "string") {
  34004. charcode = convertCidString(glyphUnicode, charcode);
  34005. }
  34006. }
  34007. if (!charcode && this.toUnicode) {
  34008. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  34009. }
  34010. if (charcode <= 0) {
  34011. charcode = glyphUnicode;
  34012. }
  34013. width = this.widths[charcode];
  34014. if (width) {
  34015. break;
  34016. }
  34017. }
  34018. width = width || this.defaultWidth;
  34019. return (0, _util.shadow)(this, "spaceWidth", width);
  34020. }
  34021. _charToGlyph(charcode, isSpace = false) {
  34022. let fontCharCode, width, operatorListId;
  34023. let widthCode = charcode;
  34024. if (this.cMap && this.cMap.contains(charcode)) {
  34025. widthCode = this.cMap.lookup(charcode);
  34026. if (typeof widthCode === "string") {
  34027. widthCode = convertCidString(charcode, widthCode);
  34028. }
  34029. }
  34030. width = this.widths[widthCode];
  34031. width = (0, _util.isNum)(width) ? width : this.defaultWidth;
  34032. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  34033. let unicode = this.toUnicode.get(charcode) || charcode;
  34034. if (typeof unicode === "number") {
  34035. unicode = String.fromCharCode(unicode);
  34036. }
  34037. let isInFont = this.toFontChar[charcode] !== undefined;
  34038. fontCharCode = this.toFontChar[charcode] || charcode;
  34039. if (this.missingFile) {
  34040. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  34041. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  34042. fontCharCode = 0x20;
  34043. }
  34044. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  34045. }
  34046. if (this.isType3Font) {
  34047. operatorListId = fontCharCode;
  34048. }
  34049. let accent = null;
  34050. if (this.seacMap && this.seacMap[charcode]) {
  34051. isInFont = true;
  34052. const seac = this.seacMap[charcode];
  34053. fontCharCode = seac.baseFontCharCode;
  34054. accent = {
  34055. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  34056. offset: seac.accentOffset
  34057. };
  34058. }
  34059. let fontChar = "";
  34060. if (typeof fontCharCode === "number") {
  34061. if (fontCharCode <= 0x10ffff) {
  34062. fontChar = String.fromCodePoint(fontCharCode);
  34063. } else {
  34064. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  34065. }
  34066. }
  34067. let glyph = this._glyphCache[charcode];
  34068. if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  34069. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  34070. this._glyphCache[charcode] = glyph;
  34071. }
  34072. return glyph;
  34073. }
  34074. charsToGlyphs(chars) {
  34075. let glyphs = this._charsCache[chars];
  34076. if (glyphs) {
  34077. return glyphs;
  34078. }
  34079. glyphs = [];
  34080. if (this.cMap) {
  34081. const c = Object.create(null),
  34082. ii = chars.length;
  34083. let i = 0;
  34084. while (i < ii) {
  34085. this.cMap.readCharCode(chars, i, c);
  34086. const {
  34087. charcode,
  34088. length
  34089. } = c;
  34090. i += length;
  34091. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  34092. glyphs.push(glyph);
  34093. }
  34094. } else {
  34095. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34096. const charcode = chars.charCodeAt(i);
  34097. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  34098. glyphs.push(glyph);
  34099. }
  34100. }
  34101. return this._charsCache[chars] = glyphs;
  34102. }
  34103. getCharPositions(chars) {
  34104. const positions = [];
  34105. if (this.cMap) {
  34106. const c = Object.create(null);
  34107. let i = 0;
  34108. while (i < chars.length) {
  34109. this.cMap.readCharCode(chars, i, c);
  34110. const length = c.length;
  34111. positions.push([i, i + length]);
  34112. i += length;
  34113. }
  34114. } else {
  34115. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34116. positions.push([i, i + 1]);
  34117. }
  34118. }
  34119. return positions;
  34120. }
  34121. get glyphCacheValues() {
  34122. return Object.values(this._glyphCache);
  34123. }
  34124. encodeString(str) {
  34125. const buffers = [];
  34126. const currentBuf = [];
  34127. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  34128. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  34129. for (let i = 0, ii = str.length; i < ii; i++) {
  34130. const unicode = str.codePointAt(i);
  34131. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  34132. i++;
  34133. }
  34134. if (this.toUnicode) {
  34135. const charCode = getCharCode(unicode);
  34136. if (charCode !== -1) {
  34137. if (hasCurrentBufErrors()) {
  34138. buffers.push(currentBuf.join(""));
  34139. currentBuf.length = 0;
  34140. }
  34141. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  34142. for (let j = charCodeLength - 1; j >= 0; j--) {
  34143. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  34144. }
  34145. continue;
  34146. }
  34147. }
  34148. if (!hasCurrentBufErrors()) {
  34149. buffers.push(currentBuf.join(""));
  34150. currentBuf.length = 0;
  34151. }
  34152. currentBuf.push(String.fromCodePoint(unicode));
  34153. }
  34154. buffers.push(currentBuf.join(""));
  34155. return buffers;
  34156. }
  34157. }
  34158. exports.Font = Font;
  34159. class ErrorFont {
  34160. constructor(error) {
  34161. this.error = error;
  34162. this.loadedName = "g_font_error";
  34163. this.missingFile = true;
  34164. }
  34165. charsToGlyphs() {
  34166. return [];
  34167. }
  34168. encodeString(chars) {
  34169. return [chars];
  34170. }
  34171. exportData(extraProperties = false) {
  34172. return {
  34173. error: this.error
  34174. };
  34175. }
  34176. }
  34177. exports.ErrorFont = ErrorFont;
  34178. /***/ }),
  34179. /* 45 */
  34180. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  34181. Object.defineProperty(exports, "__esModule", ({
  34182. value: true
  34183. }));
  34184. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  34185. var _util = __w_pdfjs_require__(2);
  34186. var _charsets = __w_pdfjs_require__(46);
  34187. var _encodings = __w_pdfjs_require__(19);
  34188. const MAX_SUBR_NESTING = 10;
  34189. 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"];
  34190. exports.CFFStandardStrings = CFFStandardStrings;
  34191. const NUM_STANDARD_CFF_STRINGS = 391;
  34192. const CFFParser = function CFFParserClosure() {
  34193. const CharstringValidationData = [null, {
  34194. id: "hstem",
  34195. min: 2,
  34196. stackClearing: true,
  34197. stem: true
  34198. }, null, {
  34199. id: "vstem",
  34200. min: 2,
  34201. stackClearing: true,
  34202. stem: true
  34203. }, {
  34204. id: "vmoveto",
  34205. min: 1,
  34206. stackClearing: true
  34207. }, {
  34208. id: "rlineto",
  34209. min: 2,
  34210. resetStack: true
  34211. }, {
  34212. id: "hlineto",
  34213. min: 1,
  34214. resetStack: true
  34215. }, {
  34216. id: "vlineto",
  34217. min: 1,
  34218. resetStack: true
  34219. }, {
  34220. id: "rrcurveto",
  34221. min: 6,
  34222. resetStack: true
  34223. }, null, {
  34224. id: "callsubr",
  34225. min: 1,
  34226. undefStack: true
  34227. }, {
  34228. id: "return",
  34229. min: 0,
  34230. undefStack: true
  34231. }, null, null, {
  34232. id: "endchar",
  34233. min: 0,
  34234. stackClearing: true
  34235. }, null, null, null, {
  34236. id: "hstemhm",
  34237. min: 2,
  34238. stackClearing: true,
  34239. stem: true
  34240. }, {
  34241. id: "hintmask",
  34242. min: 0,
  34243. stackClearing: true
  34244. }, {
  34245. id: "cntrmask",
  34246. min: 0,
  34247. stackClearing: true
  34248. }, {
  34249. id: "rmoveto",
  34250. min: 2,
  34251. stackClearing: true
  34252. }, {
  34253. id: "hmoveto",
  34254. min: 1,
  34255. stackClearing: true
  34256. }, {
  34257. id: "vstemhm",
  34258. min: 2,
  34259. stackClearing: true,
  34260. stem: true
  34261. }, {
  34262. id: "rcurveline",
  34263. min: 8,
  34264. resetStack: true
  34265. }, {
  34266. id: "rlinecurve",
  34267. min: 8,
  34268. resetStack: true
  34269. }, {
  34270. id: "vvcurveto",
  34271. min: 4,
  34272. resetStack: true
  34273. }, {
  34274. id: "hhcurveto",
  34275. min: 4,
  34276. resetStack: true
  34277. }, null, {
  34278. id: "callgsubr",
  34279. min: 1,
  34280. undefStack: true
  34281. }, {
  34282. id: "vhcurveto",
  34283. min: 4,
  34284. resetStack: true
  34285. }, {
  34286. id: "hvcurveto",
  34287. min: 4,
  34288. resetStack: true
  34289. }];
  34290. const CharstringValidationData12 = [null, null, null, {
  34291. id: "and",
  34292. min: 2,
  34293. stackDelta: -1
  34294. }, {
  34295. id: "or",
  34296. min: 2,
  34297. stackDelta: -1
  34298. }, {
  34299. id: "not",
  34300. min: 1,
  34301. stackDelta: 0
  34302. }, null, null, null, {
  34303. id: "abs",
  34304. min: 1,
  34305. stackDelta: 0
  34306. }, {
  34307. id: "add",
  34308. min: 2,
  34309. stackDelta: -1,
  34310. stackFn: function stack_div(stack, index) {
  34311. stack[index - 2] = stack[index - 2] + stack[index - 1];
  34312. }
  34313. }, {
  34314. id: "sub",
  34315. min: 2,
  34316. stackDelta: -1,
  34317. stackFn: function stack_div(stack, index) {
  34318. stack[index - 2] = stack[index - 2] - stack[index - 1];
  34319. }
  34320. }, {
  34321. id: "div",
  34322. min: 2,
  34323. stackDelta: -1,
  34324. stackFn: function stack_div(stack, index) {
  34325. stack[index - 2] = stack[index - 2] / stack[index - 1];
  34326. }
  34327. }, null, {
  34328. id: "neg",
  34329. min: 1,
  34330. stackDelta: 0,
  34331. stackFn: function stack_div(stack, index) {
  34332. stack[index - 1] = -stack[index - 1];
  34333. }
  34334. }, {
  34335. id: "eq",
  34336. min: 2,
  34337. stackDelta: -1
  34338. }, null, null, {
  34339. id: "drop",
  34340. min: 1,
  34341. stackDelta: -1
  34342. }, null, {
  34343. id: "put",
  34344. min: 2,
  34345. stackDelta: -2
  34346. }, {
  34347. id: "get",
  34348. min: 1,
  34349. stackDelta: 0
  34350. }, {
  34351. id: "ifelse",
  34352. min: 4,
  34353. stackDelta: -3
  34354. }, {
  34355. id: "random",
  34356. min: 0,
  34357. stackDelta: 1
  34358. }, {
  34359. id: "mul",
  34360. min: 2,
  34361. stackDelta: -1,
  34362. stackFn: function stack_div(stack, index) {
  34363. stack[index - 2] = stack[index - 2] * stack[index - 1];
  34364. }
  34365. }, null, {
  34366. id: "sqrt",
  34367. min: 1,
  34368. stackDelta: 0
  34369. }, {
  34370. id: "dup",
  34371. min: 1,
  34372. stackDelta: 1
  34373. }, {
  34374. id: "exch",
  34375. min: 2,
  34376. stackDelta: 0
  34377. }, {
  34378. id: "index",
  34379. min: 2,
  34380. stackDelta: 0
  34381. }, {
  34382. id: "roll",
  34383. min: 3,
  34384. stackDelta: -2
  34385. }, null, null, null, {
  34386. id: "hflex",
  34387. min: 7,
  34388. resetStack: true
  34389. }, {
  34390. id: "flex",
  34391. min: 13,
  34392. resetStack: true
  34393. }, {
  34394. id: "hflex1",
  34395. min: 9,
  34396. resetStack: true
  34397. }, {
  34398. id: "flex1",
  34399. min: 11,
  34400. resetStack: true
  34401. }];
  34402. class CFFParser {
  34403. constructor(file, properties, seacAnalysisEnabled) {
  34404. this.bytes = file.getBytes();
  34405. this.properties = properties;
  34406. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  34407. }
  34408. parse() {
  34409. const properties = this.properties;
  34410. const cff = new CFF();
  34411. this.cff = cff;
  34412. const header = this.parseHeader();
  34413. const nameIndex = this.parseIndex(header.endPos);
  34414. const topDictIndex = this.parseIndex(nameIndex.endPos);
  34415. const stringIndex = this.parseIndex(topDictIndex.endPos);
  34416. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  34417. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  34418. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  34419. cff.header = header.obj;
  34420. cff.names = this.parseNameIndex(nameIndex.obj);
  34421. cff.strings = this.parseStringIndex(stringIndex.obj);
  34422. cff.topDict = topDict;
  34423. cff.globalSubrIndex = globalSubrIndex.obj;
  34424. this.parsePrivateDict(cff.topDict);
  34425. cff.isCIDFont = topDict.hasName("ROS");
  34426. const charStringOffset = topDict.getByName("CharStrings");
  34427. const charStringIndex = this.parseIndex(charStringOffset).obj;
  34428. const fontMatrix = topDict.getByName("FontMatrix");
  34429. if (fontMatrix) {
  34430. properties.fontMatrix = fontMatrix;
  34431. }
  34432. const fontBBox = topDict.getByName("FontBBox");
  34433. if (fontBBox) {
  34434. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  34435. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  34436. properties.ascentScaled = true;
  34437. }
  34438. let charset, encoding;
  34439. if (cff.isCIDFont) {
  34440. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  34441. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  34442. const dictRaw = fdArrayIndex.get(i);
  34443. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  34444. this.parsePrivateDict(fontDict);
  34445. cff.fdArray.push(fontDict);
  34446. }
  34447. encoding = null;
  34448. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  34449. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  34450. } else {
  34451. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  34452. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  34453. }
  34454. cff.charset = charset;
  34455. cff.encoding = encoding;
  34456. const charStringsAndSeacs = this.parseCharStrings({
  34457. charStrings: charStringIndex,
  34458. localSubrIndex: topDict.privateDict.subrsIndex,
  34459. globalSubrIndex: globalSubrIndex.obj,
  34460. fdSelect: cff.fdSelect,
  34461. fdArray: cff.fdArray,
  34462. privateDict: topDict.privateDict
  34463. });
  34464. cff.charStrings = charStringsAndSeacs.charStrings;
  34465. cff.seacs = charStringsAndSeacs.seacs;
  34466. cff.widths = charStringsAndSeacs.widths;
  34467. return cff;
  34468. }
  34469. parseHeader() {
  34470. let bytes = this.bytes;
  34471. const bytesLength = bytes.length;
  34472. let offset = 0;
  34473. while (offset < bytesLength && bytes[offset] !== 1) {
  34474. ++offset;
  34475. }
  34476. if (offset >= bytesLength) {
  34477. throw new _util.FormatError("Invalid CFF header");
  34478. }
  34479. if (offset !== 0) {
  34480. (0, _util.info)("cff data is shifted");
  34481. bytes = bytes.subarray(offset);
  34482. this.bytes = bytes;
  34483. }
  34484. const major = bytes[0];
  34485. const minor = bytes[1];
  34486. const hdrSize = bytes[2];
  34487. const offSize = bytes[3];
  34488. const header = new CFFHeader(major, minor, hdrSize, offSize);
  34489. return {
  34490. obj: header,
  34491. endPos: hdrSize
  34492. };
  34493. }
  34494. parseDict(dict) {
  34495. let pos = 0;
  34496. function parseOperand() {
  34497. let value = dict[pos++];
  34498. if (value === 30) {
  34499. return parseFloatOperand();
  34500. } else if (value === 28) {
  34501. value = dict[pos++];
  34502. value = (value << 24 | dict[pos++] << 16) >> 16;
  34503. return value;
  34504. } else if (value === 29) {
  34505. value = dict[pos++];
  34506. value = value << 8 | dict[pos++];
  34507. value = value << 8 | dict[pos++];
  34508. value = value << 8 | dict[pos++];
  34509. return value;
  34510. } else if (value >= 32 && value <= 246) {
  34511. return value - 139;
  34512. } else if (value >= 247 && value <= 250) {
  34513. return (value - 247) * 256 + dict[pos++] + 108;
  34514. } else if (value >= 251 && value <= 254) {
  34515. return -((value - 251) * 256) - dict[pos++] - 108;
  34516. }
  34517. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  34518. return NaN;
  34519. }
  34520. function parseFloatOperand() {
  34521. let str = "";
  34522. const eof = 15;
  34523. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  34524. const length = dict.length;
  34525. while (pos < length) {
  34526. const b = dict[pos++];
  34527. const b1 = b >> 4;
  34528. const b2 = b & 15;
  34529. if (b1 === eof) {
  34530. break;
  34531. }
  34532. str += lookup[b1];
  34533. if (b2 === eof) {
  34534. break;
  34535. }
  34536. str += lookup[b2];
  34537. }
  34538. return parseFloat(str);
  34539. }
  34540. let operands = [];
  34541. const entries = [];
  34542. pos = 0;
  34543. const end = dict.length;
  34544. while (pos < end) {
  34545. let b = dict[pos];
  34546. if (b <= 21) {
  34547. if (b === 12) {
  34548. b = b << 8 | dict[++pos];
  34549. }
  34550. entries.push([b, operands]);
  34551. operands = [];
  34552. ++pos;
  34553. } else {
  34554. operands.push(parseOperand());
  34555. }
  34556. }
  34557. return entries;
  34558. }
  34559. parseIndex(pos) {
  34560. const cffIndex = new CFFIndex();
  34561. const bytes = this.bytes;
  34562. const count = bytes[pos++] << 8 | bytes[pos++];
  34563. const offsets = [];
  34564. let end = pos;
  34565. let i, ii;
  34566. if (count !== 0) {
  34567. const offsetSize = bytes[pos++];
  34568. const startPos = pos + (count + 1) * offsetSize - 1;
  34569. for (i = 0, ii = count + 1; i < ii; ++i) {
  34570. let offset = 0;
  34571. for (let j = 0; j < offsetSize; ++j) {
  34572. offset <<= 8;
  34573. offset += bytes[pos++];
  34574. }
  34575. offsets.push(startPos + offset);
  34576. }
  34577. end = offsets[count];
  34578. }
  34579. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  34580. const offsetStart = offsets[i];
  34581. const offsetEnd = offsets[i + 1];
  34582. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  34583. }
  34584. return {
  34585. obj: cffIndex,
  34586. endPos: end
  34587. };
  34588. }
  34589. parseNameIndex(index) {
  34590. const names = [];
  34591. for (let i = 0, ii = index.count; i < ii; ++i) {
  34592. const name = index.get(i);
  34593. names.push((0, _util.bytesToString)(name));
  34594. }
  34595. return names;
  34596. }
  34597. parseStringIndex(index) {
  34598. const strings = new CFFStrings();
  34599. for (let i = 0, ii = index.count; i < ii; ++i) {
  34600. const data = index.get(i);
  34601. strings.add((0, _util.bytesToString)(data));
  34602. }
  34603. return strings;
  34604. }
  34605. createDict(Type, dict, strings) {
  34606. const cffDict = new Type(strings);
  34607. for (let i = 0, ii = dict.length; i < ii; ++i) {
  34608. const pair = dict[i];
  34609. const key = pair[0];
  34610. const value = pair[1];
  34611. cffDict.setByKey(key, value);
  34612. }
  34613. return cffDict;
  34614. }
  34615. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  34616. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  34617. return false;
  34618. }
  34619. let stackSize = state.stackSize;
  34620. const stack = state.stack;
  34621. const length = data.length;
  34622. for (let j = 0; j < length;) {
  34623. const value = data[j++];
  34624. let validationCommand = null;
  34625. if (value === 12) {
  34626. const q = data[j++];
  34627. if (q === 0) {
  34628. data[j - 2] = 139;
  34629. data[j - 1] = 22;
  34630. stackSize = 0;
  34631. } else {
  34632. validationCommand = CharstringValidationData12[q];
  34633. }
  34634. } else if (value === 28) {
  34635. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  34636. j += 2;
  34637. stackSize++;
  34638. } else if (value === 14) {
  34639. if (stackSize >= 4) {
  34640. stackSize -= 4;
  34641. if (this.seacAnalysisEnabled) {
  34642. state.seac = stack.slice(stackSize, stackSize + 4);
  34643. return false;
  34644. }
  34645. }
  34646. validationCommand = CharstringValidationData[value];
  34647. } else if (value >= 32 && value <= 246) {
  34648. stack[stackSize] = value - 139;
  34649. stackSize++;
  34650. } else if (value >= 247 && value <= 254) {
  34651. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  34652. j++;
  34653. stackSize++;
  34654. } else if (value === 255) {
  34655. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  34656. j += 4;
  34657. stackSize++;
  34658. } else if (value === 19 || value === 20) {
  34659. state.hints += stackSize >> 1;
  34660. j += state.hints + 7 >> 3;
  34661. stackSize %= 2;
  34662. validationCommand = CharstringValidationData[value];
  34663. } else if (value === 10 || value === 29) {
  34664. let subrsIndex;
  34665. if (value === 10) {
  34666. subrsIndex = localSubrIndex;
  34667. } else {
  34668. subrsIndex = globalSubrIndex;
  34669. }
  34670. if (!subrsIndex) {
  34671. validationCommand = CharstringValidationData[value];
  34672. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  34673. return false;
  34674. }
  34675. let bias = 32768;
  34676. if (subrsIndex.count < 1240) {
  34677. bias = 107;
  34678. } else if (subrsIndex.count < 33900) {
  34679. bias = 1131;
  34680. }
  34681. const subrNumber = stack[--stackSize] + bias;
  34682. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  34683. validationCommand = CharstringValidationData[value];
  34684. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  34685. return false;
  34686. }
  34687. state.stackSize = stackSize;
  34688. state.callDepth++;
  34689. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  34690. if (!valid) {
  34691. return false;
  34692. }
  34693. state.callDepth--;
  34694. stackSize = state.stackSize;
  34695. continue;
  34696. } else if (value === 11) {
  34697. state.stackSize = stackSize;
  34698. return true;
  34699. } else if (value === 0 && j === data.length) {
  34700. data[j - 1] = 14;
  34701. validationCommand = CharstringValidationData[14];
  34702. } else {
  34703. validationCommand = CharstringValidationData[value];
  34704. }
  34705. if (validationCommand) {
  34706. if (validationCommand.stem) {
  34707. state.hints += stackSize >> 1;
  34708. if (value === 3 || value === 23) {
  34709. state.hasVStems = true;
  34710. } else if (state.hasVStems && (value === 1 || value === 18)) {
  34711. (0, _util.warn)("CFF stem hints are in wrong order");
  34712. data[j - 1] = value === 1 ? 3 : 23;
  34713. }
  34714. }
  34715. if ("min" in validationCommand) {
  34716. if (!state.undefStack && stackSize < validationCommand.min) {
  34717. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  34718. if (stackSize === 0) {
  34719. data[j - 1] = 14;
  34720. return true;
  34721. }
  34722. return false;
  34723. }
  34724. }
  34725. if (state.firstStackClearing && validationCommand.stackClearing) {
  34726. state.firstStackClearing = false;
  34727. stackSize -= validationCommand.min;
  34728. if (stackSize >= 2 && validationCommand.stem) {
  34729. stackSize %= 2;
  34730. } else if (stackSize > 1) {
  34731. (0, _util.warn)("Found too many parameters for stack-clearing command");
  34732. }
  34733. if (stackSize > 0) {
  34734. state.width = stack[stackSize - 1];
  34735. }
  34736. }
  34737. if ("stackDelta" in validationCommand) {
  34738. if ("stackFn" in validationCommand) {
  34739. validationCommand.stackFn(stack, stackSize);
  34740. }
  34741. stackSize += validationCommand.stackDelta;
  34742. } else if (validationCommand.stackClearing) {
  34743. stackSize = 0;
  34744. } else if (validationCommand.resetStack) {
  34745. stackSize = 0;
  34746. state.undefStack = false;
  34747. } else if (validationCommand.undefStack) {
  34748. stackSize = 0;
  34749. state.undefStack = true;
  34750. state.firstStackClearing = false;
  34751. }
  34752. }
  34753. }
  34754. state.stackSize = stackSize;
  34755. return true;
  34756. }
  34757. parseCharStrings({
  34758. charStrings,
  34759. localSubrIndex,
  34760. globalSubrIndex,
  34761. fdSelect,
  34762. fdArray,
  34763. privateDict
  34764. }) {
  34765. const seacs = [];
  34766. const widths = [];
  34767. const count = charStrings.count;
  34768. for (let i = 0; i < count; i++) {
  34769. const charstring = charStrings.get(i);
  34770. const state = {
  34771. callDepth: 0,
  34772. stackSize: 0,
  34773. stack: [],
  34774. undefStack: true,
  34775. hints: 0,
  34776. firstStackClearing: true,
  34777. seac: null,
  34778. width: null,
  34779. hasVStems: false
  34780. };
  34781. let valid = true;
  34782. let localSubrToUse = null;
  34783. let privateDictToUse = privateDict;
  34784. if (fdSelect && fdArray.length) {
  34785. const fdIndex = fdSelect.getFDIndex(i);
  34786. if (fdIndex === -1) {
  34787. (0, _util.warn)("Glyph index is not in fd select.");
  34788. valid = false;
  34789. }
  34790. if (fdIndex >= fdArray.length) {
  34791. (0, _util.warn)("Invalid fd index for glyph index.");
  34792. valid = false;
  34793. }
  34794. if (valid) {
  34795. privateDictToUse = fdArray[fdIndex].privateDict;
  34796. localSubrToUse = privateDictToUse.subrsIndex;
  34797. }
  34798. } else if (localSubrIndex) {
  34799. localSubrToUse = localSubrIndex;
  34800. }
  34801. if (valid) {
  34802. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  34803. }
  34804. if (state.width !== null) {
  34805. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  34806. widths[i] = nominalWidth + state.width;
  34807. } else {
  34808. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  34809. widths[i] = defaultWidth;
  34810. }
  34811. if (state.seac !== null) {
  34812. seacs[i] = state.seac;
  34813. }
  34814. if (!valid) {
  34815. charStrings.set(i, new Uint8Array([14]));
  34816. }
  34817. }
  34818. return {
  34819. charStrings,
  34820. seacs,
  34821. widths
  34822. };
  34823. }
  34824. emptyPrivateDictionary(parentDict) {
  34825. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  34826. parentDict.setByKey(18, [0, 0]);
  34827. parentDict.privateDict = privateDict;
  34828. }
  34829. parsePrivateDict(parentDict) {
  34830. if (!parentDict.hasName("Private")) {
  34831. this.emptyPrivateDictionary(parentDict);
  34832. return;
  34833. }
  34834. const privateOffset = parentDict.getByName("Private");
  34835. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  34836. parentDict.removeByName("Private");
  34837. return;
  34838. }
  34839. const size = privateOffset[0];
  34840. const offset = privateOffset[1];
  34841. if (size === 0 || offset >= this.bytes.length) {
  34842. this.emptyPrivateDictionary(parentDict);
  34843. return;
  34844. }
  34845. const privateDictEnd = offset + size;
  34846. const dictData = this.bytes.subarray(offset, privateDictEnd);
  34847. const dict = this.parseDict(dictData);
  34848. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  34849. parentDict.privateDict = privateDict;
  34850. if (!privateDict.getByName("Subrs")) {
  34851. return;
  34852. }
  34853. const subrsOffset = privateDict.getByName("Subrs");
  34854. const relativeOffset = offset + subrsOffset;
  34855. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  34856. this.emptyPrivateDictionary(parentDict);
  34857. return;
  34858. }
  34859. const subrsIndex = this.parseIndex(relativeOffset);
  34860. privateDict.subrsIndex = subrsIndex.obj;
  34861. }
  34862. parseCharsets(pos, length, strings, cid) {
  34863. if (pos === 0) {
  34864. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  34865. } else if (pos === 1) {
  34866. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  34867. } else if (pos === 2) {
  34868. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  34869. }
  34870. const bytes = this.bytes;
  34871. const start = pos;
  34872. const format = bytes[pos++];
  34873. const charset = [cid ? 0 : ".notdef"];
  34874. let id, count, i;
  34875. length -= 1;
  34876. switch (format) {
  34877. case 0:
  34878. for (i = 0; i < length; i++) {
  34879. id = bytes[pos++] << 8 | bytes[pos++];
  34880. charset.push(cid ? id : strings.get(id));
  34881. }
  34882. break;
  34883. case 1:
  34884. while (charset.length <= length) {
  34885. id = bytes[pos++] << 8 | bytes[pos++];
  34886. count = bytes[pos++];
  34887. for (i = 0; i <= count; i++) {
  34888. charset.push(cid ? id++ : strings.get(id++));
  34889. }
  34890. }
  34891. break;
  34892. case 2:
  34893. while (charset.length <= length) {
  34894. id = bytes[pos++] << 8 | bytes[pos++];
  34895. count = bytes[pos++] << 8 | bytes[pos++];
  34896. for (i = 0; i <= count; i++) {
  34897. charset.push(cid ? id++ : strings.get(id++));
  34898. }
  34899. }
  34900. break;
  34901. default:
  34902. throw new _util.FormatError("Unknown charset format");
  34903. }
  34904. const end = pos;
  34905. const raw = bytes.subarray(start, end);
  34906. return new CFFCharset(false, format, charset, raw);
  34907. }
  34908. parseEncoding(pos, properties, strings, charset) {
  34909. const encoding = Object.create(null);
  34910. const bytes = this.bytes;
  34911. let predefined = false;
  34912. let format, i, ii;
  34913. let raw = null;
  34914. function readSupplement() {
  34915. const supplementsCount = bytes[pos++];
  34916. for (i = 0; i < supplementsCount; i++) {
  34917. const code = bytes[pos++];
  34918. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  34919. encoding[code] = charset.indexOf(strings.get(sid));
  34920. }
  34921. }
  34922. if (pos === 0 || pos === 1) {
  34923. predefined = true;
  34924. format = pos;
  34925. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  34926. for (i = 0, ii = charset.length; i < ii; i++) {
  34927. const index = baseEncoding.indexOf(charset[i]);
  34928. if (index !== -1) {
  34929. encoding[index] = i;
  34930. }
  34931. }
  34932. } else {
  34933. const dataStart = pos;
  34934. format = bytes[pos++];
  34935. switch (format & 0x7f) {
  34936. case 0:
  34937. const glyphsCount = bytes[pos++];
  34938. for (i = 1; i <= glyphsCount; i++) {
  34939. encoding[bytes[pos++]] = i;
  34940. }
  34941. break;
  34942. case 1:
  34943. const rangesCount = bytes[pos++];
  34944. let gid = 1;
  34945. for (i = 0; i < rangesCount; i++) {
  34946. const start = bytes[pos++];
  34947. const left = bytes[pos++];
  34948. for (let j = start; j <= start + left; j++) {
  34949. encoding[j] = gid++;
  34950. }
  34951. }
  34952. break;
  34953. default:
  34954. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  34955. }
  34956. const dataEnd = pos;
  34957. if (format & 0x80) {
  34958. bytes[dataStart] &= 0x7f;
  34959. readSupplement();
  34960. }
  34961. raw = bytes.subarray(dataStart, dataEnd);
  34962. }
  34963. format &= 0x7f;
  34964. return new CFFEncoding(predefined, format, encoding, raw);
  34965. }
  34966. parseFDSelect(pos, length) {
  34967. const bytes = this.bytes;
  34968. const format = bytes[pos++];
  34969. const fdSelect = [];
  34970. let i;
  34971. switch (format) {
  34972. case 0:
  34973. for (i = 0; i < length; ++i) {
  34974. const id = bytes[pos++];
  34975. fdSelect.push(id);
  34976. }
  34977. break;
  34978. case 3:
  34979. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  34980. for (i = 0; i < rangesCount; ++i) {
  34981. let first = bytes[pos++] << 8 | bytes[pos++];
  34982. if (i === 0 && first !== 0) {
  34983. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  34984. first = 0;
  34985. }
  34986. const fdIndex = bytes[pos++];
  34987. const next = bytes[pos] << 8 | bytes[pos + 1];
  34988. for (let j = first; j < next; ++j) {
  34989. fdSelect.push(fdIndex);
  34990. }
  34991. }
  34992. pos += 2;
  34993. break;
  34994. default:
  34995. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  34996. }
  34997. if (fdSelect.length !== length) {
  34998. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  34999. }
  35000. return new CFFFDSelect(format, fdSelect);
  35001. }
  35002. }
  35003. return CFFParser;
  35004. }();
  35005. exports.CFFParser = CFFParser;
  35006. class CFF {
  35007. constructor() {
  35008. this.header = null;
  35009. this.names = [];
  35010. this.topDict = null;
  35011. this.strings = new CFFStrings();
  35012. this.globalSubrIndex = null;
  35013. this.encoding = null;
  35014. this.charset = null;
  35015. this.charStrings = null;
  35016. this.fdArray = [];
  35017. this.fdSelect = null;
  35018. this.isCIDFont = false;
  35019. }
  35020. duplicateFirstGlyph() {
  35021. if (this.charStrings.count >= 65535) {
  35022. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  35023. return;
  35024. }
  35025. const glyphZero = this.charStrings.get(0);
  35026. this.charStrings.add(glyphZero);
  35027. if (this.isCIDFont) {
  35028. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  35029. }
  35030. }
  35031. hasGlyphId(id) {
  35032. if (id < 0 || id >= this.charStrings.count) {
  35033. return false;
  35034. }
  35035. const glyph = this.charStrings.get(id);
  35036. return glyph.length > 0;
  35037. }
  35038. }
  35039. exports.CFF = CFF;
  35040. class CFFHeader {
  35041. constructor(major, minor, hdrSize, offSize) {
  35042. this.major = major;
  35043. this.minor = minor;
  35044. this.hdrSize = hdrSize;
  35045. this.offSize = offSize;
  35046. }
  35047. }
  35048. exports.CFFHeader = CFFHeader;
  35049. class CFFStrings {
  35050. constructor() {
  35051. this.strings = [];
  35052. }
  35053. get(index) {
  35054. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  35055. return CFFStandardStrings[index];
  35056. }
  35057. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  35058. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  35059. }
  35060. return CFFStandardStrings[0];
  35061. }
  35062. getSID(str) {
  35063. let index = CFFStandardStrings.indexOf(str);
  35064. if (index !== -1) {
  35065. return index;
  35066. }
  35067. index = this.strings.indexOf(str);
  35068. if (index !== -1) {
  35069. return index + NUM_STANDARD_CFF_STRINGS;
  35070. }
  35071. return -1;
  35072. }
  35073. add(value) {
  35074. this.strings.push(value);
  35075. }
  35076. get count() {
  35077. return this.strings.length;
  35078. }
  35079. }
  35080. exports.CFFStrings = CFFStrings;
  35081. class CFFIndex {
  35082. constructor() {
  35083. this.objects = [];
  35084. this.length = 0;
  35085. }
  35086. add(data) {
  35087. this.length += data.length;
  35088. this.objects.push(data);
  35089. }
  35090. set(index, data) {
  35091. this.length += data.length - this.objects[index].length;
  35092. this.objects[index] = data;
  35093. }
  35094. get(index) {
  35095. return this.objects[index];
  35096. }
  35097. get count() {
  35098. return this.objects.length;
  35099. }
  35100. }
  35101. exports.CFFIndex = CFFIndex;
  35102. class CFFDict {
  35103. constructor(tables, strings) {
  35104. this.keyToNameMap = tables.keyToNameMap;
  35105. this.nameToKeyMap = tables.nameToKeyMap;
  35106. this.defaults = tables.defaults;
  35107. this.types = tables.types;
  35108. this.opcodes = tables.opcodes;
  35109. this.order = tables.order;
  35110. this.strings = strings;
  35111. this.values = Object.create(null);
  35112. }
  35113. setByKey(key, value) {
  35114. if (!(key in this.keyToNameMap)) {
  35115. return false;
  35116. }
  35117. const valueLength = value.length;
  35118. if (valueLength === 0) {
  35119. return true;
  35120. }
  35121. for (let i = 0; i < valueLength; i++) {
  35122. if (isNaN(value[i])) {
  35123. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  35124. return true;
  35125. }
  35126. }
  35127. const type = this.types[key];
  35128. if (type === "num" || type === "sid" || type === "offset") {
  35129. value = value[0];
  35130. }
  35131. this.values[key] = value;
  35132. return true;
  35133. }
  35134. setByName(name, value) {
  35135. if (!(name in this.nameToKeyMap)) {
  35136. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  35137. }
  35138. this.values[this.nameToKeyMap[name]] = value;
  35139. }
  35140. hasName(name) {
  35141. return this.nameToKeyMap[name] in this.values;
  35142. }
  35143. getByName(name) {
  35144. if (!(name in this.nameToKeyMap)) {
  35145. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  35146. }
  35147. const key = this.nameToKeyMap[name];
  35148. if (!(key in this.values)) {
  35149. return this.defaults[key];
  35150. }
  35151. return this.values[key];
  35152. }
  35153. removeByName(name) {
  35154. delete this.values[this.nameToKeyMap[name]];
  35155. }
  35156. static createTables(layout) {
  35157. const tables = {
  35158. keyToNameMap: {},
  35159. nameToKeyMap: {},
  35160. defaults: {},
  35161. types: {},
  35162. opcodes: {},
  35163. order: []
  35164. };
  35165. for (let i = 0, ii = layout.length; i < ii; ++i) {
  35166. const entry = layout[i];
  35167. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  35168. tables.keyToNameMap[key] = entry[1];
  35169. tables.nameToKeyMap[entry[1]] = key;
  35170. tables.types[key] = entry[2];
  35171. tables.defaults[key] = entry[3];
  35172. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  35173. tables.order.push(key);
  35174. }
  35175. return tables;
  35176. }
  35177. }
  35178. const CFFTopDict = function CFFTopDictClosure() {
  35179. 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]];
  35180. let tables = null;
  35181. class CFFTopDict extends CFFDict {
  35182. constructor(strings) {
  35183. if (tables === null) {
  35184. tables = CFFDict.createTables(layout);
  35185. }
  35186. super(tables, strings);
  35187. this.privateDict = null;
  35188. }
  35189. }
  35190. return CFFTopDict;
  35191. }();
  35192. exports.CFFTopDict = CFFTopDict;
  35193. const CFFPrivateDict = function CFFPrivateDictClosure() {
  35194. 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]];
  35195. let tables = null;
  35196. class CFFPrivateDict extends CFFDict {
  35197. constructor(strings) {
  35198. if (tables === null) {
  35199. tables = CFFDict.createTables(layout);
  35200. }
  35201. super(tables, strings);
  35202. this.subrsIndex = null;
  35203. }
  35204. }
  35205. return CFFPrivateDict;
  35206. }();
  35207. exports.CFFPrivateDict = CFFPrivateDict;
  35208. const CFFCharsetPredefinedTypes = {
  35209. ISO_ADOBE: 0,
  35210. EXPERT: 1,
  35211. EXPERT_SUBSET: 2
  35212. };
  35213. class CFFCharset {
  35214. constructor(predefined, format, charset, raw) {
  35215. this.predefined = predefined;
  35216. this.format = format;
  35217. this.charset = charset;
  35218. this.raw = raw;
  35219. }
  35220. }
  35221. exports.CFFCharset = CFFCharset;
  35222. class CFFEncoding {
  35223. constructor(predefined, format, encoding, raw) {
  35224. this.predefined = predefined;
  35225. this.format = format;
  35226. this.encoding = encoding;
  35227. this.raw = raw;
  35228. }
  35229. }
  35230. class CFFFDSelect {
  35231. constructor(format, fdSelect) {
  35232. this.format = format;
  35233. this.fdSelect = fdSelect;
  35234. }
  35235. getFDIndex(glyphIndex) {
  35236. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  35237. return -1;
  35238. }
  35239. return this.fdSelect[glyphIndex];
  35240. }
  35241. }
  35242. exports.CFFFDSelect = CFFFDSelect;
  35243. class CFFOffsetTracker {
  35244. constructor() {
  35245. this.offsets = Object.create(null);
  35246. }
  35247. isTracking(key) {
  35248. return key in this.offsets;
  35249. }
  35250. track(key, location) {
  35251. if (key in this.offsets) {
  35252. throw new _util.FormatError(`Already tracking location of ${key}`);
  35253. }
  35254. this.offsets[key] = location;
  35255. }
  35256. offset(value) {
  35257. for (const key in this.offsets) {
  35258. this.offsets[key] += value;
  35259. }
  35260. }
  35261. setEntryLocation(key, values, output) {
  35262. if (!(key in this.offsets)) {
  35263. throw new _util.FormatError(`Not tracking location of ${key}`);
  35264. }
  35265. const data = output.data;
  35266. const dataOffset = this.offsets[key];
  35267. const size = 5;
  35268. for (let i = 0, ii = values.length; i < ii; ++i) {
  35269. const offset0 = i * size + dataOffset;
  35270. const offset1 = offset0 + 1;
  35271. const offset2 = offset0 + 2;
  35272. const offset3 = offset0 + 3;
  35273. const offset4 = offset0 + 4;
  35274. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  35275. throw new _util.FormatError("writing to an offset that is not empty");
  35276. }
  35277. const value = values[i];
  35278. data[offset0] = 0x1d;
  35279. data[offset1] = value >> 24 & 0xff;
  35280. data[offset2] = value >> 16 & 0xff;
  35281. data[offset3] = value >> 8 & 0xff;
  35282. data[offset4] = value & 0xff;
  35283. }
  35284. }
  35285. }
  35286. class CFFCompiler {
  35287. constructor(cff) {
  35288. this.cff = cff;
  35289. }
  35290. compile() {
  35291. const cff = this.cff;
  35292. const output = {
  35293. data: [],
  35294. length: 0,
  35295. add: function CFFCompiler_add(data) {
  35296. this.data = this.data.concat(data);
  35297. this.length = this.data.length;
  35298. }
  35299. };
  35300. const header = this.compileHeader(cff.header);
  35301. output.add(header);
  35302. const nameIndex = this.compileNameIndex(cff.names);
  35303. output.add(nameIndex);
  35304. if (cff.isCIDFont) {
  35305. if (cff.topDict.hasName("FontMatrix")) {
  35306. const base = cff.topDict.getByName("FontMatrix");
  35307. cff.topDict.removeByName("FontMatrix");
  35308. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  35309. const subDict = cff.fdArray[i];
  35310. let matrix = base.slice(0);
  35311. if (subDict.hasName("FontMatrix")) {
  35312. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  35313. }
  35314. subDict.setByName("FontMatrix", matrix);
  35315. }
  35316. }
  35317. }
  35318. const xuid = cff.topDict.getByName("XUID");
  35319. if (xuid && xuid.length > 16) {
  35320. cff.topDict.removeByName("XUID");
  35321. }
  35322. cff.topDict.setByName("charset", 0);
  35323. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  35324. output.add(compiled.output);
  35325. const topDictTracker = compiled.trackers[0];
  35326. const stringIndex = this.compileStringIndex(cff.strings.strings);
  35327. output.add(stringIndex);
  35328. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  35329. output.add(globalSubrIndex);
  35330. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  35331. if (cff.encoding.predefined) {
  35332. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  35333. } else {
  35334. const encoding = this.compileEncoding(cff.encoding);
  35335. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  35336. output.add(encoding);
  35337. }
  35338. }
  35339. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  35340. topDictTracker.setEntryLocation("charset", [output.length], output);
  35341. output.add(charset);
  35342. const charStrings = this.compileCharStrings(cff.charStrings);
  35343. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  35344. output.add(charStrings);
  35345. if (cff.isCIDFont) {
  35346. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  35347. const fdSelect = this.compileFDSelect(cff.fdSelect);
  35348. output.add(fdSelect);
  35349. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  35350. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  35351. output.add(compiled.output);
  35352. const fontDictTrackers = compiled.trackers;
  35353. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  35354. }
  35355. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  35356. output.add([0]);
  35357. return output.data;
  35358. }
  35359. encodeNumber(value) {
  35360. if (Number.isInteger(value)) {
  35361. return this.encodeInteger(value);
  35362. }
  35363. return this.encodeFloat(value);
  35364. }
  35365. static get EncodeFloatRegExp() {
  35366. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  35367. }
  35368. encodeFloat(num) {
  35369. let value = num.toString();
  35370. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  35371. if (m) {
  35372. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  35373. value = (Math.round(num * epsilon) / epsilon).toString();
  35374. }
  35375. let nibbles = "";
  35376. let i, ii;
  35377. for (i = 0, ii = value.length; i < ii; ++i) {
  35378. const a = value[i];
  35379. if (a === "e") {
  35380. nibbles += value[++i] === "-" ? "c" : "b";
  35381. } else if (a === ".") {
  35382. nibbles += "a";
  35383. } else if (a === "-") {
  35384. nibbles += "e";
  35385. } else {
  35386. nibbles += a;
  35387. }
  35388. }
  35389. nibbles += nibbles.length & 1 ? "f" : "ff";
  35390. const out = [30];
  35391. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  35392. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  35393. }
  35394. return out;
  35395. }
  35396. encodeInteger(value) {
  35397. let code;
  35398. if (value >= -107 && value <= 107) {
  35399. code = [value + 139];
  35400. } else if (value >= 108 && value <= 1131) {
  35401. value -= 108;
  35402. code = [(value >> 8) + 247, value & 0xff];
  35403. } else if (value >= -1131 && value <= -108) {
  35404. value = -value - 108;
  35405. code = [(value >> 8) + 251, value & 0xff];
  35406. } else if (value >= -32768 && value <= 32767) {
  35407. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  35408. } else {
  35409. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  35410. }
  35411. return code;
  35412. }
  35413. compileHeader(header) {
  35414. return [header.major, header.minor, 4, header.offSize];
  35415. }
  35416. compileNameIndex(names) {
  35417. const nameIndex = new CFFIndex();
  35418. for (let i = 0, ii = names.length; i < ii; ++i) {
  35419. const name = names[i];
  35420. const length = Math.min(name.length, 127);
  35421. let sanitizedName = new Array(length);
  35422. for (let j = 0; j < length; j++) {
  35423. let char = name[j];
  35424. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  35425. char = "_";
  35426. }
  35427. sanitizedName[j] = char;
  35428. }
  35429. sanitizedName = sanitizedName.join("");
  35430. if (sanitizedName === "") {
  35431. sanitizedName = "Bad_Font_Name";
  35432. }
  35433. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  35434. }
  35435. return this.compileIndex(nameIndex);
  35436. }
  35437. compileTopDicts(dicts, length, removeCidKeys) {
  35438. const fontDictTrackers = [];
  35439. let fdArrayIndex = new CFFIndex();
  35440. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  35441. const fontDict = dicts[i];
  35442. if (removeCidKeys) {
  35443. fontDict.removeByName("CIDFontVersion");
  35444. fontDict.removeByName("CIDFontRevision");
  35445. fontDict.removeByName("CIDFontType");
  35446. fontDict.removeByName("CIDCount");
  35447. fontDict.removeByName("UIDBase");
  35448. }
  35449. const fontDictTracker = new CFFOffsetTracker();
  35450. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  35451. fontDictTrackers.push(fontDictTracker);
  35452. fdArrayIndex.add(fontDictData);
  35453. fontDictTracker.offset(length);
  35454. }
  35455. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  35456. return {
  35457. trackers: fontDictTrackers,
  35458. output: fdArrayIndex
  35459. };
  35460. }
  35461. compilePrivateDicts(dicts, trackers, output) {
  35462. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  35463. const fontDict = dicts[i];
  35464. const privateDict = fontDict.privateDict;
  35465. if (!privateDict || !fontDict.hasName("Private")) {
  35466. throw new _util.FormatError("There must be a private dictionary.");
  35467. }
  35468. const privateDictTracker = new CFFOffsetTracker();
  35469. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  35470. let outputLength = output.length;
  35471. privateDictTracker.offset(outputLength);
  35472. if (!privateDictData.length) {
  35473. outputLength = 0;
  35474. }
  35475. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  35476. output.add(privateDictData);
  35477. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  35478. const subrs = this.compileIndex(privateDict.subrsIndex);
  35479. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  35480. output.add(subrs);
  35481. }
  35482. }
  35483. }
  35484. compileDict(dict, offsetTracker) {
  35485. let out = [];
  35486. const order = dict.order;
  35487. for (let i = 0; i < order.length; ++i) {
  35488. const key = order[i];
  35489. if (!(key in dict.values)) {
  35490. continue;
  35491. }
  35492. let values = dict.values[key];
  35493. let types = dict.types[key];
  35494. if (!Array.isArray(types)) {
  35495. types = [types];
  35496. }
  35497. if (!Array.isArray(values)) {
  35498. values = [values];
  35499. }
  35500. if (values.length === 0) {
  35501. continue;
  35502. }
  35503. for (let j = 0, jj = types.length; j < jj; ++j) {
  35504. const type = types[j];
  35505. const value = values[j];
  35506. switch (type) {
  35507. case "num":
  35508. case "sid":
  35509. out = out.concat(this.encodeNumber(value));
  35510. break;
  35511. case "offset":
  35512. const name = dict.keyToNameMap[key];
  35513. if (!offsetTracker.isTracking(name)) {
  35514. offsetTracker.track(name, out.length);
  35515. }
  35516. out = out.concat([0x1d, 0, 0, 0, 0]);
  35517. break;
  35518. case "array":
  35519. case "delta":
  35520. out = out.concat(this.encodeNumber(value));
  35521. for (let k = 1, kk = values.length; k < kk; ++k) {
  35522. out = out.concat(this.encodeNumber(values[k]));
  35523. }
  35524. break;
  35525. default:
  35526. throw new _util.FormatError(`Unknown data type of ${type}`);
  35527. }
  35528. }
  35529. out = out.concat(dict.opcodes[key]);
  35530. }
  35531. return out;
  35532. }
  35533. compileStringIndex(strings) {
  35534. const stringIndex = new CFFIndex();
  35535. for (let i = 0, ii = strings.length; i < ii; ++i) {
  35536. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  35537. }
  35538. return this.compileIndex(stringIndex);
  35539. }
  35540. compileGlobalSubrIndex() {
  35541. const globalSubrIndex = this.cff.globalSubrIndex;
  35542. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  35543. }
  35544. compileCharStrings(charStrings) {
  35545. const charStringsIndex = new CFFIndex();
  35546. for (let i = 0; i < charStrings.count; i++) {
  35547. const glyph = charStrings.get(i);
  35548. if (glyph.length === 0) {
  35549. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  35550. continue;
  35551. }
  35552. charStringsIndex.add(glyph);
  35553. }
  35554. return this.compileIndex(charStringsIndex);
  35555. }
  35556. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  35557. let out;
  35558. const numGlyphsLessNotDef = numGlyphs - 1;
  35559. if (isCIDFont) {
  35560. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  35561. } else {
  35562. const length = 1 + numGlyphsLessNotDef * 2;
  35563. out = new Uint8Array(length);
  35564. out[0] = 0;
  35565. let charsetIndex = 0;
  35566. const numCharsets = charset.charset.length;
  35567. let warned = false;
  35568. for (let i = 1; i < out.length; i += 2) {
  35569. let sid = 0;
  35570. if (charsetIndex < numCharsets) {
  35571. const name = charset.charset[charsetIndex++];
  35572. sid = strings.getSID(name);
  35573. if (sid === -1) {
  35574. sid = 0;
  35575. if (!warned) {
  35576. warned = true;
  35577. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  35578. }
  35579. }
  35580. }
  35581. out[i] = sid >> 8 & 0xff;
  35582. out[i + 1] = sid & 0xff;
  35583. }
  35584. }
  35585. return this.compileTypedArray(out);
  35586. }
  35587. compileEncoding(encoding) {
  35588. return this.compileTypedArray(encoding.raw);
  35589. }
  35590. compileFDSelect(fdSelect) {
  35591. const format = fdSelect.format;
  35592. let out, i;
  35593. switch (format) {
  35594. case 0:
  35595. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  35596. out[0] = format;
  35597. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  35598. out[i + 1] = fdSelect.fdSelect[i];
  35599. }
  35600. break;
  35601. case 3:
  35602. const start = 0;
  35603. let lastFD = fdSelect.fdSelect[0];
  35604. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  35605. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  35606. const currentFD = fdSelect.fdSelect[i];
  35607. if (currentFD !== lastFD) {
  35608. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  35609. lastFD = currentFD;
  35610. }
  35611. }
  35612. const numRanges = (ranges.length - 3) / 3;
  35613. ranges[1] = numRanges >> 8 & 0xff;
  35614. ranges[2] = numRanges & 0xff;
  35615. ranges.push(i >> 8 & 0xff, i & 0xff);
  35616. out = new Uint8Array(ranges);
  35617. break;
  35618. }
  35619. return this.compileTypedArray(out);
  35620. }
  35621. compileTypedArray(data) {
  35622. const out = [];
  35623. for (let i = 0, ii = data.length; i < ii; ++i) {
  35624. out[i] = data[i];
  35625. }
  35626. return out;
  35627. }
  35628. compileIndex(index, trackers = []) {
  35629. const objects = index.objects;
  35630. const count = objects.length;
  35631. if (count === 0) {
  35632. return [0, 0, 0];
  35633. }
  35634. const data = [count >> 8 & 0xff, count & 0xff];
  35635. let lastOffset = 1,
  35636. i;
  35637. for (i = 0; i < count; ++i) {
  35638. lastOffset += objects[i].length;
  35639. }
  35640. let offsetSize;
  35641. if (lastOffset < 0x100) {
  35642. offsetSize = 1;
  35643. } else if (lastOffset < 0x10000) {
  35644. offsetSize = 2;
  35645. } else if (lastOffset < 0x1000000) {
  35646. offsetSize = 3;
  35647. } else {
  35648. offsetSize = 4;
  35649. }
  35650. data.push(offsetSize);
  35651. let relativeOffset = 1;
  35652. for (i = 0; i < count + 1; i++) {
  35653. if (offsetSize === 1) {
  35654. data.push(relativeOffset & 0xff);
  35655. } else if (offsetSize === 2) {
  35656. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  35657. } else if (offsetSize === 3) {
  35658. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  35659. } else {
  35660. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  35661. }
  35662. if (objects[i]) {
  35663. relativeOffset += objects[i].length;
  35664. }
  35665. }
  35666. for (i = 0; i < count; i++) {
  35667. if (trackers[i]) {
  35668. trackers[i].offset(data.length);
  35669. }
  35670. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  35671. data.push(objects[i][j]);
  35672. }
  35673. }
  35674. return data;
  35675. }
  35676. }
  35677. exports.CFFCompiler = CFFCompiler;
  35678. /***/ }),
  35679. /* 46 */
  35680. /***/ ((__unused_webpack_module, exports) => {
  35681. Object.defineProperty(exports, "__esModule", ({
  35682. value: true
  35683. }));
  35684. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  35685. 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"];
  35686. exports.ISOAdobeCharset = ISOAdobeCharset;
  35687. 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"];
  35688. exports.ExpertCharset = ExpertCharset;
  35689. 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"];
  35690. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  35691. /***/ }),
  35692. /* 47 */
  35693. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  35694. Object.defineProperty(exports, "__esModule", ({
  35695. value: true
  35696. }));
  35697. exports.getStandardFontName = getStandardFontName;
  35698. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  35699. var _core_utils = __w_pdfjs_require__(9);
  35700. var _fonts_utils = __w_pdfjs_require__(18);
  35701. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35702. t["Times-Roman"] = "Times-Roman";
  35703. t.Helvetica = "Helvetica";
  35704. t.Courier = "Courier";
  35705. t.Symbol = "Symbol";
  35706. t["Times-Bold"] = "Times-Bold";
  35707. t["Helvetica-Bold"] = "Helvetica-Bold";
  35708. t["Courier-Bold"] = "Courier-Bold";
  35709. t.ZapfDingbats = "ZapfDingbats";
  35710. t["Times-Italic"] = "Times-Italic";
  35711. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  35712. t["Courier-Oblique"] = "Courier-Oblique";
  35713. t["Times-BoldItalic"] = "Times-BoldItalic";
  35714. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  35715. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  35716. t.ArialNarrow = "Helvetica";
  35717. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  35718. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  35719. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  35720. t.ArialBlack = "Helvetica";
  35721. t["ArialBlack-Bold"] = "Helvetica-Bold";
  35722. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  35723. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  35724. t["Arial-Black"] = "Helvetica";
  35725. t["Arial-Black-Bold"] = "Helvetica-Bold";
  35726. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  35727. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  35728. t.Arial = "Helvetica";
  35729. t["Arial-Bold"] = "Helvetica-Bold";
  35730. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  35731. t["Arial-Italic"] = "Helvetica-Oblique";
  35732. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  35733. t["Arial-BoldMT"] = "Helvetica-Bold";
  35734. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  35735. t.ArialMT = "Helvetica";
  35736. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  35737. t["Courier-Italic"] = "Courier-Oblique";
  35738. t.CourierNew = "Courier";
  35739. t["CourierNew-Bold"] = "Courier-Bold";
  35740. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  35741. t["CourierNew-Italic"] = "Courier-Oblique";
  35742. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  35743. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  35744. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  35745. t.CourierNewPSMT = "Courier";
  35746. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  35747. t["Helvetica-Italic"] = "Helvetica-Oblique";
  35748. t["Symbol-Bold"] = "Symbol";
  35749. t["Symbol-BoldItalic"] = "Symbol";
  35750. t["Symbol-Italic"] = "Symbol";
  35751. t.TimesNewRoman = "Times-Roman";
  35752. t["TimesNewRoman-Bold"] = "Times-Bold";
  35753. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  35754. t["TimesNewRoman-Italic"] = "Times-Italic";
  35755. t.TimesNewRomanPS = "Times-Roman";
  35756. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  35757. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  35758. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  35759. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  35760. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  35761. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  35762. t.TimesNewRomanPSMT = "Times-Roman";
  35763. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  35764. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  35765. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  35766. });
  35767. exports.getStdFontMap = getStdFontMap;
  35768. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35769. t.Courier = "FoxitFixed.pfb";
  35770. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  35771. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  35772. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  35773. t.Helvetica = "FoxitSans.pfb";
  35774. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  35775. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  35776. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  35777. t["Times-Roman"] = "FoxitSerif.pfb";
  35778. t["Times-Bold"] = "FoxitSerifBold.pfb";
  35779. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  35780. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  35781. t.Symbol = "FoxitSymbol.pfb";
  35782. t.ZapfDingbats = "FoxitDingbats.pfb";
  35783. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  35784. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  35785. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  35786. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  35787. });
  35788. exports.getFontNameToFileMap = getFontNameToFileMap;
  35789. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  35790. t.Calibri = "Helvetica";
  35791. t["Calibri-Bold"] = "Helvetica-Bold";
  35792. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  35793. t["Calibri-Italic"] = "Helvetica-Oblique";
  35794. t.CenturyGothic = "Helvetica";
  35795. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  35796. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  35797. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  35798. t.ComicSansMS = "Comic Sans MS";
  35799. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  35800. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  35801. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  35802. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  35803. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  35804. t["ItcSymbol-Book"] = "Helvetica";
  35805. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  35806. t["ItcSymbol-Medium"] = "Helvetica";
  35807. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  35808. t.LucidaConsole = "Courier";
  35809. t["LucidaConsole-Bold"] = "Courier-Bold";
  35810. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  35811. t["LucidaConsole-Italic"] = "Courier-Oblique";
  35812. t["LucidaSans-Demi"] = "Helvetica-Bold";
  35813. t["MS-Gothic"] = "MS Gothic";
  35814. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  35815. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  35816. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  35817. t["MS-Mincho"] = "MS Mincho";
  35818. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  35819. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  35820. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  35821. t["MS-PGothic"] = "MS PGothic";
  35822. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  35823. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  35824. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  35825. t["MS-PMincho"] = "MS PMincho";
  35826. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  35827. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  35828. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  35829. t.NuptialScript = "Times-Italic";
  35830. t.SegoeUISymbol = "Helvetica";
  35831. t.Wingdings = "ZapfDingbats";
  35832. t["Wingdings-Regular"] = "ZapfDingbats";
  35833. });
  35834. exports.getNonStdFontMap = getNonStdFontMap;
  35835. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  35836. t["Adobe Jenson"] = true;
  35837. t["Adobe Text"] = true;
  35838. t.Albertus = true;
  35839. t.Aldus = true;
  35840. t.Alexandria = true;
  35841. t.Algerian = true;
  35842. t["American Typewriter"] = true;
  35843. t.Antiqua = true;
  35844. t.Apex = true;
  35845. t.Arno = true;
  35846. t.Aster = true;
  35847. t.Aurora = true;
  35848. t.Baskerville = true;
  35849. t.Bell = true;
  35850. t.Bembo = true;
  35851. t["Bembo Schoolbook"] = true;
  35852. t.Benguiat = true;
  35853. t["Berkeley Old Style"] = true;
  35854. t["Bernhard Modern"] = true;
  35855. t["Berthold City"] = true;
  35856. t.Bodoni = true;
  35857. t["Bauer Bodoni"] = true;
  35858. t["Book Antiqua"] = true;
  35859. t.Bookman = true;
  35860. t["Bordeaux Roman"] = true;
  35861. t["Californian FB"] = true;
  35862. t.Calisto = true;
  35863. t.Calvert = true;
  35864. t.Capitals = true;
  35865. t.Cambria = true;
  35866. t.Cartier = true;
  35867. t.Caslon = true;
  35868. t.Catull = true;
  35869. t.Centaur = true;
  35870. t["Century Old Style"] = true;
  35871. t["Century Schoolbook"] = true;
  35872. t.Chaparral = true;
  35873. t["Charis SIL"] = true;
  35874. t.Cheltenham = true;
  35875. t["Cholla Slab"] = true;
  35876. t.Clarendon = true;
  35877. t.Clearface = true;
  35878. t.Cochin = true;
  35879. t.Colonna = true;
  35880. t["Computer Modern"] = true;
  35881. t["Concrete Roman"] = true;
  35882. t.Constantia = true;
  35883. t["Cooper Black"] = true;
  35884. t.Corona = true;
  35885. t.Ecotype = true;
  35886. t.Egyptienne = true;
  35887. t.Elephant = true;
  35888. t.Excelsior = true;
  35889. t.Fairfield = true;
  35890. t["FF Scala"] = true;
  35891. t.Folkard = true;
  35892. t.Footlight = true;
  35893. t.FreeSerif = true;
  35894. t["Friz Quadrata"] = true;
  35895. t.Garamond = true;
  35896. t.Gentium = true;
  35897. t.Georgia = true;
  35898. t.Gloucester = true;
  35899. t["Goudy Old Style"] = true;
  35900. t["Goudy Schoolbook"] = true;
  35901. t["Goudy Pro Font"] = true;
  35902. t.Granjon = true;
  35903. t["Guardian Egyptian"] = true;
  35904. t.Heather = true;
  35905. t.Hercules = true;
  35906. t["High Tower Text"] = true;
  35907. t.Hiroshige = true;
  35908. t["Hoefler Text"] = true;
  35909. t["Humana Serif"] = true;
  35910. t.Imprint = true;
  35911. t["Ionic No. 5"] = true;
  35912. t.Janson = true;
  35913. t.Joanna = true;
  35914. t.Korinna = true;
  35915. t.Lexicon = true;
  35916. t.LiberationSerif = true;
  35917. t["Liberation Serif"] = true;
  35918. t["Linux Libertine"] = true;
  35919. t.Literaturnaya = true;
  35920. t.Lucida = true;
  35921. t["Lucida Bright"] = true;
  35922. t.Melior = true;
  35923. t.Memphis = true;
  35924. t.Miller = true;
  35925. t.Minion = true;
  35926. t.Modern = true;
  35927. t["Mona Lisa"] = true;
  35928. t["Mrs Eaves"] = true;
  35929. t["MS Serif"] = true;
  35930. t["Museo Slab"] = true;
  35931. t["New York"] = true;
  35932. t["Nimbus Roman"] = true;
  35933. t["NPS Rawlinson Roadway"] = true;
  35934. t.NuptialScript = true;
  35935. t.Palatino = true;
  35936. t.Perpetua = true;
  35937. t.Plantin = true;
  35938. t["Plantin Schoolbook"] = true;
  35939. t.Playbill = true;
  35940. t["Poor Richard"] = true;
  35941. t["Rawlinson Roadway"] = true;
  35942. t.Renault = true;
  35943. t.Requiem = true;
  35944. t.Rockwell = true;
  35945. t.Roman = true;
  35946. t["Rotis Serif"] = true;
  35947. t.Sabon = true;
  35948. t.Scala = true;
  35949. t.Seagull = true;
  35950. t.Sistina = true;
  35951. t.Souvenir = true;
  35952. t.STIX = true;
  35953. t["Stone Informal"] = true;
  35954. t["Stone Serif"] = true;
  35955. t.Sylfaen = true;
  35956. t.Times = true;
  35957. t.Trajan = true;
  35958. t["Trinité"] = true;
  35959. t["Trump Mediaeval"] = true;
  35960. t.Utopia = true;
  35961. t["Vale Type"] = true;
  35962. t["Bitstream Vera"] = true;
  35963. t["Vera Serif"] = true;
  35964. t.Versailles = true;
  35965. t.Wanted = true;
  35966. t.Weiss = true;
  35967. t["Wide Latin"] = true;
  35968. t.Windsor = true;
  35969. t.XITS = true;
  35970. });
  35971. exports.getSerifFonts = getSerifFonts;
  35972. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  35973. t.Dingbats = true;
  35974. t.Symbol = true;
  35975. t.ZapfDingbats = true;
  35976. });
  35977. exports.getSymbolsFonts = getSymbolsFonts;
  35978. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  35979. t[2] = 10;
  35980. t[3] = 32;
  35981. t[4] = 33;
  35982. t[5] = 34;
  35983. t[6] = 35;
  35984. t[7] = 36;
  35985. t[8] = 37;
  35986. t[9] = 38;
  35987. t[10] = 39;
  35988. t[11] = 40;
  35989. t[12] = 41;
  35990. t[13] = 42;
  35991. t[14] = 43;
  35992. t[15] = 44;
  35993. t[16] = 45;
  35994. t[17] = 46;
  35995. t[18] = 47;
  35996. t[19] = 48;
  35997. t[20] = 49;
  35998. t[21] = 50;
  35999. t[22] = 51;
  36000. t[23] = 52;
  36001. t[24] = 53;
  36002. t[25] = 54;
  36003. t[26] = 55;
  36004. t[27] = 56;
  36005. t[28] = 57;
  36006. t[29] = 58;
  36007. t[30] = 894;
  36008. t[31] = 60;
  36009. t[32] = 61;
  36010. t[33] = 62;
  36011. t[34] = 63;
  36012. t[35] = 64;
  36013. t[36] = 65;
  36014. t[37] = 66;
  36015. t[38] = 67;
  36016. t[39] = 68;
  36017. t[40] = 69;
  36018. t[41] = 70;
  36019. t[42] = 71;
  36020. t[43] = 72;
  36021. t[44] = 73;
  36022. t[45] = 74;
  36023. t[46] = 75;
  36024. t[47] = 76;
  36025. t[48] = 77;
  36026. t[49] = 78;
  36027. t[50] = 79;
  36028. t[51] = 80;
  36029. t[52] = 81;
  36030. t[53] = 82;
  36031. t[54] = 83;
  36032. t[55] = 84;
  36033. t[56] = 85;
  36034. t[57] = 86;
  36035. t[58] = 87;
  36036. t[59] = 88;
  36037. t[60] = 89;
  36038. t[61] = 90;
  36039. t[62] = 91;
  36040. t[63] = 92;
  36041. t[64] = 93;
  36042. t[65] = 94;
  36043. t[66] = 95;
  36044. t[67] = 96;
  36045. t[68] = 97;
  36046. t[69] = 98;
  36047. t[70] = 99;
  36048. t[71] = 100;
  36049. t[72] = 101;
  36050. t[73] = 102;
  36051. t[74] = 103;
  36052. t[75] = 104;
  36053. t[76] = 105;
  36054. t[77] = 106;
  36055. t[78] = 107;
  36056. t[79] = 108;
  36057. t[80] = 109;
  36058. t[81] = 110;
  36059. t[82] = 111;
  36060. t[83] = 112;
  36061. t[84] = 113;
  36062. t[85] = 114;
  36063. t[86] = 115;
  36064. t[87] = 116;
  36065. t[88] = 117;
  36066. t[89] = 118;
  36067. t[90] = 119;
  36068. t[91] = 120;
  36069. t[92] = 121;
  36070. t[93] = 122;
  36071. t[94] = 123;
  36072. t[95] = 124;
  36073. t[96] = 125;
  36074. t[97] = 126;
  36075. t[98] = 196;
  36076. t[99] = 197;
  36077. t[100] = 199;
  36078. t[101] = 201;
  36079. t[102] = 209;
  36080. t[103] = 214;
  36081. t[104] = 220;
  36082. t[105] = 225;
  36083. t[106] = 224;
  36084. t[107] = 226;
  36085. t[108] = 228;
  36086. t[109] = 227;
  36087. t[110] = 229;
  36088. t[111] = 231;
  36089. t[112] = 233;
  36090. t[113] = 232;
  36091. t[114] = 234;
  36092. t[115] = 235;
  36093. t[116] = 237;
  36094. t[117] = 236;
  36095. t[118] = 238;
  36096. t[119] = 239;
  36097. t[120] = 241;
  36098. t[121] = 243;
  36099. t[122] = 242;
  36100. t[123] = 244;
  36101. t[124] = 246;
  36102. t[125] = 245;
  36103. t[126] = 250;
  36104. t[127] = 249;
  36105. t[128] = 251;
  36106. t[129] = 252;
  36107. t[130] = 8224;
  36108. t[131] = 176;
  36109. t[132] = 162;
  36110. t[133] = 163;
  36111. t[134] = 167;
  36112. t[135] = 8226;
  36113. t[136] = 182;
  36114. t[137] = 223;
  36115. t[138] = 174;
  36116. t[139] = 169;
  36117. t[140] = 8482;
  36118. t[141] = 180;
  36119. t[142] = 168;
  36120. t[143] = 8800;
  36121. t[144] = 198;
  36122. t[145] = 216;
  36123. t[146] = 8734;
  36124. t[147] = 177;
  36125. t[148] = 8804;
  36126. t[149] = 8805;
  36127. t[150] = 165;
  36128. t[151] = 181;
  36129. t[152] = 8706;
  36130. t[153] = 8721;
  36131. t[154] = 8719;
  36132. t[156] = 8747;
  36133. t[157] = 170;
  36134. t[158] = 186;
  36135. t[159] = 8486;
  36136. t[160] = 230;
  36137. t[161] = 248;
  36138. t[162] = 191;
  36139. t[163] = 161;
  36140. t[164] = 172;
  36141. t[165] = 8730;
  36142. t[166] = 402;
  36143. t[167] = 8776;
  36144. t[168] = 8710;
  36145. t[169] = 171;
  36146. t[170] = 187;
  36147. t[171] = 8230;
  36148. t[200] = 193;
  36149. t[203] = 205;
  36150. t[210] = 218;
  36151. t[223] = 711;
  36152. t[224] = 321;
  36153. t[225] = 322;
  36154. t[226] = 352;
  36155. t[227] = 353;
  36156. t[228] = 381;
  36157. t[229] = 382;
  36158. t[233] = 221;
  36159. t[234] = 253;
  36160. t[252] = 263;
  36161. t[253] = 268;
  36162. t[254] = 269;
  36163. t[258] = 258;
  36164. t[260] = 260;
  36165. t[261] = 261;
  36166. t[265] = 280;
  36167. t[266] = 281;
  36168. t[267] = 282;
  36169. t[268] = 283;
  36170. t[269] = 313;
  36171. t[275] = 323;
  36172. t[276] = 324;
  36173. t[278] = 328;
  36174. t[283] = 344;
  36175. t[284] = 345;
  36176. t[285] = 346;
  36177. t[286] = 347;
  36178. t[292] = 367;
  36179. t[295] = 377;
  36180. t[296] = 378;
  36181. t[298] = 380;
  36182. t[305] = 963;
  36183. t[306] = 964;
  36184. t[307] = 966;
  36185. t[308] = 8215;
  36186. t[309] = 8252;
  36187. t[310] = 8319;
  36188. t[311] = 8359;
  36189. t[312] = 8592;
  36190. t[313] = 8593;
  36191. t[337] = 9552;
  36192. t[493] = 1039;
  36193. t[494] = 1040;
  36194. t[705] = 1524;
  36195. t[706] = 8362;
  36196. t[710] = 64288;
  36197. t[711] = 64298;
  36198. t[759] = 1617;
  36199. t[761] = 1776;
  36200. t[763] = 1778;
  36201. t[775] = 1652;
  36202. t[777] = 1764;
  36203. t[778] = 1780;
  36204. t[779] = 1781;
  36205. t[780] = 1782;
  36206. t[782] = 771;
  36207. t[783] = 64726;
  36208. t[786] = 8363;
  36209. t[788] = 8532;
  36210. t[790] = 768;
  36211. t[791] = 769;
  36212. t[792] = 768;
  36213. t[795] = 803;
  36214. t[797] = 64336;
  36215. t[798] = 64337;
  36216. t[799] = 64342;
  36217. t[800] = 64343;
  36218. t[801] = 64344;
  36219. t[802] = 64345;
  36220. t[803] = 64362;
  36221. t[804] = 64363;
  36222. t[805] = 64364;
  36223. t[2424] = 7821;
  36224. t[2425] = 7822;
  36225. t[2426] = 7823;
  36226. t[2427] = 7824;
  36227. t[2428] = 7825;
  36228. t[2429] = 7826;
  36229. t[2430] = 7827;
  36230. t[2433] = 7682;
  36231. t[2678] = 8045;
  36232. t[2679] = 8046;
  36233. t[2830] = 1552;
  36234. t[2838] = 686;
  36235. t[2840] = 751;
  36236. t[2842] = 753;
  36237. t[2843] = 754;
  36238. t[2844] = 755;
  36239. t[2846] = 757;
  36240. t[2856] = 767;
  36241. t[2857] = 848;
  36242. t[2858] = 849;
  36243. t[2862] = 853;
  36244. t[2863] = 854;
  36245. t[2864] = 855;
  36246. t[2865] = 861;
  36247. t[2866] = 862;
  36248. t[2906] = 7460;
  36249. t[2908] = 7462;
  36250. t[2909] = 7463;
  36251. t[2910] = 7464;
  36252. t[2912] = 7466;
  36253. t[2913] = 7467;
  36254. t[2914] = 7468;
  36255. t[2916] = 7470;
  36256. t[2917] = 7471;
  36257. t[2918] = 7472;
  36258. t[2920] = 7474;
  36259. t[2921] = 7475;
  36260. t[2922] = 7476;
  36261. t[2924] = 7478;
  36262. t[2925] = 7479;
  36263. t[2926] = 7480;
  36264. t[2928] = 7482;
  36265. t[2929] = 7483;
  36266. t[2930] = 7484;
  36267. t[2932] = 7486;
  36268. t[2933] = 7487;
  36269. t[2934] = 7488;
  36270. t[2936] = 7490;
  36271. t[2937] = 7491;
  36272. t[2938] = 7492;
  36273. t[2940] = 7494;
  36274. t[2941] = 7495;
  36275. t[2942] = 7496;
  36276. t[2944] = 7498;
  36277. t[2946] = 7500;
  36278. t[2948] = 7502;
  36279. t[2950] = 7504;
  36280. t[2951] = 7505;
  36281. t[2952] = 7506;
  36282. t[2954] = 7508;
  36283. t[2955] = 7509;
  36284. t[2956] = 7510;
  36285. t[2958] = 7512;
  36286. t[2959] = 7513;
  36287. t[2960] = 7514;
  36288. t[2962] = 7516;
  36289. t[2963] = 7517;
  36290. t[2964] = 7518;
  36291. t[2966] = 7520;
  36292. t[2967] = 7521;
  36293. t[2968] = 7522;
  36294. t[2970] = 7524;
  36295. t[2971] = 7525;
  36296. t[2972] = 7526;
  36297. t[2974] = 7528;
  36298. t[2975] = 7529;
  36299. t[2976] = 7530;
  36300. t[2978] = 1537;
  36301. t[2979] = 1538;
  36302. t[2980] = 1539;
  36303. t[2982] = 1549;
  36304. t[2983] = 1551;
  36305. t[2984] = 1552;
  36306. t[2986] = 1554;
  36307. t[2987] = 1555;
  36308. t[2988] = 1556;
  36309. t[2990] = 1623;
  36310. t[2991] = 1624;
  36311. t[2995] = 1775;
  36312. t[2999] = 1791;
  36313. t[3002] = 64290;
  36314. t[3003] = 64291;
  36315. t[3004] = 64292;
  36316. t[3006] = 64294;
  36317. t[3007] = 64295;
  36318. t[3008] = 64296;
  36319. t[3011] = 1900;
  36320. t[3014] = 8223;
  36321. t[3015] = 8244;
  36322. t[3017] = 7532;
  36323. t[3018] = 7533;
  36324. t[3019] = 7534;
  36325. t[3075] = 7590;
  36326. t[3076] = 7591;
  36327. t[3079] = 7594;
  36328. t[3080] = 7595;
  36329. t[3083] = 7598;
  36330. t[3084] = 7599;
  36331. t[3087] = 7602;
  36332. t[3088] = 7603;
  36333. t[3091] = 7606;
  36334. t[3092] = 7607;
  36335. t[3095] = 7610;
  36336. t[3096] = 7611;
  36337. t[3099] = 7614;
  36338. t[3100] = 7615;
  36339. t[3103] = 7618;
  36340. t[3104] = 7619;
  36341. t[3107] = 8337;
  36342. t[3108] = 8338;
  36343. t[3116] = 1884;
  36344. t[3119] = 1885;
  36345. t[3120] = 1885;
  36346. t[3123] = 1886;
  36347. t[3124] = 1886;
  36348. t[3127] = 1887;
  36349. t[3128] = 1887;
  36350. t[3131] = 1888;
  36351. t[3132] = 1888;
  36352. t[3135] = 1889;
  36353. t[3136] = 1889;
  36354. t[3139] = 1890;
  36355. t[3140] = 1890;
  36356. t[3143] = 1891;
  36357. t[3144] = 1891;
  36358. t[3147] = 1892;
  36359. t[3148] = 1892;
  36360. t[3153] = 580;
  36361. t[3154] = 581;
  36362. t[3157] = 584;
  36363. t[3158] = 585;
  36364. t[3161] = 588;
  36365. t[3162] = 589;
  36366. t[3165] = 891;
  36367. t[3166] = 892;
  36368. t[3169] = 1274;
  36369. t[3170] = 1275;
  36370. t[3173] = 1278;
  36371. t[3174] = 1279;
  36372. t[3181] = 7622;
  36373. t[3182] = 7623;
  36374. t[3282] = 11799;
  36375. t[3316] = 578;
  36376. t[3379] = 42785;
  36377. t[3393] = 1159;
  36378. t[3416] = 8377;
  36379. });
  36380. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  36381. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  36382. t[227] = 322;
  36383. t[264] = 261;
  36384. t[291] = 346;
  36385. });
  36386. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  36387. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  36388. t[1] = 32;
  36389. t[4] = 65;
  36390. t[6] = 193;
  36391. t[17] = 66;
  36392. t[18] = 67;
  36393. t[21] = 268;
  36394. t[24] = 68;
  36395. t[28] = 69;
  36396. t[30] = 201;
  36397. t[32] = 282;
  36398. t[38] = 70;
  36399. t[39] = 71;
  36400. t[44] = 72;
  36401. t[47] = 73;
  36402. t[49] = 205;
  36403. t[58] = 74;
  36404. t[60] = 75;
  36405. t[62] = 76;
  36406. t[68] = 77;
  36407. t[69] = 78;
  36408. t[75] = 79;
  36409. t[87] = 80;
  36410. t[89] = 81;
  36411. t[90] = 82;
  36412. t[92] = 344;
  36413. t[94] = 83;
  36414. t[97] = 352;
  36415. t[100] = 84;
  36416. t[104] = 85;
  36417. t[115] = 86;
  36418. t[116] = 87;
  36419. t[121] = 88;
  36420. t[122] = 89;
  36421. t[124] = 221;
  36422. t[127] = 90;
  36423. t[129] = 381;
  36424. t[258] = 97;
  36425. t[260] = 225;
  36426. t[268] = 261;
  36427. t[271] = 98;
  36428. t[272] = 99;
  36429. t[273] = 263;
  36430. t[275] = 269;
  36431. t[282] = 100;
  36432. t[286] = 101;
  36433. t[288] = 233;
  36434. t[290] = 283;
  36435. t[295] = 281;
  36436. t[296] = 102;
  36437. t[336] = 103;
  36438. t[346] = 104;
  36439. t[349] = 105;
  36440. t[351] = 237;
  36441. t[361] = 106;
  36442. t[364] = 107;
  36443. t[367] = 108;
  36444. t[371] = 322;
  36445. t[373] = 109;
  36446. t[374] = 110;
  36447. t[381] = 111;
  36448. t[383] = 243;
  36449. t[393] = 112;
  36450. t[395] = 113;
  36451. t[396] = 114;
  36452. t[398] = 345;
  36453. t[400] = 115;
  36454. t[401] = 347;
  36455. t[403] = 353;
  36456. t[410] = 116;
  36457. t[437] = 117;
  36458. t[448] = 118;
  36459. t[449] = 119;
  36460. t[454] = 120;
  36461. t[455] = 121;
  36462. t[457] = 253;
  36463. t[460] = 122;
  36464. t[462] = 382;
  36465. t[463] = 380;
  36466. t[853] = 44;
  36467. t[855] = 58;
  36468. t[856] = 46;
  36469. t[876] = 47;
  36470. t[878] = 45;
  36471. t[882] = 45;
  36472. t[894] = 40;
  36473. t[895] = 41;
  36474. t[896] = 91;
  36475. t[897] = 93;
  36476. t[923] = 64;
  36477. t[1004] = 48;
  36478. t[1005] = 49;
  36479. t[1006] = 50;
  36480. t[1007] = 51;
  36481. t[1008] = 52;
  36482. t[1009] = 53;
  36483. t[1010] = 54;
  36484. t[1011] = 55;
  36485. t[1012] = 56;
  36486. t[1013] = 57;
  36487. t[1081] = 37;
  36488. t[1085] = 43;
  36489. t[1086] = 45;
  36490. });
  36491. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  36492. function getStandardFontName(name) {
  36493. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  36494. const stdFontMap = getStdFontMap();
  36495. return stdFontMap[fontName];
  36496. }
  36497. /***/ }),
  36498. /* 48 */
  36499. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36500. Object.defineProperty(exports, "__esModule", ({
  36501. value: true
  36502. }));
  36503. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  36504. var _util = __w_pdfjs_require__(2);
  36505. class ToUnicodeMap {
  36506. constructor(cmap = []) {
  36507. this._map = cmap;
  36508. }
  36509. get length() {
  36510. return this._map.length;
  36511. }
  36512. forEach(callback) {
  36513. for (const charCode in this._map) {
  36514. callback(charCode, this._map[charCode].charCodeAt(0));
  36515. }
  36516. }
  36517. has(i) {
  36518. return this._map[i] !== undefined;
  36519. }
  36520. get(i) {
  36521. return this._map[i];
  36522. }
  36523. charCodeOf(value) {
  36524. const map = this._map;
  36525. if (map.length <= 0x10000) {
  36526. return map.indexOf(value);
  36527. }
  36528. for (const charCode in map) {
  36529. if (map[charCode] === value) {
  36530. return charCode | 0;
  36531. }
  36532. }
  36533. return -1;
  36534. }
  36535. amend(map) {
  36536. for (const charCode in map) {
  36537. this._map[charCode] = map[charCode];
  36538. }
  36539. }
  36540. }
  36541. exports.ToUnicodeMap = ToUnicodeMap;
  36542. class IdentityToUnicodeMap {
  36543. constructor(firstChar, lastChar) {
  36544. this.firstChar = firstChar;
  36545. this.lastChar = lastChar;
  36546. }
  36547. get length() {
  36548. return this.lastChar + 1 - this.firstChar;
  36549. }
  36550. forEach(callback) {
  36551. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  36552. callback(i, i);
  36553. }
  36554. }
  36555. has(i) {
  36556. return this.firstChar <= i && i <= this.lastChar;
  36557. }
  36558. get(i) {
  36559. if (this.firstChar <= i && i <= this.lastChar) {
  36560. return String.fromCharCode(i);
  36561. }
  36562. return undefined;
  36563. }
  36564. charCodeOf(v) {
  36565. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  36566. }
  36567. amend(map) {
  36568. (0, _util.unreachable)("Should not call amend()");
  36569. }
  36570. }
  36571. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  36572. /***/ }),
  36573. /* 49 */
  36574. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36575. Object.defineProperty(exports, "__esModule", ({
  36576. value: true
  36577. }));
  36578. exports.CFFFont = void 0;
  36579. var _cff_parser = __w_pdfjs_require__(45);
  36580. var _fonts_utils = __w_pdfjs_require__(18);
  36581. var _util = __w_pdfjs_require__(2);
  36582. class CFFFont {
  36583. constructor(file, properties) {
  36584. this.properties = properties;
  36585. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  36586. this.cff = parser.parse();
  36587. this.cff.duplicateFirstGlyph();
  36588. const compiler = new _cff_parser.CFFCompiler(this.cff);
  36589. this.seacs = this.cff.seacs;
  36590. try {
  36591. this.data = compiler.compile();
  36592. } catch (e) {
  36593. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  36594. this.data = file;
  36595. }
  36596. this._createBuiltInEncoding();
  36597. }
  36598. get numGlyphs() {
  36599. return this.cff.charStrings.count;
  36600. }
  36601. getCharset() {
  36602. return this.cff.charset.charset;
  36603. }
  36604. getGlyphMapping() {
  36605. const cff = this.cff;
  36606. const properties = this.properties;
  36607. const charsets = cff.charset.charset;
  36608. let charCodeToGlyphId;
  36609. let glyphId;
  36610. if (properties.composite) {
  36611. charCodeToGlyphId = Object.create(null);
  36612. let charCode;
  36613. if (cff.isCIDFont) {
  36614. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  36615. const cid = charsets[glyphId];
  36616. charCode = properties.cMap.charCodeOf(cid);
  36617. charCodeToGlyphId[charCode] = glyphId;
  36618. }
  36619. } else {
  36620. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  36621. charCode = properties.cMap.charCodeOf(glyphId);
  36622. charCodeToGlyphId[charCode] = glyphId;
  36623. }
  36624. }
  36625. return charCodeToGlyphId;
  36626. }
  36627. let encoding = cff.encoding ? cff.encoding.encoding : null;
  36628. if (properties.isInternalFont) {
  36629. encoding = properties.defaultEncoding;
  36630. }
  36631. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  36632. return charCodeToGlyphId;
  36633. }
  36634. hasGlyphId(id) {
  36635. return this.cff.hasGlyphId(id);
  36636. }
  36637. _createBuiltInEncoding() {
  36638. const {
  36639. charset,
  36640. encoding
  36641. } = this.cff;
  36642. if (!charset || !encoding) {
  36643. return;
  36644. }
  36645. const charsets = charset.charset,
  36646. encodings = encoding.encoding;
  36647. const map = [];
  36648. for (const charCode in encodings) {
  36649. const glyphId = encodings[charCode];
  36650. if (glyphId >= 0) {
  36651. const glyphName = charsets[glyphId];
  36652. if (glyphName) {
  36653. map[charCode] = glyphName;
  36654. }
  36655. }
  36656. }
  36657. if (map.length > 0) {
  36658. this.properties.builtInEncoding = map;
  36659. }
  36660. }
  36661. }
  36662. exports.CFFFont = CFFFont;
  36663. /***/ }),
  36664. /* 50 */
  36665. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36666. Object.defineProperty(exports, "__esModule", ({
  36667. value: true
  36668. }));
  36669. exports.FontRendererFactory = void 0;
  36670. var _util = __w_pdfjs_require__(2);
  36671. var _cff_parser = __w_pdfjs_require__(45);
  36672. var _glyphlist = __w_pdfjs_require__(20);
  36673. var _encodings = __w_pdfjs_require__(19);
  36674. var _stream = __w_pdfjs_require__(10);
  36675. function getLong(data, offset) {
  36676. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  36677. }
  36678. function getUshort(data, offset) {
  36679. return data[offset] << 8 | data[offset + 1];
  36680. }
  36681. function getSubroutineBias(subrs) {
  36682. const numSubrs = subrs.length;
  36683. let bias = 32768;
  36684. if (numSubrs < 1240) {
  36685. bias = 107;
  36686. } else if (numSubrs < 33900) {
  36687. bias = 1131;
  36688. }
  36689. return bias;
  36690. }
  36691. function parseCmap(data, start, end) {
  36692. const offset = getUshort(data, start + 2) === 1 ? getLong(data, start + 8) : getLong(data, start + 16);
  36693. const format = getUshort(data, start + offset);
  36694. let ranges, p, i;
  36695. if (format === 4) {
  36696. getUshort(data, start + offset + 2);
  36697. const segCount = getUshort(data, start + offset + 6) >> 1;
  36698. p = start + offset + 14;
  36699. ranges = [];
  36700. for (i = 0; i < segCount; i++, p += 2) {
  36701. ranges[i] = {
  36702. end: getUshort(data, p)
  36703. };
  36704. }
  36705. p += 2;
  36706. for (i = 0; i < segCount; i++, p += 2) {
  36707. ranges[i].start = getUshort(data, p);
  36708. }
  36709. for (i = 0; i < segCount; i++, p += 2) {
  36710. ranges[i].idDelta = getUshort(data, p);
  36711. }
  36712. for (i = 0; i < segCount; i++, p += 2) {
  36713. let idOffset = getUshort(data, p);
  36714. if (idOffset === 0) {
  36715. continue;
  36716. }
  36717. ranges[i].ids = [];
  36718. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  36719. ranges[i].ids[j] = getUshort(data, p + idOffset);
  36720. idOffset += 2;
  36721. }
  36722. }
  36723. return ranges;
  36724. } else if (format === 12) {
  36725. getLong(data, start + offset + 4);
  36726. const groups = getLong(data, start + offset + 12);
  36727. p = start + offset + 16;
  36728. ranges = [];
  36729. for (i = 0; i < groups; i++) {
  36730. ranges.push({
  36731. start: getLong(data, p),
  36732. end: getLong(data, p + 4),
  36733. idDelta: getLong(data, p + 8) - getLong(data, p)
  36734. });
  36735. p += 12;
  36736. }
  36737. return ranges;
  36738. }
  36739. throw new _util.FormatError(`unsupported cmap: ${format}`);
  36740. }
  36741. function parseCff(data, start, end, seacAnalysisEnabled) {
  36742. const properties = {};
  36743. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  36744. const cff = parser.parse();
  36745. return {
  36746. glyphs: cff.charStrings.objects,
  36747. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  36748. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  36749. isCFFCIDFont: cff.isCIDFont,
  36750. fdSelect: cff.fdSelect,
  36751. fdArray: cff.fdArray
  36752. };
  36753. }
  36754. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  36755. let itemSize, itemDecode;
  36756. if (isGlyphLocationsLong) {
  36757. itemSize = 4;
  36758. itemDecode = function fontItemDecodeLong(data, offset) {
  36759. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  36760. };
  36761. } else {
  36762. itemSize = 2;
  36763. itemDecode = function fontItemDecode(data, offset) {
  36764. return data[offset] << 9 | data[offset + 1] << 1;
  36765. };
  36766. }
  36767. const glyphs = [];
  36768. let startOffset = itemDecode(loca, 0);
  36769. for (let j = itemSize; j < loca.length; j += itemSize) {
  36770. const endOffset = itemDecode(loca, j);
  36771. glyphs.push(glyf.subarray(startOffset, endOffset));
  36772. startOffset = endOffset;
  36773. }
  36774. return glyphs;
  36775. }
  36776. function lookupCmap(ranges, unicode) {
  36777. const code = unicode.codePointAt(0);
  36778. let gid = 0,
  36779. l = 0,
  36780. r = ranges.length - 1;
  36781. while (l < r) {
  36782. const c = l + r + 1 >> 1;
  36783. if (code < ranges[c].start) {
  36784. r = c - 1;
  36785. } else {
  36786. l = c;
  36787. }
  36788. }
  36789. if (ranges[l].start <= code && code <= ranges[l].end) {
  36790. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  36791. }
  36792. return {
  36793. charCode: code,
  36794. glyphId: gid
  36795. };
  36796. }
  36797. function compileGlyf(code, cmds, font) {
  36798. function moveTo(x, y) {
  36799. cmds.push({
  36800. cmd: "moveTo",
  36801. args: [x, y]
  36802. });
  36803. }
  36804. function lineTo(x, y) {
  36805. cmds.push({
  36806. cmd: "lineTo",
  36807. args: [x, y]
  36808. });
  36809. }
  36810. function quadraticCurveTo(xa, ya, x, y) {
  36811. cmds.push({
  36812. cmd: "quadraticCurveTo",
  36813. args: [xa, ya, x, y]
  36814. });
  36815. }
  36816. let i = 0;
  36817. const numberOfContours = (code[i] << 24 | code[i + 1] << 16) >> 16;
  36818. let flags;
  36819. let x = 0,
  36820. y = 0;
  36821. i += 10;
  36822. if (numberOfContours < 0) {
  36823. do {
  36824. flags = code[i] << 8 | code[i + 1];
  36825. const glyphIndex = code[i + 2] << 8 | code[i + 3];
  36826. i += 4;
  36827. let arg1, arg2;
  36828. if (flags & 0x01) {
  36829. arg1 = (code[i] << 24 | code[i + 1] << 16) >> 16;
  36830. arg2 = (code[i + 2] << 24 | code[i + 3] << 16) >> 16;
  36831. i += 4;
  36832. } else {
  36833. arg1 = code[i++];
  36834. arg2 = code[i++];
  36835. }
  36836. if (flags & 0x02) {
  36837. x = arg1;
  36838. y = arg2;
  36839. } else {
  36840. x = 0;
  36841. y = 0;
  36842. }
  36843. let scaleX = 1,
  36844. scaleY = 1,
  36845. scale01 = 0,
  36846. scale10 = 0;
  36847. if (flags & 0x08) {
  36848. scaleX = scaleY = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  36849. i += 2;
  36850. } else if (flags & 0x40) {
  36851. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  36852. scaleY = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  36853. i += 4;
  36854. } else if (flags & 0x80) {
  36855. scaleX = (code[i] << 24 | code[i + 1] << 16) / 1073741824;
  36856. scale01 = (code[i + 2] << 24 | code[i + 3] << 16) / 1073741824;
  36857. scale10 = (code[i + 4] << 24 | code[i + 5] << 16) / 1073741824;
  36858. scaleY = (code[i + 6] << 24 | code[i + 7] << 16) / 1073741824;
  36859. i += 8;
  36860. }
  36861. const subglyph = font.glyphs[glyphIndex];
  36862. if (subglyph) {
  36863. cmds.push({
  36864. cmd: "save"
  36865. }, {
  36866. cmd: "transform",
  36867. args: [scaleX, scale01, scale10, scaleY, x, y]
  36868. });
  36869. compileGlyf(subglyph, cmds, font);
  36870. cmds.push({
  36871. cmd: "restore"
  36872. });
  36873. }
  36874. } while (flags & 0x20);
  36875. } else {
  36876. const endPtsOfContours = [];
  36877. let j, jj;
  36878. for (j = 0; j < numberOfContours; j++) {
  36879. endPtsOfContours.push(code[i] << 8 | code[i + 1]);
  36880. i += 2;
  36881. }
  36882. const instructionLength = code[i] << 8 | code[i + 1];
  36883. i += 2 + instructionLength;
  36884. const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  36885. const points = [];
  36886. while (points.length < numberOfPoints) {
  36887. flags = code[i++];
  36888. let repeat = 1;
  36889. if (flags & 0x08) {
  36890. repeat += code[i++];
  36891. }
  36892. while (repeat-- > 0) {
  36893. points.push({
  36894. flags
  36895. });
  36896. }
  36897. }
  36898. for (j = 0; j < numberOfPoints; j++) {
  36899. switch (points[j].flags & 0x12) {
  36900. case 0x00:
  36901. x += (code[i] << 24 | code[i + 1] << 16) >> 16;
  36902. i += 2;
  36903. break;
  36904. case 0x02:
  36905. x -= code[i++];
  36906. break;
  36907. case 0x12:
  36908. x += code[i++];
  36909. break;
  36910. }
  36911. points[j].x = x;
  36912. }
  36913. for (j = 0; j < numberOfPoints; j++) {
  36914. switch (points[j].flags & 0x24) {
  36915. case 0x00:
  36916. y += (code[i] << 24 | code[i + 1] << 16) >> 16;
  36917. i += 2;
  36918. break;
  36919. case 0x04:
  36920. y -= code[i++];
  36921. break;
  36922. case 0x24:
  36923. y += code[i++];
  36924. break;
  36925. }
  36926. points[j].y = y;
  36927. }
  36928. let startPoint = 0;
  36929. for (i = 0; i < numberOfContours; i++) {
  36930. const endPoint = endPtsOfContours[i];
  36931. const contour = points.slice(startPoint, endPoint + 1);
  36932. if (contour[0].flags & 1) {
  36933. contour.push(contour[0]);
  36934. } else if (contour[contour.length - 1].flags & 1) {
  36935. contour.unshift(contour[contour.length - 1]);
  36936. } else {
  36937. const p = {
  36938. flags: 1,
  36939. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  36940. y: (contour[0].y + contour[contour.length - 1].y) / 2
  36941. };
  36942. contour.unshift(p);
  36943. contour.push(p);
  36944. }
  36945. moveTo(contour[0].x, contour[0].y);
  36946. for (j = 1, jj = contour.length; j < jj; j++) {
  36947. if (contour[j].flags & 1) {
  36948. lineTo(contour[j].x, contour[j].y);
  36949. } else if (contour[j + 1].flags & 1) {
  36950. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  36951. j++;
  36952. } else {
  36953. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  36954. }
  36955. }
  36956. startPoint = endPoint + 1;
  36957. }
  36958. }
  36959. }
  36960. function compileCharString(charStringCode, cmds, font, glyphId) {
  36961. function moveTo(x, y) {
  36962. cmds.push({
  36963. cmd: "moveTo",
  36964. args: [x, y]
  36965. });
  36966. }
  36967. function lineTo(x, y) {
  36968. cmds.push({
  36969. cmd: "lineTo",
  36970. args: [x, y]
  36971. });
  36972. }
  36973. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  36974. cmds.push({
  36975. cmd: "bezierCurveTo",
  36976. args: [x1, y1, x2, y2, x, y]
  36977. });
  36978. }
  36979. const stack = [];
  36980. let x = 0,
  36981. y = 0;
  36982. let stems = 0;
  36983. function parse(code) {
  36984. let i = 0;
  36985. while (i < code.length) {
  36986. let stackClean = false;
  36987. let v = code[i++];
  36988. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  36989. switch (v) {
  36990. case 1:
  36991. stems += stack.length >> 1;
  36992. stackClean = true;
  36993. break;
  36994. case 3:
  36995. stems += stack.length >> 1;
  36996. stackClean = true;
  36997. break;
  36998. case 4:
  36999. y += stack.pop();
  37000. moveTo(x, y);
  37001. stackClean = true;
  37002. break;
  37003. case 5:
  37004. while (stack.length > 0) {
  37005. x += stack.shift();
  37006. y += stack.shift();
  37007. lineTo(x, y);
  37008. }
  37009. break;
  37010. case 6:
  37011. while (stack.length > 0) {
  37012. x += stack.shift();
  37013. lineTo(x, y);
  37014. if (stack.length === 0) {
  37015. break;
  37016. }
  37017. y += stack.shift();
  37018. lineTo(x, y);
  37019. }
  37020. break;
  37021. case 7:
  37022. while (stack.length > 0) {
  37023. y += stack.shift();
  37024. lineTo(x, y);
  37025. if (stack.length === 0) {
  37026. break;
  37027. }
  37028. x += stack.shift();
  37029. lineTo(x, y);
  37030. }
  37031. break;
  37032. case 8:
  37033. while (stack.length > 0) {
  37034. xa = x + stack.shift();
  37035. ya = y + stack.shift();
  37036. xb = xa + stack.shift();
  37037. yb = ya + stack.shift();
  37038. x = xb + stack.shift();
  37039. y = yb + stack.shift();
  37040. bezierCurveTo(xa, ya, xb, yb, x, y);
  37041. }
  37042. break;
  37043. case 10:
  37044. n = stack.pop();
  37045. subrCode = null;
  37046. if (font.isCFFCIDFont) {
  37047. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  37048. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  37049. const fontDict = font.fdArray[fdIndex];
  37050. let subrs;
  37051. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  37052. subrs = fontDict.privateDict.subrsIndex.objects;
  37053. }
  37054. if (subrs) {
  37055. n += getSubroutineBias(subrs);
  37056. subrCode = subrs[n];
  37057. }
  37058. } else {
  37059. (0, _util.warn)("Invalid fd index for glyph index.");
  37060. }
  37061. } else {
  37062. subrCode = font.subrs[n + font.subrsBias];
  37063. }
  37064. if (subrCode) {
  37065. parse(subrCode);
  37066. }
  37067. break;
  37068. case 11:
  37069. return;
  37070. case 12:
  37071. v = code[i++];
  37072. switch (v) {
  37073. case 34:
  37074. xa = x + stack.shift();
  37075. xb = xa + stack.shift();
  37076. y1 = y + stack.shift();
  37077. x = xb + stack.shift();
  37078. bezierCurveTo(xa, y, xb, y1, x, y1);
  37079. xa = x + stack.shift();
  37080. xb = xa + stack.shift();
  37081. x = xb + stack.shift();
  37082. bezierCurveTo(xa, y1, xb, y, x, y);
  37083. break;
  37084. case 35:
  37085. xa = x + stack.shift();
  37086. ya = y + stack.shift();
  37087. xb = xa + stack.shift();
  37088. yb = ya + stack.shift();
  37089. x = xb + stack.shift();
  37090. y = yb + stack.shift();
  37091. bezierCurveTo(xa, ya, xb, yb, x, y);
  37092. xa = x + stack.shift();
  37093. ya = y + stack.shift();
  37094. xb = xa + stack.shift();
  37095. yb = ya + stack.shift();
  37096. x = xb + stack.shift();
  37097. y = yb + stack.shift();
  37098. bezierCurveTo(xa, ya, xb, yb, x, y);
  37099. stack.pop();
  37100. break;
  37101. case 36:
  37102. xa = x + stack.shift();
  37103. y1 = y + stack.shift();
  37104. xb = xa + stack.shift();
  37105. y2 = y1 + stack.shift();
  37106. x = xb + stack.shift();
  37107. bezierCurveTo(xa, y1, xb, y2, x, y2);
  37108. xa = x + stack.shift();
  37109. xb = xa + stack.shift();
  37110. y3 = y2 + stack.shift();
  37111. x = xb + stack.shift();
  37112. bezierCurveTo(xa, y2, xb, y3, x, y);
  37113. break;
  37114. case 37:
  37115. const x0 = x,
  37116. y0 = y;
  37117. xa = x + stack.shift();
  37118. ya = y + stack.shift();
  37119. xb = xa + stack.shift();
  37120. yb = ya + stack.shift();
  37121. x = xb + stack.shift();
  37122. y = yb + stack.shift();
  37123. bezierCurveTo(xa, ya, xb, yb, x, y);
  37124. xa = x + stack.shift();
  37125. ya = y + stack.shift();
  37126. xb = xa + stack.shift();
  37127. yb = ya + stack.shift();
  37128. x = xb;
  37129. y = yb;
  37130. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  37131. x += stack.shift();
  37132. } else {
  37133. y += stack.shift();
  37134. }
  37135. bezierCurveTo(xa, ya, xb, yb, x, y);
  37136. break;
  37137. default:
  37138. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  37139. }
  37140. break;
  37141. case 14:
  37142. if (stack.length >= 4) {
  37143. const achar = stack.pop();
  37144. const bchar = stack.pop();
  37145. y = stack.pop();
  37146. x = stack.pop();
  37147. cmds.push({
  37148. cmd: "save"
  37149. }, {
  37150. cmd: "translate",
  37151. args: [x, y]
  37152. });
  37153. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  37154. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37155. cmds.push({
  37156. cmd: "restore"
  37157. });
  37158. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  37159. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37160. }
  37161. return;
  37162. case 18:
  37163. stems += stack.length >> 1;
  37164. stackClean = true;
  37165. break;
  37166. case 19:
  37167. stems += stack.length >> 1;
  37168. i += stems + 7 >> 3;
  37169. stackClean = true;
  37170. break;
  37171. case 20:
  37172. stems += stack.length >> 1;
  37173. i += stems + 7 >> 3;
  37174. stackClean = true;
  37175. break;
  37176. case 21:
  37177. y += stack.pop();
  37178. x += stack.pop();
  37179. moveTo(x, y);
  37180. stackClean = true;
  37181. break;
  37182. case 22:
  37183. x += stack.pop();
  37184. moveTo(x, y);
  37185. stackClean = true;
  37186. break;
  37187. case 23:
  37188. stems += stack.length >> 1;
  37189. stackClean = true;
  37190. break;
  37191. case 24:
  37192. while (stack.length > 2) {
  37193. xa = x + stack.shift();
  37194. ya = y + stack.shift();
  37195. xb = xa + stack.shift();
  37196. yb = ya + stack.shift();
  37197. x = xb + stack.shift();
  37198. y = yb + stack.shift();
  37199. bezierCurveTo(xa, ya, xb, yb, x, y);
  37200. }
  37201. x += stack.shift();
  37202. y += stack.shift();
  37203. lineTo(x, y);
  37204. break;
  37205. case 25:
  37206. while (stack.length > 6) {
  37207. x += stack.shift();
  37208. y += stack.shift();
  37209. lineTo(x, y);
  37210. }
  37211. xa = x + stack.shift();
  37212. ya = y + stack.shift();
  37213. xb = xa + stack.shift();
  37214. yb = ya + stack.shift();
  37215. x = xb + stack.shift();
  37216. y = yb + stack.shift();
  37217. bezierCurveTo(xa, ya, xb, yb, x, y);
  37218. break;
  37219. case 26:
  37220. if (stack.length % 2) {
  37221. x += stack.shift();
  37222. }
  37223. while (stack.length > 0) {
  37224. xa = x;
  37225. ya = y + stack.shift();
  37226. xb = xa + stack.shift();
  37227. yb = ya + stack.shift();
  37228. x = xb;
  37229. y = yb + stack.shift();
  37230. bezierCurveTo(xa, ya, xb, yb, x, y);
  37231. }
  37232. break;
  37233. case 27:
  37234. if (stack.length % 2) {
  37235. y += stack.shift();
  37236. }
  37237. while (stack.length > 0) {
  37238. xa = x + stack.shift();
  37239. ya = y;
  37240. xb = xa + stack.shift();
  37241. yb = ya + stack.shift();
  37242. x = xb + stack.shift();
  37243. y = yb;
  37244. bezierCurveTo(xa, ya, xb, yb, x, y);
  37245. }
  37246. break;
  37247. case 28:
  37248. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  37249. i += 2;
  37250. break;
  37251. case 29:
  37252. n = stack.pop() + font.gsubrsBias;
  37253. subrCode = font.gsubrs[n];
  37254. if (subrCode) {
  37255. parse(subrCode);
  37256. }
  37257. break;
  37258. case 30:
  37259. while (stack.length > 0) {
  37260. xa = x;
  37261. ya = y + stack.shift();
  37262. xb = xa + stack.shift();
  37263. yb = ya + stack.shift();
  37264. x = xb + stack.shift();
  37265. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37266. bezierCurveTo(xa, ya, xb, yb, x, y);
  37267. if (stack.length === 0) {
  37268. break;
  37269. }
  37270. xa = x + stack.shift();
  37271. ya = y;
  37272. xb = xa + stack.shift();
  37273. yb = ya + stack.shift();
  37274. y = yb + stack.shift();
  37275. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37276. bezierCurveTo(xa, ya, xb, yb, x, y);
  37277. }
  37278. break;
  37279. case 31:
  37280. while (stack.length > 0) {
  37281. xa = x + stack.shift();
  37282. ya = y;
  37283. xb = xa + stack.shift();
  37284. yb = ya + stack.shift();
  37285. y = yb + stack.shift();
  37286. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37287. bezierCurveTo(xa, ya, xb, yb, x, y);
  37288. if (stack.length === 0) {
  37289. break;
  37290. }
  37291. xa = x;
  37292. ya = y + stack.shift();
  37293. xb = xa + stack.shift();
  37294. yb = ya + stack.shift();
  37295. x = xb + stack.shift();
  37296. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37297. bezierCurveTo(xa, ya, xb, yb, x, y);
  37298. }
  37299. break;
  37300. default:
  37301. if (v < 32) {
  37302. throw new _util.FormatError(`unknown operator: ${v}`);
  37303. }
  37304. if (v < 247) {
  37305. stack.push(v - 139);
  37306. } else if (v < 251) {
  37307. stack.push((v - 247) * 256 + code[i++] + 108);
  37308. } else if (v < 255) {
  37309. stack.push(-(v - 251) * 256 - code[i++] - 108);
  37310. } else {
  37311. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  37312. i += 4;
  37313. }
  37314. break;
  37315. }
  37316. if (stackClean) {
  37317. stack.length = 0;
  37318. }
  37319. }
  37320. }
  37321. parse(charStringCode);
  37322. }
  37323. const NOOP = [];
  37324. class CompiledFont {
  37325. constructor(fontMatrix) {
  37326. if (this.constructor === CompiledFont) {
  37327. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  37328. }
  37329. this.fontMatrix = fontMatrix;
  37330. this.compiledGlyphs = Object.create(null);
  37331. this.compiledCharCodeToGlyphId = Object.create(null);
  37332. }
  37333. getPathJs(unicode) {
  37334. const {
  37335. charCode,
  37336. glyphId
  37337. } = lookupCmap(this.cmap, unicode);
  37338. let fn = this.compiledGlyphs[glyphId];
  37339. if (!fn) {
  37340. try {
  37341. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  37342. this.compiledGlyphs[glyphId] = fn;
  37343. } catch (ex) {
  37344. this.compiledGlyphs[glyphId] = NOOP;
  37345. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37346. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37347. }
  37348. throw ex;
  37349. }
  37350. }
  37351. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37352. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37353. }
  37354. return fn;
  37355. }
  37356. compileGlyph(code, glyphId) {
  37357. if (!code || code.length === 0 || code[0] === 14) {
  37358. return NOOP;
  37359. }
  37360. let fontMatrix = this.fontMatrix;
  37361. if (this.isCFFCIDFont) {
  37362. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  37363. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  37364. const fontDict = this.fdArray[fdIndex];
  37365. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  37366. } else {
  37367. (0, _util.warn)("Invalid fd index for glyph index.");
  37368. }
  37369. }
  37370. const cmds = [{
  37371. cmd: "save"
  37372. }, {
  37373. cmd: "transform",
  37374. args: fontMatrix.slice()
  37375. }, {
  37376. cmd: "scale",
  37377. args: ["size", "-size"]
  37378. }];
  37379. this.compileGlyphImpl(code, cmds, glyphId);
  37380. cmds.push({
  37381. cmd: "restore"
  37382. });
  37383. return cmds;
  37384. }
  37385. compileGlyphImpl() {
  37386. (0, _util.unreachable)("Children classes should implement this.");
  37387. }
  37388. hasBuiltPath(unicode) {
  37389. const {
  37390. charCode,
  37391. glyphId
  37392. } = lookupCmap(this.cmap, unicode);
  37393. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  37394. }
  37395. }
  37396. class TrueTypeCompiled extends CompiledFont {
  37397. constructor(glyphs, cmap, fontMatrix) {
  37398. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  37399. this.glyphs = glyphs;
  37400. this.cmap = cmap;
  37401. }
  37402. compileGlyphImpl(code, cmds) {
  37403. compileGlyf(code, cmds, this);
  37404. }
  37405. }
  37406. class Type2Compiled extends CompiledFont {
  37407. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  37408. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  37409. this.glyphs = cffInfo.glyphs;
  37410. this.gsubrs = cffInfo.gsubrs || [];
  37411. this.subrs = cffInfo.subrs || [];
  37412. this.cmap = cmap;
  37413. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  37414. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  37415. this.subrsBias = getSubroutineBias(this.subrs);
  37416. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  37417. this.fdSelect = cffInfo.fdSelect;
  37418. this.fdArray = cffInfo.fdArray;
  37419. }
  37420. compileGlyphImpl(code, cmds, glyphId) {
  37421. compileCharString(code, cmds, this, glyphId);
  37422. }
  37423. }
  37424. class FontRendererFactory {
  37425. static create(font, seacAnalysisEnabled) {
  37426. const data = new Uint8Array(font.data);
  37427. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  37428. const numTables = getUshort(data, 4);
  37429. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  37430. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  37431. const offset = getLong(data, p + 8);
  37432. const length = getLong(data, p + 12);
  37433. switch (tag) {
  37434. case "cmap":
  37435. cmap = parseCmap(data, offset, offset + length);
  37436. break;
  37437. case "glyf":
  37438. glyf = data.subarray(offset, offset + length);
  37439. break;
  37440. case "loca":
  37441. loca = data.subarray(offset, offset + length);
  37442. break;
  37443. case "head":
  37444. unitsPerEm = getUshort(data, offset + 18);
  37445. indexToLocFormat = getUshort(data, offset + 50);
  37446. break;
  37447. case "CFF ":
  37448. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  37449. break;
  37450. }
  37451. }
  37452. if (glyf) {
  37453. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  37454. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  37455. }
  37456. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  37457. }
  37458. }
  37459. exports.FontRendererFactory = FontRendererFactory;
  37460. /***/ }),
  37461. /* 51 */
  37462. /***/ ((__unused_webpack_module, exports) => {
  37463. Object.defineProperty(exports, "__esModule", ({
  37464. value: true
  37465. }));
  37466. exports.GlyfTable = void 0;
  37467. const ON_CURVE_POINT = 1 << 0;
  37468. const X_SHORT_VECTOR = 1 << 1;
  37469. const Y_SHORT_VECTOR = 1 << 2;
  37470. const REPEAT_FLAG = 1 << 3;
  37471. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  37472. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  37473. const OVERLAP_SIMPLE = 1 << 6;
  37474. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  37475. const ARGS_ARE_XY_VALUES = 1 << 1;
  37476. const WE_HAVE_A_SCALE = 1 << 3;
  37477. const MORE_COMPONENTS = 1 << 5;
  37478. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  37479. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  37480. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  37481. class GlyfTable {
  37482. constructor({
  37483. glyfTable,
  37484. isGlyphLocationsLong,
  37485. locaTable,
  37486. numGlyphs
  37487. }) {
  37488. this.glyphs = [];
  37489. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  37490. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  37491. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  37492. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  37493. let pos = 0;
  37494. for (let i = 0; i < numGlyphs; i++) {
  37495. pos += offsetSize;
  37496. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  37497. if (next === prev) {
  37498. this.glyphs.push(new Glyph({}));
  37499. continue;
  37500. }
  37501. const glyph = Glyph.parse(prev, glyf);
  37502. this.glyphs.push(glyph);
  37503. prev = next;
  37504. }
  37505. }
  37506. getSize() {
  37507. return this.glyphs.reduce((a, g) => {
  37508. const size = g.getSize();
  37509. return a + (size + 3 & ~3);
  37510. }, 0);
  37511. }
  37512. write() {
  37513. const totalSize = this.getSize();
  37514. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  37515. const isLocationLong = totalSize > 0x1fffe;
  37516. const offsetSize = isLocationLong ? 4 : 2;
  37517. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  37518. if (isLocationLong) {
  37519. locaTable.setUint32(0, 0);
  37520. } else {
  37521. locaTable.setUint16(0, 0);
  37522. }
  37523. let pos = 0;
  37524. let locaIndex = 0;
  37525. for (const glyph of this.glyphs) {
  37526. pos += glyph.write(pos, glyfTable);
  37527. pos = pos + 3 & ~3;
  37528. locaIndex += offsetSize;
  37529. if (isLocationLong) {
  37530. locaTable.setUint32(locaIndex, pos);
  37531. } else {
  37532. locaTable.setUint16(locaIndex, pos >> 1);
  37533. }
  37534. }
  37535. return {
  37536. isLocationLong,
  37537. loca: new Uint8Array(locaTable.buffer),
  37538. glyf: new Uint8Array(glyfTable.buffer)
  37539. };
  37540. }
  37541. scale(factors) {
  37542. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  37543. this.glyphs[i].scale(factors[i]);
  37544. }
  37545. }
  37546. }
  37547. exports.GlyfTable = GlyfTable;
  37548. class Glyph {
  37549. constructor({
  37550. header = null,
  37551. simple = null,
  37552. composites = null
  37553. }) {
  37554. this.header = header;
  37555. this.simple = simple;
  37556. this.composites = composites;
  37557. }
  37558. static parse(pos, glyf) {
  37559. const [read, header] = GlyphHeader.parse(pos, glyf);
  37560. pos += read;
  37561. if (header.numberOfContours < 0) {
  37562. const composites = [];
  37563. while (true) {
  37564. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  37565. pos += n;
  37566. composites.push(composite);
  37567. if (!(composite.flags & MORE_COMPONENTS)) {
  37568. break;
  37569. }
  37570. }
  37571. return new Glyph({
  37572. header,
  37573. composites
  37574. });
  37575. }
  37576. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  37577. return new Glyph({
  37578. header,
  37579. simple
  37580. });
  37581. }
  37582. getSize() {
  37583. if (!this.header) {
  37584. return 0;
  37585. }
  37586. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  37587. return this.header.getSize() + size;
  37588. }
  37589. write(pos, buf) {
  37590. if (!this.header) {
  37591. return 0;
  37592. }
  37593. const spos = pos;
  37594. pos += this.header.write(pos, buf);
  37595. if (this.simple) {
  37596. pos += this.simple.write(pos, buf);
  37597. } else {
  37598. for (const composite of this.composites) {
  37599. pos += composite.write(pos, buf);
  37600. }
  37601. }
  37602. return pos - spos;
  37603. }
  37604. scale(factor) {
  37605. if (!this.header) {
  37606. return;
  37607. }
  37608. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  37609. this.header.scale(xMiddle, factor);
  37610. if (this.simple) {
  37611. this.simple.scale(xMiddle, factor);
  37612. } else {
  37613. for (const composite of this.composites) {
  37614. composite.scale(xMiddle, factor);
  37615. }
  37616. }
  37617. }
  37618. }
  37619. class GlyphHeader {
  37620. constructor({
  37621. numberOfContours,
  37622. xMin,
  37623. yMin,
  37624. xMax,
  37625. yMax
  37626. }) {
  37627. this.numberOfContours = numberOfContours;
  37628. this.xMin = xMin;
  37629. this.yMin = yMin;
  37630. this.xMax = xMax;
  37631. this.yMax = yMax;
  37632. }
  37633. static parse(pos, glyf) {
  37634. return [10, new GlyphHeader({
  37635. numberOfContours: glyf.getInt16(pos),
  37636. xMin: glyf.getInt16(pos + 2),
  37637. yMin: glyf.getInt16(pos + 4),
  37638. xMax: glyf.getInt16(pos + 6),
  37639. yMax: glyf.getInt16(pos + 8)
  37640. })];
  37641. }
  37642. getSize() {
  37643. return 10;
  37644. }
  37645. write(pos, buf) {
  37646. buf.setInt16(pos, this.numberOfContours);
  37647. buf.setInt16(pos + 2, this.xMin);
  37648. buf.setInt16(pos + 4, this.yMin);
  37649. buf.setInt16(pos + 6, this.xMax);
  37650. buf.setInt16(pos + 8, this.yMax);
  37651. return 10;
  37652. }
  37653. scale(x, factor) {
  37654. this.xMin = Math.round(x + (this.xMin - x) * factor);
  37655. this.xMax = Math.round(x + (this.xMax - x) * factor);
  37656. }
  37657. }
  37658. class Contour {
  37659. constructor({
  37660. flags,
  37661. xCoordinates,
  37662. yCoordinates
  37663. }) {
  37664. this.xCoordinates = xCoordinates;
  37665. this.yCoordinates = yCoordinates;
  37666. this.flags = flags;
  37667. }
  37668. }
  37669. class SimpleGlyph {
  37670. constructor({
  37671. contours,
  37672. instructions
  37673. }) {
  37674. this.contours = contours;
  37675. this.instructions = instructions;
  37676. }
  37677. static parse(pos, glyf, numberOfContours) {
  37678. const endPtsOfContours = [];
  37679. for (let i = 0; i < numberOfContours; i++) {
  37680. const endPt = glyf.getUint16(pos);
  37681. pos += 2;
  37682. endPtsOfContours.push(endPt);
  37683. }
  37684. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  37685. const instructionLength = glyf.getUint16(pos);
  37686. pos += 2;
  37687. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  37688. pos += instructionLength;
  37689. const flags = [];
  37690. for (let i = 0; i < numberOfPt; pos++, i++) {
  37691. let flag = glyf.getUint8(pos);
  37692. flags.push(flag);
  37693. if (flag & REPEAT_FLAG) {
  37694. const count = glyf.getUint8(++pos);
  37695. flag ^= REPEAT_FLAG;
  37696. for (let m = 0; m < count; m++) {
  37697. flags.push(flag);
  37698. }
  37699. i += count;
  37700. }
  37701. }
  37702. const allXCoordinates = [];
  37703. let xCoordinates = [];
  37704. let yCoordinates = [];
  37705. let pointFlags = [];
  37706. const contours = [];
  37707. let endPtsOfContoursIndex = 0;
  37708. let lastCoordinate = 0;
  37709. for (let i = 0; i < numberOfPt; i++) {
  37710. const flag = flags[i];
  37711. if (flag & X_SHORT_VECTOR) {
  37712. const x = glyf.getUint8(pos++);
  37713. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  37714. xCoordinates.push(lastCoordinate);
  37715. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  37716. xCoordinates.push(lastCoordinate);
  37717. } else {
  37718. lastCoordinate += glyf.getInt16(pos);
  37719. pos += 2;
  37720. xCoordinates.push(lastCoordinate);
  37721. }
  37722. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  37723. endPtsOfContoursIndex++;
  37724. allXCoordinates.push(xCoordinates);
  37725. xCoordinates = [];
  37726. }
  37727. }
  37728. lastCoordinate = 0;
  37729. endPtsOfContoursIndex = 0;
  37730. for (let i = 0; i < numberOfPt; i++) {
  37731. const flag = flags[i];
  37732. if (flag & Y_SHORT_VECTOR) {
  37733. const y = glyf.getUint8(pos++);
  37734. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  37735. yCoordinates.push(lastCoordinate);
  37736. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  37737. yCoordinates.push(lastCoordinate);
  37738. } else {
  37739. lastCoordinate += glyf.getInt16(pos);
  37740. pos += 2;
  37741. yCoordinates.push(lastCoordinate);
  37742. }
  37743. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  37744. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  37745. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  37746. endPtsOfContoursIndex++;
  37747. contours.push(new Contour({
  37748. flags: pointFlags,
  37749. xCoordinates,
  37750. yCoordinates
  37751. }));
  37752. yCoordinates = [];
  37753. pointFlags = [];
  37754. }
  37755. }
  37756. return new SimpleGlyph({
  37757. contours,
  37758. instructions
  37759. });
  37760. }
  37761. getSize() {
  37762. let size = this.contours.length * 2 + 2 + this.instructions.length;
  37763. let lastX = 0;
  37764. let lastY = 0;
  37765. for (const contour of this.contours) {
  37766. size += contour.flags.length;
  37767. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  37768. const x = contour.xCoordinates[i];
  37769. const y = contour.yCoordinates[i];
  37770. let abs = Math.abs(x - lastX);
  37771. if (abs > 255) {
  37772. size += 2;
  37773. } else if (abs > 0) {
  37774. size += 1;
  37775. }
  37776. lastX = x;
  37777. abs = Math.abs(y - lastY);
  37778. if (abs > 255) {
  37779. size += 2;
  37780. } else if (abs > 0) {
  37781. size += 1;
  37782. }
  37783. lastY = y;
  37784. }
  37785. }
  37786. return size;
  37787. }
  37788. write(pos, buf) {
  37789. const spos = pos;
  37790. const xCoordinates = [];
  37791. const yCoordinates = [];
  37792. const flags = [];
  37793. let lastX = 0;
  37794. let lastY = 0;
  37795. for (const contour of this.contours) {
  37796. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  37797. let flag = contour.flags[i];
  37798. const x = contour.xCoordinates[i];
  37799. let delta = x - lastX;
  37800. if (delta === 0) {
  37801. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  37802. xCoordinates.push(0);
  37803. } else {
  37804. const abs = Math.abs(delta);
  37805. if (abs <= 255) {
  37806. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  37807. xCoordinates.push(abs);
  37808. } else {
  37809. xCoordinates.push(delta);
  37810. }
  37811. }
  37812. lastX = x;
  37813. const y = contour.yCoordinates[i];
  37814. delta = y - lastY;
  37815. if (delta === 0) {
  37816. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  37817. yCoordinates.push(0);
  37818. } else {
  37819. const abs = Math.abs(delta);
  37820. if (abs <= 255) {
  37821. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  37822. yCoordinates.push(abs);
  37823. } else {
  37824. yCoordinates.push(delta);
  37825. }
  37826. }
  37827. lastY = y;
  37828. flags.push(flag);
  37829. }
  37830. buf.setUint16(pos, xCoordinates.length - 1);
  37831. pos += 2;
  37832. }
  37833. buf.setUint16(pos, this.instructions.length);
  37834. pos += 2;
  37835. if (this.instructions.length) {
  37836. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  37837. pos += this.instructions.length;
  37838. }
  37839. for (const flag of flags) {
  37840. buf.setUint8(pos++, flag);
  37841. }
  37842. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  37843. const x = xCoordinates[i];
  37844. const flag = flags[i];
  37845. if (flag & X_SHORT_VECTOR) {
  37846. buf.setUint8(pos++, x);
  37847. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  37848. buf.setInt16(pos, x);
  37849. pos += 2;
  37850. }
  37851. }
  37852. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  37853. const y = yCoordinates[i];
  37854. const flag = flags[i];
  37855. if (flag & Y_SHORT_VECTOR) {
  37856. buf.setUint8(pos++, y);
  37857. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  37858. buf.setInt16(pos, y);
  37859. pos += 2;
  37860. }
  37861. }
  37862. return pos - spos;
  37863. }
  37864. scale(x, factor) {
  37865. for (const contour of this.contours) {
  37866. if (contour.xCoordinates.length === 0) {
  37867. continue;
  37868. }
  37869. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  37870. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  37871. }
  37872. }
  37873. }
  37874. }
  37875. class CompositeGlyph {
  37876. constructor({
  37877. flags,
  37878. glyphIndex,
  37879. argument1,
  37880. argument2,
  37881. transf,
  37882. instructions
  37883. }) {
  37884. this.flags = flags;
  37885. this.glyphIndex = glyphIndex;
  37886. this.argument1 = argument1;
  37887. this.argument2 = argument2;
  37888. this.transf = transf;
  37889. this.instructions = instructions;
  37890. }
  37891. static parse(pos, glyf) {
  37892. const spos = pos;
  37893. const transf = [];
  37894. let flags = glyf.getUint16(pos);
  37895. const glyphIndex = glyf.getUint16(pos + 2);
  37896. pos += 4;
  37897. let argument1, argument2;
  37898. if (flags & ARG_1_AND_2_ARE_WORDS) {
  37899. if (flags & ARGS_ARE_XY_VALUES) {
  37900. argument1 = glyf.getInt16(pos);
  37901. argument2 = glyf.getInt16(pos + 2);
  37902. } else {
  37903. argument1 = glyf.getUint16(pos);
  37904. argument2 = glyf.getUint16(pos + 2);
  37905. }
  37906. pos += 4;
  37907. flags ^= ARG_1_AND_2_ARE_WORDS;
  37908. } else {
  37909. argument1 = glyf.getUint8(pos);
  37910. argument2 = glyf.getUint8(pos + 1);
  37911. if (flags & ARGS_ARE_XY_VALUES) {
  37912. const abs1 = argument1 & 0x7f;
  37913. argument1 = argument1 & 0x80 ? -abs1 : abs1;
  37914. const abs2 = argument2 & 0x7f;
  37915. argument2 = argument2 & 0x80 ? -abs2 : abs2;
  37916. }
  37917. pos += 2;
  37918. }
  37919. if (flags & WE_HAVE_A_SCALE) {
  37920. transf.push(glyf.getUint16(pos));
  37921. pos += 2;
  37922. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  37923. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  37924. pos += 4;
  37925. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  37926. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  37927. pos += 8;
  37928. }
  37929. let instructions = null;
  37930. if (flags & WE_HAVE_INSTRUCTIONS) {
  37931. const instructionLength = glyf.getUint16(pos);
  37932. pos += 2;
  37933. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  37934. pos += instructionLength;
  37935. }
  37936. return [pos - spos, new CompositeGlyph({
  37937. flags,
  37938. glyphIndex,
  37939. argument1,
  37940. argument2,
  37941. transf,
  37942. instructions
  37943. })];
  37944. }
  37945. getSize() {
  37946. let size = 2 + 2 + this.transf.length * 2;
  37947. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  37948. size += 2 + this.instructions.length;
  37949. }
  37950. size += 2;
  37951. if (this.flags & 2) {
  37952. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  37953. size += 2;
  37954. }
  37955. } else {
  37956. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  37957. size += 2;
  37958. }
  37959. }
  37960. return size;
  37961. }
  37962. write(pos, buf) {
  37963. const spos = pos;
  37964. if (this.flags & ARGS_ARE_XY_VALUES) {
  37965. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  37966. this.flags |= ARG_1_AND_2_ARE_WORDS;
  37967. }
  37968. } else {
  37969. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  37970. this.flags |= ARG_1_AND_2_ARE_WORDS;
  37971. }
  37972. }
  37973. buf.setUint16(pos, this.flags);
  37974. buf.setUint16(pos + 2, this.glyphIndex);
  37975. pos += 4;
  37976. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  37977. if (this.flags & ARGS_ARE_XY_VALUES) {
  37978. buf.setInt16(pos, this.argument1);
  37979. buf.setInt16(pos + 2, this.argument2);
  37980. } else {
  37981. buf.setUint16(pos, this.argument1);
  37982. buf.setUint16(pos + 2, this.argument2);
  37983. }
  37984. pos += 4;
  37985. } else {
  37986. buf.setUint8(pos, this.argument1);
  37987. buf.setUint8(pos + 1, this.argument2);
  37988. pos += 2;
  37989. }
  37990. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  37991. buf.setUint16(pos, this.instructions.length);
  37992. pos += 2;
  37993. if (this.instructions.length) {
  37994. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  37995. pos += this.instructions.length;
  37996. }
  37997. }
  37998. return pos - spos;
  37999. }
  38000. scale(x, factor) {}
  38001. }
  38002. /***/ }),
  38003. /* 52 */
  38004. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38005. Object.defineProperty(exports, "__esModule", ({
  38006. value: true
  38007. }));
  38008. exports.OpenTypeFileBuilder = void 0;
  38009. var _core_utils = __w_pdfjs_require__(9);
  38010. var _util = __w_pdfjs_require__(2);
  38011. function writeInt16(dest, offset, num) {
  38012. dest[offset] = num >> 8 & 0xff;
  38013. dest[offset + 1] = num & 0xff;
  38014. }
  38015. function writeInt32(dest, offset, num) {
  38016. dest[offset] = num >> 24 & 0xff;
  38017. dest[offset + 1] = num >> 16 & 0xff;
  38018. dest[offset + 2] = num >> 8 & 0xff;
  38019. dest[offset + 3] = num & 0xff;
  38020. }
  38021. function writeData(dest, offset, data) {
  38022. if (data instanceof Uint8Array) {
  38023. dest.set(data, offset);
  38024. } else if (typeof data === "string") {
  38025. for (let i = 0, ii = data.length; i < ii; i++) {
  38026. dest[offset++] = data.charCodeAt(i) & 0xff;
  38027. }
  38028. } else {
  38029. for (let i = 0, ii = data.length; i < ii; i++) {
  38030. dest[offset++] = data[i] & 0xff;
  38031. }
  38032. }
  38033. }
  38034. const OTF_HEADER_SIZE = 12;
  38035. const OTF_TABLE_ENTRY_SIZE = 16;
  38036. class OpenTypeFileBuilder {
  38037. constructor(sfnt) {
  38038. this.sfnt = sfnt;
  38039. this.tables = Object.create(null);
  38040. }
  38041. static getSearchParams(entriesCount, entrySize) {
  38042. let maxPower2 = 1,
  38043. log2 = 0;
  38044. while ((maxPower2 ^ entriesCount) > maxPower2) {
  38045. maxPower2 <<= 1;
  38046. log2++;
  38047. }
  38048. const searchRange = maxPower2 * entrySize;
  38049. return {
  38050. range: searchRange,
  38051. entry: log2,
  38052. rangeShift: entrySize * entriesCount - searchRange
  38053. };
  38054. }
  38055. toArray() {
  38056. let sfnt = this.sfnt;
  38057. const tables = this.tables;
  38058. const tablesNames = Object.keys(tables);
  38059. tablesNames.sort();
  38060. const numTables = tablesNames.length;
  38061. let i, j, jj, table, tableName;
  38062. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  38063. const tableOffsets = [offset];
  38064. for (i = 0; i < numTables; i++) {
  38065. table = tables[tablesNames[i]];
  38066. const paddedLength = (table.length + 3 & ~3) >>> 0;
  38067. offset += paddedLength;
  38068. tableOffsets.push(offset);
  38069. }
  38070. const file = new Uint8Array(offset);
  38071. for (i = 0; i < numTables; i++) {
  38072. table = tables[tablesNames[i]];
  38073. writeData(file, tableOffsets[i], table);
  38074. }
  38075. if (sfnt === "true") {
  38076. sfnt = (0, _util.string32)(0x00010000);
  38077. }
  38078. file[0] = sfnt.charCodeAt(0) & 0xff;
  38079. file[1] = sfnt.charCodeAt(1) & 0xff;
  38080. file[2] = sfnt.charCodeAt(2) & 0xff;
  38081. file[3] = sfnt.charCodeAt(3) & 0xff;
  38082. writeInt16(file, 4, numTables);
  38083. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  38084. writeInt16(file, 6, searchParams.range);
  38085. writeInt16(file, 8, searchParams.entry);
  38086. writeInt16(file, 10, searchParams.rangeShift);
  38087. offset = OTF_HEADER_SIZE;
  38088. for (i = 0; i < numTables; i++) {
  38089. tableName = tablesNames[i];
  38090. file[offset] = tableName.charCodeAt(0) & 0xff;
  38091. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  38092. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  38093. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  38094. let checksum = 0;
  38095. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  38096. const quad = (0, _core_utils.readUint32)(file, j);
  38097. checksum = checksum + quad >>> 0;
  38098. }
  38099. writeInt32(file, offset + 4, checksum);
  38100. writeInt32(file, offset + 8, tableOffsets[i]);
  38101. writeInt32(file, offset + 12, tables[tableName].length);
  38102. offset += OTF_TABLE_ENTRY_SIZE;
  38103. }
  38104. return file;
  38105. }
  38106. addTable(tag, data) {
  38107. if (tag in this.tables) {
  38108. throw new Error("Table " + tag + " already exists");
  38109. }
  38110. this.tables[tag] = data;
  38111. }
  38112. }
  38113. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  38114. /***/ }),
  38115. /* 53 */
  38116. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38117. Object.defineProperty(exports, "__esModule", ({
  38118. value: true
  38119. }));
  38120. exports.Type1Font = void 0;
  38121. var _cff_parser = __w_pdfjs_require__(45);
  38122. var _fonts_utils = __w_pdfjs_require__(18);
  38123. var _core_utils = __w_pdfjs_require__(9);
  38124. var _stream = __w_pdfjs_require__(10);
  38125. var _type1_parser = __w_pdfjs_require__(54);
  38126. var _util = __w_pdfjs_require__(2);
  38127. function findBlock(streamBytes, signature, startIndex) {
  38128. const streamBytesLength = streamBytes.length;
  38129. const signatureLength = signature.length;
  38130. const scanLength = streamBytesLength - signatureLength;
  38131. let i = startIndex,
  38132. found = false;
  38133. while (i < scanLength) {
  38134. let j = 0;
  38135. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  38136. j++;
  38137. }
  38138. if (j >= signatureLength) {
  38139. i += j;
  38140. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  38141. i++;
  38142. }
  38143. found = true;
  38144. break;
  38145. }
  38146. i++;
  38147. }
  38148. return {
  38149. found,
  38150. length: i
  38151. };
  38152. }
  38153. function getHeaderBlock(stream, suggestedLength) {
  38154. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  38155. const streamStartPos = stream.pos;
  38156. let headerBytes, headerBytesLength, block;
  38157. try {
  38158. headerBytes = stream.getBytes(suggestedLength);
  38159. headerBytesLength = headerBytes.length;
  38160. } catch (ex) {}
  38161. if (headerBytesLength === suggestedLength) {
  38162. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  38163. if (block.found && block.length === suggestedLength) {
  38164. return {
  38165. stream: new _stream.Stream(headerBytes),
  38166. length: suggestedLength
  38167. };
  38168. }
  38169. }
  38170. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  38171. stream.pos = streamStartPos;
  38172. const SCAN_BLOCK_LENGTH = 2048;
  38173. let actualLength;
  38174. while (true) {
  38175. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  38176. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  38177. if (block.length === 0) {
  38178. break;
  38179. }
  38180. stream.pos += block.length;
  38181. if (block.found) {
  38182. actualLength = stream.pos - streamStartPos;
  38183. break;
  38184. }
  38185. }
  38186. stream.pos = streamStartPos;
  38187. if (actualLength) {
  38188. return {
  38189. stream: new _stream.Stream(stream.getBytes(actualLength)),
  38190. length: actualLength
  38191. };
  38192. }
  38193. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  38194. return {
  38195. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  38196. length: suggestedLength
  38197. };
  38198. }
  38199. function getEexecBlock(stream, suggestedLength) {
  38200. const eexecBytes = stream.getBytes();
  38201. return {
  38202. stream: new _stream.Stream(eexecBytes),
  38203. length: eexecBytes.length
  38204. };
  38205. }
  38206. class Type1Font {
  38207. constructor(name, file, properties) {
  38208. const PFB_HEADER_SIZE = 6;
  38209. let headerBlockLength = properties.length1;
  38210. let eexecBlockLength = properties.length2;
  38211. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  38212. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  38213. if (pfbHeaderPresent) {
  38214. file.skip(PFB_HEADER_SIZE);
  38215. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  38216. }
  38217. const headerBlock = getHeaderBlock(file, headerBlockLength);
  38218. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  38219. headerBlockParser.extractFontHeader(properties);
  38220. if (pfbHeaderPresent) {
  38221. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  38222. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  38223. }
  38224. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  38225. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  38226. const data = eexecBlockParser.extractFontProgram(properties);
  38227. for (const key in data.properties) {
  38228. properties[key] = data.properties[key];
  38229. }
  38230. const charstrings = data.charstrings;
  38231. const type2Charstrings = this.getType2Charstrings(charstrings);
  38232. const subrs = this.getType2Subrs(data.subrs);
  38233. this.charstrings = charstrings;
  38234. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  38235. this.seacs = this.getSeacs(data.charstrings);
  38236. }
  38237. get numGlyphs() {
  38238. return this.charstrings.length + 1;
  38239. }
  38240. getCharset() {
  38241. const charset = [".notdef"];
  38242. const charstrings = this.charstrings;
  38243. for (let glyphId = 0; glyphId < charstrings.length; glyphId++) {
  38244. charset.push(charstrings[glyphId].glyphName);
  38245. }
  38246. return charset;
  38247. }
  38248. getGlyphMapping(properties) {
  38249. const charstrings = this.charstrings;
  38250. if (properties.composite) {
  38251. const charCodeToGlyphId = Object.create(null);
  38252. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  38253. const charCode = properties.cMap.charCodeOf(glyphId);
  38254. charCodeToGlyphId[charCode] = glyphId + 1;
  38255. }
  38256. return charCodeToGlyphId;
  38257. }
  38258. const glyphNames = [".notdef"];
  38259. let builtInEncoding, glyphId;
  38260. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  38261. glyphNames.push(charstrings[glyphId].glyphName);
  38262. }
  38263. const encoding = properties.builtInEncoding;
  38264. if (encoding) {
  38265. builtInEncoding = Object.create(null);
  38266. for (const charCode in encoding) {
  38267. glyphId = glyphNames.indexOf(encoding[charCode]);
  38268. if (glyphId >= 0) {
  38269. builtInEncoding[charCode] = glyphId;
  38270. }
  38271. }
  38272. }
  38273. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  38274. }
  38275. hasGlyphId(id) {
  38276. if (id < 0 || id >= this.numGlyphs) {
  38277. return false;
  38278. }
  38279. if (id === 0) {
  38280. return true;
  38281. }
  38282. const glyph = this.charstrings[id - 1];
  38283. return glyph.charstring.length > 0;
  38284. }
  38285. getSeacs(charstrings) {
  38286. const seacMap = [];
  38287. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  38288. const charstring = charstrings[i];
  38289. if (charstring.seac) {
  38290. seacMap[i + 1] = charstring.seac;
  38291. }
  38292. }
  38293. return seacMap;
  38294. }
  38295. getType2Charstrings(type1Charstrings) {
  38296. const type2Charstrings = [];
  38297. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  38298. type2Charstrings.push(type1Charstrings[i].charstring);
  38299. }
  38300. return type2Charstrings;
  38301. }
  38302. getType2Subrs(type1Subrs) {
  38303. let bias = 0;
  38304. const count = type1Subrs.length;
  38305. if (count < 1133) {
  38306. bias = 107;
  38307. } else if (count < 33769) {
  38308. bias = 1131;
  38309. } else {
  38310. bias = 32768;
  38311. }
  38312. const type2Subrs = [];
  38313. let i;
  38314. for (i = 0; i < bias; i++) {
  38315. type2Subrs.push([0x0b]);
  38316. }
  38317. for (i = 0; i < count; i++) {
  38318. type2Subrs.push(type1Subrs[i]);
  38319. }
  38320. return type2Subrs;
  38321. }
  38322. wrap(name, glyphs, charstrings, subrs, properties) {
  38323. const cff = new _cff_parser.CFF();
  38324. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  38325. cff.names = [name];
  38326. const topDict = new _cff_parser.CFFTopDict();
  38327. topDict.setByName("version", 391);
  38328. topDict.setByName("Notice", 392);
  38329. topDict.setByName("FullName", 393);
  38330. topDict.setByName("FamilyName", 394);
  38331. topDict.setByName("Weight", 395);
  38332. topDict.setByName("Encoding", null);
  38333. topDict.setByName("FontMatrix", properties.fontMatrix);
  38334. topDict.setByName("FontBBox", properties.bbox);
  38335. topDict.setByName("charset", null);
  38336. topDict.setByName("CharStrings", null);
  38337. topDict.setByName("Private", null);
  38338. cff.topDict = topDict;
  38339. const strings = new _cff_parser.CFFStrings();
  38340. strings.add("Version 0.11");
  38341. strings.add("See original notice");
  38342. strings.add(name);
  38343. strings.add(name);
  38344. strings.add("Medium");
  38345. cff.strings = strings;
  38346. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  38347. const count = glyphs.length;
  38348. const charsetArray = [".notdef"];
  38349. let i, ii;
  38350. for (i = 0; i < count; i++) {
  38351. const glyphName = charstrings[i].glyphName;
  38352. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  38353. if (index === -1) {
  38354. strings.add(glyphName);
  38355. }
  38356. charsetArray.push(glyphName);
  38357. }
  38358. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  38359. const charStringsIndex = new _cff_parser.CFFIndex();
  38360. charStringsIndex.add([0x8b, 0x0e]);
  38361. for (i = 0; i < count; i++) {
  38362. charStringsIndex.add(glyphs[i]);
  38363. }
  38364. cff.charStrings = charStringsIndex;
  38365. const privateDict = new _cff_parser.CFFPrivateDict();
  38366. privateDict.setByName("Subrs", null);
  38367. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  38368. for (i = 0, ii = fields.length; i < ii; i++) {
  38369. const field = fields[i];
  38370. if (!(field in properties.privateData)) {
  38371. continue;
  38372. }
  38373. const value = properties.privateData[field];
  38374. if (Array.isArray(value)) {
  38375. for (let j = value.length - 1; j > 0; j--) {
  38376. value[j] -= value[j - 1];
  38377. }
  38378. }
  38379. privateDict.setByName(field, value);
  38380. }
  38381. cff.topDict.privateDict = privateDict;
  38382. const subrIndex = new _cff_parser.CFFIndex();
  38383. for (i = 0, ii = subrs.length; i < ii; i++) {
  38384. subrIndex.add(subrs[i]);
  38385. }
  38386. privateDict.subrsIndex = subrIndex;
  38387. const compiler = new _cff_parser.CFFCompiler(cff);
  38388. return compiler.compile();
  38389. }
  38390. }
  38391. exports.Type1Font = Type1Font;
  38392. /***/ }),
  38393. /* 54 */
  38394. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38395. Object.defineProperty(exports, "__esModule", ({
  38396. value: true
  38397. }));
  38398. exports.Type1Parser = void 0;
  38399. var _encodings = __w_pdfjs_require__(19);
  38400. var _core_utils = __w_pdfjs_require__(9);
  38401. var _stream = __w_pdfjs_require__(10);
  38402. var _util = __w_pdfjs_require__(2);
  38403. const HINTING_ENABLED = false;
  38404. const Type1CharString = function Type1CharStringClosure() {
  38405. const COMMAND_MAP = {
  38406. hstem: [1],
  38407. vstem: [3],
  38408. vmoveto: [4],
  38409. rlineto: [5],
  38410. hlineto: [6],
  38411. vlineto: [7],
  38412. rrcurveto: [8],
  38413. callsubr: [10],
  38414. flex: [12, 35],
  38415. drop: [12, 18],
  38416. endchar: [14],
  38417. rmoveto: [21],
  38418. hmoveto: [22],
  38419. vhcurveto: [30],
  38420. hvcurveto: [31]
  38421. };
  38422. class Type1CharString {
  38423. constructor() {
  38424. this.width = 0;
  38425. this.lsb = 0;
  38426. this.flexing = false;
  38427. this.output = [];
  38428. this.stack = [];
  38429. }
  38430. convert(encoded, subrs, seacAnalysisEnabled) {
  38431. const count = encoded.length;
  38432. let error = false;
  38433. let wx, sbx, subrNumber;
  38434. for (let i = 0; i < count; i++) {
  38435. let value = encoded[i];
  38436. if (value < 32) {
  38437. if (value === 12) {
  38438. value = (value << 8) + encoded[++i];
  38439. }
  38440. switch (value) {
  38441. case 1:
  38442. if (!HINTING_ENABLED) {
  38443. this.stack = [];
  38444. break;
  38445. }
  38446. error = this.executeCommand(2, COMMAND_MAP.hstem);
  38447. break;
  38448. case 3:
  38449. if (!HINTING_ENABLED) {
  38450. this.stack = [];
  38451. break;
  38452. }
  38453. error = this.executeCommand(2, COMMAND_MAP.vstem);
  38454. break;
  38455. case 4:
  38456. if (this.flexing) {
  38457. if (this.stack.length < 1) {
  38458. error = true;
  38459. break;
  38460. }
  38461. const dy = this.stack.pop();
  38462. this.stack.push(0, dy);
  38463. break;
  38464. }
  38465. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  38466. break;
  38467. case 5:
  38468. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  38469. break;
  38470. case 6:
  38471. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  38472. break;
  38473. case 7:
  38474. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  38475. break;
  38476. case 8:
  38477. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  38478. break;
  38479. case 9:
  38480. this.stack = [];
  38481. break;
  38482. case 10:
  38483. if (this.stack.length < 1) {
  38484. error = true;
  38485. break;
  38486. }
  38487. subrNumber = this.stack.pop();
  38488. if (!subrs[subrNumber]) {
  38489. error = true;
  38490. break;
  38491. }
  38492. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  38493. break;
  38494. case 11:
  38495. return error;
  38496. case 13:
  38497. if (this.stack.length < 2) {
  38498. error = true;
  38499. break;
  38500. }
  38501. wx = this.stack.pop();
  38502. sbx = this.stack.pop();
  38503. this.lsb = sbx;
  38504. this.width = wx;
  38505. this.stack.push(wx, sbx);
  38506. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  38507. break;
  38508. case 14:
  38509. this.output.push(COMMAND_MAP.endchar[0]);
  38510. break;
  38511. case 21:
  38512. if (this.flexing) {
  38513. break;
  38514. }
  38515. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  38516. break;
  38517. case 22:
  38518. if (this.flexing) {
  38519. this.stack.push(0);
  38520. break;
  38521. }
  38522. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  38523. break;
  38524. case 30:
  38525. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  38526. break;
  38527. case 31:
  38528. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  38529. break;
  38530. case (12 << 8) + 0:
  38531. this.stack = [];
  38532. break;
  38533. case (12 << 8) + 1:
  38534. if (!HINTING_ENABLED) {
  38535. this.stack = [];
  38536. break;
  38537. }
  38538. error = this.executeCommand(2, COMMAND_MAP.vstem);
  38539. break;
  38540. case (12 << 8) + 2:
  38541. if (!HINTING_ENABLED) {
  38542. this.stack = [];
  38543. break;
  38544. }
  38545. error = this.executeCommand(2, COMMAND_MAP.hstem);
  38546. break;
  38547. case (12 << 8) + 6:
  38548. if (seacAnalysisEnabled) {
  38549. const asb = this.stack[this.stack.length - 5];
  38550. this.seac = this.stack.splice(-4, 4);
  38551. this.seac[0] += this.lsb - asb;
  38552. error = this.executeCommand(0, COMMAND_MAP.endchar);
  38553. } else {
  38554. error = this.executeCommand(4, COMMAND_MAP.endchar);
  38555. }
  38556. break;
  38557. case (12 << 8) + 7:
  38558. if (this.stack.length < 4) {
  38559. error = true;
  38560. break;
  38561. }
  38562. this.stack.pop();
  38563. wx = this.stack.pop();
  38564. const sby = this.stack.pop();
  38565. sbx = this.stack.pop();
  38566. this.lsb = sbx;
  38567. this.width = wx;
  38568. this.stack.push(wx, sbx, sby);
  38569. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  38570. break;
  38571. case (12 << 8) + 12:
  38572. if (this.stack.length < 2) {
  38573. error = true;
  38574. break;
  38575. }
  38576. const num2 = this.stack.pop();
  38577. const num1 = this.stack.pop();
  38578. this.stack.push(num1 / num2);
  38579. break;
  38580. case (12 << 8) + 16:
  38581. if (this.stack.length < 2) {
  38582. error = true;
  38583. break;
  38584. }
  38585. subrNumber = this.stack.pop();
  38586. const numArgs = this.stack.pop();
  38587. if (subrNumber === 0 && numArgs === 3) {
  38588. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  38589. 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]);
  38590. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  38591. this.flexing = false;
  38592. this.stack.push(flexArgs[15], flexArgs[16]);
  38593. } else if (subrNumber === 1 && numArgs === 0) {
  38594. this.flexing = true;
  38595. }
  38596. break;
  38597. case (12 << 8) + 17:
  38598. break;
  38599. case (12 << 8) + 33:
  38600. this.stack = [];
  38601. break;
  38602. default:
  38603. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  38604. break;
  38605. }
  38606. if (error) {
  38607. break;
  38608. }
  38609. continue;
  38610. } else if (value <= 246) {
  38611. value -= 139;
  38612. } else if (value <= 250) {
  38613. value = (value - 247) * 256 + encoded[++i] + 108;
  38614. } else if (value <= 254) {
  38615. value = -((value - 251) * 256) - encoded[++i] - 108;
  38616. } else {
  38617. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  38618. }
  38619. this.stack.push(value);
  38620. }
  38621. return error;
  38622. }
  38623. executeCommand(howManyArgs, command, keepStack) {
  38624. const stackLength = this.stack.length;
  38625. if (howManyArgs > stackLength) {
  38626. return true;
  38627. }
  38628. const start = stackLength - howManyArgs;
  38629. for (let i = start; i < stackLength; i++) {
  38630. let value = this.stack[i];
  38631. if (Number.isInteger(value)) {
  38632. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  38633. } else {
  38634. value = 65536 * value | 0;
  38635. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  38636. }
  38637. }
  38638. this.output.push.apply(this.output, command);
  38639. if (keepStack) {
  38640. this.stack.splice(start, howManyArgs);
  38641. } else {
  38642. this.stack.length = 0;
  38643. }
  38644. return false;
  38645. }
  38646. }
  38647. return Type1CharString;
  38648. }();
  38649. const Type1Parser = function Type1ParserClosure() {
  38650. const EEXEC_ENCRYPT_KEY = 55665;
  38651. const CHAR_STRS_ENCRYPT_KEY = 4330;
  38652. function isHexDigit(code) {
  38653. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  38654. }
  38655. function decrypt(data, key, discardNumber) {
  38656. if (discardNumber >= data.length) {
  38657. return new Uint8Array(0);
  38658. }
  38659. const c1 = 52845,
  38660. c2 = 22719;
  38661. let r = key | 0,
  38662. i,
  38663. j;
  38664. for (i = 0; i < discardNumber; i++) {
  38665. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  38666. }
  38667. const count = data.length - discardNumber;
  38668. const decrypted = new Uint8Array(count);
  38669. for (i = discardNumber, j = 0; j < count; i++, j++) {
  38670. const value = data[i];
  38671. decrypted[j] = value ^ r >> 8;
  38672. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  38673. }
  38674. return decrypted;
  38675. }
  38676. function decryptAscii(data, key, discardNumber) {
  38677. const c1 = 52845,
  38678. c2 = 22719;
  38679. let r = key | 0;
  38680. const count = data.length,
  38681. maybeLength = count >>> 1;
  38682. const decrypted = new Uint8Array(maybeLength);
  38683. let i, j;
  38684. for (i = 0, j = 0; i < count; i++) {
  38685. const digit1 = data[i];
  38686. if (!isHexDigit(digit1)) {
  38687. continue;
  38688. }
  38689. i++;
  38690. let digit2;
  38691. while (i < count && !isHexDigit(digit2 = data[i])) {
  38692. i++;
  38693. }
  38694. if (i < count) {
  38695. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  38696. decrypted[j++] = value ^ r >> 8;
  38697. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  38698. }
  38699. }
  38700. return decrypted.slice(discardNumber, j);
  38701. }
  38702. function isSpecial(c) {
  38703. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  38704. }
  38705. class Type1Parser {
  38706. constructor(stream, encrypted, seacAnalysisEnabled) {
  38707. if (encrypted) {
  38708. const data = stream.getBytes();
  38709. 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]));
  38710. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  38711. }
  38712. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  38713. this.stream = stream;
  38714. this.nextChar();
  38715. }
  38716. readNumberArray() {
  38717. this.getToken();
  38718. const array = [];
  38719. while (true) {
  38720. const token = this.getToken();
  38721. if (token === null || token === "]" || token === "}") {
  38722. break;
  38723. }
  38724. array.push(parseFloat(token || 0));
  38725. }
  38726. return array;
  38727. }
  38728. readNumber() {
  38729. const token = this.getToken();
  38730. return parseFloat(token || 0);
  38731. }
  38732. readInt() {
  38733. const token = this.getToken();
  38734. return parseInt(token || 0, 10) | 0;
  38735. }
  38736. readBoolean() {
  38737. const token = this.getToken();
  38738. return token === "true" ? 1 : 0;
  38739. }
  38740. nextChar() {
  38741. return this.currentChar = this.stream.getByte();
  38742. }
  38743. getToken() {
  38744. let comment = false;
  38745. let ch = this.currentChar;
  38746. while (true) {
  38747. if (ch === -1) {
  38748. return null;
  38749. }
  38750. if (comment) {
  38751. if (ch === 0x0a || ch === 0x0d) {
  38752. comment = false;
  38753. }
  38754. } else if (ch === 0x25) {
  38755. comment = true;
  38756. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  38757. break;
  38758. }
  38759. ch = this.nextChar();
  38760. }
  38761. if (isSpecial(ch)) {
  38762. this.nextChar();
  38763. return String.fromCharCode(ch);
  38764. }
  38765. let token = "";
  38766. do {
  38767. token += String.fromCharCode(ch);
  38768. ch = this.nextChar();
  38769. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  38770. return token;
  38771. }
  38772. readCharStrings(bytes, lenIV) {
  38773. if (lenIV === -1) {
  38774. return bytes;
  38775. }
  38776. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  38777. }
  38778. extractFontProgram(properties) {
  38779. const stream = this.stream;
  38780. const subrs = [],
  38781. charstrings = [];
  38782. const privateData = Object.create(null);
  38783. privateData.lenIV = 4;
  38784. const program = {
  38785. subrs: [],
  38786. charstrings: [],
  38787. properties: {
  38788. privateData
  38789. }
  38790. };
  38791. let token, length, data, lenIV, encoded;
  38792. while ((token = this.getToken()) !== null) {
  38793. if (token !== "/") {
  38794. continue;
  38795. }
  38796. token = this.getToken();
  38797. switch (token) {
  38798. case "CharStrings":
  38799. this.getToken();
  38800. this.getToken();
  38801. this.getToken();
  38802. this.getToken();
  38803. while (true) {
  38804. token = this.getToken();
  38805. if (token === null || token === "end") {
  38806. break;
  38807. }
  38808. if (token !== "/") {
  38809. continue;
  38810. }
  38811. const glyph = this.getToken();
  38812. length = this.readInt();
  38813. this.getToken();
  38814. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  38815. lenIV = program.properties.privateData.lenIV;
  38816. encoded = this.readCharStrings(data, lenIV);
  38817. this.nextChar();
  38818. token = this.getToken();
  38819. if (token === "noaccess") {
  38820. this.getToken();
  38821. }
  38822. charstrings.push({
  38823. glyph,
  38824. encoded
  38825. });
  38826. }
  38827. break;
  38828. case "Subrs":
  38829. this.readInt();
  38830. this.getToken();
  38831. while (this.getToken() === "dup") {
  38832. const index = this.readInt();
  38833. length = this.readInt();
  38834. this.getToken();
  38835. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  38836. lenIV = program.properties.privateData.lenIV;
  38837. encoded = this.readCharStrings(data, lenIV);
  38838. this.nextChar();
  38839. token = this.getToken();
  38840. if (token === "noaccess") {
  38841. this.getToken();
  38842. }
  38843. subrs[index] = encoded;
  38844. }
  38845. break;
  38846. case "BlueValues":
  38847. case "OtherBlues":
  38848. case "FamilyBlues":
  38849. case "FamilyOtherBlues":
  38850. const blueArray = this.readNumberArray();
  38851. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  38852. program.properties.privateData[token] = blueArray;
  38853. }
  38854. break;
  38855. case "StemSnapH":
  38856. case "StemSnapV":
  38857. program.properties.privateData[token] = this.readNumberArray();
  38858. break;
  38859. case "StdHW":
  38860. case "StdVW":
  38861. program.properties.privateData[token] = this.readNumberArray()[0];
  38862. break;
  38863. case "BlueShift":
  38864. case "lenIV":
  38865. case "BlueFuzz":
  38866. case "BlueScale":
  38867. case "LanguageGroup":
  38868. case "ExpansionFactor":
  38869. program.properties.privateData[token] = this.readNumber();
  38870. break;
  38871. case "ForceBold":
  38872. program.properties.privateData[token] = this.readBoolean();
  38873. break;
  38874. }
  38875. }
  38876. for (let i = 0; i < charstrings.length; i++) {
  38877. const glyph = charstrings[i].glyph;
  38878. encoded = charstrings[i].encoded;
  38879. const charString = new Type1CharString();
  38880. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  38881. let output = charString.output;
  38882. if (error) {
  38883. output = [14];
  38884. }
  38885. const charStringObject = {
  38886. glyphName: glyph,
  38887. charstring: output,
  38888. width: charString.width,
  38889. lsb: charString.lsb,
  38890. seac: charString.seac
  38891. };
  38892. if (glyph === ".notdef") {
  38893. program.charstrings.unshift(charStringObject);
  38894. } else {
  38895. program.charstrings.push(charStringObject);
  38896. }
  38897. if (properties.builtInEncoding) {
  38898. const index = properties.builtInEncoding.indexOf(glyph);
  38899. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  38900. properties.widths[index] = charString.width;
  38901. }
  38902. }
  38903. }
  38904. return program;
  38905. }
  38906. extractFontHeader(properties) {
  38907. let token;
  38908. while ((token = this.getToken()) !== null) {
  38909. if (token !== "/") {
  38910. continue;
  38911. }
  38912. token = this.getToken();
  38913. switch (token) {
  38914. case "FontMatrix":
  38915. const matrix = this.readNumberArray();
  38916. properties.fontMatrix = matrix;
  38917. break;
  38918. case "Encoding":
  38919. const encodingArg = this.getToken();
  38920. let encoding;
  38921. if (!/^\d+$/.test(encodingArg)) {
  38922. encoding = (0, _encodings.getEncoding)(encodingArg);
  38923. } else {
  38924. encoding = [];
  38925. const size = parseInt(encodingArg, 10) | 0;
  38926. this.getToken();
  38927. for (let j = 0; j < size; j++) {
  38928. token = this.getToken();
  38929. while (token !== "dup" && token !== "def") {
  38930. token = this.getToken();
  38931. if (token === null) {
  38932. return;
  38933. }
  38934. }
  38935. if (token === "def") {
  38936. break;
  38937. }
  38938. const index = this.readInt();
  38939. this.getToken();
  38940. const glyph = this.getToken();
  38941. encoding[index] = glyph;
  38942. this.getToken();
  38943. }
  38944. }
  38945. properties.builtInEncoding = encoding;
  38946. break;
  38947. case "FontBBox":
  38948. const fontBBox = this.readNumberArray();
  38949. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  38950. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  38951. properties.ascentScaled = true;
  38952. break;
  38953. }
  38954. }
  38955. }
  38956. }
  38957. return Type1Parser;
  38958. }();
  38959. exports.Type1Parser = Type1Parser;
  38960. /***/ }),
  38961. /* 55 */
  38962. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38963. Object.defineProperty(exports, "__esModule", ({
  38964. value: true
  38965. }));
  38966. exports.getTilingPatternIR = getTilingPatternIR;
  38967. exports.Pattern = void 0;
  38968. var _util = __w_pdfjs_require__(2);
  38969. var _colorspace = __w_pdfjs_require__(24);
  38970. var _primitives = __w_pdfjs_require__(5);
  38971. var _core_utils = __w_pdfjs_require__(9);
  38972. const ShadingType = {
  38973. FUNCTION_BASED: 1,
  38974. AXIAL: 2,
  38975. RADIAL: 3,
  38976. FREE_FORM_MESH: 4,
  38977. LATTICE_FORM_MESH: 5,
  38978. COONS_PATCH_MESH: 6,
  38979. TENSOR_PATCH_MESH: 7
  38980. };
  38981. class Pattern {
  38982. constructor() {
  38983. (0, _util.unreachable)("Cannot initialize Pattern.");
  38984. }
  38985. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  38986. const dict = (0, _primitives.isStream)(shading) ? shading.dict : shading;
  38987. const type = dict.get("ShadingType");
  38988. try {
  38989. switch (type) {
  38990. case ShadingType.AXIAL:
  38991. case ShadingType.RADIAL:
  38992. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  38993. case ShadingType.FREE_FORM_MESH:
  38994. case ShadingType.LATTICE_FORM_MESH:
  38995. case ShadingType.COONS_PATCH_MESH:
  38996. case ShadingType.TENSOR_PATCH_MESH:
  38997. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  38998. default:
  38999. throw new _util.FormatError("Unsupported ShadingType: " + type);
  39000. }
  39001. } catch (ex) {
  39002. if (ex instanceof _core_utils.MissingDataException) {
  39003. throw ex;
  39004. }
  39005. handler.send("UnsupportedFeature", {
  39006. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  39007. });
  39008. (0, _util.warn)(ex);
  39009. return new DummyShading();
  39010. }
  39011. }
  39012. }
  39013. exports.Pattern = Pattern;
  39014. class BaseShading {
  39015. static get SMALL_NUMBER() {
  39016. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  39017. }
  39018. constructor() {
  39019. if (this.constructor === BaseShading) {
  39020. (0, _util.unreachable)("Cannot initialize BaseShading.");
  39021. }
  39022. }
  39023. getIR() {
  39024. (0, _util.unreachable)("Abstract method `getIR` called.");
  39025. }
  39026. }
  39027. class RadialAxialShading extends BaseShading {
  39028. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  39029. super();
  39030. this.coordsArr = dict.getArray("Coords");
  39031. this.shadingType = dict.get("ShadingType");
  39032. const cs = _colorspace.ColorSpace.parse({
  39033. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  39034. xref,
  39035. resources,
  39036. pdfFunctionFactory,
  39037. localColorSpaceCache
  39038. });
  39039. const bbox = dict.getArray("BBox");
  39040. if (Array.isArray(bbox) && bbox.length === 4) {
  39041. this.bbox = _util.Util.normalizeRect(bbox);
  39042. } else {
  39043. this.bbox = null;
  39044. }
  39045. let t0 = 0.0,
  39046. t1 = 1.0;
  39047. if (dict.has("Domain")) {
  39048. const domainArr = dict.getArray("Domain");
  39049. t0 = domainArr[0];
  39050. t1 = domainArr[1];
  39051. }
  39052. let extendStart = false,
  39053. extendEnd = false;
  39054. if (dict.has("Extend")) {
  39055. const extendArr = dict.getArray("Extend");
  39056. extendStart = extendArr[0];
  39057. extendEnd = extendArr[1];
  39058. }
  39059. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  39060. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  39061. const distance = Math.hypot(x1 - x2, y1 - y2);
  39062. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  39063. (0, _util.warn)("Unsupported radial gradient.");
  39064. }
  39065. }
  39066. this.extendStart = extendStart;
  39067. this.extendEnd = extendEnd;
  39068. const fnObj = dict.getRaw("Function");
  39069. const fn = pdfFunctionFactory.createFromArray(fnObj);
  39070. const NUMBER_OF_SAMPLES = 10;
  39071. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  39072. const colorStops = this.colorStops = [];
  39073. if (t0 >= t1 || step <= 0) {
  39074. (0, _util.info)("Bad shading domain.");
  39075. return;
  39076. }
  39077. const color = new Float32Array(cs.numComps),
  39078. ratio = new Float32Array(1);
  39079. let rgbColor;
  39080. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  39081. ratio[0] = t0 + i * step;
  39082. fn(ratio, 0, color, 0);
  39083. rgbColor = cs.getRgb(color, 0);
  39084. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  39085. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  39086. }
  39087. let background = "transparent";
  39088. if (dict.has("Background")) {
  39089. rgbColor = cs.getRgb(dict.get("Background"), 0);
  39090. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  39091. }
  39092. if (!extendStart) {
  39093. colorStops.unshift([0, background]);
  39094. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  39095. }
  39096. if (!extendEnd) {
  39097. colorStops[colorStops.length - 1][0] -= BaseShading.SMALL_NUMBER;
  39098. colorStops.push([1, background]);
  39099. }
  39100. this.colorStops = colorStops;
  39101. }
  39102. getIR() {
  39103. const coordsArr = this.coordsArr;
  39104. const shadingType = this.shadingType;
  39105. let type, p0, p1, r0, r1;
  39106. if (shadingType === ShadingType.AXIAL) {
  39107. p0 = [coordsArr[0], coordsArr[1]];
  39108. p1 = [coordsArr[2], coordsArr[3]];
  39109. r0 = null;
  39110. r1 = null;
  39111. type = "axial";
  39112. } else if (shadingType === ShadingType.RADIAL) {
  39113. p0 = [coordsArr[0], coordsArr[1]];
  39114. p1 = [coordsArr[3], coordsArr[4]];
  39115. r0 = coordsArr[2];
  39116. r1 = coordsArr[5];
  39117. type = "radial";
  39118. } else {
  39119. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  39120. }
  39121. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  39122. }
  39123. }
  39124. class MeshStreamReader {
  39125. constructor(stream, context) {
  39126. this.stream = stream;
  39127. this.context = context;
  39128. this.buffer = 0;
  39129. this.bufferLength = 0;
  39130. const numComps = context.numComps;
  39131. this.tmpCompsBuf = new Float32Array(numComps);
  39132. const csNumComps = context.colorSpace.numComps;
  39133. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  39134. }
  39135. get hasData() {
  39136. if (this.stream.end) {
  39137. return this.stream.pos < this.stream.end;
  39138. }
  39139. if (this.bufferLength > 0) {
  39140. return true;
  39141. }
  39142. const nextByte = this.stream.getByte();
  39143. if (nextByte < 0) {
  39144. return false;
  39145. }
  39146. this.buffer = nextByte;
  39147. this.bufferLength = 8;
  39148. return true;
  39149. }
  39150. readBits(n) {
  39151. let buffer = this.buffer;
  39152. let bufferLength = this.bufferLength;
  39153. if (n === 32) {
  39154. if (bufferLength === 0) {
  39155. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  39156. }
  39157. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  39158. const nextByte = this.stream.getByte();
  39159. this.buffer = nextByte & (1 << bufferLength) - 1;
  39160. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  39161. }
  39162. if (n === 8 && bufferLength === 0) {
  39163. return this.stream.getByte();
  39164. }
  39165. while (bufferLength < n) {
  39166. buffer = buffer << 8 | this.stream.getByte();
  39167. bufferLength += 8;
  39168. }
  39169. bufferLength -= n;
  39170. this.bufferLength = bufferLength;
  39171. this.buffer = buffer & (1 << bufferLength) - 1;
  39172. return buffer >> bufferLength;
  39173. }
  39174. align() {
  39175. this.buffer = 0;
  39176. this.bufferLength = 0;
  39177. }
  39178. readFlag() {
  39179. return this.readBits(this.context.bitsPerFlag);
  39180. }
  39181. readCoordinate() {
  39182. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  39183. const xi = this.readBits(bitsPerCoordinate);
  39184. const yi = this.readBits(bitsPerCoordinate);
  39185. const decode = this.context.decode;
  39186. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  39187. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  39188. }
  39189. readComponents() {
  39190. const numComps = this.context.numComps;
  39191. const bitsPerComponent = this.context.bitsPerComponent;
  39192. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  39193. const decode = this.context.decode;
  39194. const components = this.tmpCompsBuf;
  39195. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  39196. const ci = this.readBits(bitsPerComponent);
  39197. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  39198. }
  39199. const color = this.tmpCsCompsBuf;
  39200. if (this.context.colorFn) {
  39201. this.context.colorFn(components, 0, color, 0);
  39202. }
  39203. return this.context.colorSpace.getRgb(color, 0);
  39204. }
  39205. }
  39206. const getB = function getBClosure() {
  39207. function buildB(count) {
  39208. const lut = [];
  39209. for (let i = 0; i <= count; i++) {
  39210. const t = i / count,
  39211. t_ = 1 - t;
  39212. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  39213. }
  39214. return lut;
  39215. }
  39216. const cache = [];
  39217. return function (count) {
  39218. if (!cache[count]) {
  39219. cache[count] = buildB(count);
  39220. }
  39221. return cache[count];
  39222. };
  39223. }();
  39224. class MeshShading extends BaseShading {
  39225. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  39226. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  39227. }
  39228. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  39229. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  39230. }
  39231. static get TRIANGLE_DENSITY() {
  39232. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  39233. }
  39234. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  39235. super();
  39236. if (!(0, _primitives.isStream)(stream)) {
  39237. throw new _util.FormatError("Mesh data is not a stream");
  39238. }
  39239. const dict = stream.dict;
  39240. this.shadingType = dict.get("ShadingType");
  39241. const bbox = dict.getArray("BBox");
  39242. if (Array.isArray(bbox) && bbox.length === 4) {
  39243. this.bbox = _util.Util.normalizeRect(bbox);
  39244. } else {
  39245. this.bbox = null;
  39246. }
  39247. const cs = _colorspace.ColorSpace.parse({
  39248. cs: dict.getRaw("ColorSpace") || dict.getRaw("CS"),
  39249. xref,
  39250. resources,
  39251. pdfFunctionFactory,
  39252. localColorSpaceCache
  39253. });
  39254. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  39255. const fnObj = dict.getRaw("Function");
  39256. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  39257. this.coords = [];
  39258. this.colors = [];
  39259. this.figures = [];
  39260. const decodeContext = {
  39261. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  39262. bitsPerComponent: dict.get("BitsPerComponent"),
  39263. bitsPerFlag: dict.get("BitsPerFlag"),
  39264. decode: dict.getArray("Decode"),
  39265. colorFn: fn,
  39266. colorSpace: cs,
  39267. numComps: fn ? 1 : cs.numComps
  39268. };
  39269. const reader = new MeshStreamReader(stream, decodeContext);
  39270. let patchMesh = false;
  39271. switch (this.shadingType) {
  39272. case ShadingType.FREE_FORM_MESH:
  39273. this._decodeType4Shading(reader);
  39274. break;
  39275. case ShadingType.LATTICE_FORM_MESH:
  39276. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  39277. if (verticesPerRow < 2) {
  39278. throw new _util.FormatError("Invalid VerticesPerRow");
  39279. }
  39280. this._decodeType5Shading(reader, verticesPerRow);
  39281. break;
  39282. case ShadingType.COONS_PATCH_MESH:
  39283. this._decodeType6Shading(reader);
  39284. patchMesh = true;
  39285. break;
  39286. case ShadingType.TENSOR_PATCH_MESH:
  39287. this._decodeType7Shading(reader);
  39288. patchMesh = true;
  39289. break;
  39290. default:
  39291. (0, _util.unreachable)("Unsupported mesh type.");
  39292. break;
  39293. }
  39294. if (patchMesh) {
  39295. this._updateBounds();
  39296. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  39297. this._buildFigureFromPatch(i);
  39298. }
  39299. }
  39300. this._updateBounds();
  39301. this._packData();
  39302. }
  39303. _decodeType4Shading(reader) {
  39304. const coords = this.coords;
  39305. const colors = this.colors;
  39306. const operators = [];
  39307. const ps = [];
  39308. let verticesLeft = 0;
  39309. while (reader.hasData) {
  39310. const f = reader.readFlag();
  39311. const coord = reader.readCoordinate();
  39312. const color = reader.readComponents();
  39313. if (verticesLeft === 0) {
  39314. if (!(0 <= f && f <= 2)) {
  39315. throw new _util.FormatError("Unknown type4 flag");
  39316. }
  39317. switch (f) {
  39318. case 0:
  39319. verticesLeft = 3;
  39320. break;
  39321. case 1:
  39322. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  39323. verticesLeft = 1;
  39324. break;
  39325. case 2:
  39326. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  39327. verticesLeft = 1;
  39328. break;
  39329. }
  39330. operators.push(f);
  39331. }
  39332. ps.push(coords.length);
  39333. coords.push(coord);
  39334. colors.push(color);
  39335. verticesLeft--;
  39336. reader.align();
  39337. }
  39338. this.figures.push({
  39339. type: "triangles",
  39340. coords: new Int32Array(ps),
  39341. colors: new Int32Array(ps)
  39342. });
  39343. }
  39344. _decodeType5Shading(reader, verticesPerRow) {
  39345. const coords = this.coords;
  39346. const colors = this.colors;
  39347. const ps = [];
  39348. while (reader.hasData) {
  39349. const coord = reader.readCoordinate();
  39350. const color = reader.readComponents();
  39351. ps.push(coords.length);
  39352. coords.push(coord);
  39353. colors.push(color);
  39354. }
  39355. this.figures.push({
  39356. type: "lattice",
  39357. coords: new Int32Array(ps),
  39358. colors: new Int32Array(ps),
  39359. verticesPerRow
  39360. });
  39361. }
  39362. _decodeType6Shading(reader) {
  39363. const coords = this.coords;
  39364. const colors = this.colors;
  39365. const ps = new Int32Array(16);
  39366. const cs = new Int32Array(4);
  39367. while (reader.hasData) {
  39368. const f = reader.readFlag();
  39369. if (!(0 <= f && f <= 3)) {
  39370. throw new _util.FormatError("Unknown type6 flag");
  39371. }
  39372. const pi = coords.length;
  39373. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  39374. coords.push(reader.readCoordinate());
  39375. }
  39376. const ci = colors.length;
  39377. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  39378. colors.push(reader.readComponents());
  39379. }
  39380. let tmp1, tmp2, tmp3, tmp4;
  39381. switch (f) {
  39382. case 0:
  39383. ps[12] = pi + 3;
  39384. ps[13] = pi + 4;
  39385. ps[14] = pi + 5;
  39386. ps[15] = pi + 6;
  39387. ps[8] = pi + 2;
  39388. ps[11] = pi + 7;
  39389. ps[4] = pi + 1;
  39390. ps[7] = pi + 8;
  39391. ps[0] = pi;
  39392. ps[1] = pi + 11;
  39393. ps[2] = pi + 10;
  39394. ps[3] = pi + 9;
  39395. cs[2] = ci + 1;
  39396. cs[3] = ci + 2;
  39397. cs[0] = ci;
  39398. cs[1] = ci + 3;
  39399. break;
  39400. case 1:
  39401. tmp1 = ps[12];
  39402. tmp2 = ps[13];
  39403. tmp3 = ps[14];
  39404. tmp4 = ps[15];
  39405. ps[12] = tmp4;
  39406. ps[13] = pi + 0;
  39407. ps[14] = pi + 1;
  39408. ps[15] = pi + 2;
  39409. ps[8] = tmp3;
  39410. ps[11] = pi + 3;
  39411. ps[4] = tmp2;
  39412. ps[7] = pi + 4;
  39413. ps[0] = tmp1;
  39414. ps[1] = pi + 7;
  39415. ps[2] = pi + 6;
  39416. ps[3] = pi + 5;
  39417. tmp1 = cs[2];
  39418. tmp2 = cs[3];
  39419. cs[2] = tmp2;
  39420. cs[3] = ci;
  39421. cs[0] = tmp1;
  39422. cs[1] = ci + 1;
  39423. break;
  39424. case 2:
  39425. tmp1 = ps[15];
  39426. tmp2 = ps[11];
  39427. ps[12] = ps[3];
  39428. ps[13] = pi + 0;
  39429. ps[14] = pi + 1;
  39430. ps[15] = pi + 2;
  39431. ps[8] = ps[7];
  39432. ps[11] = pi + 3;
  39433. ps[4] = tmp2;
  39434. ps[7] = pi + 4;
  39435. ps[0] = tmp1;
  39436. ps[1] = pi + 7;
  39437. ps[2] = pi + 6;
  39438. ps[3] = pi + 5;
  39439. tmp1 = cs[3];
  39440. cs[2] = cs[1];
  39441. cs[3] = ci;
  39442. cs[0] = tmp1;
  39443. cs[1] = ci + 1;
  39444. break;
  39445. case 3:
  39446. ps[12] = ps[0];
  39447. ps[13] = pi + 0;
  39448. ps[14] = pi + 1;
  39449. ps[15] = pi + 2;
  39450. ps[8] = ps[1];
  39451. ps[11] = pi + 3;
  39452. ps[4] = ps[2];
  39453. ps[7] = pi + 4;
  39454. ps[0] = ps[3];
  39455. ps[1] = pi + 7;
  39456. ps[2] = pi + 6;
  39457. ps[3] = pi + 5;
  39458. cs[2] = cs[0];
  39459. cs[3] = ci;
  39460. cs[0] = cs[1];
  39461. cs[1] = ci + 1;
  39462. break;
  39463. }
  39464. ps[5] = coords.length;
  39465. 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]);
  39466. ps[6] = coords.length;
  39467. 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]);
  39468. ps[9] = coords.length;
  39469. 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]);
  39470. ps[10] = coords.length;
  39471. 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]);
  39472. this.figures.push({
  39473. type: "patch",
  39474. coords: new Int32Array(ps),
  39475. colors: new Int32Array(cs)
  39476. });
  39477. }
  39478. }
  39479. _decodeType7Shading(reader) {
  39480. const coords = this.coords;
  39481. const colors = this.colors;
  39482. const ps = new Int32Array(16);
  39483. const cs = new Int32Array(4);
  39484. while (reader.hasData) {
  39485. const f = reader.readFlag();
  39486. if (!(0 <= f && f <= 3)) {
  39487. throw new _util.FormatError("Unknown type7 flag");
  39488. }
  39489. const pi = coords.length;
  39490. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  39491. coords.push(reader.readCoordinate());
  39492. }
  39493. const ci = colors.length;
  39494. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  39495. colors.push(reader.readComponents());
  39496. }
  39497. let tmp1, tmp2, tmp3, tmp4;
  39498. switch (f) {
  39499. case 0:
  39500. ps[12] = pi + 3;
  39501. ps[13] = pi + 4;
  39502. ps[14] = pi + 5;
  39503. ps[15] = pi + 6;
  39504. ps[8] = pi + 2;
  39505. ps[9] = pi + 13;
  39506. ps[10] = pi + 14;
  39507. ps[11] = pi + 7;
  39508. ps[4] = pi + 1;
  39509. ps[5] = pi + 12;
  39510. ps[6] = pi + 15;
  39511. ps[7] = pi + 8;
  39512. ps[0] = pi;
  39513. ps[1] = pi + 11;
  39514. ps[2] = pi + 10;
  39515. ps[3] = pi + 9;
  39516. cs[2] = ci + 1;
  39517. cs[3] = ci + 2;
  39518. cs[0] = ci;
  39519. cs[1] = ci + 3;
  39520. break;
  39521. case 1:
  39522. tmp1 = ps[12];
  39523. tmp2 = ps[13];
  39524. tmp3 = ps[14];
  39525. tmp4 = ps[15];
  39526. ps[12] = tmp4;
  39527. ps[13] = pi + 0;
  39528. ps[14] = pi + 1;
  39529. ps[15] = pi + 2;
  39530. ps[8] = tmp3;
  39531. ps[9] = pi + 9;
  39532. ps[10] = pi + 10;
  39533. ps[11] = pi + 3;
  39534. ps[4] = tmp2;
  39535. ps[5] = pi + 8;
  39536. ps[6] = pi + 11;
  39537. ps[7] = pi + 4;
  39538. ps[0] = tmp1;
  39539. ps[1] = pi + 7;
  39540. ps[2] = pi + 6;
  39541. ps[3] = pi + 5;
  39542. tmp1 = cs[2];
  39543. tmp2 = cs[3];
  39544. cs[2] = tmp2;
  39545. cs[3] = ci;
  39546. cs[0] = tmp1;
  39547. cs[1] = ci + 1;
  39548. break;
  39549. case 2:
  39550. tmp1 = ps[15];
  39551. tmp2 = ps[11];
  39552. ps[12] = ps[3];
  39553. ps[13] = pi + 0;
  39554. ps[14] = pi + 1;
  39555. ps[15] = pi + 2;
  39556. ps[8] = ps[7];
  39557. ps[9] = pi + 9;
  39558. ps[10] = pi + 10;
  39559. ps[11] = pi + 3;
  39560. ps[4] = tmp2;
  39561. ps[5] = pi + 8;
  39562. ps[6] = pi + 11;
  39563. ps[7] = pi + 4;
  39564. ps[0] = tmp1;
  39565. ps[1] = pi + 7;
  39566. ps[2] = pi + 6;
  39567. ps[3] = pi + 5;
  39568. tmp1 = cs[3];
  39569. cs[2] = cs[1];
  39570. cs[3] = ci;
  39571. cs[0] = tmp1;
  39572. cs[1] = ci + 1;
  39573. break;
  39574. case 3:
  39575. ps[12] = ps[0];
  39576. ps[13] = pi + 0;
  39577. ps[14] = pi + 1;
  39578. ps[15] = pi + 2;
  39579. ps[8] = ps[1];
  39580. ps[9] = pi + 9;
  39581. ps[10] = pi + 10;
  39582. ps[11] = pi + 3;
  39583. ps[4] = ps[2];
  39584. ps[5] = pi + 8;
  39585. ps[6] = pi + 11;
  39586. ps[7] = pi + 4;
  39587. ps[0] = ps[3];
  39588. ps[1] = pi + 7;
  39589. ps[2] = pi + 6;
  39590. ps[3] = pi + 5;
  39591. cs[2] = cs[0];
  39592. cs[3] = ci;
  39593. cs[0] = cs[1];
  39594. cs[1] = ci + 1;
  39595. break;
  39596. }
  39597. this.figures.push({
  39598. type: "patch",
  39599. coords: new Int32Array(ps),
  39600. colors: new Int32Array(cs)
  39601. });
  39602. }
  39603. }
  39604. _buildFigureFromPatch(index) {
  39605. const figure = this.figures[index];
  39606. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  39607. const coords = this.coords,
  39608. colors = this.colors;
  39609. const pi = figure.coords;
  39610. const ci = figure.colors;
  39611. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  39612. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  39613. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  39614. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  39615. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  39616. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  39617. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  39618. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  39619. const verticesPerRow = splitXBy + 1;
  39620. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  39621. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  39622. let k = 0;
  39623. const cl = new Uint8Array(3),
  39624. cr = new Uint8Array(3);
  39625. const c0 = colors[ci[0]],
  39626. c1 = colors[ci[1]],
  39627. c2 = colors[ci[2]],
  39628. c3 = colors[ci[3]];
  39629. const bRow = getB(splitYBy),
  39630. bCol = getB(splitXBy);
  39631. for (let row = 0; row <= splitYBy; row++) {
  39632. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  39633. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  39634. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  39635. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  39636. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  39637. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  39638. for (let col = 0; col <= splitXBy; col++, k++) {
  39639. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  39640. continue;
  39641. }
  39642. let x = 0,
  39643. y = 0;
  39644. let q = 0;
  39645. for (let i = 0; i <= 3; i++) {
  39646. for (let j = 0; j <= 3; j++, q++) {
  39647. const m = bRow[row][i] * bCol[col][j];
  39648. x += coords[pi[q]][0] * m;
  39649. y += coords[pi[q]][1] * m;
  39650. }
  39651. }
  39652. figureCoords[k] = coords.length;
  39653. coords.push([x, y]);
  39654. figureColors[k] = colors.length;
  39655. const newColor = new Uint8Array(3);
  39656. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  39657. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  39658. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  39659. colors.push(newColor);
  39660. }
  39661. }
  39662. figureCoords[0] = pi[0];
  39663. figureColors[0] = ci[0];
  39664. figureCoords[splitXBy] = pi[3];
  39665. figureColors[splitXBy] = ci[1];
  39666. figureCoords[verticesPerRow * splitYBy] = pi[12];
  39667. figureColors[verticesPerRow * splitYBy] = ci[2];
  39668. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  39669. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  39670. this.figures[index] = {
  39671. type: "lattice",
  39672. coords: figureCoords,
  39673. colors: figureColors,
  39674. verticesPerRow
  39675. };
  39676. }
  39677. _updateBounds() {
  39678. let minX = this.coords[0][0],
  39679. minY = this.coords[0][1],
  39680. maxX = minX,
  39681. maxY = minY;
  39682. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  39683. const x = this.coords[i][0],
  39684. y = this.coords[i][1];
  39685. minX = minX > x ? x : minX;
  39686. minY = minY > y ? y : minY;
  39687. maxX = maxX < x ? x : maxX;
  39688. maxY = maxY < y ? y : maxY;
  39689. }
  39690. this.bounds = [minX, minY, maxX, maxY];
  39691. }
  39692. _packData() {
  39693. let i, ii, j, jj;
  39694. const coords = this.coords;
  39695. const coordsPacked = new Float32Array(coords.length * 2);
  39696. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  39697. const xy = coords[i];
  39698. coordsPacked[j++] = xy[0];
  39699. coordsPacked[j++] = xy[1];
  39700. }
  39701. this.coords = coordsPacked;
  39702. const colors = this.colors;
  39703. const colorsPacked = new Uint8Array(colors.length * 3);
  39704. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  39705. const c = colors[i];
  39706. colorsPacked[j++] = c[0];
  39707. colorsPacked[j++] = c[1];
  39708. colorsPacked[j++] = c[2];
  39709. }
  39710. this.colors = colorsPacked;
  39711. const figures = this.figures;
  39712. for (i = 0, ii = figures.length; i < ii; i++) {
  39713. const figure = figures[i],
  39714. ps = figure.coords,
  39715. cs = figure.colors;
  39716. for (j = 0, jj = ps.length; j < jj; j++) {
  39717. ps[j] *= 2;
  39718. cs[j] *= 3;
  39719. }
  39720. }
  39721. }
  39722. getIR() {
  39723. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  39724. }
  39725. }
  39726. class DummyShading extends BaseShading {
  39727. getIR() {
  39728. return ["Dummy"];
  39729. }
  39730. }
  39731. function getTilingPatternIR(operatorList, dict, color) {
  39732. const matrix = dict.getArray("Matrix");
  39733. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  39734. const xstep = dict.get("XStep");
  39735. const ystep = dict.get("YStep");
  39736. const paintType = dict.get("PaintType");
  39737. const tilingType = dict.get("TilingType");
  39738. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  39739. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  39740. }
  39741. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  39742. }
  39743. /***/ }),
  39744. /* 56 */
  39745. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  39746. Object.defineProperty(exports, "__esModule", ({
  39747. value: true
  39748. }));
  39749. exports.isPDFFunction = isPDFFunction;
  39750. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  39751. var _primitives = __w_pdfjs_require__(5);
  39752. var _util = __w_pdfjs_require__(2);
  39753. var _ps_parser = __w_pdfjs_require__(57);
  39754. var _image_utils = __w_pdfjs_require__(58);
  39755. class PDFFunctionFactory {
  39756. constructor({
  39757. xref,
  39758. isEvalSupported = true
  39759. }) {
  39760. this.xref = xref;
  39761. this.isEvalSupported = isEvalSupported !== false;
  39762. }
  39763. create(fn) {
  39764. const cachedFunction = this.getCached(fn);
  39765. if (cachedFunction) {
  39766. return cachedFunction;
  39767. }
  39768. const parsedFunction = PDFFunction.parse({
  39769. xref: this.xref,
  39770. isEvalSupported: this.isEvalSupported,
  39771. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  39772. });
  39773. this._cache(fn, parsedFunction);
  39774. return parsedFunction;
  39775. }
  39776. createFromArray(fnObj) {
  39777. const cachedFunction = this.getCached(fnObj);
  39778. if (cachedFunction) {
  39779. return cachedFunction;
  39780. }
  39781. const parsedFunction = PDFFunction.parseArray({
  39782. xref: this.xref,
  39783. isEvalSupported: this.isEvalSupported,
  39784. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  39785. });
  39786. this._cache(fnObj, parsedFunction);
  39787. return parsedFunction;
  39788. }
  39789. getCached(cacheKey) {
  39790. let fnRef;
  39791. if (cacheKey instanceof _primitives.Ref) {
  39792. fnRef = cacheKey;
  39793. } else if (cacheKey instanceof _primitives.Dict) {
  39794. fnRef = cacheKey.objId;
  39795. } else if ((0, _primitives.isStream)(cacheKey)) {
  39796. fnRef = cacheKey.dict && cacheKey.dict.objId;
  39797. }
  39798. if (fnRef) {
  39799. const localFunction = this._localFunctionCache.getByRef(fnRef);
  39800. if (localFunction) {
  39801. return localFunction;
  39802. }
  39803. }
  39804. return null;
  39805. }
  39806. _cache(cacheKey, parsedFunction) {
  39807. if (!parsedFunction) {
  39808. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  39809. }
  39810. let fnRef;
  39811. if (cacheKey instanceof _primitives.Ref) {
  39812. fnRef = cacheKey;
  39813. } else if (cacheKey instanceof _primitives.Dict) {
  39814. fnRef = cacheKey.objId;
  39815. } else if ((0, _primitives.isStream)(cacheKey)) {
  39816. fnRef = cacheKey.dict && cacheKey.dict.objId;
  39817. }
  39818. if (fnRef) {
  39819. this._localFunctionCache.set(null, fnRef, parsedFunction);
  39820. }
  39821. }
  39822. get _localFunctionCache() {
  39823. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  39824. }
  39825. }
  39826. exports.PDFFunctionFactory = PDFFunctionFactory;
  39827. function toNumberArray(arr) {
  39828. if (!Array.isArray(arr)) {
  39829. return null;
  39830. }
  39831. const length = arr.length;
  39832. for (let i = 0; i < length; i++) {
  39833. if (typeof arr[i] !== "number") {
  39834. const result = new Array(length);
  39835. for (let j = 0; j < length; j++) {
  39836. result[j] = +arr[j];
  39837. }
  39838. return result;
  39839. }
  39840. }
  39841. return arr;
  39842. }
  39843. class PDFFunction {
  39844. static getSampleArray(size, outputSize, bps, stream) {
  39845. let i, ii;
  39846. let length = 1;
  39847. for (i = 0, ii = size.length; i < ii; i++) {
  39848. length *= size[i];
  39849. }
  39850. length *= outputSize;
  39851. const array = new Array(length);
  39852. let codeSize = 0;
  39853. let codeBuf = 0;
  39854. const sampleMul = 1.0 / (2.0 ** bps - 1);
  39855. const strBytes = stream.getBytes((length * bps + 7) / 8);
  39856. let strIdx = 0;
  39857. for (i = 0; i < length; i++) {
  39858. while (codeSize < bps) {
  39859. codeBuf <<= 8;
  39860. codeBuf |= strBytes[strIdx++];
  39861. codeSize += 8;
  39862. }
  39863. codeSize -= bps;
  39864. array[i] = (codeBuf >> codeSize) * sampleMul;
  39865. codeBuf &= (1 << codeSize) - 1;
  39866. }
  39867. return array;
  39868. }
  39869. static parse({
  39870. xref,
  39871. isEvalSupported,
  39872. fn
  39873. }) {
  39874. const dict = fn.dict || fn;
  39875. const typeNum = dict.get("FunctionType");
  39876. switch (typeNum) {
  39877. case 0:
  39878. return this.constructSampled({
  39879. xref,
  39880. isEvalSupported,
  39881. fn,
  39882. dict
  39883. });
  39884. case 1:
  39885. break;
  39886. case 2:
  39887. return this.constructInterpolated({
  39888. xref,
  39889. isEvalSupported,
  39890. dict
  39891. });
  39892. case 3:
  39893. return this.constructStiched({
  39894. xref,
  39895. isEvalSupported,
  39896. dict
  39897. });
  39898. case 4:
  39899. return this.constructPostScript({
  39900. xref,
  39901. isEvalSupported,
  39902. fn,
  39903. dict
  39904. });
  39905. }
  39906. throw new _util.FormatError("Unknown type of function");
  39907. }
  39908. static parseArray({
  39909. xref,
  39910. isEvalSupported,
  39911. fnObj
  39912. }) {
  39913. if (!Array.isArray(fnObj)) {
  39914. return this.parse({
  39915. xref,
  39916. isEvalSupported,
  39917. fn: fnObj
  39918. });
  39919. }
  39920. const fnArray = [];
  39921. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  39922. fnArray.push(this.parse({
  39923. xref,
  39924. isEvalSupported,
  39925. fn: xref.fetchIfRef(fnObj[j])
  39926. }));
  39927. }
  39928. return function (src, srcOffset, dest, destOffset) {
  39929. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  39930. fnArray[i](src, srcOffset, dest, destOffset + i);
  39931. }
  39932. };
  39933. }
  39934. static constructSampled({
  39935. xref,
  39936. isEvalSupported,
  39937. fn,
  39938. dict
  39939. }) {
  39940. function toMultiArray(arr) {
  39941. const inputLength = arr.length;
  39942. const out = [];
  39943. let index = 0;
  39944. for (let i = 0; i < inputLength; i += 2) {
  39945. out[index++] = [arr[i], arr[i + 1]];
  39946. }
  39947. return out;
  39948. }
  39949. function interpolate(x, xmin, xmax, ymin, ymax) {
  39950. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  39951. }
  39952. let domain = toNumberArray(dict.getArray("Domain"));
  39953. let range = toNumberArray(dict.getArray("Range"));
  39954. if (!domain || !range) {
  39955. throw new _util.FormatError("No domain or range");
  39956. }
  39957. const inputSize = domain.length / 2;
  39958. const outputSize = range.length / 2;
  39959. domain = toMultiArray(domain);
  39960. range = toMultiArray(range);
  39961. const size = toNumberArray(dict.getArray("Size"));
  39962. const bps = dict.get("BitsPerSample");
  39963. const order = dict.get("Order") || 1;
  39964. if (order !== 1) {
  39965. (0, _util.info)("No support for cubic spline interpolation: " + order);
  39966. }
  39967. let encode = toNumberArray(dict.getArray("Encode"));
  39968. if (!encode) {
  39969. encode = [];
  39970. for (let i = 0; i < inputSize; ++i) {
  39971. encode.push([0, size[i] - 1]);
  39972. }
  39973. } else {
  39974. encode = toMultiArray(encode);
  39975. }
  39976. let decode = toNumberArray(dict.getArray("Decode"));
  39977. if (!decode) {
  39978. decode = range;
  39979. } else {
  39980. decode = toMultiArray(decode);
  39981. }
  39982. const samples = this.getSampleArray(size, outputSize, bps, fn);
  39983. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  39984. const cubeVertices = 1 << inputSize;
  39985. const cubeN = new Float64Array(cubeVertices);
  39986. const cubeVertex = new Uint32Array(cubeVertices);
  39987. let i, j;
  39988. for (j = 0; j < cubeVertices; j++) {
  39989. cubeN[j] = 1;
  39990. }
  39991. let k = outputSize,
  39992. pos = 1;
  39993. for (i = 0; i < inputSize; ++i) {
  39994. const domain_2i = domain[i][0];
  39995. const domain_2i_1 = domain[i][1];
  39996. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  39997. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  39998. const size_i = size[i];
  39999. e = Math.min(Math.max(e, 0), size_i - 1);
  40000. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  40001. const n0 = e0 + 1 - e;
  40002. const n1 = e - e0;
  40003. const offset0 = e0 * k;
  40004. const offset1 = offset0 + k;
  40005. for (j = 0; j < cubeVertices; j++) {
  40006. if (j & pos) {
  40007. cubeN[j] *= n1;
  40008. cubeVertex[j] += offset1;
  40009. } else {
  40010. cubeN[j] *= n0;
  40011. cubeVertex[j] += offset0;
  40012. }
  40013. }
  40014. k *= size_i;
  40015. pos <<= 1;
  40016. }
  40017. for (j = 0; j < outputSize; ++j) {
  40018. let rj = 0;
  40019. for (i = 0; i < cubeVertices; i++) {
  40020. rj += samples[cubeVertex[i] + j] * cubeN[i];
  40021. }
  40022. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  40023. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  40024. }
  40025. };
  40026. }
  40027. static constructInterpolated({
  40028. xref,
  40029. isEvalSupported,
  40030. dict
  40031. }) {
  40032. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  40033. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  40034. const n = dict.get("N");
  40035. const diff = [];
  40036. for (let i = 0, ii = c0.length; i < ii; ++i) {
  40037. diff.push(c1[i] - c0[i]);
  40038. }
  40039. const length = diff.length;
  40040. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  40041. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  40042. for (let j = 0; j < length; ++j) {
  40043. dest[destOffset + j] = c0[j] + x * diff[j];
  40044. }
  40045. };
  40046. }
  40047. static constructStiched({
  40048. xref,
  40049. isEvalSupported,
  40050. dict
  40051. }) {
  40052. const domain = toNumberArray(dict.getArray("Domain"));
  40053. if (!domain) {
  40054. throw new _util.FormatError("No domain");
  40055. }
  40056. const inputSize = domain.length / 2;
  40057. if (inputSize !== 1) {
  40058. throw new _util.FormatError("Bad domain for stiched function");
  40059. }
  40060. const fnRefs = dict.get("Functions");
  40061. const fns = [];
  40062. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  40063. fns.push(this.parse({
  40064. xref,
  40065. isEvalSupported,
  40066. fn: xref.fetchIfRef(fnRefs[i])
  40067. }));
  40068. }
  40069. const bounds = toNumberArray(dict.getArray("Bounds"));
  40070. const encode = toNumberArray(dict.getArray("Encode"));
  40071. const tmpBuf = new Float32Array(1);
  40072. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  40073. const clip = function constructStichedFromIRClip(v, min, max) {
  40074. if (v > max) {
  40075. v = max;
  40076. } else if (v < min) {
  40077. v = min;
  40078. }
  40079. return v;
  40080. };
  40081. const v = clip(src[srcOffset], domain[0], domain[1]);
  40082. const length = bounds.length;
  40083. let i;
  40084. for (i = 0; i < length; ++i) {
  40085. if (v < bounds[i]) {
  40086. break;
  40087. }
  40088. }
  40089. let dmin = domain[0];
  40090. if (i > 0) {
  40091. dmin = bounds[i - 1];
  40092. }
  40093. let dmax = domain[1];
  40094. if (i < bounds.length) {
  40095. dmax = bounds[i];
  40096. }
  40097. const rmin = encode[2 * i];
  40098. const rmax = encode[2 * i + 1];
  40099. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  40100. fns[i](tmpBuf, 0, dest, destOffset);
  40101. };
  40102. }
  40103. static constructPostScript({
  40104. xref,
  40105. isEvalSupported,
  40106. fn,
  40107. dict
  40108. }) {
  40109. const domain = toNumberArray(dict.getArray("Domain"));
  40110. const range = toNumberArray(dict.getArray("Range"));
  40111. if (!domain) {
  40112. throw new _util.FormatError("No domain.");
  40113. }
  40114. if (!range) {
  40115. throw new _util.FormatError("No range.");
  40116. }
  40117. const lexer = new _ps_parser.PostScriptLexer(fn);
  40118. const parser = new _ps_parser.PostScriptParser(lexer);
  40119. const code = parser.parse();
  40120. if (isEvalSupported && _util.IsEvalSupportedCached.value) {
  40121. const compiled = new PostScriptCompiler().compile(code, domain, range);
  40122. if (compiled) {
  40123. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  40124. }
  40125. }
  40126. (0, _util.info)("Unable to compile PS function");
  40127. const numOutputs = range.length >> 1;
  40128. const numInputs = domain.length >> 1;
  40129. const evaluator = new PostScriptEvaluator(code);
  40130. const cache = Object.create(null);
  40131. const MAX_CACHE_SIZE = 2048 * 4;
  40132. let cache_available = MAX_CACHE_SIZE;
  40133. const tmpBuf = new Float32Array(numInputs);
  40134. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  40135. let i, value;
  40136. let key = "";
  40137. const input = tmpBuf;
  40138. for (i = 0; i < numInputs; i++) {
  40139. value = src[srcOffset + i];
  40140. input[i] = value;
  40141. key += value + "_";
  40142. }
  40143. const cachedValue = cache[key];
  40144. if (cachedValue !== undefined) {
  40145. dest.set(cachedValue, destOffset);
  40146. return;
  40147. }
  40148. const output = new Float32Array(numOutputs);
  40149. const stack = evaluator.execute(input);
  40150. const stackIndex = stack.length - numOutputs;
  40151. for (i = 0; i < numOutputs; i++) {
  40152. value = stack[stackIndex + i];
  40153. let bound = range[i * 2];
  40154. if (value < bound) {
  40155. value = bound;
  40156. } else {
  40157. bound = range[i * 2 + 1];
  40158. if (value > bound) {
  40159. value = bound;
  40160. }
  40161. }
  40162. output[i] = value;
  40163. }
  40164. if (cache_available > 0) {
  40165. cache_available--;
  40166. cache[key] = output;
  40167. }
  40168. dest.set(output, destOffset);
  40169. };
  40170. }
  40171. }
  40172. function isPDFFunction(v) {
  40173. let fnDict;
  40174. if (typeof v !== "object") {
  40175. return false;
  40176. } else if ((0, _primitives.isDict)(v)) {
  40177. fnDict = v;
  40178. } else if ((0, _primitives.isStream)(v)) {
  40179. fnDict = v.dict;
  40180. } else {
  40181. return false;
  40182. }
  40183. return fnDict.has("FunctionType");
  40184. }
  40185. class PostScriptStack {
  40186. static get MAX_STACK_SIZE() {
  40187. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  40188. }
  40189. constructor(initialStack) {
  40190. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  40191. }
  40192. push(value) {
  40193. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  40194. throw new Error("PostScript function stack overflow.");
  40195. }
  40196. this.stack.push(value);
  40197. }
  40198. pop() {
  40199. if (this.stack.length <= 0) {
  40200. throw new Error("PostScript function stack underflow.");
  40201. }
  40202. return this.stack.pop();
  40203. }
  40204. copy(n) {
  40205. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  40206. throw new Error("PostScript function stack overflow.");
  40207. }
  40208. const stack = this.stack;
  40209. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  40210. stack.push(stack[i]);
  40211. }
  40212. }
  40213. index(n) {
  40214. this.push(this.stack[this.stack.length - n - 1]);
  40215. }
  40216. roll(n, p) {
  40217. const stack = this.stack;
  40218. const l = stack.length - n;
  40219. const r = stack.length - 1;
  40220. const c = l + (p - Math.floor(p / n) * n);
  40221. for (let i = l, j = r; i < j; i++, j--) {
  40222. const t = stack[i];
  40223. stack[i] = stack[j];
  40224. stack[j] = t;
  40225. }
  40226. for (let i = l, j = c - 1; i < j; i++, j--) {
  40227. const t = stack[i];
  40228. stack[i] = stack[j];
  40229. stack[j] = t;
  40230. }
  40231. for (let i = c, j = r; i < j; i++, j--) {
  40232. const t = stack[i];
  40233. stack[i] = stack[j];
  40234. stack[j] = t;
  40235. }
  40236. }
  40237. }
  40238. class PostScriptEvaluator {
  40239. constructor(operators) {
  40240. this.operators = operators;
  40241. }
  40242. execute(initialStack) {
  40243. const stack = new PostScriptStack(initialStack);
  40244. let counter = 0;
  40245. const operators = this.operators;
  40246. const length = operators.length;
  40247. let operator, a, b;
  40248. while (counter < length) {
  40249. operator = operators[counter++];
  40250. if (typeof operator === "number") {
  40251. stack.push(operator);
  40252. continue;
  40253. }
  40254. switch (operator) {
  40255. case "jz":
  40256. b = stack.pop();
  40257. a = stack.pop();
  40258. if (!a) {
  40259. counter = b;
  40260. }
  40261. break;
  40262. case "j":
  40263. a = stack.pop();
  40264. counter = a;
  40265. break;
  40266. case "abs":
  40267. a = stack.pop();
  40268. stack.push(Math.abs(a));
  40269. break;
  40270. case "add":
  40271. b = stack.pop();
  40272. a = stack.pop();
  40273. stack.push(a + b);
  40274. break;
  40275. case "and":
  40276. b = stack.pop();
  40277. a = stack.pop();
  40278. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  40279. stack.push(a && b);
  40280. } else {
  40281. stack.push(a & b);
  40282. }
  40283. break;
  40284. case "atan":
  40285. a = stack.pop();
  40286. stack.push(Math.atan(a));
  40287. break;
  40288. case "bitshift":
  40289. b = stack.pop();
  40290. a = stack.pop();
  40291. if (a > 0) {
  40292. stack.push(a << b);
  40293. } else {
  40294. stack.push(a >> b);
  40295. }
  40296. break;
  40297. case "ceiling":
  40298. a = stack.pop();
  40299. stack.push(Math.ceil(a));
  40300. break;
  40301. case "copy":
  40302. a = stack.pop();
  40303. stack.copy(a);
  40304. break;
  40305. case "cos":
  40306. a = stack.pop();
  40307. stack.push(Math.cos(a));
  40308. break;
  40309. case "cvi":
  40310. a = stack.pop() | 0;
  40311. stack.push(a);
  40312. break;
  40313. case "cvr":
  40314. break;
  40315. case "div":
  40316. b = stack.pop();
  40317. a = stack.pop();
  40318. stack.push(a / b);
  40319. break;
  40320. case "dup":
  40321. stack.copy(1);
  40322. break;
  40323. case "eq":
  40324. b = stack.pop();
  40325. a = stack.pop();
  40326. stack.push(a === b);
  40327. break;
  40328. case "exch":
  40329. stack.roll(2, 1);
  40330. break;
  40331. case "exp":
  40332. b = stack.pop();
  40333. a = stack.pop();
  40334. stack.push(a ** b);
  40335. break;
  40336. case "false":
  40337. stack.push(false);
  40338. break;
  40339. case "floor":
  40340. a = stack.pop();
  40341. stack.push(Math.floor(a));
  40342. break;
  40343. case "ge":
  40344. b = stack.pop();
  40345. a = stack.pop();
  40346. stack.push(a >= b);
  40347. break;
  40348. case "gt":
  40349. b = stack.pop();
  40350. a = stack.pop();
  40351. stack.push(a > b);
  40352. break;
  40353. case "idiv":
  40354. b = stack.pop();
  40355. a = stack.pop();
  40356. stack.push(a / b | 0);
  40357. break;
  40358. case "index":
  40359. a = stack.pop();
  40360. stack.index(a);
  40361. break;
  40362. case "le":
  40363. b = stack.pop();
  40364. a = stack.pop();
  40365. stack.push(a <= b);
  40366. break;
  40367. case "ln":
  40368. a = stack.pop();
  40369. stack.push(Math.log(a));
  40370. break;
  40371. case "log":
  40372. a = stack.pop();
  40373. stack.push(Math.log(a) / Math.LN10);
  40374. break;
  40375. case "lt":
  40376. b = stack.pop();
  40377. a = stack.pop();
  40378. stack.push(a < b);
  40379. break;
  40380. case "mod":
  40381. b = stack.pop();
  40382. a = stack.pop();
  40383. stack.push(a % b);
  40384. break;
  40385. case "mul":
  40386. b = stack.pop();
  40387. a = stack.pop();
  40388. stack.push(a * b);
  40389. break;
  40390. case "ne":
  40391. b = stack.pop();
  40392. a = stack.pop();
  40393. stack.push(a !== b);
  40394. break;
  40395. case "neg":
  40396. a = stack.pop();
  40397. stack.push(-a);
  40398. break;
  40399. case "not":
  40400. a = stack.pop();
  40401. if ((0, _util.isBool)(a)) {
  40402. stack.push(!a);
  40403. } else {
  40404. stack.push(~a);
  40405. }
  40406. break;
  40407. case "or":
  40408. b = stack.pop();
  40409. a = stack.pop();
  40410. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  40411. stack.push(a || b);
  40412. } else {
  40413. stack.push(a | b);
  40414. }
  40415. break;
  40416. case "pop":
  40417. stack.pop();
  40418. break;
  40419. case "roll":
  40420. b = stack.pop();
  40421. a = stack.pop();
  40422. stack.roll(a, b);
  40423. break;
  40424. case "round":
  40425. a = stack.pop();
  40426. stack.push(Math.round(a));
  40427. break;
  40428. case "sin":
  40429. a = stack.pop();
  40430. stack.push(Math.sin(a));
  40431. break;
  40432. case "sqrt":
  40433. a = stack.pop();
  40434. stack.push(Math.sqrt(a));
  40435. break;
  40436. case "sub":
  40437. b = stack.pop();
  40438. a = stack.pop();
  40439. stack.push(a - b);
  40440. break;
  40441. case "true":
  40442. stack.push(true);
  40443. break;
  40444. case "truncate":
  40445. a = stack.pop();
  40446. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  40447. stack.push(a);
  40448. break;
  40449. case "xor":
  40450. b = stack.pop();
  40451. a = stack.pop();
  40452. if ((0, _util.isBool)(a) && (0, _util.isBool)(b)) {
  40453. stack.push(a !== b);
  40454. } else {
  40455. stack.push(a ^ b);
  40456. }
  40457. break;
  40458. default:
  40459. throw new _util.FormatError(`Unknown operator ${operator}`);
  40460. }
  40461. }
  40462. return stack.stack;
  40463. }
  40464. }
  40465. exports.PostScriptEvaluator = PostScriptEvaluator;
  40466. const PostScriptCompiler = function PostScriptCompilerClosure() {
  40467. class AstNode {
  40468. constructor(type) {
  40469. this.type = type;
  40470. }
  40471. visit(visitor) {
  40472. (0, _util.unreachable)("abstract method");
  40473. }
  40474. }
  40475. class AstArgument extends AstNode {
  40476. constructor(index, min, max) {
  40477. super("args");
  40478. this.index = index;
  40479. this.min = min;
  40480. this.max = max;
  40481. }
  40482. visit(visitor) {
  40483. visitor.visitArgument(this);
  40484. }
  40485. }
  40486. class AstLiteral extends AstNode {
  40487. constructor(number) {
  40488. super("literal");
  40489. this.number = number;
  40490. this.min = number;
  40491. this.max = number;
  40492. }
  40493. visit(visitor) {
  40494. visitor.visitLiteral(this);
  40495. }
  40496. }
  40497. class AstBinaryOperation extends AstNode {
  40498. constructor(op, arg1, arg2, min, max) {
  40499. super("binary");
  40500. this.op = op;
  40501. this.arg1 = arg1;
  40502. this.arg2 = arg2;
  40503. this.min = min;
  40504. this.max = max;
  40505. }
  40506. visit(visitor) {
  40507. visitor.visitBinaryOperation(this);
  40508. }
  40509. }
  40510. class AstMin extends AstNode {
  40511. constructor(arg, max) {
  40512. super("max");
  40513. this.arg = arg;
  40514. this.min = arg.min;
  40515. this.max = max;
  40516. }
  40517. visit(visitor) {
  40518. visitor.visitMin(this);
  40519. }
  40520. }
  40521. class AstVariable extends AstNode {
  40522. constructor(index, min, max) {
  40523. super("var");
  40524. this.index = index;
  40525. this.min = min;
  40526. this.max = max;
  40527. }
  40528. visit(visitor) {
  40529. visitor.visitVariable(this);
  40530. }
  40531. }
  40532. class AstVariableDefinition extends AstNode {
  40533. constructor(variable, arg) {
  40534. super("definition");
  40535. this.variable = variable;
  40536. this.arg = arg;
  40537. }
  40538. visit(visitor) {
  40539. visitor.visitVariableDefinition(this);
  40540. }
  40541. }
  40542. class ExpressionBuilderVisitor {
  40543. constructor() {
  40544. this.parts = [];
  40545. }
  40546. visitArgument(arg) {
  40547. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  40548. }
  40549. visitVariable(variable) {
  40550. this.parts.push("v", variable.index);
  40551. }
  40552. visitLiteral(literal) {
  40553. this.parts.push(literal.number);
  40554. }
  40555. visitBinaryOperation(operation) {
  40556. this.parts.push("(");
  40557. operation.arg1.visit(this);
  40558. this.parts.push(" ", operation.op, " ");
  40559. operation.arg2.visit(this);
  40560. this.parts.push(")");
  40561. }
  40562. visitVariableDefinition(definition) {
  40563. this.parts.push("var ");
  40564. definition.variable.visit(this);
  40565. this.parts.push(" = ");
  40566. definition.arg.visit(this);
  40567. this.parts.push(";");
  40568. }
  40569. visitMin(max) {
  40570. this.parts.push("Math.min(");
  40571. max.arg.visit(this);
  40572. this.parts.push(", ", max.max, ")");
  40573. }
  40574. toString() {
  40575. return this.parts.join("");
  40576. }
  40577. }
  40578. function buildAddOperation(num1, num2) {
  40579. if (num2.type === "literal" && num2.number === 0) {
  40580. return num1;
  40581. }
  40582. if (num1.type === "literal" && num1.number === 0) {
  40583. return num2;
  40584. }
  40585. if (num2.type === "literal" && num1.type === "literal") {
  40586. return new AstLiteral(num1.number + num2.number);
  40587. }
  40588. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  40589. }
  40590. function buildMulOperation(num1, num2) {
  40591. if (num2.type === "literal") {
  40592. if (num2.number === 0) {
  40593. return new AstLiteral(0);
  40594. } else if (num2.number === 1) {
  40595. return num1;
  40596. } else if (num1.type === "literal") {
  40597. return new AstLiteral(num1.number * num2.number);
  40598. }
  40599. }
  40600. if (num1.type === "literal") {
  40601. if (num1.number === 0) {
  40602. return new AstLiteral(0);
  40603. } else if (num1.number === 1) {
  40604. return num2;
  40605. }
  40606. }
  40607. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  40608. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  40609. return new AstBinaryOperation("*", num1, num2, min, max);
  40610. }
  40611. function buildSubOperation(num1, num2) {
  40612. if (num2.type === "literal") {
  40613. if (num2.number === 0) {
  40614. return num1;
  40615. } else if (num1.type === "literal") {
  40616. return new AstLiteral(num1.number - num2.number);
  40617. }
  40618. }
  40619. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  40620. return num2.arg2;
  40621. }
  40622. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  40623. }
  40624. function buildMinOperation(num1, max) {
  40625. if (num1.min >= max) {
  40626. return new AstLiteral(max);
  40627. } else if (num1.max <= max) {
  40628. return num1;
  40629. }
  40630. return new AstMin(num1, max);
  40631. }
  40632. class PostScriptCompiler {
  40633. compile(code, domain, range) {
  40634. const stack = [];
  40635. const instructions = [];
  40636. const inputSize = domain.length >> 1,
  40637. outputSize = range.length >> 1;
  40638. let lastRegister = 0;
  40639. let n, j;
  40640. let num1, num2, ast1, ast2, tmpVar, item;
  40641. for (let i = 0; i < inputSize; i++) {
  40642. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  40643. }
  40644. for (let i = 0, ii = code.length; i < ii; i++) {
  40645. item = code[i];
  40646. if (typeof item === "number") {
  40647. stack.push(new AstLiteral(item));
  40648. continue;
  40649. }
  40650. switch (item) {
  40651. case "add":
  40652. if (stack.length < 2) {
  40653. return null;
  40654. }
  40655. num2 = stack.pop();
  40656. num1 = stack.pop();
  40657. stack.push(buildAddOperation(num1, num2));
  40658. break;
  40659. case "cvr":
  40660. if (stack.length < 1) {
  40661. return null;
  40662. }
  40663. break;
  40664. case "mul":
  40665. if (stack.length < 2) {
  40666. return null;
  40667. }
  40668. num2 = stack.pop();
  40669. num1 = stack.pop();
  40670. stack.push(buildMulOperation(num1, num2));
  40671. break;
  40672. case "sub":
  40673. if (stack.length < 2) {
  40674. return null;
  40675. }
  40676. num2 = stack.pop();
  40677. num1 = stack.pop();
  40678. stack.push(buildSubOperation(num1, num2));
  40679. break;
  40680. case "exch":
  40681. if (stack.length < 2) {
  40682. return null;
  40683. }
  40684. ast1 = stack.pop();
  40685. ast2 = stack.pop();
  40686. stack.push(ast1, ast2);
  40687. break;
  40688. case "pop":
  40689. if (stack.length < 1) {
  40690. return null;
  40691. }
  40692. stack.pop();
  40693. break;
  40694. case "index":
  40695. if (stack.length < 1) {
  40696. return null;
  40697. }
  40698. num1 = stack.pop();
  40699. if (num1.type !== "literal") {
  40700. return null;
  40701. }
  40702. n = num1.number;
  40703. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  40704. return null;
  40705. }
  40706. ast1 = stack[stack.length - n - 1];
  40707. if (ast1.type === "literal" || ast1.type === "var") {
  40708. stack.push(ast1);
  40709. break;
  40710. }
  40711. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  40712. stack[stack.length - n - 1] = tmpVar;
  40713. stack.push(tmpVar);
  40714. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  40715. break;
  40716. case "dup":
  40717. if (stack.length < 1) {
  40718. return null;
  40719. }
  40720. 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]) {
  40721. num1 = stack.pop();
  40722. stack.push(buildMinOperation(num1, code[i + 1]));
  40723. i += 6;
  40724. break;
  40725. }
  40726. ast1 = stack[stack.length - 1];
  40727. if (ast1.type === "literal" || ast1.type === "var") {
  40728. stack.push(ast1);
  40729. break;
  40730. }
  40731. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  40732. stack[stack.length - 1] = tmpVar;
  40733. stack.push(tmpVar);
  40734. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  40735. break;
  40736. case "roll":
  40737. if (stack.length < 2) {
  40738. return null;
  40739. }
  40740. num2 = stack.pop();
  40741. num1 = stack.pop();
  40742. if (num2.type !== "literal" || num1.type !== "literal") {
  40743. return null;
  40744. }
  40745. j = num2.number;
  40746. n = num1.number;
  40747. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  40748. return null;
  40749. }
  40750. j = (j % n + n) % n;
  40751. if (j === 0) {
  40752. break;
  40753. }
  40754. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  40755. break;
  40756. default:
  40757. return null;
  40758. }
  40759. }
  40760. if (stack.length !== outputSize) {
  40761. return null;
  40762. }
  40763. const result = [];
  40764. for (const instruction of instructions) {
  40765. const statementBuilder = new ExpressionBuilderVisitor();
  40766. instruction.visit(statementBuilder);
  40767. result.push(statementBuilder.toString());
  40768. }
  40769. for (let i = 0, ii = stack.length; i < ii; i++) {
  40770. const expr = stack[i],
  40771. statementBuilder = new ExpressionBuilderVisitor();
  40772. expr.visit(statementBuilder);
  40773. const min = range[i * 2],
  40774. max = range[i * 2 + 1];
  40775. const out = [statementBuilder.toString()];
  40776. if (min > expr.min) {
  40777. out.unshift("Math.max(", min, ", ");
  40778. out.push(")");
  40779. }
  40780. if (max < expr.max) {
  40781. out.unshift("Math.min(", max, ", ");
  40782. out.push(")");
  40783. }
  40784. out.unshift("dest[destOffset + ", i, "] = ");
  40785. out.push(";");
  40786. result.push(out.join(""));
  40787. }
  40788. return result.join("\n");
  40789. }
  40790. }
  40791. return PostScriptCompiler;
  40792. }();
  40793. exports.PostScriptCompiler = PostScriptCompiler;
  40794. /***/ }),
  40795. /* 57 */
  40796. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40797. Object.defineProperty(exports, "__esModule", ({
  40798. value: true
  40799. }));
  40800. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  40801. var _util = __w_pdfjs_require__(2);
  40802. var _primitives = __w_pdfjs_require__(5);
  40803. var _core_utils = __w_pdfjs_require__(9);
  40804. class PostScriptParser {
  40805. constructor(lexer) {
  40806. this.lexer = lexer;
  40807. this.operators = [];
  40808. this.token = null;
  40809. this.prev = null;
  40810. }
  40811. nextToken() {
  40812. this.prev = this.token;
  40813. this.token = this.lexer.getToken();
  40814. }
  40815. accept(type) {
  40816. if (this.token.type === type) {
  40817. this.nextToken();
  40818. return true;
  40819. }
  40820. return false;
  40821. }
  40822. expect(type) {
  40823. if (this.accept(type)) {
  40824. return true;
  40825. }
  40826. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  40827. }
  40828. parse() {
  40829. this.nextToken();
  40830. this.expect(PostScriptTokenTypes.LBRACE);
  40831. this.parseBlock();
  40832. this.expect(PostScriptTokenTypes.RBRACE);
  40833. return this.operators;
  40834. }
  40835. parseBlock() {
  40836. while (true) {
  40837. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  40838. this.operators.push(this.prev.value);
  40839. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  40840. this.operators.push(this.prev.value);
  40841. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  40842. this.parseCondition();
  40843. } else {
  40844. return;
  40845. }
  40846. }
  40847. }
  40848. parseCondition() {
  40849. const conditionLocation = this.operators.length;
  40850. this.operators.push(null, null);
  40851. this.parseBlock();
  40852. this.expect(PostScriptTokenTypes.RBRACE);
  40853. if (this.accept(PostScriptTokenTypes.IF)) {
  40854. this.operators[conditionLocation] = this.operators.length;
  40855. this.operators[conditionLocation + 1] = "jz";
  40856. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  40857. const jumpLocation = this.operators.length;
  40858. this.operators.push(null, null);
  40859. const endOfTrue = this.operators.length;
  40860. this.parseBlock();
  40861. this.expect(PostScriptTokenTypes.RBRACE);
  40862. this.expect(PostScriptTokenTypes.IFELSE);
  40863. this.operators[jumpLocation] = this.operators.length;
  40864. this.operators[jumpLocation + 1] = "j";
  40865. this.operators[conditionLocation] = endOfTrue;
  40866. this.operators[conditionLocation + 1] = "jz";
  40867. } else {
  40868. throw new _util.FormatError("PS Function: error parsing conditional.");
  40869. }
  40870. }
  40871. }
  40872. exports.PostScriptParser = PostScriptParser;
  40873. const PostScriptTokenTypes = {
  40874. LBRACE: 0,
  40875. RBRACE: 1,
  40876. NUMBER: 2,
  40877. OPERATOR: 3,
  40878. IF: 4,
  40879. IFELSE: 5
  40880. };
  40881. class PostScriptToken {
  40882. static get opCache() {
  40883. return (0, _util.shadow)(this, "opCache", Object.create(null));
  40884. }
  40885. constructor(type, value) {
  40886. this.type = type;
  40887. this.value = value;
  40888. }
  40889. static getOperator(op) {
  40890. const opValue = PostScriptToken.opCache[op];
  40891. if (opValue) {
  40892. return opValue;
  40893. }
  40894. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  40895. }
  40896. static get LBRACE() {
  40897. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  40898. }
  40899. static get RBRACE() {
  40900. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  40901. }
  40902. static get IF() {
  40903. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  40904. }
  40905. static get IFELSE() {
  40906. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  40907. }
  40908. }
  40909. class PostScriptLexer {
  40910. constructor(stream) {
  40911. this.stream = stream;
  40912. this.nextChar();
  40913. this.strBuf = [];
  40914. }
  40915. nextChar() {
  40916. return this.currentChar = this.stream.getByte();
  40917. }
  40918. getToken() {
  40919. let comment = false;
  40920. let ch = this.currentChar;
  40921. while (true) {
  40922. if (ch < 0) {
  40923. return _primitives.EOF;
  40924. }
  40925. if (comment) {
  40926. if (ch === 0x0a || ch === 0x0d) {
  40927. comment = false;
  40928. }
  40929. } else if (ch === 0x25) {
  40930. comment = true;
  40931. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  40932. break;
  40933. }
  40934. ch = this.nextChar();
  40935. }
  40936. switch (ch | 0) {
  40937. case 0x30:
  40938. case 0x31:
  40939. case 0x32:
  40940. case 0x33:
  40941. case 0x34:
  40942. case 0x35:
  40943. case 0x36:
  40944. case 0x37:
  40945. case 0x38:
  40946. case 0x39:
  40947. case 0x2b:
  40948. case 0x2d:
  40949. case 0x2e:
  40950. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  40951. case 0x7b:
  40952. this.nextChar();
  40953. return PostScriptToken.LBRACE;
  40954. case 0x7d:
  40955. this.nextChar();
  40956. return PostScriptToken.RBRACE;
  40957. }
  40958. const strBuf = this.strBuf;
  40959. strBuf.length = 0;
  40960. strBuf[0] = String.fromCharCode(ch);
  40961. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  40962. strBuf.push(String.fromCharCode(ch));
  40963. }
  40964. const str = strBuf.join("");
  40965. switch (str.toLowerCase()) {
  40966. case "if":
  40967. return PostScriptToken.IF;
  40968. case "ifelse":
  40969. return PostScriptToken.IFELSE;
  40970. default:
  40971. return PostScriptToken.getOperator(str);
  40972. }
  40973. }
  40974. getNumber() {
  40975. let ch = this.currentChar;
  40976. const strBuf = this.strBuf;
  40977. strBuf.length = 0;
  40978. strBuf[0] = String.fromCharCode(ch);
  40979. while ((ch = this.nextChar()) >= 0) {
  40980. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  40981. strBuf.push(String.fromCharCode(ch));
  40982. } else {
  40983. break;
  40984. }
  40985. }
  40986. const value = parseFloat(strBuf.join(""));
  40987. if (isNaN(value)) {
  40988. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  40989. }
  40990. return value;
  40991. }
  40992. }
  40993. exports.PostScriptLexer = PostScriptLexer;
  40994. /***/ }),
  40995. /* 58 */
  40996. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  40997. Object.defineProperty(exports, "__esModule", ({
  40998. value: true
  40999. }));
  41000. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  41001. var _util = __w_pdfjs_require__(2);
  41002. var _primitives = __w_pdfjs_require__(5);
  41003. class BaseLocalCache {
  41004. constructor(options) {
  41005. if (this.constructor === BaseLocalCache) {
  41006. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  41007. }
  41008. this._onlyRefs = (options && options.onlyRefs) === true;
  41009. if (!this._onlyRefs) {
  41010. this._nameRefMap = new Map();
  41011. this._imageMap = new Map();
  41012. }
  41013. this._imageCache = new _primitives.RefSetCache();
  41014. }
  41015. getByName(name) {
  41016. if (this._onlyRefs) {
  41017. (0, _util.unreachable)("Should not call `getByName` method.");
  41018. }
  41019. const ref = this._nameRefMap.get(name);
  41020. if (ref) {
  41021. return this.getByRef(ref);
  41022. }
  41023. return this._imageMap.get(name) || null;
  41024. }
  41025. getByRef(ref) {
  41026. return this._imageCache.get(ref) || null;
  41027. }
  41028. set(name, ref, data) {
  41029. (0, _util.unreachable)("Abstract method `set` called.");
  41030. }
  41031. }
  41032. class LocalImageCache extends BaseLocalCache {
  41033. set(name, ref = null, data) {
  41034. if (typeof name !== "string") {
  41035. throw new Error('LocalImageCache.set - expected "name" argument.');
  41036. }
  41037. if (ref) {
  41038. if (this._imageCache.has(ref)) {
  41039. return;
  41040. }
  41041. this._nameRefMap.set(name, ref);
  41042. this._imageCache.put(ref, data);
  41043. return;
  41044. }
  41045. if (this._imageMap.has(name)) {
  41046. return;
  41047. }
  41048. this._imageMap.set(name, data);
  41049. }
  41050. }
  41051. exports.LocalImageCache = LocalImageCache;
  41052. class LocalColorSpaceCache extends BaseLocalCache {
  41053. set(name = null, ref = null, data) {
  41054. if (typeof name !== "string" && !ref) {
  41055. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  41056. }
  41057. if (ref) {
  41058. if (this._imageCache.has(ref)) {
  41059. return;
  41060. }
  41061. if (name !== null) {
  41062. this._nameRefMap.set(name, ref);
  41063. }
  41064. this._imageCache.put(ref, data);
  41065. return;
  41066. }
  41067. if (this._imageMap.has(name)) {
  41068. return;
  41069. }
  41070. this._imageMap.set(name, data);
  41071. }
  41072. }
  41073. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  41074. class LocalFunctionCache extends BaseLocalCache {
  41075. constructor(options) {
  41076. super({
  41077. onlyRefs: true
  41078. });
  41079. }
  41080. set(name = null, ref, data) {
  41081. if (!ref) {
  41082. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  41083. }
  41084. if (this._imageCache.has(ref)) {
  41085. return;
  41086. }
  41087. this._imageCache.put(ref, data);
  41088. }
  41089. }
  41090. exports.LocalFunctionCache = LocalFunctionCache;
  41091. class LocalGStateCache extends BaseLocalCache {
  41092. set(name, ref = null, data) {
  41093. if (typeof name !== "string") {
  41094. throw new Error('LocalGStateCache.set - expected "name" argument.');
  41095. }
  41096. if (ref) {
  41097. if (this._imageCache.has(ref)) {
  41098. return;
  41099. }
  41100. this._nameRefMap.set(name, ref);
  41101. this._imageCache.put(ref, data);
  41102. return;
  41103. }
  41104. if (this._imageMap.has(name)) {
  41105. return;
  41106. }
  41107. this._imageMap.set(name, data);
  41108. }
  41109. }
  41110. exports.LocalGStateCache = LocalGStateCache;
  41111. class LocalTilingPatternCache extends BaseLocalCache {
  41112. constructor(options) {
  41113. super({
  41114. onlyRefs: true
  41115. });
  41116. }
  41117. set(name = null, ref, data) {
  41118. if (!ref) {
  41119. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  41120. }
  41121. if (this._imageCache.has(ref)) {
  41122. return;
  41123. }
  41124. this._imageCache.put(ref, data);
  41125. }
  41126. }
  41127. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  41128. class GlobalImageCache {
  41129. static get NUM_PAGES_THRESHOLD() {
  41130. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  41131. }
  41132. static get MIN_IMAGES_TO_CACHE() {
  41133. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  41134. }
  41135. static get MAX_BYTE_SIZE() {
  41136. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  41137. }
  41138. constructor() {
  41139. this._refCache = new _primitives.RefSetCache();
  41140. this._imageCache = new _primitives.RefSetCache();
  41141. }
  41142. get _byteSize() {
  41143. let byteSize = 0;
  41144. this._imageCache.forEach(imageData => {
  41145. byteSize += imageData.byteSize;
  41146. });
  41147. return byteSize;
  41148. }
  41149. get _cacheLimitReached() {
  41150. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  41151. return false;
  41152. }
  41153. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  41154. return false;
  41155. }
  41156. return true;
  41157. }
  41158. shouldCache(ref, pageIndex) {
  41159. const pageIndexSet = this._refCache.get(ref);
  41160. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  41161. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  41162. return false;
  41163. }
  41164. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  41165. return false;
  41166. }
  41167. return true;
  41168. }
  41169. addPageIndex(ref, pageIndex) {
  41170. let pageIndexSet = this._refCache.get(ref);
  41171. if (!pageIndexSet) {
  41172. pageIndexSet = new Set();
  41173. this._refCache.put(ref, pageIndexSet);
  41174. }
  41175. pageIndexSet.add(pageIndex);
  41176. }
  41177. addByteSize(ref, byteSize) {
  41178. const imageData = this._imageCache.get(ref);
  41179. if (!imageData) {
  41180. return;
  41181. }
  41182. if (imageData.byteSize) {
  41183. return;
  41184. }
  41185. imageData.byteSize = byteSize;
  41186. }
  41187. getData(ref, pageIndex) {
  41188. const pageIndexSet = this._refCache.get(ref);
  41189. if (!pageIndexSet) {
  41190. return null;
  41191. }
  41192. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  41193. return null;
  41194. }
  41195. const imageData = this._imageCache.get(ref);
  41196. if (!imageData) {
  41197. return null;
  41198. }
  41199. pageIndexSet.add(pageIndex);
  41200. return imageData;
  41201. }
  41202. setData(ref, data) {
  41203. if (!this._refCache.has(ref)) {
  41204. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  41205. }
  41206. if (this._imageCache.has(ref)) {
  41207. return;
  41208. }
  41209. if (this._cacheLimitReached) {
  41210. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  41211. return;
  41212. }
  41213. this._imageCache.put(ref, data);
  41214. }
  41215. clear(onlyData = false) {
  41216. if (!onlyData) {
  41217. this._refCache.clear();
  41218. }
  41219. this._imageCache.clear();
  41220. }
  41221. }
  41222. exports.GlobalImageCache = GlobalImageCache;
  41223. /***/ }),
  41224. /* 59 */
  41225. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41226. Object.defineProperty(exports, "__esModule", ({
  41227. value: true
  41228. }));
  41229. exports.bidi = bidi;
  41230. var _util = __w_pdfjs_require__(2);
  41231. const 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"];
  41232. const 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"];
  41233. function isOdd(i) {
  41234. return (i & 1) !== 0;
  41235. }
  41236. function isEven(i) {
  41237. return (i & 1) === 0;
  41238. }
  41239. function findUnequal(arr, start, value) {
  41240. let j, jj;
  41241. for (j = start, jj = arr.length; j < jj; ++j) {
  41242. if (arr[j] !== value) {
  41243. return j;
  41244. }
  41245. }
  41246. return j;
  41247. }
  41248. function setValues(arr, start, end, value) {
  41249. for (let j = start; j < end; ++j) {
  41250. arr[j] = value;
  41251. }
  41252. }
  41253. function reverseValues(arr, start, end) {
  41254. for (let i = start, j = end - 1; i < j; ++i, --j) {
  41255. const temp = arr[i];
  41256. arr[i] = arr[j];
  41257. arr[j] = temp;
  41258. }
  41259. }
  41260. function createBidiText(str, isLTR, vertical = false) {
  41261. let dir = "ltr";
  41262. if (vertical) {
  41263. dir = "ttb";
  41264. } else if (!isLTR) {
  41265. dir = "rtl";
  41266. }
  41267. return {
  41268. str,
  41269. dir
  41270. };
  41271. }
  41272. const chars = [];
  41273. const types = [];
  41274. function bidi(str, startLevel = -1, vertical = false) {
  41275. let isLTR = true;
  41276. const strLength = str.length;
  41277. if (strLength === 0 || vertical) {
  41278. return createBidiText(str, isLTR, vertical);
  41279. }
  41280. chars.length = strLength;
  41281. types.length = strLength;
  41282. let numBidi = 0;
  41283. let i, ii;
  41284. for (i = 0; i < strLength; ++i) {
  41285. chars[i] = str.charAt(i);
  41286. const charCode = str.charCodeAt(i);
  41287. let charType = "L";
  41288. if (charCode <= 0x00ff) {
  41289. charType = baseTypes[charCode];
  41290. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  41291. charType = "R";
  41292. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  41293. charType = arabicTypes[charCode & 0xff];
  41294. if (!charType) {
  41295. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  41296. }
  41297. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  41298. charType = "AL";
  41299. }
  41300. if (charType === "R" || charType === "AL" || charType === "AN") {
  41301. numBidi++;
  41302. }
  41303. types[i] = charType;
  41304. }
  41305. if (numBidi === 0) {
  41306. isLTR = true;
  41307. return createBidiText(str, isLTR);
  41308. }
  41309. if (startLevel === -1) {
  41310. if (numBidi / strLength < 0.3) {
  41311. isLTR = true;
  41312. startLevel = 0;
  41313. } else {
  41314. isLTR = false;
  41315. startLevel = 1;
  41316. }
  41317. }
  41318. const levels = [];
  41319. for (i = 0; i < strLength; ++i) {
  41320. levels[i] = startLevel;
  41321. }
  41322. const e = isOdd(startLevel) ? "R" : "L";
  41323. const sor = e;
  41324. const eor = sor;
  41325. let lastType = sor;
  41326. for (i = 0; i < strLength; ++i) {
  41327. if (types[i] === "NSM") {
  41328. types[i] = lastType;
  41329. } else {
  41330. lastType = types[i];
  41331. }
  41332. }
  41333. lastType = sor;
  41334. let t;
  41335. for (i = 0; i < strLength; ++i) {
  41336. t = types[i];
  41337. if (t === "EN") {
  41338. types[i] = lastType === "AL" ? "AN" : "EN";
  41339. } else if (t === "R" || t === "L" || t === "AL") {
  41340. lastType = t;
  41341. }
  41342. }
  41343. for (i = 0; i < strLength; ++i) {
  41344. t = types[i];
  41345. if (t === "AL") {
  41346. types[i] = "R";
  41347. }
  41348. }
  41349. for (i = 1; i < strLength - 1; ++i) {
  41350. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  41351. types[i] = "EN";
  41352. }
  41353. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  41354. types[i] = types[i - 1];
  41355. }
  41356. }
  41357. for (i = 0; i < strLength; ++i) {
  41358. if (types[i] === "EN") {
  41359. for (let j = i - 1; j >= 0; --j) {
  41360. if (types[j] !== "ET") {
  41361. break;
  41362. }
  41363. types[j] = "EN";
  41364. }
  41365. for (let j = i + 1; j < strLength; ++j) {
  41366. if (types[j] !== "ET") {
  41367. break;
  41368. }
  41369. types[j] = "EN";
  41370. }
  41371. }
  41372. }
  41373. for (i = 0; i < strLength; ++i) {
  41374. t = types[i];
  41375. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  41376. types[i] = "ON";
  41377. }
  41378. }
  41379. lastType = sor;
  41380. for (i = 0; i < strLength; ++i) {
  41381. t = types[i];
  41382. if (t === "EN") {
  41383. types[i] = lastType === "L" ? "L" : "EN";
  41384. } else if (t === "R" || t === "L") {
  41385. lastType = t;
  41386. }
  41387. }
  41388. for (i = 0; i < strLength; ++i) {
  41389. if (types[i] === "ON") {
  41390. const end = findUnequal(types, i + 1, "ON");
  41391. let before = sor;
  41392. if (i > 0) {
  41393. before = types[i - 1];
  41394. }
  41395. let after = eor;
  41396. if (end + 1 < strLength) {
  41397. after = types[end + 1];
  41398. }
  41399. if (before !== "L") {
  41400. before = "R";
  41401. }
  41402. if (after !== "L") {
  41403. after = "R";
  41404. }
  41405. if (before === after) {
  41406. setValues(types, i, end, before);
  41407. }
  41408. i = end - 1;
  41409. }
  41410. }
  41411. for (i = 0; i < strLength; ++i) {
  41412. if (types[i] === "ON") {
  41413. types[i] = e;
  41414. }
  41415. }
  41416. for (i = 0; i < strLength; ++i) {
  41417. t = types[i];
  41418. if (isEven(levels[i])) {
  41419. if (t === "R") {
  41420. levels[i] += 1;
  41421. } else if (t === "AN" || t === "EN") {
  41422. levels[i] += 2;
  41423. }
  41424. } else {
  41425. if (t === "L" || t === "AN" || t === "EN") {
  41426. levels[i] += 1;
  41427. }
  41428. }
  41429. }
  41430. let highestLevel = -1;
  41431. let lowestOddLevel = 99;
  41432. let level;
  41433. for (i = 0, ii = levels.length; i < ii; ++i) {
  41434. level = levels[i];
  41435. if (highestLevel < level) {
  41436. highestLevel = level;
  41437. }
  41438. if (lowestOddLevel > level && isOdd(level)) {
  41439. lowestOddLevel = level;
  41440. }
  41441. }
  41442. for (level = highestLevel; level >= lowestOddLevel; --level) {
  41443. let start = -1;
  41444. for (i = 0, ii = levels.length; i < ii; ++i) {
  41445. if (levels[i] < level) {
  41446. if (start >= 0) {
  41447. reverseValues(chars, start, i);
  41448. start = -1;
  41449. }
  41450. } else if (start < 0) {
  41451. start = i;
  41452. }
  41453. }
  41454. if (start >= 0) {
  41455. reverseValues(chars, start, levels.length);
  41456. }
  41457. }
  41458. for (i = 0, ii = chars.length; i < ii; ++i) {
  41459. const ch = chars[i];
  41460. if (ch === "<" || ch === ">") {
  41461. chars[i] = "";
  41462. }
  41463. }
  41464. return createBidiText(chars.join(""), isLTR);
  41465. }
  41466. /***/ }),
  41467. /* 60 */
  41468. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41469. Object.defineProperty(exports, "__esModule", ({
  41470. value: true
  41471. }));
  41472. exports.getMetrics = void 0;
  41473. var _core_utils = __w_pdfjs_require__(9);
  41474. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41475. t.Courier = 600;
  41476. t["Courier-Bold"] = 600;
  41477. t["Courier-BoldOblique"] = 600;
  41478. t["Courier-Oblique"] = 600;
  41479. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  41480. t.space = 278;
  41481. t.exclam = 278;
  41482. t.quotedbl = 355;
  41483. t.numbersign = 556;
  41484. t.dollar = 556;
  41485. t.percent = 889;
  41486. t.ampersand = 667;
  41487. t.quoteright = 222;
  41488. t.parenleft = 333;
  41489. t.parenright = 333;
  41490. t.asterisk = 389;
  41491. t.plus = 584;
  41492. t.comma = 278;
  41493. t.hyphen = 333;
  41494. t.period = 278;
  41495. t.slash = 278;
  41496. t.zero = 556;
  41497. t.one = 556;
  41498. t.two = 556;
  41499. t.three = 556;
  41500. t.four = 556;
  41501. t.five = 556;
  41502. t.six = 556;
  41503. t.seven = 556;
  41504. t.eight = 556;
  41505. t.nine = 556;
  41506. t.colon = 278;
  41507. t.semicolon = 278;
  41508. t.less = 584;
  41509. t.equal = 584;
  41510. t.greater = 584;
  41511. t.question = 556;
  41512. t.at = 1015;
  41513. t.A = 667;
  41514. t.B = 667;
  41515. t.C = 722;
  41516. t.D = 722;
  41517. t.E = 667;
  41518. t.F = 611;
  41519. t.G = 778;
  41520. t.H = 722;
  41521. t.I = 278;
  41522. t.J = 500;
  41523. t.K = 667;
  41524. t.L = 556;
  41525. t.M = 833;
  41526. t.N = 722;
  41527. t.O = 778;
  41528. t.P = 667;
  41529. t.Q = 778;
  41530. t.R = 722;
  41531. t.S = 667;
  41532. t.T = 611;
  41533. t.U = 722;
  41534. t.V = 667;
  41535. t.W = 944;
  41536. t.X = 667;
  41537. t.Y = 667;
  41538. t.Z = 611;
  41539. t.bracketleft = 278;
  41540. t.backslash = 278;
  41541. t.bracketright = 278;
  41542. t.asciicircum = 469;
  41543. t.underscore = 556;
  41544. t.quoteleft = 222;
  41545. t.a = 556;
  41546. t.b = 556;
  41547. t.c = 500;
  41548. t.d = 556;
  41549. t.e = 556;
  41550. t.f = 278;
  41551. t.g = 556;
  41552. t.h = 556;
  41553. t.i = 222;
  41554. t.j = 222;
  41555. t.k = 500;
  41556. t.l = 222;
  41557. t.m = 833;
  41558. t.n = 556;
  41559. t.o = 556;
  41560. t.p = 556;
  41561. t.q = 556;
  41562. t.r = 333;
  41563. t.s = 500;
  41564. t.t = 278;
  41565. t.u = 556;
  41566. t.v = 500;
  41567. t.w = 722;
  41568. t.x = 500;
  41569. t.y = 500;
  41570. t.z = 500;
  41571. t.braceleft = 334;
  41572. t.bar = 260;
  41573. t.braceright = 334;
  41574. t.asciitilde = 584;
  41575. t.exclamdown = 333;
  41576. t.cent = 556;
  41577. t.sterling = 556;
  41578. t.fraction = 167;
  41579. t.yen = 556;
  41580. t.florin = 556;
  41581. t.section = 556;
  41582. t.currency = 556;
  41583. t.quotesingle = 191;
  41584. t.quotedblleft = 333;
  41585. t.guillemotleft = 556;
  41586. t.guilsinglleft = 333;
  41587. t.guilsinglright = 333;
  41588. t.fi = 500;
  41589. t.fl = 500;
  41590. t.endash = 556;
  41591. t.dagger = 556;
  41592. t.daggerdbl = 556;
  41593. t.periodcentered = 278;
  41594. t.paragraph = 537;
  41595. t.bullet = 350;
  41596. t.quotesinglbase = 222;
  41597. t.quotedblbase = 333;
  41598. t.quotedblright = 333;
  41599. t.guillemotright = 556;
  41600. t.ellipsis = 1000;
  41601. t.perthousand = 1000;
  41602. t.questiondown = 611;
  41603. t.grave = 333;
  41604. t.acute = 333;
  41605. t.circumflex = 333;
  41606. t.tilde = 333;
  41607. t.macron = 333;
  41608. t.breve = 333;
  41609. t.dotaccent = 333;
  41610. t.dieresis = 333;
  41611. t.ring = 333;
  41612. t.cedilla = 333;
  41613. t.hungarumlaut = 333;
  41614. t.ogonek = 333;
  41615. t.caron = 333;
  41616. t.emdash = 1000;
  41617. t.AE = 1000;
  41618. t.ordfeminine = 370;
  41619. t.Lslash = 556;
  41620. t.Oslash = 778;
  41621. t.OE = 1000;
  41622. t.ordmasculine = 365;
  41623. t.ae = 889;
  41624. t.dotlessi = 278;
  41625. t.lslash = 222;
  41626. t.oslash = 611;
  41627. t.oe = 944;
  41628. t.germandbls = 611;
  41629. t.Idieresis = 278;
  41630. t.eacute = 556;
  41631. t.abreve = 556;
  41632. t.uhungarumlaut = 556;
  41633. t.ecaron = 556;
  41634. t.Ydieresis = 667;
  41635. t.divide = 584;
  41636. t.Yacute = 667;
  41637. t.Acircumflex = 667;
  41638. t.aacute = 556;
  41639. t.Ucircumflex = 722;
  41640. t.yacute = 500;
  41641. t.scommaaccent = 500;
  41642. t.ecircumflex = 556;
  41643. t.Uring = 722;
  41644. t.Udieresis = 722;
  41645. t.aogonek = 556;
  41646. t.Uacute = 722;
  41647. t.uogonek = 556;
  41648. t.Edieresis = 667;
  41649. t.Dcroat = 722;
  41650. t.commaaccent = 250;
  41651. t.copyright = 737;
  41652. t.Emacron = 667;
  41653. t.ccaron = 500;
  41654. t.aring = 556;
  41655. t.Ncommaaccent = 722;
  41656. t.lacute = 222;
  41657. t.agrave = 556;
  41658. t.Tcommaaccent = 611;
  41659. t.Cacute = 722;
  41660. t.atilde = 556;
  41661. t.Edotaccent = 667;
  41662. t.scaron = 500;
  41663. t.scedilla = 500;
  41664. t.iacute = 278;
  41665. t.lozenge = 471;
  41666. t.Rcaron = 722;
  41667. t.Gcommaaccent = 778;
  41668. t.ucircumflex = 556;
  41669. t.acircumflex = 556;
  41670. t.Amacron = 667;
  41671. t.rcaron = 333;
  41672. t.ccedilla = 500;
  41673. t.Zdotaccent = 611;
  41674. t.Thorn = 667;
  41675. t.Omacron = 778;
  41676. t.Racute = 722;
  41677. t.Sacute = 667;
  41678. t.dcaron = 643;
  41679. t.Umacron = 722;
  41680. t.uring = 556;
  41681. t.threesuperior = 333;
  41682. t.Ograve = 778;
  41683. t.Agrave = 667;
  41684. t.Abreve = 667;
  41685. t.multiply = 584;
  41686. t.uacute = 556;
  41687. t.Tcaron = 611;
  41688. t.partialdiff = 476;
  41689. t.ydieresis = 500;
  41690. t.Nacute = 722;
  41691. t.icircumflex = 278;
  41692. t.Ecircumflex = 667;
  41693. t.adieresis = 556;
  41694. t.edieresis = 556;
  41695. t.cacute = 500;
  41696. t.nacute = 556;
  41697. t.umacron = 556;
  41698. t.Ncaron = 722;
  41699. t.Iacute = 278;
  41700. t.plusminus = 584;
  41701. t.brokenbar = 260;
  41702. t.registered = 737;
  41703. t.Gbreve = 778;
  41704. t.Idotaccent = 278;
  41705. t.summation = 600;
  41706. t.Egrave = 667;
  41707. t.racute = 333;
  41708. t.omacron = 556;
  41709. t.Zacute = 611;
  41710. t.Zcaron = 611;
  41711. t.greaterequal = 549;
  41712. t.Eth = 722;
  41713. t.Ccedilla = 722;
  41714. t.lcommaaccent = 222;
  41715. t.tcaron = 317;
  41716. t.eogonek = 556;
  41717. t.Uogonek = 722;
  41718. t.Aacute = 667;
  41719. t.Adieresis = 667;
  41720. t.egrave = 556;
  41721. t.zacute = 500;
  41722. t.iogonek = 222;
  41723. t.Oacute = 778;
  41724. t.oacute = 556;
  41725. t.amacron = 556;
  41726. t.sacute = 500;
  41727. t.idieresis = 278;
  41728. t.Ocircumflex = 778;
  41729. t.Ugrave = 722;
  41730. t.Delta = 612;
  41731. t.thorn = 556;
  41732. t.twosuperior = 333;
  41733. t.Odieresis = 778;
  41734. t.mu = 556;
  41735. t.igrave = 278;
  41736. t.ohungarumlaut = 556;
  41737. t.Eogonek = 667;
  41738. t.dcroat = 556;
  41739. t.threequarters = 834;
  41740. t.Scedilla = 667;
  41741. t.lcaron = 299;
  41742. t.Kcommaaccent = 667;
  41743. t.Lacute = 556;
  41744. t.trademark = 1000;
  41745. t.edotaccent = 556;
  41746. t.Igrave = 278;
  41747. t.Imacron = 278;
  41748. t.Lcaron = 556;
  41749. t.onehalf = 834;
  41750. t.lessequal = 549;
  41751. t.ocircumflex = 556;
  41752. t.ntilde = 556;
  41753. t.Uhungarumlaut = 722;
  41754. t.Eacute = 667;
  41755. t.emacron = 556;
  41756. t.gbreve = 556;
  41757. t.onequarter = 834;
  41758. t.Scaron = 667;
  41759. t.Scommaaccent = 667;
  41760. t.Ohungarumlaut = 778;
  41761. t.degree = 400;
  41762. t.ograve = 556;
  41763. t.Ccaron = 722;
  41764. t.ugrave = 556;
  41765. t.radical = 453;
  41766. t.Dcaron = 722;
  41767. t.rcommaaccent = 333;
  41768. t.Ntilde = 722;
  41769. t.otilde = 556;
  41770. t.Rcommaaccent = 722;
  41771. t.Lcommaaccent = 556;
  41772. t.Atilde = 667;
  41773. t.Aogonek = 667;
  41774. t.Aring = 667;
  41775. t.Otilde = 778;
  41776. t.zdotaccent = 500;
  41777. t.Ecaron = 667;
  41778. t.Iogonek = 278;
  41779. t.kcommaaccent = 500;
  41780. t.minus = 584;
  41781. t.Icircumflex = 278;
  41782. t.ncaron = 556;
  41783. t.tcommaaccent = 278;
  41784. t.logicalnot = 584;
  41785. t.odieresis = 556;
  41786. t.udieresis = 556;
  41787. t.notequal = 549;
  41788. t.gcommaaccent = 556;
  41789. t.eth = 556;
  41790. t.zcaron = 500;
  41791. t.ncommaaccent = 556;
  41792. t.onesuperior = 333;
  41793. t.imacron = 278;
  41794. t.Euro = 556;
  41795. });
  41796. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  41797. t.space = 278;
  41798. t.exclam = 333;
  41799. t.quotedbl = 474;
  41800. t.numbersign = 556;
  41801. t.dollar = 556;
  41802. t.percent = 889;
  41803. t.ampersand = 722;
  41804. t.quoteright = 278;
  41805. t.parenleft = 333;
  41806. t.parenright = 333;
  41807. t.asterisk = 389;
  41808. t.plus = 584;
  41809. t.comma = 278;
  41810. t.hyphen = 333;
  41811. t.period = 278;
  41812. t.slash = 278;
  41813. t.zero = 556;
  41814. t.one = 556;
  41815. t.two = 556;
  41816. t.three = 556;
  41817. t.four = 556;
  41818. t.five = 556;
  41819. t.six = 556;
  41820. t.seven = 556;
  41821. t.eight = 556;
  41822. t.nine = 556;
  41823. t.colon = 333;
  41824. t.semicolon = 333;
  41825. t.less = 584;
  41826. t.equal = 584;
  41827. t.greater = 584;
  41828. t.question = 611;
  41829. t.at = 975;
  41830. t.A = 722;
  41831. t.B = 722;
  41832. t.C = 722;
  41833. t.D = 722;
  41834. t.E = 667;
  41835. t.F = 611;
  41836. t.G = 778;
  41837. t.H = 722;
  41838. t.I = 278;
  41839. t.J = 556;
  41840. t.K = 722;
  41841. t.L = 611;
  41842. t.M = 833;
  41843. t.N = 722;
  41844. t.O = 778;
  41845. t.P = 667;
  41846. t.Q = 778;
  41847. t.R = 722;
  41848. t.S = 667;
  41849. t.T = 611;
  41850. t.U = 722;
  41851. t.V = 667;
  41852. t.W = 944;
  41853. t.X = 667;
  41854. t.Y = 667;
  41855. t.Z = 611;
  41856. t.bracketleft = 333;
  41857. t.backslash = 278;
  41858. t.bracketright = 333;
  41859. t.asciicircum = 584;
  41860. t.underscore = 556;
  41861. t.quoteleft = 278;
  41862. t.a = 556;
  41863. t.b = 611;
  41864. t.c = 556;
  41865. t.d = 611;
  41866. t.e = 556;
  41867. t.f = 333;
  41868. t.g = 611;
  41869. t.h = 611;
  41870. t.i = 278;
  41871. t.j = 278;
  41872. t.k = 556;
  41873. t.l = 278;
  41874. t.m = 889;
  41875. t.n = 611;
  41876. t.o = 611;
  41877. t.p = 611;
  41878. t.q = 611;
  41879. t.r = 389;
  41880. t.s = 556;
  41881. t.t = 333;
  41882. t.u = 611;
  41883. t.v = 556;
  41884. t.w = 778;
  41885. t.x = 556;
  41886. t.y = 556;
  41887. t.z = 500;
  41888. t.braceleft = 389;
  41889. t.bar = 280;
  41890. t.braceright = 389;
  41891. t.asciitilde = 584;
  41892. t.exclamdown = 333;
  41893. t.cent = 556;
  41894. t.sterling = 556;
  41895. t.fraction = 167;
  41896. t.yen = 556;
  41897. t.florin = 556;
  41898. t.section = 556;
  41899. t.currency = 556;
  41900. t.quotesingle = 238;
  41901. t.quotedblleft = 500;
  41902. t.guillemotleft = 556;
  41903. t.guilsinglleft = 333;
  41904. t.guilsinglright = 333;
  41905. t.fi = 611;
  41906. t.fl = 611;
  41907. t.endash = 556;
  41908. t.dagger = 556;
  41909. t.daggerdbl = 556;
  41910. t.periodcentered = 278;
  41911. t.paragraph = 556;
  41912. t.bullet = 350;
  41913. t.quotesinglbase = 278;
  41914. t.quotedblbase = 500;
  41915. t.quotedblright = 500;
  41916. t.guillemotright = 556;
  41917. t.ellipsis = 1000;
  41918. t.perthousand = 1000;
  41919. t.questiondown = 611;
  41920. t.grave = 333;
  41921. t.acute = 333;
  41922. t.circumflex = 333;
  41923. t.tilde = 333;
  41924. t.macron = 333;
  41925. t.breve = 333;
  41926. t.dotaccent = 333;
  41927. t.dieresis = 333;
  41928. t.ring = 333;
  41929. t.cedilla = 333;
  41930. t.hungarumlaut = 333;
  41931. t.ogonek = 333;
  41932. t.caron = 333;
  41933. t.emdash = 1000;
  41934. t.AE = 1000;
  41935. t.ordfeminine = 370;
  41936. t.Lslash = 611;
  41937. t.Oslash = 778;
  41938. t.OE = 1000;
  41939. t.ordmasculine = 365;
  41940. t.ae = 889;
  41941. t.dotlessi = 278;
  41942. t.lslash = 278;
  41943. t.oslash = 611;
  41944. t.oe = 944;
  41945. t.germandbls = 611;
  41946. t.Idieresis = 278;
  41947. t.eacute = 556;
  41948. t.abreve = 556;
  41949. t.uhungarumlaut = 611;
  41950. t.ecaron = 556;
  41951. t.Ydieresis = 667;
  41952. t.divide = 584;
  41953. t.Yacute = 667;
  41954. t.Acircumflex = 722;
  41955. t.aacute = 556;
  41956. t.Ucircumflex = 722;
  41957. t.yacute = 556;
  41958. t.scommaaccent = 556;
  41959. t.ecircumflex = 556;
  41960. t.Uring = 722;
  41961. t.Udieresis = 722;
  41962. t.aogonek = 556;
  41963. t.Uacute = 722;
  41964. t.uogonek = 611;
  41965. t.Edieresis = 667;
  41966. t.Dcroat = 722;
  41967. t.commaaccent = 250;
  41968. t.copyright = 737;
  41969. t.Emacron = 667;
  41970. t.ccaron = 556;
  41971. t.aring = 556;
  41972. t.Ncommaaccent = 722;
  41973. t.lacute = 278;
  41974. t.agrave = 556;
  41975. t.Tcommaaccent = 611;
  41976. t.Cacute = 722;
  41977. t.atilde = 556;
  41978. t.Edotaccent = 667;
  41979. t.scaron = 556;
  41980. t.scedilla = 556;
  41981. t.iacute = 278;
  41982. t.lozenge = 494;
  41983. t.Rcaron = 722;
  41984. t.Gcommaaccent = 778;
  41985. t.ucircumflex = 611;
  41986. t.acircumflex = 556;
  41987. t.Amacron = 722;
  41988. t.rcaron = 389;
  41989. t.ccedilla = 556;
  41990. t.Zdotaccent = 611;
  41991. t.Thorn = 667;
  41992. t.Omacron = 778;
  41993. t.Racute = 722;
  41994. t.Sacute = 667;
  41995. t.dcaron = 743;
  41996. t.Umacron = 722;
  41997. t.uring = 611;
  41998. t.threesuperior = 333;
  41999. t.Ograve = 778;
  42000. t.Agrave = 722;
  42001. t.Abreve = 722;
  42002. t.multiply = 584;
  42003. t.uacute = 611;
  42004. t.Tcaron = 611;
  42005. t.partialdiff = 494;
  42006. t.ydieresis = 556;
  42007. t.Nacute = 722;
  42008. t.icircumflex = 278;
  42009. t.Ecircumflex = 667;
  42010. t.adieresis = 556;
  42011. t.edieresis = 556;
  42012. t.cacute = 556;
  42013. t.nacute = 611;
  42014. t.umacron = 611;
  42015. t.Ncaron = 722;
  42016. t.Iacute = 278;
  42017. t.plusminus = 584;
  42018. t.brokenbar = 280;
  42019. t.registered = 737;
  42020. t.Gbreve = 778;
  42021. t.Idotaccent = 278;
  42022. t.summation = 600;
  42023. t.Egrave = 667;
  42024. t.racute = 389;
  42025. t.omacron = 611;
  42026. t.Zacute = 611;
  42027. t.Zcaron = 611;
  42028. t.greaterequal = 549;
  42029. t.Eth = 722;
  42030. t.Ccedilla = 722;
  42031. t.lcommaaccent = 278;
  42032. t.tcaron = 389;
  42033. t.eogonek = 556;
  42034. t.Uogonek = 722;
  42035. t.Aacute = 722;
  42036. t.Adieresis = 722;
  42037. t.egrave = 556;
  42038. t.zacute = 500;
  42039. t.iogonek = 278;
  42040. t.Oacute = 778;
  42041. t.oacute = 611;
  42042. t.amacron = 556;
  42043. t.sacute = 556;
  42044. t.idieresis = 278;
  42045. t.Ocircumflex = 778;
  42046. t.Ugrave = 722;
  42047. t.Delta = 612;
  42048. t.thorn = 611;
  42049. t.twosuperior = 333;
  42050. t.Odieresis = 778;
  42051. t.mu = 611;
  42052. t.igrave = 278;
  42053. t.ohungarumlaut = 611;
  42054. t.Eogonek = 667;
  42055. t.dcroat = 611;
  42056. t.threequarters = 834;
  42057. t.Scedilla = 667;
  42058. t.lcaron = 400;
  42059. t.Kcommaaccent = 722;
  42060. t.Lacute = 611;
  42061. t.trademark = 1000;
  42062. t.edotaccent = 556;
  42063. t.Igrave = 278;
  42064. t.Imacron = 278;
  42065. t.Lcaron = 611;
  42066. t.onehalf = 834;
  42067. t.lessequal = 549;
  42068. t.ocircumflex = 611;
  42069. t.ntilde = 611;
  42070. t.Uhungarumlaut = 722;
  42071. t.Eacute = 667;
  42072. t.emacron = 556;
  42073. t.gbreve = 611;
  42074. t.onequarter = 834;
  42075. t.Scaron = 667;
  42076. t.Scommaaccent = 667;
  42077. t.Ohungarumlaut = 778;
  42078. t.degree = 400;
  42079. t.ograve = 611;
  42080. t.Ccaron = 722;
  42081. t.ugrave = 611;
  42082. t.radical = 549;
  42083. t.Dcaron = 722;
  42084. t.rcommaaccent = 389;
  42085. t.Ntilde = 722;
  42086. t.otilde = 611;
  42087. t.Rcommaaccent = 722;
  42088. t.Lcommaaccent = 611;
  42089. t.Atilde = 722;
  42090. t.Aogonek = 722;
  42091. t.Aring = 722;
  42092. t.Otilde = 778;
  42093. t.zdotaccent = 500;
  42094. t.Ecaron = 667;
  42095. t.Iogonek = 278;
  42096. t.kcommaaccent = 556;
  42097. t.minus = 584;
  42098. t.Icircumflex = 278;
  42099. t.ncaron = 611;
  42100. t.tcommaaccent = 333;
  42101. t.logicalnot = 584;
  42102. t.odieresis = 611;
  42103. t.udieresis = 611;
  42104. t.notequal = 549;
  42105. t.gcommaaccent = 611;
  42106. t.eth = 611;
  42107. t.zcaron = 500;
  42108. t.ncommaaccent = 611;
  42109. t.onesuperior = 333;
  42110. t.imacron = 278;
  42111. t.Euro = 556;
  42112. });
  42113. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42114. t.space = 278;
  42115. t.exclam = 333;
  42116. t.quotedbl = 474;
  42117. t.numbersign = 556;
  42118. t.dollar = 556;
  42119. t.percent = 889;
  42120. t.ampersand = 722;
  42121. t.quoteright = 278;
  42122. t.parenleft = 333;
  42123. t.parenright = 333;
  42124. t.asterisk = 389;
  42125. t.plus = 584;
  42126. t.comma = 278;
  42127. t.hyphen = 333;
  42128. t.period = 278;
  42129. t.slash = 278;
  42130. t.zero = 556;
  42131. t.one = 556;
  42132. t.two = 556;
  42133. t.three = 556;
  42134. t.four = 556;
  42135. t.five = 556;
  42136. t.six = 556;
  42137. t.seven = 556;
  42138. t.eight = 556;
  42139. t.nine = 556;
  42140. t.colon = 333;
  42141. t.semicolon = 333;
  42142. t.less = 584;
  42143. t.equal = 584;
  42144. t.greater = 584;
  42145. t.question = 611;
  42146. t.at = 975;
  42147. t.A = 722;
  42148. t.B = 722;
  42149. t.C = 722;
  42150. t.D = 722;
  42151. t.E = 667;
  42152. t.F = 611;
  42153. t.G = 778;
  42154. t.H = 722;
  42155. t.I = 278;
  42156. t.J = 556;
  42157. t.K = 722;
  42158. t.L = 611;
  42159. t.M = 833;
  42160. t.N = 722;
  42161. t.O = 778;
  42162. t.P = 667;
  42163. t.Q = 778;
  42164. t.R = 722;
  42165. t.S = 667;
  42166. t.T = 611;
  42167. t.U = 722;
  42168. t.V = 667;
  42169. t.W = 944;
  42170. t.X = 667;
  42171. t.Y = 667;
  42172. t.Z = 611;
  42173. t.bracketleft = 333;
  42174. t.backslash = 278;
  42175. t.bracketright = 333;
  42176. t.asciicircum = 584;
  42177. t.underscore = 556;
  42178. t.quoteleft = 278;
  42179. t.a = 556;
  42180. t.b = 611;
  42181. t.c = 556;
  42182. t.d = 611;
  42183. t.e = 556;
  42184. t.f = 333;
  42185. t.g = 611;
  42186. t.h = 611;
  42187. t.i = 278;
  42188. t.j = 278;
  42189. t.k = 556;
  42190. t.l = 278;
  42191. t.m = 889;
  42192. t.n = 611;
  42193. t.o = 611;
  42194. t.p = 611;
  42195. t.q = 611;
  42196. t.r = 389;
  42197. t.s = 556;
  42198. t.t = 333;
  42199. t.u = 611;
  42200. t.v = 556;
  42201. t.w = 778;
  42202. t.x = 556;
  42203. t.y = 556;
  42204. t.z = 500;
  42205. t.braceleft = 389;
  42206. t.bar = 280;
  42207. t.braceright = 389;
  42208. t.asciitilde = 584;
  42209. t.exclamdown = 333;
  42210. t.cent = 556;
  42211. t.sterling = 556;
  42212. t.fraction = 167;
  42213. t.yen = 556;
  42214. t.florin = 556;
  42215. t.section = 556;
  42216. t.currency = 556;
  42217. t.quotesingle = 238;
  42218. t.quotedblleft = 500;
  42219. t.guillemotleft = 556;
  42220. t.guilsinglleft = 333;
  42221. t.guilsinglright = 333;
  42222. t.fi = 611;
  42223. t.fl = 611;
  42224. t.endash = 556;
  42225. t.dagger = 556;
  42226. t.daggerdbl = 556;
  42227. t.periodcentered = 278;
  42228. t.paragraph = 556;
  42229. t.bullet = 350;
  42230. t.quotesinglbase = 278;
  42231. t.quotedblbase = 500;
  42232. t.quotedblright = 500;
  42233. t.guillemotright = 556;
  42234. t.ellipsis = 1000;
  42235. t.perthousand = 1000;
  42236. t.questiondown = 611;
  42237. t.grave = 333;
  42238. t.acute = 333;
  42239. t.circumflex = 333;
  42240. t.tilde = 333;
  42241. t.macron = 333;
  42242. t.breve = 333;
  42243. t.dotaccent = 333;
  42244. t.dieresis = 333;
  42245. t.ring = 333;
  42246. t.cedilla = 333;
  42247. t.hungarumlaut = 333;
  42248. t.ogonek = 333;
  42249. t.caron = 333;
  42250. t.emdash = 1000;
  42251. t.AE = 1000;
  42252. t.ordfeminine = 370;
  42253. t.Lslash = 611;
  42254. t.Oslash = 778;
  42255. t.OE = 1000;
  42256. t.ordmasculine = 365;
  42257. t.ae = 889;
  42258. t.dotlessi = 278;
  42259. t.lslash = 278;
  42260. t.oslash = 611;
  42261. t.oe = 944;
  42262. t.germandbls = 611;
  42263. t.Idieresis = 278;
  42264. t.eacute = 556;
  42265. t.abreve = 556;
  42266. t.uhungarumlaut = 611;
  42267. t.ecaron = 556;
  42268. t.Ydieresis = 667;
  42269. t.divide = 584;
  42270. t.Yacute = 667;
  42271. t.Acircumflex = 722;
  42272. t.aacute = 556;
  42273. t.Ucircumflex = 722;
  42274. t.yacute = 556;
  42275. t.scommaaccent = 556;
  42276. t.ecircumflex = 556;
  42277. t.Uring = 722;
  42278. t.Udieresis = 722;
  42279. t.aogonek = 556;
  42280. t.Uacute = 722;
  42281. t.uogonek = 611;
  42282. t.Edieresis = 667;
  42283. t.Dcroat = 722;
  42284. t.commaaccent = 250;
  42285. t.copyright = 737;
  42286. t.Emacron = 667;
  42287. t.ccaron = 556;
  42288. t.aring = 556;
  42289. t.Ncommaaccent = 722;
  42290. t.lacute = 278;
  42291. t.agrave = 556;
  42292. t.Tcommaaccent = 611;
  42293. t.Cacute = 722;
  42294. t.atilde = 556;
  42295. t.Edotaccent = 667;
  42296. t.scaron = 556;
  42297. t.scedilla = 556;
  42298. t.iacute = 278;
  42299. t.lozenge = 494;
  42300. t.Rcaron = 722;
  42301. t.Gcommaaccent = 778;
  42302. t.ucircumflex = 611;
  42303. t.acircumflex = 556;
  42304. t.Amacron = 722;
  42305. t.rcaron = 389;
  42306. t.ccedilla = 556;
  42307. t.Zdotaccent = 611;
  42308. t.Thorn = 667;
  42309. t.Omacron = 778;
  42310. t.Racute = 722;
  42311. t.Sacute = 667;
  42312. t.dcaron = 743;
  42313. t.Umacron = 722;
  42314. t.uring = 611;
  42315. t.threesuperior = 333;
  42316. t.Ograve = 778;
  42317. t.Agrave = 722;
  42318. t.Abreve = 722;
  42319. t.multiply = 584;
  42320. t.uacute = 611;
  42321. t.Tcaron = 611;
  42322. t.partialdiff = 494;
  42323. t.ydieresis = 556;
  42324. t.Nacute = 722;
  42325. t.icircumflex = 278;
  42326. t.Ecircumflex = 667;
  42327. t.adieresis = 556;
  42328. t.edieresis = 556;
  42329. t.cacute = 556;
  42330. t.nacute = 611;
  42331. t.umacron = 611;
  42332. t.Ncaron = 722;
  42333. t.Iacute = 278;
  42334. t.plusminus = 584;
  42335. t.brokenbar = 280;
  42336. t.registered = 737;
  42337. t.Gbreve = 778;
  42338. t.Idotaccent = 278;
  42339. t.summation = 600;
  42340. t.Egrave = 667;
  42341. t.racute = 389;
  42342. t.omacron = 611;
  42343. t.Zacute = 611;
  42344. t.Zcaron = 611;
  42345. t.greaterequal = 549;
  42346. t.Eth = 722;
  42347. t.Ccedilla = 722;
  42348. t.lcommaaccent = 278;
  42349. t.tcaron = 389;
  42350. t.eogonek = 556;
  42351. t.Uogonek = 722;
  42352. t.Aacute = 722;
  42353. t.Adieresis = 722;
  42354. t.egrave = 556;
  42355. t.zacute = 500;
  42356. t.iogonek = 278;
  42357. t.Oacute = 778;
  42358. t.oacute = 611;
  42359. t.amacron = 556;
  42360. t.sacute = 556;
  42361. t.idieresis = 278;
  42362. t.Ocircumflex = 778;
  42363. t.Ugrave = 722;
  42364. t.Delta = 612;
  42365. t.thorn = 611;
  42366. t.twosuperior = 333;
  42367. t.Odieresis = 778;
  42368. t.mu = 611;
  42369. t.igrave = 278;
  42370. t.ohungarumlaut = 611;
  42371. t.Eogonek = 667;
  42372. t.dcroat = 611;
  42373. t.threequarters = 834;
  42374. t.Scedilla = 667;
  42375. t.lcaron = 400;
  42376. t.Kcommaaccent = 722;
  42377. t.Lacute = 611;
  42378. t.trademark = 1000;
  42379. t.edotaccent = 556;
  42380. t.Igrave = 278;
  42381. t.Imacron = 278;
  42382. t.Lcaron = 611;
  42383. t.onehalf = 834;
  42384. t.lessequal = 549;
  42385. t.ocircumflex = 611;
  42386. t.ntilde = 611;
  42387. t.Uhungarumlaut = 722;
  42388. t.Eacute = 667;
  42389. t.emacron = 556;
  42390. t.gbreve = 611;
  42391. t.onequarter = 834;
  42392. t.Scaron = 667;
  42393. t.Scommaaccent = 667;
  42394. t.Ohungarumlaut = 778;
  42395. t.degree = 400;
  42396. t.ograve = 611;
  42397. t.Ccaron = 722;
  42398. t.ugrave = 611;
  42399. t.radical = 549;
  42400. t.Dcaron = 722;
  42401. t.rcommaaccent = 389;
  42402. t.Ntilde = 722;
  42403. t.otilde = 611;
  42404. t.Rcommaaccent = 722;
  42405. t.Lcommaaccent = 611;
  42406. t.Atilde = 722;
  42407. t.Aogonek = 722;
  42408. t.Aring = 722;
  42409. t.Otilde = 778;
  42410. t.zdotaccent = 500;
  42411. t.Ecaron = 667;
  42412. t.Iogonek = 278;
  42413. t.kcommaaccent = 556;
  42414. t.minus = 584;
  42415. t.Icircumflex = 278;
  42416. t.ncaron = 611;
  42417. t.tcommaaccent = 333;
  42418. t.logicalnot = 584;
  42419. t.odieresis = 611;
  42420. t.udieresis = 611;
  42421. t.notequal = 549;
  42422. t.gcommaaccent = 611;
  42423. t.eth = 611;
  42424. t.zcaron = 500;
  42425. t.ncommaaccent = 611;
  42426. t.onesuperior = 333;
  42427. t.imacron = 278;
  42428. t.Euro = 556;
  42429. });
  42430. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42431. t.space = 278;
  42432. t.exclam = 278;
  42433. t.quotedbl = 355;
  42434. t.numbersign = 556;
  42435. t.dollar = 556;
  42436. t.percent = 889;
  42437. t.ampersand = 667;
  42438. t.quoteright = 222;
  42439. t.parenleft = 333;
  42440. t.parenright = 333;
  42441. t.asterisk = 389;
  42442. t.plus = 584;
  42443. t.comma = 278;
  42444. t.hyphen = 333;
  42445. t.period = 278;
  42446. t.slash = 278;
  42447. t.zero = 556;
  42448. t.one = 556;
  42449. t.two = 556;
  42450. t.three = 556;
  42451. t.four = 556;
  42452. t.five = 556;
  42453. t.six = 556;
  42454. t.seven = 556;
  42455. t.eight = 556;
  42456. t.nine = 556;
  42457. t.colon = 278;
  42458. t.semicolon = 278;
  42459. t.less = 584;
  42460. t.equal = 584;
  42461. t.greater = 584;
  42462. t.question = 556;
  42463. t.at = 1015;
  42464. t.A = 667;
  42465. t.B = 667;
  42466. t.C = 722;
  42467. t.D = 722;
  42468. t.E = 667;
  42469. t.F = 611;
  42470. t.G = 778;
  42471. t.H = 722;
  42472. t.I = 278;
  42473. t.J = 500;
  42474. t.K = 667;
  42475. t.L = 556;
  42476. t.M = 833;
  42477. t.N = 722;
  42478. t.O = 778;
  42479. t.P = 667;
  42480. t.Q = 778;
  42481. t.R = 722;
  42482. t.S = 667;
  42483. t.T = 611;
  42484. t.U = 722;
  42485. t.V = 667;
  42486. t.W = 944;
  42487. t.X = 667;
  42488. t.Y = 667;
  42489. t.Z = 611;
  42490. t.bracketleft = 278;
  42491. t.backslash = 278;
  42492. t.bracketright = 278;
  42493. t.asciicircum = 469;
  42494. t.underscore = 556;
  42495. t.quoteleft = 222;
  42496. t.a = 556;
  42497. t.b = 556;
  42498. t.c = 500;
  42499. t.d = 556;
  42500. t.e = 556;
  42501. t.f = 278;
  42502. t.g = 556;
  42503. t.h = 556;
  42504. t.i = 222;
  42505. t.j = 222;
  42506. t.k = 500;
  42507. t.l = 222;
  42508. t.m = 833;
  42509. t.n = 556;
  42510. t.o = 556;
  42511. t.p = 556;
  42512. t.q = 556;
  42513. t.r = 333;
  42514. t.s = 500;
  42515. t.t = 278;
  42516. t.u = 556;
  42517. t.v = 500;
  42518. t.w = 722;
  42519. t.x = 500;
  42520. t.y = 500;
  42521. t.z = 500;
  42522. t.braceleft = 334;
  42523. t.bar = 260;
  42524. t.braceright = 334;
  42525. t.asciitilde = 584;
  42526. t.exclamdown = 333;
  42527. t.cent = 556;
  42528. t.sterling = 556;
  42529. t.fraction = 167;
  42530. t.yen = 556;
  42531. t.florin = 556;
  42532. t.section = 556;
  42533. t.currency = 556;
  42534. t.quotesingle = 191;
  42535. t.quotedblleft = 333;
  42536. t.guillemotleft = 556;
  42537. t.guilsinglleft = 333;
  42538. t.guilsinglright = 333;
  42539. t.fi = 500;
  42540. t.fl = 500;
  42541. t.endash = 556;
  42542. t.dagger = 556;
  42543. t.daggerdbl = 556;
  42544. t.periodcentered = 278;
  42545. t.paragraph = 537;
  42546. t.bullet = 350;
  42547. t.quotesinglbase = 222;
  42548. t.quotedblbase = 333;
  42549. t.quotedblright = 333;
  42550. t.guillemotright = 556;
  42551. t.ellipsis = 1000;
  42552. t.perthousand = 1000;
  42553. t.questiondown = 611;
  42554. t.grave = 333;
  42555. t.acute = 333;
  42556. t.circumflex = 333;
  42557. t.tilde = 333;
  42558. t.macron = 333;
  42559. t.breve = 333;
  42560. t.dotaccent = 333;
  42561. t.dieresis = 333;
  42562. t.ring = 333;
  42563. t.cedilla = 333;
  42564. t.hungarumlaut = 333;
  42565. t.ogonek = 333;
  42566. t.caron = 333;
  42567. t.emdash = 1000;
  42568. t.AE = 1000;
  42569. t.ordfeminine = 370;
  42570. t.Lslash = 556;
  42571. t.Oslash = 778;
  42572. t.OE = 1000;
  42573. t.ordmasculine = 365;
  42574. t.ae = 889;
  42575. t.dotlessi = 278;
  42576. t.lslash = 222;
  42577. t.oslash = 611;
  42578. t.oe = 944;
  42579. t.germandbls = 611;
  42580. t.Idieresis = 278;
  42581. t.eacute = 556;
  42582. t.abreve = 556;
  42583. t.uhungarumlaut = 556;
  42584. t.ecaron = 556;
  42585. t.Ydieresis = 667;
  42586. t.divide = 584;
  42587. t.Yacute = 667;
  42588. t.Acircumflex = 667;
  42589. t.aacute = 556;
  42590. t.Ucircumflex = 722;
  42591. t.yacute = 500;
  42592. t.scommaaccent = 500;
  42593. t.ecircumflex = 556;
  42594. t.Uring = 722;
  42595. t.Udieresis = 722;
  42596. t.aogonek = 556;
  42597. t.Uacute = 722;
  42598. t.uogonek = 556;
  42599. t.Edieresis = 667;
  42600. t.Dcroat = 722;
  42601. t.commaaccent = 250;
  42602. t.copyright = 737;
  42603. t.Emacron = 667;
  42604. t.ccaron = 500;
  42605. t.aring = 556;
  42606. t.Ncommaaccent = 722;
  42607. t.lacute = 222;
  42608. t.agrave = 556;
  42609. t.Tcommaaccent = 611;
  42610. t.Cacute = 722;
  42611. t.atilde = 556;
  42612. t.Edotaccent = 667;
  42613. t.scaron = 500;
  42614. t.scedilla = 500;
  42615. t.iacute = 278;
  42616. t.lozenge = 471;
  42617. t.Rcaron = 722;
  42618. t.Gcommaaccent = 778;
  42619. t.ucircumflex = 556;
  42620. t.acircumflex = 556;
  42621. t.Amacron = 667;
  42622. t.rcaron = 333;
  42623. t.ccedilla = 500;
  42624. t.Zdotaccent = 611;
  42625. t.Thorn = 667;
  42626. t.Omacron = 778;
  42627. t.Racute = 722;
  42628. t.Sacute = 667;
  42629. t.dcaron = 643;
  42630. t.Umacron = 722;
  42631. t.uring = 556;
  42632. t.threesuperior = 333;
  42633. t.Ograve = 778;
  42634. t.Agrave = 667;
  42635. t.Abreve = 667;
  42636. t.multiply = 584;
  42637. t.uacute = 556;
  42638. t.Tcaron = 611;
  42639. t.partialdiff = 476;
  42640. t.ydieresis = 500;
  42641. t.Nacute = 722;
  42642. t.icircumflex = 278;
  42643. t.Ecircumflex = 667;
  42644. t.adieresis = 556;
  42645. t.edieresis = 556;
  42646. t.cacute = 500;
  42647. t.nacute = 556;
  42648. t.umacron = 556;
  42649. t.Ncaron = 722;
  42650. t.Iacute = 278;
  42651. t.plusminus = 584;
  42652. t.brokenbar = 260;
  42653. t.registered = 737;
  42654. t.Gbreve = 778;
  42655. t.Idotaccent = 278;
  42656. t.summation = 600;
  42657. t.Egrave = 667;
  42658. t.racute = 333;
  42659. t.omacron = 556;
  42660. t.Zacute = 611;
  42661. t.Zcaron = 611;
  42662. t.greaterequal = 549;
  42663. t.Eth = 722;
  42664. t.Ccedilla = 722;
  42665. t.lcommaaccent = 222;
  42666. t.tcaron = 317;
  42667. t.eogonek = 556;
  42668. t.Uogonek = 722;
  42669. t.Aacute = 667;
  42670. t.Adieresis = 667;
  42671. t.egrave = 556;
  42672. t.zacute = 500;
  42673. t.iogonek = 222;
  42674. t.Oacute = 778;
  42675. t.oacute = 556;
  42676. t.amacron = 556;
  42677. t.sacute = 500;
  42678. t.idieresis = 278;
  42679. t.Ocircumflex = 778;
  42680. t.Ugrave = 722;
  42681. t.Delta = 612;
  42682. t.thorn = 556;
  42683. t.twosuperior = 333;
  42684. t.Odieresis = 778;
  42685. t.mu = 556;
  42686. t.igrave = 278;
  42687. t.ohungarumlaut = 556;
  42688. t.Eogonek = 667;
  42689. t.dcroat = 556;
  42690. t.threequarters = 834;
  42691. t.Scedilla = 667;
  42692. t.lcaron = 299;
  42693. t.Kcommaaccent = 667;
  42694. t.Lacute = 556;
  42695. t.trademark = 1000;
  42696. t.edotaccent = 556;
  42697. t.Igrave = 278;
  42698. t.Imacron = 278;
  42699. t.Lcaron = 556;
  42700. t.onehalf = 834;
  42701. t.lessequal = 549;
  42702. t.ocircumflex = 556;
  42703. t.ntilde = 556;
  42704. t.Uhungarumlaut = 722;
  42705. t.Eacute = 667;
  42706. t.emacron = 556;
  42707. t.gbreve = 556;
  42708. t.onequarter = 834;
  42709. t.Scaron = 667;
  42710. t.Scommaaccent = 667;
  42711. t.Ohungarumlaut = 778;
  42712. t.degree = 400;
  42713. t.ograve = 556;
  42714. t.Ccaron = 722;
  42715. t.ugrave = 556;
  42716. t.radical = 453;
  42717. t.Dcaron = 722;
  42718. t.rcommaaccent = 333;
  42719. t.Ntilde = 722;
  42720. t.otilde = 556;
  42721. t.Rcommaaccent = 722;
  42722. t.Lcommaaccent = 556;
  42723. t.Atilde = 667;
  42724. t.Aogonek = 667;
  42725. t.Aring = 667;
  42726. t.Otilde = 778;
  42727. t.zdotaccent = 500;
  42728. t.Ecaron = 667;
  42729. t.Iogonek = 278;
  42730. t.kcommaaccent = 500;
  42731. t.minus = 584;
  42732. t.Icircumflex = 278;
  42733. t.ncaron = 556;
  42734. t.tcommaaccent = 278;
  42735. t.logicalnot = 584;
  42736. t.odieresis = 556;
  42737. t.udieresis = 556;
  42738. t.notequal = 549;
  42739. t.gcommaaccent = 556;
  42740. t.eth = 556;
  42741. t.zcaron = 500;
  42742. t.ncommaaccent = 556;
  42743. t.onesuperior = 333;
  42744. t.imacron = 278;
  42745. t.Euro = 556;
  42746. });
  42747. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  42748. t.space = 250;
  42749. t.exclam = 333;
  42750. t.universal = 713;
  42751. t.numbersign = 500;
  42752. t.existential = 549;
  42753. t.percent = 833;
  42754. t.ampersand = 778;
  42755. t.suchthat = 439;
  42756. t.parenleft = 333;
  42757. t.parenright = 333;
  42758. t.asteriskmath = 500;
  42759. t.plus = 549;
  42760. t.comma = 250;
  42761. t.minus = 549;
  42762. t.period = 250;
  42763. t.slash = 278;
  42764. t.zero = 500;
  42765. t.one = 500;
  42766. t.two = 500;
  42767. t.three = 500;
  42768. t.four = 500;
  42769. t.five = 500;
  42770. t.six = 500;
  42771. t.seven = 500;
  42772. t.eight = 500;
  42773. t.nine = 500;
  42774. t.colon = 278;
  42775. t.semicolon = 278;
  42776. t.less = 549;
  42777. t.equal = 549;
  42778. t.greater = 549;
  42779. t.question = 444;
  42780. t.congruent = 549;
  42781. t.Alpha = 722;
  42782. t.Beta = 667;
  42783. t.Chi = 722;
  42784. t.Delta = 612;
  42785. t.Epsilon = 611;
  42786. t.Phi = 763;
  42787. t.Gamma = 603;
  42788. t.Eta = 722;
  42789. t.Iota = 333;
  42790. t.theta1 = 631;
  42791. t.Kappa = 722;
  42792. t.Lambda = 686;
  42793. t.Mu = 889;
  42794. t.Nu = 722;
  42795. t.Omicron = 722;
  42796. t.Pi = 768;
  42797. t.Theta = 741;
  42798. t.Rho = 556;
  42799. t.Sigma = 592;
  42800. t.Tau = 611;
  42801. t.Upsilon = 690;
  42802. t.sigma1 = 439;
  42803. t.Omega = 768;
  42804. t.Xi = 645;
  42805. t.Psi = 795;
  42806. t.Zeta = 611;
  42807. t.bracketleft = 333;
  42808. t.therefore = 863;
  42809. t.bracketright = 333;
  42810. t.perpendicular = 658;
  42811. t.underscore = 500;
  42812. t.radicalex = 500;
  42813. t.alpha = 631;
  42814. t.beta = 549;
  42815. t.chi = 549;
  42816. t.delta = 494;
  42817. t.epsilon = 439;
  42818. t.phi = 521;
  42819. t.gamma = 411;
  42820. t.eta = 603;
  42821. t.iota = 329;
  42822. t.phi1 = 603;
  42823. t.kappa = 549;
  42824. t.lambda = 549;
  42825. t.mu = 576;
  42826. t.nu = 521;
  42827. t.omicron = 549;
  42828. t.pi = 549;
  42829. t.theta = 521;
  42830. t.rho = 549;
  42831. t.sigma = 603;
  42832. t.tau = 439;
  42833. t.upsilon = 576;
  42834. t.omega1 = 713;
  42835. t.omega = 686;
  42836. t.xi = 493;
  42837. t.psi = 686;
  42838. t.zeta = 494;
  42839. t.braceleft = 480;
  42840. t.bar = 200;
  42841. t.braceright = 480;
  42842. t.similar = 549;
  42843. t.Euro = 750;
  42844. t.Upsilon1 = 620;
  42845. t.minute = 247;
  42846. t.lessequal = 549;
  42847. t.fraction = 167;
  42848. t.infinity = 713;
  42849. t.florin = 500;
  42850. t.club = 753;
  42851. t.diamond = 753;
  42852. t.heart = 753;
  42853. t.spade = 753;
  42854. t.arrowboth = 1042;
  42855. t.arrowleft = 987;
  42856. t.arrowup = 603;
  42857. t.arrowright = 987;
  42858. t.arrowdown = 603;
  42859. t.degree = 400;
  42860. t.plusminus = 549;
  42861. t.second = 411;
  42862. t.greaterequal = 549;
  42863. t.multiply = 549;
  42864. t.proportional = 713;
  42865. t.partialdiff = 494;
  42866. t.bullet = 460;
  42867. t.divide = 549;
  42868. t.notequal = 549;
  42869. t.equivalence = 549;
  42870. t.approxequal = 549;
  42871. t.ellipsis = 1000;
  42872. t.arrowvertex = 603;
  42873. t.arrowhorizex = 1000;
  42874. t.carriagereturn = 658;
  42875. t.aleph = 823;
  42876. t.Ifraktur = 686;
  42877. t.Rfraktur = 795;
  42878. t.weierstrass = 987;
  42879. t.circlemultiply = 768;
  42880. t.circleplus = 768;
  42881. t.emptyset = 823;
  42882. t.intersection = 768;
  42883. t.union = 768;
  42884. t.propersuperset = 713;
  42885. t.reflexsuperset = 713;
  42886. t.notsubset = 713;
  42887. t.propersubset = 713;
  42888. t.reflexsubset = 713;
  42889. t.element = 713;
  42890. t.notelement = 713;
  42891. t.angle = 768;
  42892. t.gradient = 713;
  42893. t.registerserif = 790;
  42894. t.copyrightserif = 790;
  42895. t.trademarkserif = 890;
  42896. t.product = 823;
  42897. t.radical = 549;
  42898. t.dotmath = 250;
  42899. t.logicalnot = 713;
  42900. t.logicaland = 603;
  42901. t.logicalor = 603;
  42902. t.arrowdblboth = 1042;
  42903. t.arrowdblleft = 987;
  42904. t.arrowdblup = 603;
  42905. t.arrowdblright = 987;
  42906. t.arrowdbldown = 603;
  42907. t.lozenge = 494;
  42908. t.angleleft = 329;
  42909. t.registersans = 790;
  42910. t.copyrightsans = 790;
  42911. t.trademarksans = 786;
  42912. t.summation = 713;
  42913. t.parenlefttp = 384;
  42914. t.parenleftex = 384;
  42915. t.parenleftbt = 384;
  42916. t.bracketlefttp = 384;
  42917. t.bracketleftex = 384;
  42918. t.bracketleftbt = 384;
  42919. t.bracelefttp = 494;
  42920. t.braceleftmid = 494;
  42921. t.braceleftbt = 494;
  42922. t.braceex = 494;
  42923. t.angleright = 329;
  42924. t.integral = 274;
  42925. t.integraltp = 686;
  42926. t.integralex = 686;
  42927. t.integralbt = 686;
  42928. t.parenrighttp = 384;
  42929. t.parenrightex = 384;
  42930. t.parenrightbt = 384;
  42931. t.bracketrighttp = 384;
  42932. t.bracketrightex = 384;
  42933. t.bracketrightbt = 384;
  42934. t.bracerighttp = 494;
  42935. t.bracerightmid = 494;
  42936. t.bracerightbt = 494;
  42937. t.apple = 790;
  42938. });
  42939. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  42940. t.space = 250;
  42941. t.exclam = 333;
  42942. t.quotedbl = 408;
  42943. t.numbersign = 500;
  42944. t.dollar = 500;
  42945. t.percent = 833;
  42946. t.ampersand = 778;
  42947. t.quoteright = 333;
  42948. t.parenleft = 333;
  42949. t.parenright = 333;
  42950. t.asterisk = 500;
  42951. t.plus = 564;
  42952. t.comma = 250;
  42953. t.hyphen = 333;
  42954. t.period = 250;
  42955. t.slash = 278;
  42956. t.zero = 500;
  42957. t.one = 500;
  42958. t.two = 500;
  42959. t.three = 500;
  42960. t.four = 500;
  42961. t.five = 500;
  42962. t.six = 500;
  42963. t.seven = 500;
  42964. t.eight = 500;
  42965. t.nine = 500;
  42966. t.colon = 278;
  42967. t.semicolon = 278;
  42968. t.less = 564;
  42969. t.equal = 564;
  42970. t.greater = 564;
  42971. t.question = 444;
  42972. t.at = 921;
  42973. t.A = 722;
  42974. t.B = 667;
  42975. t.C = 667;
  42976. t.D = 722;
  42977. t.E = 611;
  42978. t.F = 556;
  42979. t.G = 722;
  42980. t.H = 722;
  42981. t.I = 333;
  42982. t.J = 389;
  42983. t.K = 722;
  42984. t.L = 611;
  42985. t.M = 889;
  42986. t.N = 722;
  42987. t.O = 722;
  42988. t.P = 556;
  42989. t.Q = 722;
  42990. t.R = 667;
  42991. t.S = 556;
  42992. t.T = 611;
  42993. t.U = 722;
  42994. t.V = 722;
  42995. t.W = 944;
  42996. t.X = 722;
  42997. t.Y = 722;
  42998. t.Z = 611;
  42999. t.bracketleft = 333;
  43000. t.backslash = 278;
  43001. t.bracketright = 333;
  43002. t.asciicircum = 469;
  43003. t.underscore = 500;
  43004. t.quoteleft = 333;
  43005. t.a = 444;
  43006. t.b = 500;
  43007. t.c = 444;
  43008. t.d = 500;
  43009. t.e = 444;
  43010. t.f = 333;
  43011. t.g = 500;
  43012. t.h = 500;
  43013. t.i = 278;
  43014. t.j = 278;
  43015. t.k = 500;
  43016. t.l = 278;
  43017. t.m = 778;
  43018. t.n = 500;
  43019. t.o = 500;
  43020. t.p = 500;
  43021. t.q = 500;
  43022. t.r = 333;
  43023. t.s = 389;
  43024. t.t = 278;
  43025. t.u = 500;
  43026. t.v = 500;
  43027. t.w = 722;
  43028. t.x = 500;
  43029. t.y = 500;
  43030. t.z = 444;
  43031. t.braceleft = 480;
  43032. t.bar = 200;
  43033. t.braceright = 480;
  43034. t.asciitilde = 541;
  43035. t.exclamdown = 333;
  43036. t.cent = 500;
  43037. t.sterling = 500;
  43038. t.fraction = 167;
  43039. t.yen = 500;
  43040. t.florin = 500;
  43041. t.section = 500;
  43042. t.currency = 500;
  43043. t.quotesingle = 180;
  43044. t.quotedblleft = 444;
  43045. t.guillemotleft = 500;
  43046. t.guilsinglleft = 333;
  43047. t.guilsinglright = 333;
  43048. t.fi = 556;
  43049. t.fl = 556;
  43050. t.endash = 500;
  43051. t.dagger = 500;
  43052. t.daggerdbl = 500;
  43053. t.periodcentered = 250;
  43054. t.paragraph = 453;
  43055. t.bullet = 350;
  43056. t.quotesinglbase = 333;
  43057. t.quotedblbase = 444;
  43058. t.quotedblright = 444;
  43059. t.guillemotright = 500;
  43060. t.ellipsis = 1000;
  43061. t.perthousand = 1000;
  43062. t.questiondown = 444;
  43063. t.grave = 333;
  43064. t.acute = 333;
  43065. t.circumflex = 333;
  43066. t.tilde = 333;
  43067. t.macron = 333;
  43068. t.breve = 333;
  43069. t.dotaccent = 333;
  43070. t.dieresis = 333;
  43071. t.ring = 333;
  43072. t.cedilla = 333;
  43073. t.hungarumlaut = 333;
  43074. t.ogonek = 333;
  43075. t.caron = 333;
  43076. t.emdash = 1000;
  43077. t.AE = 889;
  43078. t.ordfeminine = 276;
  43079. t.Lslash = 611;
  43080. t.Oslash = 722;
  43081. t.OE = 889;
  43082. t.ordmasculine = 310;
  43083. t.ae = 667;
  43084. t.dotlessi = 278;
  43085. t.lslash = 278;
  43086. t.oslash = 500;
  43087. t.oe = 722;
  43088. t.germandbls = 500;
  43089. t.Idieresis = 333;
  43090. t.eacute = 444;
  43091. t.abreve = 444;
  43092. t.uhungarumlaut = 500;
  43093. t.ecaron = 444;
  43094. t.Ydieresis = 722;
  43095. t.divide = 564;
  43096. t.Yacute = 722;
  43097. t.Acircumflex = 722;
  43098. t.aacute = 444;
  43099. t.Ucircumflex = 722;
  43100. t.yacute = 500;
  43101. t.scommaaccent = 389;
  43102. t.ecircumflex = 444;
  43103. t.Uring = 722;
  43104. t.Udieresis = 722;
  43105. t.aogonek = 444;
  43106. t.Uacute = 722;
  43107. t.uogonek = 500;
  43108. t.Edieresis = 611;
  43109. t.Dcroat = 722;
  43110. t.commaaccent = 250;
  43111. t.copyright = 760;
  43112. t.Emacron = 611;
  43113. t.ccaron = 444;
  43114. t.aring = 444;
  43115. t.Ncommaaccent = 722;
  43116. t.lacute = 278;
  43117. t.agrave = 444;
  43118. t.Tcommaaccent = 611;
  43119. t.Cacute = 667;
  43120. t.atilde = 444;
  43121. t.Edotaccent = 611;
  43122. t.scaron = 389;
  43123. t.scedilla = 389;
  43124. t.iacute = 278;
  43125. t.lozenge = 471;
  43126. t.Rcaron = 667;
  43127. t.Gcommaaccent = 722;
  43128. t.ucircumflex = 500;
  43129. t.acircumflex = 444;
  43130. t.Amacron = 722;
  43131. t.rcaron = 333;
  43132. t.ccedilla = 444;
  43133. t.Zdotaccent = 611;
  43134. t.Thorn = 556;
  43135. t.Omacron = 722;
  43136. t.Racute = 667;
  43137. t.Sacute = 556;
  43138. t.dcaron = 588;
  43139. t.Umacron = 722;
  43140. t.uring = 500;
  43141. t.threesuperior = 300;
  43142. t.Ograve = 722;
  43143. t.Agrave = 722;
  43144. t.Abreve = 722;
  43145. t.multiply = 564;
  43146. t.uacute = 500;
  43147. t.Tcaron = 611;
  43148. t.partialdiff = 476;
  43149. t.ydieresis = 500;
  43150. t.Nacute = 722;
  43151. t.icircumflex = 278;
  43152. t.Ecircumflex = 611;
  43153. t.adieresis = 444;
  43154. t.edieresis = 444;
  43155. t.cacute = 444;
  43156. t.nacute = 500;
  43157. t.umacron = 500;
  43158. t.Ncaron = 722;
  43159. t.Iacute = 333;
  43160. t.plusminus = 564;
  43161. t.brokenbar = 200;
  43162. t.registered = 760;
  43163. t.Gbreve = 722;
  43164. t.Idotaccent = 333;
  43165. t.summation = 600;
  43166. t.Egrave = 611;
  43167. t.racute = 333;
  43168. t.omacron = 500;
  43169. t.Zacute = 611;
  43170. t.Zcaron = 611;
  43171. t.greaterequal = 549;
  43172. t.Eth = 722;
  43173. t.Ccedilla = 667;
  43174. t.lcommaaccent = 278;
  43175. t.tcaron = 326;
  43176. t.eogonek = 444;
  43177. t.Uogonek = 722;
  43178. t.Aacute = 722;
  43179. t.Adieresis = 722;
  43180. t.egrave = 444;
  43181. t.zacute = 444;
  43182. t.iogonek = 278;
  43183. t.Oacute = 722;
  43184. t.oacute = 500;
  43185. t.amacron = 444;
  43186. t.sacute = 389;
  43187. t.idieresis = 278;
  43188. t.Ocircumflex = 722;
  43189. t.Ugrave = 722;
  43190. t.Delta = 612;
  43191. t.thorn = 500;
  43192. t.twosuperior = 300;
  43193. t.Odieresis = 722;
  43194. t.mu = 500;
  43195. t.igrave = 278;
  43196. t.ohungarumlaut = 500;
  43197. t.Eogonek = 611;
  43198. t.dcroat = 500;
  43199. t.threequarters = 750;
  43200. t.Scedilla = 556;
  43201. t.lcaron = 344;
  43202. t.Kcommaaccent = 722;
  43203. t.Lacute = 611;
  43204. t.trademark = 980;
  43205. t.edotaccent = 444;
  43206. t.Igrave = 333;
  43207. t.Imacron = 333;
  43208. t.Lcaron = 611;
  43209. t.onehalf = 750;
  43210. t.lessequal = 549;
  43211. t.ocircumflex = 500;
  43212. t.ntilde = 500;
  43213. t.Uhungarumlaut = 722;
  43214. t.Eacute = 611;
  43215. t.emacron = 444;
  43216. t.gbreve = 500;
  43217. t.onequarter = 750;
  43218. t.Scaron = 556;
  43219. t.Scommaaccent = 556;
  43220. t.Ohungarumlaut = 722;
  43221. t.degree = 400;
  43222. t.ograve = 500;
  43223. t.Ccaron = 667;
  43224. t.ugrave = 500;
  43225. t.radical = 453;
  43226. t.Dcaron = 722;
  43227. t.rcommaaccent = 333;
  43228. t.Ntilde = 722;
  43229. t.otilde = 500;
  43230. t.Rcommaaccent = 667;
  43231. t.Lcommaaccent = 611;
  43232. t.Atilde = 722;
  43233. t.Aogonek = 722;
  43234. t.Aring = 722;
  43235. t.Otilde = 722;
  43236. t.zdotaccent = 444;
  43237. t.Ecaron = 611;
  43238. t.Iogonek = 333;
  43239. t.kcommaaccent = 500;
  43240. t.minus = 564;
  43241. t.Icircumflex = 333;
  43242. t.ncaron = 500;
  43243. t.tcommaaccent = 278;
  43244. t.logicalnot = 564;
  43245. t.odieresis = 500;
  43246. t.udieresis = 500;
  43247. t.notequal = 549;
  43248. t.gcommaaccent = 500;
  43249. t.eth = 500;
  43250. t.zcaron = 444;
  43251. t.ncommaaccent = 500;
  43252. t.onesuperior = 300;
  43253. t.imacron = 278;
  43254. t.Euro = 500;
  43255. });
  43256. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43257. t.space = 250;
  43258. t.exclam = 333;
  43259. t.quotedbl = 555;
  43260. t.numbersign = 500;
  43261. t.dollar = 500;
  43262. t.percent = 1000;
  43263. t.ampersand = 833;
  43264. t.quoteright = 333;
  43265. t.parenleft = 333;
  43266. t.parenright = 333;
  43267. t.asterisk = 500;
  43268. t.plus = 570;
  43269. t.comma = 250;
  43270. t.hyphen = 333;
  43271. t.period = 250;
  43272. t.slash = 278;
  43273. t.zero = 500;
  43274. t.one = 500;
  43275. t.two = 500;
  43276. t.three = 500;
  43277. t.four = 500;
  43278. t.five = 500;
  43279. t.six = 500;
  43280. t.seven = 500;
  43281. t.eight = 500;
  43282. t.nine = 500;
  43283. t.colon = 333;
  43284. t.semicolon = 333;
  43285. t.less = 570;
  43286. t.equal = 570;
  43287. t.greater = 570;
  43288. t.question = 500;
  43289. t.at = 930;
  43290. t.A = 722;
  43291. t.B = 667;
  43292. t.C = 722;
  43293. t.D = 722;
  43294. t.E = 667;
  43295. t.F = 611;
  43296. t.G = 778;
  43297. t.H = 778;
  43298. t.I = 389;
  43299. t.J = 500;
  43300. t.K = 778;
  43301. t.L = 667;
  43302. t.M = 944;
  43303. t.N = 722;
  43304. t.O = 778;
  43305. t.P = 611;
  43306. t.Q = 778;
  43307. t.R = 722;
  43308. t.S = 556;
  43309. t.T = 667;
  43310. t.U = 722;
  43311. t.V = 722;
  43312. t.W = 1000;
  43313. t.X = 722;
  43314. t.Y = 722;
  43315. t.Z = 667;
  43316. t.bracketleft = 333;
  43317. t.backslash = 278;
  43318. t.bracketright = 333;
  43319. t.asciicircum = 581;
  43320. t.underscore = 500;
  43321. t.quoteleft = 333;
  43322. t.a = 500;
  43323. t.b = 556;
  43324. t.c = 444;
  43325. t.d = 556;
  43326. t.e = 444;
  43327. t.f = 333;
  43328. t.g = 500;
  43329. t.h = 556;
  43330. t.i = 278;
  43331. t.j = 333;
  43332. t.k = 556;
  43333. t.l = 278;
  43334. t.m = 833;
  43335. t.n = 556;
  43336. t.o = 500;
  43337. t.p = 556;
  43338. t.q = 556;
  43339. t.r = 444;
  43340. t.s = 389;
  43341. t.t = 333;
  43342. t.u = 556;
  43343. t.v = 500;
  43344. t.w = 722;
  43345. t.x = 500;
  43346. t.y = 500;
  43347. t.z = 444;
  43348. t.braceleft = 394;
  43349. t.bar = 220;
  43350. t.braceright = 394;
  43351. t.asciitilde = 520;
  43352. t.exclamdown = 333;
  43353. t.cent = 500;
  43354. t.sterling = 500;
  43355. t.fraction = 167;
  43356. t.yen = 500;
  43357. t.florin = 500;
  43358. t.section = 500;
  43359. t.currency = 500;
  43360. t.quotesingle = 278;
  43361. t.quotedblleft = 500;
  43362. t.guillemotleft = 500;
  43363. t.guilsinglleft = 333;
  43364. t.guilsinglright = 333;
  43365. t.fi = 556;
  43366. t.fl = 556;
  43367. t.endash = 500;
  43368. t.dagger = 500;
  43369. t.daggerdbl = 500;
  43370. t.periodcentered = 250;
  43371. t.paragraph = 540;
  43372. t.bullet = 350;
  43373. t.quotesinglbase = 333;
  43374. t.quotedblbase = 500;
  43375. t.quotedblright = 500;
  43376. t.guillemotright = 500;
  43377. t.ellipsis = 1000;
  43378. t.perthousand = 1000;
  43379. t.questiondown = 500;
  43380. t.grave = 333;
  43381. t.acute = 333;
  43382. t.circumflex = 333;
  43383. t.tilde = 333;
  43384. t.macron = 333;
  43385. t.breve = 333;
  43386. t.dotaccent = 333;
  43387. t.dieresis = 333;
  43388. t.ring = 333;
  43389. t.cedilla = 333;
  43390. t.hungarumlaut = 333;
  43391. t.ogonek = 333;
  43392. t.caron = 333;
  43393. t.emdash = 1000;
  43394. t.AE = 1000;
  43395. t.ordfeminine = 300;
  43396. t.Lslash = 667;
  43397. t.Oslash = 778;
  43398. t.OE = 1000;
  43399. t.ordmasculine = 330;
  43400. t.ae = 722;
  43401. t.dotlessi = 278;
  43402. t.lslash = 278;
  43403. t.oslash = 500;
  43404. t.oe = 722;
  43405. t.germandbls = 556;
  43406. t.Idieresis = 389;
  43407. t.eacute = 444;
  43408. t.abreve = 500;
  43409. t.uhungarumlaut = 556;
  43410. t.ecaron = 444;
  43411. t.Ydieresis = 722;
  43412. t.divide = 570;
  43413. t.Yacute = 722;
  43414. t.Acircumflex = 722;
  43415. t.aacute = 500;
  43416. t.Ucircumflex = 722;
  43417. t.yacute = 500;
  43418. t.scommaaccent = 389;
  43419. t.ecircumflex = 444;
  43420. t.Uring = 722;
  43421. t.Udieresis = 722;
  43422. t.aogonek = 500;
  43423. t.Uacute = 722;
  43424. t.uogonek = 556;
  43425. t.Edieresis = 667;
  43426. t.Dcroat = 722;
  43427. t.commaaccent = 250;
  43428. t.copyright = 747;
  43429. t.Emacron = 667;
  43430. t.ccaron = 444;
  43431. t.aring = 500;
  43432. t.Ncommaaccent = 722;
  43433. t.lacute = 278;
  43434. t.agrave = 500;
  43435. t.Tcommaaccent = 667;
  43436. t.Cacute = 722;
  43437. t.atilde = 500;
  43438. t.Edotaccent = 667;
  43439. t.scaron = 389;
  43440. t.scedilla = 389;
  43441. t.iacute = 278;
  43442. t.lozenge = 494;
  43443. t.Rcaron = 722;
  43444. t.Gcommaaccent = 778;
  43445. t.ucircumflex = 556;
  43446. t.acircumflex = 500;
  43447. t.Amacron = 722;
  43448. t.rcaron = 444;
  43449. t.ccedilla = 444;
  43450. t.Zdotaccent = 667;
  43451. t.Thorn = 611;
  43452. t.Omacron = 778;
  43453. t.Racute = 722;
  43454. t.Sacute = 556;
  43455. t.dcaron = 672;
  43456. t.Umacron = 722;
  43457. t.uring = 556;
  43458. t.threesuperior = 300;
  43459. t.Ograve = 778;
  43460. t.Agrave = 722;
  43461. t.Abreve = 722;
  43462. t.multiply = 570;
  43463. t.uacute = 556;
  43464. t.Tcaron = 667;
  43465. t.partialdiff = 494;
  43466. t.ydieresis = 500;
  43467. t.Nacute = 722;
  43468. t.icircumflex = 278;
  43469. t.Ecircumflex = 667;
  43470. t.adieresis = 500;
  43471. t.edieresis = 444;
  43472. t.cacute = 444;
  43473. t.nacute = 556;
  43474. t.umacron = 556;
  43475. t.Ncaron = 722;
  43476. t.Iacute = 389;
  43477. t.plusminus = 570;
  43478. t.brokenbar = 220;
  43479. t.registered = 747;
  43480. t.Gbreve = 778;
  43481. t.Idotaccent = 389;
  43482. t.summation = 600;
  43483. t.Egrave = 667;
  43484. t.racute = 444;
  43485. t.omacron = 500;
  43486. t.Zacute = 667;
  43487. t.Zcaron = 667;
  43488. t.greaterequal = 549;
  43489. t.Eth = 722;
  43490. t.Ccedilla = 722;
  43491. t.lcommaaccent = 278;
  43492. t.tcaron = 416;
  43493. t.eogonek = 444;
  43494. t.Uogonek = 722;
  43495. t.Aacute = 722;
  43496. t.Adieresis = 722;
  43497. t.egrave = 444;
  43498. t.zacute = 444;
  43499. t.iogonek = 278;
  43500. t.Oacute = 778;
  43501. t.oacute = 500;
  43502. t.amacron = 500;
  43503. t.sacute = 389;
  43504. t.idieresis = 278;
  43505. t.Ocircumflex = 778;
  43506. t.Ugrave = 722;
  43507. t.Delta = 612;
  43508. t.thorn = 556;
  43509. t.twosuperior = 300;
  43510. t.Odieresis = 778;
  43511. t.mu = 556;
  43512. t.igrave = 278;
  43513. t.ohungarumlaut = 500;
  43514. t.Eogonek = 667;
  43515. t.dcroat = 556;
  43516. t.threequarters = 750;
  43517. t.Scedilla = 556;
  43518. t.lcaron = 394;
  43519. t.Kcommaaccent = 778;
  43520. t.Lacute = 667;
  43521. t.trademark = 1000;
  43522. t.edotaccent = 444;
  43523. t.Igrave = 389;
  43524. t.Imacron = 389;
  43525. t.Lcaron = 667;
  43526. t.onehalf = 750;
  43527. t.lessequal = 549;
  43528. t.ocircumflex = 500;
  43529. t.ntilde = 556;
  43530. t.Uhungarumlaut = 722;
  43531. t.Eacute = 667;
  43532. t.emacron = 444;
  43533. t.gbreve = 500;
  43534. t.onequarter = 750;
  43535. t.Scaron = 556;
  43536. t.Scommaaccent = 556;
  43537. t.Ohungarumlaut = 778;
  43538. t.degree = 400;
  43539. t.ograve = 500;
  43540. t.Ccaron = 722;
  43541. t.ugrave = 556;
  43542. t.radical = 549;
  43543. t.Dcaron = 722;
  43544. t.rcommaaccent = 444;
  43545. t.Ntilde = 722;
  43546. t.otilde = 500;
  43547. t.Rcommaaccent = 722;
  43548. t.Lcommaaccent = 667;
  43549. t.Atilde = 722;
  43550. t.Aogonek = 722;
  43551. t.Aring = 722;
  43552. t.Otilde = 778;
  43553. t.zdotaccent = 444;
  43554. t.Ecaron = 667;
  43555. t.Iogonek = 389;
  43556. t.kcommaaccent = 556;
  43557. t.minus = 570;
  43558. t.Icircumflex = 389;
  43559. t.ncaron = 556;
  43560. t.tcommaaccent = 333;
  43561. t.logicalnot = 570;
  43562. t.odieresis = 500;
  43563. t.udieresis = 556;
  43564. t.notequal = 549;
  43565. t.gcommaaccent = 500;
  43566. t.eth = 500;
  43567. t.zcaron = 444;
  43568. t.ncommaaccent = 556;
  43569. t.onesuperior = 300;
  43570. t.imacron = 278;
  43571. t.Euro = 500;
  43572. });
  43573. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43574. t.space = 250;
  43575. t.exclam = 389;
  43576. t.quotedbl = 555;
  43577. t.numbersign = 500;
  43578. t.dollar = 500;
  43579. t.percent = 833;
  43580. t.ampersand = 778;
  43581. t.quoteright = 333;
  43582. t.parenleft = 333;
  43583. t.parenright = 333;
  43584. t.asterisk = 500;
  43585. t.plus = 570;
  43586. t.comma = 250;
  43587. t.hyphen = 333;
  43588. t.period = 250;
  43589. t.slash = 278;
  43590. t.zero = 500;
  43591. t.one = 500;
  43592. t.two = 500;
  43593. t.three = 500;
  43594. t.four = 500;
  43595. t.five = 500;
  43596. t.six = 500;
  43597. t.seven = 500;
  43598. t.eight = 500;
  43599. t.nine = 500;
  43600. t.colon = 333;
  43601. t.semicolon = 333;
  43602. t.less = 570;
  43603. t.equal = 570;
  43604. t.greater = 570;
  43605. t.question = 500;
  43606. t.at = 832;
  43607. t.A = 667;
  43608. t.B = 667;
  43609. t.C = 667;
  43610. t.D = 722;
  43611. t.E = 667;
  43612. t.F = 667;
  43613. t.G = 722;
  43614. t.H = 778;
  43615. t.I = 389;
  43616. t.J = 500;
  43617. t.K = 667;
  43618. t.L = 611;
  43619. t.M = 889;
  43620. t.N = 722;
  43621. t.O = 722;
  43622. t.P = 611;
  43623. t.Q = 722;
  43624. t.R = 667;
  43625. t.S = 556;
  43626. t.T = 611;
  43627. t.U = 722;
  43628. t.V = 667;
  43629. t.W = 889;
  43630. t.X = 667;
  43631. t.Y = 611;
  43632. t.Z = 611;
  43633. t.bracketleft = 333;
  43634. t.backslash = 278;
  43635. t.bracketright = 333;
  43636. t.asciicircum = 570;
  43637. t.underscore = 500;
  43638. t.quoteleft = 333;
  43639. t.a = 500;
  43640. t.b = 500;
  43641. t.c = 444;
  43642. t.d = 500;
  43643. t.e = 444;
  43644. t.f = 333;
  43645. t.g = 500;
  43646. t.h = 556;
  43647. t.i = 278;
  43648. t.j = 278;
  43649. t.k = 500;
  43650. t.l = 278;
  43651. t.m = 778;
  43652. t.n = 556;
  43653. t.o = 500;
  43654. t.p = 500;
  43655. t.q = 500;
  43656. t.r = 389;
  43657. t.s = 389;
  43658. t.t = 278;
  43659. t.u = 556;
  43660. t.v = 444;
  43661. t.w = 667;
  43662. t.x = 500;
  43663. t.y = 444;
  43664. t.z = 389;
  43665. t.braceleft = 348;
  43666. t.bar = 220;
  43667. t.braceright = 348;
  43668. t.asciitilde = 570;
  43669. t.exclamdown = 389;
  43670. t.cent = 500;
  43671. t.sterling = 500;
  43672. t.fraction = 167;
  43673. t.yen = 500;
  43674. t.florin = 500;
  43675. t.section = 500;
  43676. t.currency = 500;
  43677. t.quotesingle = 278;
  43678. t.quotedblleft = 500;
  43679. t.guillemotleft = 500;
  43680. t.guilsinglleft = 333;
  43681. t.guilsinglright = 333;
  43682. t.fi = 556;
  43683. t.fl = 556;
  43684. t.endash = 500;
  43685. t.dagger = 500;
  43686. t.daggerdbl = 500;
  43687. t.periodcentered = 250;
  43688. t.paragraph = 500;
  43689. t.bullet = 350;
  43690. t.quotesinglbase = 333;
  43691. t.quotedblbase = 500;
  43692. t.quotedblright = 500;
  43693. t.guillemotright = 500;
  43694. t.ellipsis = 1000;
  43695. t.perthousand = 1000;
  43696. t.questiondown = 500;
  43697. t.grave = 333;
  43698. t.acute = 333;
  43699. t.circumflex = 333;
  43700. t.tilde = 333;
  43701. t.macron = 333;
  43702. t.breve = 333;
  43703. t.dotaccent = 333;
  43704. t.dieresis = 333;
  43705. t.ring = 333;
  43706. t.cedilla = 333;
  43707. t.hungarumlaut = 333;
  43708. t.ogonek = 333;
  43709. t.caron = 333;
  43710. t.emdash = 1000;
  43711. t.AE = 944;
  43712. t.ordfeminine = 266;
  43713. t.Lslash = 611;
  43714. t.Oslash = 722;
  43715. t.OE = 944;
  43716. t.ordmasculine = 300;
  43717. t.ae = 722;
  43718. t.dotlessi = 278;
  43719. t.lslash = 278;
  43720. t.oslash = 500;
  43721. t.oe = 722;
  43722. t.germandbls = 500;
  43723. t.Idieresis = 389;
  43724. t.eacute = 444;
  43725. t.abreve = 500;
  43726. t.uhungarumlaut = 556;
  43727. t.ecaron = 444;
  43728. t.Ydieresis = 611;
  43729. t.divide = 570;
  43730. t.Yacute = 611;
  43731. t.Acircumflex = 667;
  43732. t.aacute = 500;
  43733. t.Ucircumflex = 722;
  43734. t.yacute = 444;
  43735. t.scommaaccent = 389;
  43736. t.ecircumflex = 444;
  43737. t.Uring = 722;
  43738. t.Udieresis = 722;
  43739. t.aogonek = 500;
  43740. t.Uacute = 722;
  43741. t.uogonek = 556;
  43742. t.Edieresis = 667;
  43743. t.Dcroat = 722;
  43744. t.commaaccent = 250;
  43745. t.copyright = 747;
  43746. t.Emacron = 667;
  43747. t.ccaron = 444;
  43748. t.aring = 500;
  43749. t.Ncommaaccent = 722;
  43750. t.lacute = 278;
  43751. t.agrave = 500;
  43752. t.Tcommaaccent = 611;
  43753. t.Cacute = 667;
  43754. t.atilde = 500;
  43755. t.Edotaccent = 667;
  43756. t.scaron = 389;
  43757. t.scedilla = 389;
  43758. t.iacute = 278;
  43759. t.lozenge = 494;
  43760. t.Rcaron = 667;
  43761. t.Gcommaaccent = 722;
  43762. t.ucircumflex = 556;
  43763. t.acircumflex = 500;
  43764. t.Amacron = 667;
  43765. t.rcaron = 389;
  43766. t.ccedilla = 444;
  43767. t.Zdotaccent = 611;
  43768. t.Thorn = 611;
  43769. t.Omacron = 722;
  43770. t.Racute = 667;
  43771. t.Sacute = 556;
  43772. t.dcaron = 608;
  43773. t.Umacron = 722;
  43774. t.uring = 556;
  43775. t.threesuperior = 300;
  43776. t.Ograve = 722;
  43777. t.Agrave = 667;
  43778. t.Abreve = 667;
  43779. t.multiply = 570;
  43780. t.uacute = 556;
  43781. t.Tcaron = 611;
  43782. t.partialdiff = 494;
  43783. t.ydieresis = 444;
  43784. t.Nacute = 722;
  43785. t.icircumflex = 278;
  43786. t.Ecircumflex = 667;
  43787. t.adieresis = 500;
  43788. t.edieresis = 444;
  43789. t.cacute = 444;
  43790. t.nacute = 556;
  43791. t.umacron = 556;
  43792. t.Ncaron = 722;
  43793. t.Iacute = 389;
  43794. t.plusminus = 570;
  43795. t.brokenbar = 220;
  43796. t.registered = 747;
  43797. t.Gbreve = 722;
  43798. t.Idotaccent = 389;
  43799. t.summation = 600;
  43800. t.Egrave = 667;
  43801. t.racute = 389;
  43802. t.omacron = 500;
  43803. t.Zacute = 611;
  43804. t.Zcaron = 611;
  43805. t.greaterequal = 549;
  43806. t.Eth = 722;
  43807. t.Ccedilla = 667;
  43808. t.lcommaaccent = 278;
  43809. t.tcaron = 366;
  43810. t.eogonek = 444;
  43811. t.Uogonek = 722;
  43812. t.Aacute = 667;
  43813. t.Adieresis = 667;
  43814. t.egrave = 444;
  43815. t.zacute = 389;
  43816. t.iogonek = 278;
  43817. t.Oacute = 722;
  43818. t.oacute = 500;
  43819. t.amacron = 500;
  43820. t.sacute = 389;
  43821. t.idieresis = 278;
  43822. t.Ocircumflex = 722;
  43823. t.Ugrave = 722;
  43824. t.Delta = 612;
  43825. t.thorn = 500;
  43826. t.twosuperior = 300;
  43827. t.Odieresis = 722;
  43828. t.mu = 576;
  43829. t.igrave = 278;
  43830. t.ohungarumlaut = 500;
  43831. t.Eogonek = 667;
  43832. t.dcroat = 500;
  43833. t.threequarters = 750;
  43834. t.Scedilla = 556;
  43835. t.lcaron = 382;
  43836. t.Kcommaaccent = 667;
  43837. t.Lacute = 611;
  43838. t.trademark = 1000;
  43839. t.edotaccent = 444;
  43840. t.Igrave = 389;
  43841. t.Imacron = 389;
  43842. t.Lcaron = 611;
  43843. t.onehalf = 750;
  43844. t.lessequal = 549;
  43845. t.ocircumflex = 500;
  43846. t.ntilde = 556;
  43847. t.Uhungarumlaut = 722;
  43848. t.Eacute = 667;
  43849. t.emacron = 444;
  43850. t.gbreve = 500;
  43851. t.onequarter = 750;
  43852. t.Scaron = 556;
  43853. t.Scommaaccent = 556;
  43854. t.Ohungarumlaut = 722;
  43855. t.degree = 400;
  43856. t.ograve = 500;
  43857. t.Ccaron = 667;
  43858. t.ugrave = 556;
  43859. t.radical = 549;
  43860. t.Dcaron = 722;
  43861. t.rcommaaccent = 389;
  43862. t.Ntilde = 722;
  43863. t.otilde = 500;
  43864. t.Rcommaaccent = 667;
  43865. t.Lcommaaccent = 611;
  43866. t.Atilde = 667;
  43867. t.Aogonek = 667;
  43868. t.Aring = 667;
  43869. t.Otilde = 722;
  43870. t.zdotaccent = 389;
  43871. t.Ecaron = 667;
  43872. t.Iogonek = 389;
  43873. t.kcommaaccent = 500;
  43874. t.minus = 606;
  43875. t.Icircumflex = 389;
  43876. t.ncaron = 556;
  43877. t.tcommaaccent = 278;
  43878. t.logicalnot = 606;
  43879. t.odieresis = 500;
  43880. t.udieresis = 556;
  43881. t.notequal = 549;
  43882. t.gcommaaccent = 500;
  43883. t.eth = 500;
  43884. t.zcaron = 389;
  43885. t.ncommaaccent = 556;
  43886. t.onesuperior = 300;
  43887. t.imacron = 278;
  43888. t.Euro = 500;
  43889. });
  43890. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  43891. t.space = 250;
  43892. t.exclam = 333;
  43893. t.quotedbl = 420;
  43894. t.numbersign = 500;
  43895. t.dollar = 500;
  43896. t.percent = 833;
  43897. t.ampersand = 778;
  43898. t.quoteright = 333;
  43899. t.parenleft = 333;
  43900. t.parenright = 333;
  43901. t.asterisk = 500;
  43902. t.plus = 675;
  43903. t.comma = 250;
  43904. t.hyphen = 333;
  43905. t.period = 250;
  43906. t.slash = 278;
  43907. t.zero = 500;
  43908. t.one = 500;
  43909. t.two = 500;
  43910. t.three = 500;
  43911. t.four = 500;
  43912. t.five = 500;
  43913. t.six = 500;
  43914. t.seven = 500;
  43915. t.eight = 500;
  43916. t.nine = 500;
  43917. t.colon = 333;
  43918. t.semicolon = 333;
  43919. t.less = 675;
  43920. t.equal = 675;
  43921. t.greater = 675;
  43922. t.question = 500;
  43923. t.at = 920;
  43924. t.A = 611;
  43925. t.B = 611;
  43926. t.C = 667;
  43927. t.D = 722;
  43928. t.E = 611;
  43929. t.F = 611;
  43930. t.G = 722;
  43931. t.H = 722;
  43932. t.I = 333;
  43933. t.J = 444;
  43934. t.K = 667;
  43935. t.L = 556;
  43936. t.M = 833;
  43937. t.N = 667;
  43938. t.O = 722;
  43939. t.P = 611;
  43940. t.Q = 722;
  43941. t.R = 611;
  43942. t.S = 500;
  43943. t.T = 556;
  43944. t.U = 722;
  43945. t.V = 611;
  43946. t.W = 833;
  43947. t.X = 611;
  43948. t.Y = 556;
  43949. t.Z = 556;
  43950. t.bracketleft = 389;
  43951. t.backslash = 278;
  43952. t.bracketright = 389;
  43953. t.asciicircum = 422;
  43954. t.underscore = 500;
  43955. t.quoteleft = 333;
  43956. t.a = 500;
  43957. t.b = 500;
  43958. t.c = 444;
  43959. t.d = 500;
  43960. t.e = 444;
  43961. t.f = 278;
  43962. t.g = 500;
  43963. t.h = 500;
  43964. t.i = 278;
  43965. t.j = 278;
  43966. t.k = 444;
  43967. t.l = 278;
  43968. t.m = 722;
  43969. t.n = 500;
  43970. t.o = 500;
  43971. t.p = 500;
  43972. t.q = 500;
  43973. t.r = 389;
  43974. t.s = 389;
  43975. t.t = 278;
  43976. t.u = 500;
  43977. t.v = 444;
  43978. t.w = 667;
  43979. t.x = 444;
  43980. t.y = 444;
  43981. t.z = 389;
  43982. t.braceleft = 400;
  43983. t.bar = 275;
  43984. t.braceright = 400;
  43985. t.asciitilde = 541;
  43986. t.exclamdown = 389;
  43987. t.cent = 500;
  43988. t.sterling = 500;
  43989. t.fraction = 167;
  43990. t.yen = 500;
  43991. t.florin = 500;
  43992. t.section = 500;
  43993. t.currency = 500;
  43994. t.quotesingle = 214;
  43995. t.quotedblleft = 556;
  43996. t.guillemotleft = 500;
  43997. t.guilsinglleft = 333;
  43998. t.guilsinglright = 333;
  43999. t.fi = 500;
  44000. t.fl = 500;
  44001. t.endash = 500;
  44002. t.dagger = 500;
  44003. t.daggerdbl = 500;
  44004. t.periodcentered = 250;
  44005. t.paragraph = 523;
  44006. t.bullet = 350;
  44007. t.quotesinglbase = 333;
  44008. t.quotedblbase = 556;
  44009. t.quotedblright = 556;
  44010. t.guillemotright = 500;
  44011. t.ellipsis = 889;
  44012. t.perthousand = 1000;
  44013. t.questiondown = 500;
  44014. t.grave = 333;
  44015. t.acute = 333;
  44016. t.circumflex = 333;
  44017. t.tilde = 333;
  44018. t.macron = 333;
  44019. t.breve = 333;
  44020. t.dotaccent = 333;
  44021. t.dieresis = 333;
  44022. t.ring = 333;
  44023. t.cedilla = 333;
  44024. t.hungarumlaut = 333;
  44025. t.ogonek = 333;
  44026. t.caron = 333;
  44027. t.emdash = 889;
  44028. t.AE = 889;
  44029. t.ordfeminine = 276;
  44030. t.Lslash = 556;
  44031. t.Oslash = 722;
  44032. t.OE = 944;
  44033. t.ordmasculine = 310;
  44034. t.ae = 667;
  44035. t.dotlessi = 278;
  44036. t.lslash = 278;
  44037. t.oslash = 500;
  44038. t.oe = 667;
  44039. t.germandbls = 500;
  44040. t.Idieresis = 333;
  44041. t.eacute = 444;
  44042. t.abreve = 500;
  44043. t.uhungarumlaut = 500;
  44044. t.ecaron = 444;
  44045. t.Ydieresis = 556;
  44046. t.divide = 675;
  44047. t.Yacute = 556;
  44048. t.Acircumflex = 611;
  44049. t.aacute = 500;
  44050. t.Ucircumflex = 722;
  44051. t.yacute = 444;
  44052. t.scommaaccent = 389;
  44053. t.ecircumflex = 444;
  44054. t.Uring = 722;
  44055. t.Udieresis = 722;
  44056. t.aogonek = 500;
  44057. t.Uacute = 722;
  44058. t.uogonek = 500;
  44059. t.Edieresis = 611;
  44060. t.Dcroat = 722;
  44061. t.commaaccent = 250;
  44062. t.copyright = 760;
  44063. t.Emacron = 611;
  44064. t.ccaron = 444;
  44065. t.aring = 500;
  44066. t.Ncommaaccent = 667;
  44067. t.lacute = 278;
  44068. t.agrave = 500;
  44069. t.Tcommaaccent = 556;
  44070. t.Cacute = 667;
  44071. t.atilde = 500;
  44072. t.Edotaccent = 611;
  44073. t.scaron = 389;
  44074. t.scedilla = 389;
  44075. t.iacute = 278;
  44076. t.lozenge = 471;
  44077. t.Rcaron = 611;
  44078. t.Gcommaaccent = 722;
  44079. t.ucircumflex = 500;
  44080. t.acircumflex = 500;
  44081. t.Amacron = 611;
  44082. t.rcaron = 389;
  44083. t.ccedilla = 444;
  44084. t.Zdotaccent = 556;
  44085. t.Thorn = 611;
  44086. t.Omacron = 722;
  44087. t.Racute = 611;
  44088. t.Sacute = 500;
  44089. t.dcaron = 544;
  44090. t.Umacron = 722;
  44091. t.uring = 500;
  44092. t.threesuperior = 300;
  44093. t.Ograve = 722;
  44094. t.Agrave = 611;
  44095. t.Abreve = 611;
  44096. t.multiply = 675;
  44097. t.uacute = 500;
  44098. t.Tcaron = 556;
  44099. t.partialdiff = 476;
  44100. t.ydieresis = 444;
  44101. t.Nacute = 667;
  44102. t.icircumflex = 278;
  44103. t.Ecircumflex = 611;
  44104. t.adieresis = 500;
  44105. t.edieresis = 444;
  44106. t.cacute = 444;
  44107. t.nacute = 500;
  44108. t.umacron = 500;
  44109. t.Ncaron = 667;
  44110. t.Iacute = 333;
  44111. t.plusminus = 675;
  44112. t.brokenbar = 275;
  44113. t.registered = 760;
  44114. t.Gbreve = 722;
  44115. t.Idotaccent = 333;
  44116. t.summation = 600;
  44117. t.Egrave = 611;
  44118. t.racute = 389;
  44119. t.omacron = 500;
  44120. t.Zacute = 556;
  44121. t.Zcaron = 556;
  44122. t.greaterequal = 549;
  44123. t.Eth = 722;
  44124. t.Ccedilla = 667;
  44125. t.lcommaaccent = 278;
  44126. t.tcaron = 300;
  44127. t.eogonek = 444;
  44128. t.Uogonek = 722;
  44129. t.Aacute = 611;
  44130. t.Adieresis = 611;
  44131. t.egrave = 444;
  44132. t.zacute = 389;
  44133. t.iogonek = 278;
  44134. t.Oacute = 722;
  44135. t.oacute = 500;
  44136. t.amacron = 500;
  44137. t.sacute = 389;
  44138. t.idieresis = 278;
  44139. t.Ocircumflex = 722;
  44140. t.Ugrave = 722;
  44141. t.Delta = 612;
  44142. t.thorn = 500;
  44143. t.twosuperior = 300;
  44144. t.Odieresis = 722;
  44145. t.mu = 500;
  44146. t.igrave = 278;
  44147. t.ohungarumlaut = 500;
  44148. t.Eogonek = 611;
  44149. t.dcroat = 500;
  44150. t.threequarters = 750;
  44151. t.Scedilla = 500;
  44152. t.lcaron = 300;
  44153. t.Kcommaaccent = 667;
  44154. t.Lacute = 556;
  44155. t.trademark = 980;
  44156. t.edotaccent = 444;
  44157. t.Igrave = 333;
  44158. t.Imacron = 333;
  44159. t.Lcaron = 611;
  44160. t.onehalf = 750;
  44161. t.lessequal = 549;
  44162. t.ocircumflex = 500;
  44163. t.ntilde = 500;
  44164. t.Uhungarumlaut = 722;
  44165. t.Eacute = 611;
  44166. t.emacron = 444;
  44167. t.gbreve = 500;
  44168. t.onequarter = 750;
  44169. t.Scaron = 500;
  44170. t.Scommaaccent = 500;
  44171. t.Ohungarumlaut = 722;
  44172. t.degree = 400;
  44173. t.ograve = 500;
  44174. t.Ccaron = 667;
  44175. t.ugrave = 500;
  44176. t.radical = 453;
  44177. t.Dcaron = 722;
  44178. t.rcommaaccent = 389;
  44179. t.Ntilde = 667;
  44180. t.otilde = 500;
  44181. t.Rcommaaccent = 611;
  44182. t.Lcommaaccent = 556;
  44183. t.Atilde = 611;
  44184. t.Aogonek = 611;
  44185. t.Aring = 611;
  44186. t.Otilde = 722;
  44187. t.zdotaccent = 389;
  44188. t.Ecaron = 611;
  44189. t.Iogonek = 333;
  44190. t.kcommaaccent = 444;
  44191. t.minus = 675;
  44192. t.Icircumflex = 333;
  44193. t.ncaron = 500;
  44194. t.tcommaaccent = 278;
  44195. t.logicalnot = 675;
  44196. t.odieresis = 500;
  44197. t.udieresis = 500;
  44198. t.notequal = 549;
  44199. t.gcommaaccent = 500;
  44200. t.eth = 500;
  44201. t.zcaron = 389;
  44202. t.ncommaaccent = 500;
  44203. t.onesuperior = 300;
  44204. t.imacron = 278;
  44205. t.Euro = 500;
  44206. });
  44207. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  44208. t.space = 278;
  44209. t.a1 = 974;
  44210. t.a2 = 961;
  44211. t.a202 = 974;
  44212. t.a3 = 980;
  44213. t.a4 = 719;
  44214. t.a5 = 789;
  44215. t.a119 = 790;
  44216. t.a118 = 791;
  44217. t.a117 = 690;
  44218. t.a11 = 960;
  44219. t.a12 = 939;
  44220. t.a13 = 549;
  44221. t.a14 = 855;
  44222. t.a15 = 911;
  44223. t.a16 = 933;
  44224. t.a105 = 911;
  44225. t.a17 = 945;
  44226. t.a18 = 974;
  44227. t.a19 = 755;
  44228. t.a20 = 846;
  44229. t.a21 = 762;
  44230. t.a22 = 761;
  44231. t.a23 = 571;
  44232. t.a24 = 677;
  44233. t.a25 = 763;
  44234. t.a26 = 760;
  44235. t.a27 = 759;
  44236. t.a28 = 754;
  44237. t.a6 = 494;
  44238. t.a7 = 552;
  44239. t.a8 = 537;
  44240. t.a9 = 577;
  44241. t.a10 = 692;
  44242. t.a29 = 786;
  44243. t.a30 = 788;
  44244. t.a31 = 788;
  44245. t.a32 = 790;
  44246. t.a33 = 793;
  44247. t.a34 = 794;
  44248. t.a35 = 816;
  44249. t.a36 = 823;
  44250. t.a37 = 789;
  44251. t.a38 = 841;
  44252. t.a39 = 823;
  44253. t.a40 = 833;
  44254. t.a41 = 816;
  44255. t.a42 = 831;
  44256. t.a43 = 923;
  44257. t.a44 = 744;
  44258. t.a45 = 723;
  44259. t.a46 = 749;
  44260. t.a47 = 790;
  44261. t.a48 = 792;
  44262. t.a49 = 695;
  44263. t.a50 = 776;
  44264. t.a51 = 768;
  44265. t.a52 = 792;
  44266. t.a53 = 759;
  44267. t.a54 = 707;
  44268. t.a55 = 708;
  44269. t.a56 = 682;
  44270. t.a57 = 701;
  44271. t.a58 = 826;
  44272. t.a59 = 815;
  44273. t.a60 = 789;
  44274. t.a61 = 789;
  44275. t.a62 = 707;
  44276. t.a63 = 687;
  44277. t.a64 = 696;
  44278. t.a65 = 689;
  44279. t.a66 = 786;
  44280. t.a67 = 787;
  44281. t.a68 = 713;
  44282. t.a69 = 791;
  44283. t.a70 = 785;
  44284. t.a71 = 791;
  44285. t.a72 = 873;
  44286. t.a73 = 761;
  44287. t.a74 = 762;
  44288. t.a203 = 762;
  44289. t.a75 = 759;
  44290. t.a204 = 759;
  44291. t.a76 = 892;
  44292. t.a77 = 892;
  44293. t.a78 = 788;
  44294. t.a79 = 784;
  44295. t.a81 = 438;
  44296. t.a82 = 138;
  44297. t.a83 = 277;
  44298. t.a84 = 415;
  44299. t.a97 = 392;
  44300. t.a98 = 392;
  44301. t.a99 = 668;
  44302. t.a100 = 668;
  44303. t.a89 = 390;
  44304. t.a90 = 390;
  44305. t.a93 = 317;
  44306. t.a94 = 317;
  44307. t.a91 = 276;
  44308. t.a92 = 276;
  44309. t.a205 = 509;
  44310. t.a85 = 509;
  44311. t.a206 = 410;
  44312. t.a86 = 410;
  44313. t.a87 = 234;
  44314. t.a88 = 234;
  44315. t.a95 = 334;
  44316. t.a96 = 334;
  44317. t.a101 = 732;
  44318. t.a102 = 544;
  44319. t.a103 = 544;
  44320. t.a104 = 910;
  44321. t.a106 = 667;
  44322. t.a107 = 760;
  44323. t.a108 = 760;
  44324. t.a112 = 776;
  44325. t.a111 = 595;
  44326. t.a110 = 694;
  44327. t.a109 = 626;
  44328. t.a120 = 788;
  44329. t.a121 = 788;
  44330. t.a122 = 788;
  44331. t.a123 = 788;
  44332. t.a124 = 788;
  44333. t.a125 = 788;
  44334. t.a126 = 788;
  44335. t.a127 = 788;
  44336. t.a128 = 788;
  44337. t.a129 = 788;
  44338. t.a130 = 788;
  44339. t.a131 = 788;
  44340. t.a132 = 788;
  44341. t.a133 = 788;
  44342. t.a134 = 788;
  44343. t.a135 = 788;
  44344. t.a136 = 788;
  44345. t.a137 = 788;
  44346. t.a138 = 788;
  44347. t.a139 = 788;
  44348. t.a140 = 788;
  44349. t.a141 = 788;
  44350. t.a142 = 788;
  44351. t.a143 = 788;
  44352. t.a144 = 788;
  44353. t.a145 = 788;
  44354. t.a146 = 788;
  44355. t.a147 = 788;
  44356. t.a148 = 788;
  44357. t.a149 = 788;
  44358. t.a150 = 788;
  44359. t.a151 = 788;
  44360. t.a152 = 788;
  44361. t.a153 = 788;
  44362. t.a154 = 788;
  44363. t.a155 = 788;
  44364. t.a156 = 788;
  44365. t.a157 = 788;
  44366. t.a158 = 788;
  44367. t.a159 = 788;
  44368. t.a160 = 894;
  44369. t.a161 = 838;
  44370. t.a163 = 1016;
  44371. t.a164 = 458;
  44372. t.a196 = 748;
  44373. t.a165 = 924;
  44374. t.a192 = 748;
  44375. t.a166 = 918;
  44376. t.a167 = 927;
  44377. t.a168 = 928;
  44378. t.a169 = 928;
  44379. t.a170 = 834;
  44380. t.a171 = 873;
  44381. t.a172 = 828;
  44382. t.a173 = 924;
  44383. t.a162 = 924;
  44384. t.a174 = 917;
  44385. t.a175 = 930;
  44386. t.a176 = 931;
  44387. t.a177 = 463;
  44388. t.a178 = 883;
  44389. t.a179 = 836;
  44390. t.a193 = 836;
  44391. t.a180 = 867;
  44392. t.a199 = 867;
  44393. t.a181 = 696;
  44394. t.a200 = 696;
  44395. t.a182 = 874;
  44396. t.a201 = 874;
  44397. t.a183 = 760;
  44398. t.a184 = 946;
  44399. t.a197 = 771;
  44400. t.a185 = 865;
  44401. t.a194 = 771;
  44402. t.a198 = 888;
  44403. t.a186 = 967;
  44404. t.a195 = 888;
  44405. t.a187 = 831;
  44406. t.a188 = 873;
  44407. t.a189 = 927;
  44408. t.a190 = 970;
  44409. t.a191 = 918;
  44410. });
  44411. });
  44412. exports.getMetrics = getMetrics;
  44413. /***/ }),
  44414. /* 61 */
  44415. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44416. Object.defineProperty(exports, "__esModule", ({
  44417. value: true
  44418. }));
  44419. exports.MurmurHash3_64 = void 0;
  44420. var _util = __w_pdfjs_require__(2);
  44421. const SEED = 0xc3d2e1f0;
  44422. const MASK_HIGH = 0xffff0000;
  44423. const MASK_LOW = 0xffff;
  44424. class MurmurHash3_64 {
  44425. constructor(seed) {
  44426. this.h1 = seed ? seed & 0xffffffff : SEED;
  44427. this.h2 = seed ? seed & 0xffffffff : SEED;
  44428. }
  44429. update(input) {
  44430. let data, length;
  44431. if ((0, _util.isString)(input)) {
  44432. data = new Uint8Array(input.length * 2);
  44433. length = 0;
  44434. for (let i = 0, ii = input.length; i < ii; i++) {
  44435. const code = input.charCodeAt(i);
  44436. if (code <= 0xff) {
  44437. data[length++] = code;
  44438. } else {
  44439. data[length++] = code >>> 8;
  44440. data[length++] = code & 0xff;
  44441. }
  44442. }
  44443. } else if ((0, _util.isArrayBuffer)(input)) {
  44444. data = input.slice();
  44445. length = data.byteLength;
  44446. } else {
  44447. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  44448. }
  44449. const blockCounts = length >> 2;
  44450. const tailLength = length - blockCounts * 4;
  44451. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  44452. let k1 = 0,
  44453. k2 = 0;
  44454. let h1 = this.h1,
  44455. h2 = this.h2;
  44456. const C1 = 0xcc9e2d51,
  44457. C2 = 0x1b873593;
  44458. const C1_LOW = C1 & MASK_LOW,
  44459. C2_LOW = C2 & MASK_LOW;
  44460. for (let i = 0; i < blockCounts; i++) {
  44461. if (i & 1) {
  44462. k1 = dataUint32[i];
  44463. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  44464. k1 = k1 << 15 | k1 >>> 17;
  44465. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  44466. h1 ^= k1;
  44467. h1 = h1 << 13 | h1 >>> 19;
  44468. h1 = h1 * 5 + 0xe6546b64;
  44469. } else {
  44470. k2 = dataUint32[i];
  44471. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  44472. k2 = k2 << 15 | k2 >>> 17;
  44473. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  44474. h2 ^= k2;
  44475. h2 = h2 << 13 | h2 >>> 19;
  44476. h2 = h2 * 5 + 0xe6546b64;
  44477. }
  44478. }
  44479. k1 = 0;
  44480. switch (tailLength) {
  44481. case 3:
  44482. k1 ^= data[blockCounts * 4 + 2] << 16;
  44483. case 2:
  44484. k1 ^= data[blockCounts * 4 + 1] << 8;
  44485. case 1:
  44486. k1 ^= data[blockCounts * 4];
  44487. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  44488. k1 = k1 << 15 | k1 >>> 17;
  44489. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  44490. if (blockCounts & 1) {
  44491. h1 ^= k1;
  44492. } else {
  44493. h2 ^= k1;
  44494. }
  44495. }
  44496. this.h1 = h1;
  44497. this.h2 = h2;
  44498. }
  44499. hexdigest() {
  44500. let h1 = this.h1,
  44501. h2 = this.h2;
  44502. h1 ^= h2 >>> 1;
  44503. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  44504. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  44505. h1 ^= h2 >>> 1;
  44506. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  44507. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  44508. h1 ^= h2 >>> 1;
  44509. const hex1 = (h1 >>> 0).toString(16),
  44510. hex2 = (h2 >>> 0).toString(16);
  44511. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  44512. }
  44513. }
  44514. exports.MurmurHash3_64 = MurmurHash3_64;
  44515. /***/ }),
  44516. /* 62 */
  44517. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44518. Object.defineProperty(exports, "__esModule", ({
  44519. value: true
  44520. }));
  44521. exports.OperatorList = void 0;
  44522. var _util = __w_pdfjs_require__(2);
  44523. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  44524. let state = parentState;
  44525. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  44526. const item = pattern[i];
  44527. state = state[item] || (state[item] = []);
  44528. }
  44529. state[pattern[pattern.length - 1]] = {
  44530. checkFn,
  44531. iterateFn,
  44532. processFn
  44533. };
  44534. }
  44535. function handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray) {
  44536. const iFirstPIMXO = iFirstSave + 2;
  44537. let i;
  44538. for (i = 0; i < count; i++) {
  44539. const arg = argsArray[iFirstPIMXO + 4 * i];
  44540. const imageMask = arg.length === 1 && arg[0];
  44541. if (imageMask && imageMask.width === 1 && imageMask.height === 1 && (!imageMask.data.length || imageMask.data.length === 1 && imageMask.data[0] === 0)) {
  44542. fnArray[iFirstPIMXO + 4 * i] = _util.OPS.paintSolidColorImageMask;
  44543. continue;
  44544. }
  44545. break;
  44546. }
  44547. return count - i;
  44548. }
  44549. const InitialState = [];
  44550. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  44551. const fnArray = context.fnArray;
  44552. const iFirstSave = context.iCurr - 3;
  44553. const pos = (i - iFirstSave) % 4;
  44554. switch (pos) {
  44555. case 0:
  44556. return fnArray[i] === _util.OPS.save;
  44557. case 1:
  44558. return fnArray[i] === _util.OPS.transform;
  44559. case 2:
  44560. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  44561. case 3:
  44562. return fnArray[i] === _util.OPS.restore;
  44563. }
  44564. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  44565. }, function foundInlineImageGroup(context, i) {
  44566. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  44567. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  44568. const MAX_WIDTH = 1000;
  44569. const IMAGE_PADDING = 1;
  44570. const fnArray = context.fnArray,
  44571. argsArray = context.argsArray;
  44572. const curr = context.iCurr;
  44573. const iFirstSave = curr - 3;
  44574. const iFirstTransform = curr - 2;
  44575. const iFirstPIIXO = curr - 1;
  44576. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  44577. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  44578. return i - (i - iFirstSave) % 4;
  44579. }
  44580. let maxX = 0;
  44581. const map = [];
  44582. let maxLineHeight = 0;
  44583. let currentX = IMAGE_PADDING,
  44584. currentY = IMAGE_PADDING;
  44585. for (let q = 0; q < count; q++) {
  44586. const transform = argsArray[iFirstTransform + (q << 2)];
  44587. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  44588. if (currentX + img.width > MAX_WIDTH) {
  44589. maxX = Math.max(maxX, currentX);
  44590. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  44591. currentX = 0;
  44592. maxLineHeight = 0;
  44593. }
  44594. map.push({
  44595. transform,
  44596. x: currentX,
  44597. y: currentY,
  44598. w: img.width,
  44599. h: img.height
  44600. });
  44601. currentX += img.width + 2 * IMAGE_PADDING;
  44602. maxLineHeight = Math.max(maxLineHeight, img.height);
  44603. }
  44604. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  44605. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  44606. const imgData = new Uint8ClampedArray(imgWidth * imgHeight * 4);
  44607. const imgRowSize = imgWidth << 2;
  44608. for (let q = 0; q < count; q++) {
  44609. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  44610. const rowSize = map[q].w << 2;
  44611. let dataOffset = 0;
  44612. let offset = map[q].x + map[q].y * imgWidth << 2;
  44613. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  44614. for (let k = 0, kk = map[q].h; k < kk; k++) {
  44615. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  44616. dataOffset += rowSize;
  44617. offset += imgRowSize;
  44618. }
  44619. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  44620. while (offset >= 0) {
  44621. data[offset - 4] = data[offset];
  44622. data[offset - 3] = data[offset + 1];
  44623. data[offset - 2] = data[offset + 2];
  44624. data[offset - 1] = data[offset + 3];
  44625. data[offset + rowSize] = data[offset + rowSize - 4];
  44626. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  44627. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  44628. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  44629. offset -= imgRowSize;
  44630. }
  44631. }
  44632. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  44633. argsArray.splice(iFirstSave, count * 4, [{
  44634. width: imgWidth,
  44635. height: imgHeight,
  44636. kind: _util.ImageKind.RGBA_32BPP,
  44637. data: imgData
  44638. }, map]);
  44639. return iFirstSave + 1;
  44640. });
  44641. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  44642. const fnArray = context.fnArray;
  44643. const iFirstSave = context.iCurr - 3;
  44644. const pos = (i - iFirstSave) % 4;
  44645. switch (pos) {
  44646. case 0:
  44647. return fnArray[i] === _util.OPS.save;
  44648. case 1:
  44649. return fnArray[i] === _util.OPS.transform;
  44650. case 2:
  44651. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  44652. case 3:
  44653. return fnArray[i] === _util.OPS.restore;
  44654. }
  44655. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  44656. }, function foundImageMaskGroup(context, i) {
  44657. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  44658. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  44659. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  44660. const fnArray = context.fnArray,
  44661. argsArray = context.argsArray;
  44662. const curr = context.iCurr;
  44663. const iFirstSave = curr - 3;
  44664. const iFirstTransform = curr - 2;
  44665. const iFirstPIMXO = curr - 1;
  44666. let count = Math.floor((i - iFirstSave) / 4);
  44667. count = handlePaintSolidColorImageMask(iFirstSave, count, fnArray, argsArray);
  44668. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  44669. return i - (i - iFirstSave) % 4;
  44670. }
  44671. let isSameImage = false;
  44672. let iTransform, transformArgs;
  44673. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  44674. const firstTransformArg0 = argsArray[iFirstTransform][0],
  44675. firstTransformArg1 = argsArray[iFirstTransform][1],
  44676. firstTransformArg2 = argsArray[iFirstTransform][2],
  44677. firstTransformArg3 = argsArray[iFirstTransform][3];
  44678. if (firstTransformArg1 === firstTransformArg2) {
  44679. isSameImage = true;
  44680. iTransform = iFirstTransform + 4;
  44681. let iPIMXO = iFirstPIMXO + 4;
  44682. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  44683. transformArgs = argsArray[iTransform];
  44684. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  44685. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  44686. isSameImage = false;
  44687. } else {
  44688. count = q;
  44689. }
  44690. break;
  44691. }
  44692. }
  44693. }
  44694. if (isSameImage) {
  44695. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  44696. const positions = new Float32Array(count * 2);
  44697. iTransform = iFirstTransform;
  44698. for (let q = 0; q < count; q++, iTransform += 4) {
  44699. transformArgs = argsArray[iTransform];
  44700. positions[q << 1] = transformArgs[4];
  44701. positions[(q << 1) + 1] = transformArgs[5];
  44702. }
  44703. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  44704. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  44705. } else {
  44706. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  44707. const images = [];
  44708. for (let q = 0; q < count; q++) {
  44709. transformArgs = argsArray[iFirstTransform + (q << 2)];
  44710. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  44711. images.push({
  44712. data: maskParams.data,
  44713. width: maskParams.width,
  44714. height: maskParams.height,
  44715. transform: transformArgs
  44716. });
  44717. }
  44718. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  44719. argsArray.splice(iFirstSave, count * 4, [images]);
  44720. }
  44721. return iFirstSave + 1;
  44722. });
  44723. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  44724. const argsArray = context.argsArray;
  44725. const iFirstTransform = context.iCurr - 2;
  44726. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  44727. }, function iterateImageGroup(context, i) {
  44728. const fnArray = context.fnArray,
  44729. argsArray = context.argsArray;
  44730. const iFirstSave = context.iCurr - 3;
  44731. const pos = (i - iFirstSave) % 4;
  44732. switch (pos) {
  44733. case 0:
  44734. return fnArray[i] === _util.OPS.save;
  44735. case 1:
  44736. if (fnArray[i] !== _util.OPS.transform) {
  44737. return false;
  44738. }
  44739. const iFirstTransform = context.iCurr - 2;
  44740. const firstTransformArg0 = argsArray[iFirstTransform][0];
  44741. const firstTransformArg3 = argsArray[iFirstTransform][3];
  44742. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  44743. return false;
  44744. }
  44745. return true;
  44746. case 2:
  44747. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  44748. return false;
  44749. }
  44750. const iFirstPIXO = context.iCurr - 1;
  44751. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  44752. if (argsArray[i][0] !== firstPIXOArg0) {
  44753. return false;
  44754. }
  44755. return true;
  44756. case 3:
  44757. return fnArray[i] === _util.OPS.restore;
  44758. }
  44759. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  44760. }, function (context, i) {
  44761. const MIN_IMAGES_IN_BLOCK = 3;
  44762. const MAX_IMAGES_IN_BLOCK = 1000;
  44763. const fnArray = context.fnArray,
  44764. argsArray = context.argsArray;
  44765. const curr = context.iCurr;
  44766. const iFirstSave = curr - 3;
  44767. const iFirstTransform = curr - 2;
  44768. const iFirstPIXO = curr - 1;
  44769. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  44770. const firstTransformArg0 = argsArray[iFirstTransform][0];
  44771. const firstTransformArg3 = argsArray[iFirstTransform][3];
  44772. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  44773. if (count < MIN_IMAGES_IN_BLOCK) {
  44774. return i - (i - iFirstSave) % 4;
  44775. }
  44776. const positions = new Float32Array(count * 2);
  44777. let iTransform = iFirstTransform;
  44778. for (let q = 0; q < count; q++, iTransform += 4) {
  44779. const transformArgs = argsArray[iTransform];
  44780. positions[q << 1] = transformArgs[4];
  44781. positions[(q << 1) + 1] = transformArgs[5];
  44782. }
  44783. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  44784. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  44785. argsArray.splice(iFirstSave, count * 4, args);
  44786. return iFirstSave + 1;
  44787. });
  44788. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  44789. const fnArray = context.fnArray,
  44790. argsArray = context.argsArray;
  44791. const iFirstSave = context.iCurr - 4;
  44792. const pos = (i - iFirstSave) % 5;
  44793. switch (pos) {
  44794. case 0:
  44795. return fnArray[i] === _util.OPS.beginText;
  44796. case 1:
  44797. return fnArray[i] === _util.OPS.setFont;
  44798. case 2:
  44799. return fnArray[i] === _util.OPS.setTextMatrix;
  44800. case 3:
  44801. if (fnArray[i] !== _util.OPS.showText) {
  44802. return false;
  44803. }
  44804. const iFirstSetFont = context.iCurr - 3;
  44805. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  44806. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  44807. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  44808. return false;
  44809. }
  44810. return true;
  44811. case 4:
  44812. return fnArray[i] === _util.OPS.endText;
  44813. }
  44814. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  44815. }, function (context, i) {
  44816. const MIN_CHARS_IN_BLOCK = 3;
  44817. const MAX_CHARS_IN_BLOCK = 1000;
  44818. const fnArray = context.fnArray,
  44819. argsArray = context.argsArray;
  44820. const curr = context.iCurr;
  44821. const iFirstBeginText = curr - 4;
  44822. const iFirstSetFont = curr - 3;
  44823. const iFirstSetTextMatrix = curr - 2;
  44824. const iFirstShowText = curr - 1;
  44825. const iFirstEndText = curr;
  44826. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  44827. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  44828. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  44829. if (count < MIN_CHARS_IN_BLOCK) {
  44830. return i - (i - iFirstBeginText) % 5;
  44831. }
  44832. let iFirst = iFirstBeginText;
  44833. 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) {
  44834. count++;
  44835. iFirst -= 5;
  44836. }
  44837. let iEndText = iFirst + 4;
  44838. for (let q = 1; q < count; q++) {
  44839. fnArray.splice(iEndText, 3);
  44840. argsArray.splice(iEndText, 3);
  44841. iEndText += 2;
  44842. }
  44843. return iEndText + 1;
  44844. });
  44845. class NullOptimizer {
  44846. constructor(queue) {
  44847. this.queue = queue;
  44848. }
  44849. _optimize() {}
  44850. push(fn, args) {
  44851. this.queue.fnArray.push(fn);
  44852. this.queue.argsArray.push(args);
  44853. this._optimize();
  44854. }
  44855. flush() {}
  44856. reset() {}
  44857. }
  44858. class QueueOptimizer extends NullOptimizer {
  44859. constructor(queue) {
  44860. super(queue);
  44861. this.state = null;
  44862. this.context = {
  44863. iCurr: 0,
  44864. fnArray: queue.fnArray,
  44865. argsArray: queue.argsArray
  44866. };
  44867. this.match = null;
  44868. this.lastProcessed = 0;
  44869. }
  44870. _optimize() {
  44871. const fnArray = this.queue.fnArray;
  44872. let i = this.lastProcessed,
  44873. ii = fnArray.length;
  44874. let state = this.state;
  44875. let match = this.match;
  44876. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  44877. this.lastProcessed = ii;
  44878. return;
  44879. }
  44880. const context = this.context;
  44881. while (i < ii) {
  44882. if (match) {
  44883. const iterate = (0, match.iterateFn)(context, i);
  44884. if (iterate) {
  44885. i++;
  44886. continue;
  44887. }
  44888. i = (0, match.processFn)(context, i + 1);
  44889. ii = fnArray.length;
  44890. match = null;
  44891. state = null;
  44892. if (i >= ii) {
  44893. break;
  44894. }
  44895. }
  44896. state = (state || InitialState)[fnArray[i]];
  44897. if (!state || Array.isArray(state)) {
  44898. i++;
  44899. continue;
  44900. }
  44901. context.iCurr = i;
  44902. i++;
  44903. if (state.checkFn && !(0, state.checkFn)(context)) {
  44904. state = null;
  44905. continue;
  44906. }
  44907. match = state;
  44908. state = null;
  44909. }
  44910. this.state = state;
  44911. this.match = match;
  44912. this.lastProcessed = i;
  44913. }
  44914. flush() {
  44915. while (this.match) {
  44916. const length = this.queue.fnArray.length;
  44917. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  44918. this.match = null;
  44919. this.state = null;
  44920. this._optimize();
  44921. }
  44922. }
  44923. reset() {
  44924. this.state = null;
  44925. this.match = null;
  44926. this.lastProcessed = 0;
  44927. }
  44928. }
  44929. class OperatorList {
  44930. static get CHUNK_SIZE() {
  44931. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  44932. }
  44933. static get CHUNK_SIZE_ABOUT() {
  44934. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  44935. }
  44936. constructor(intent = 0, streamSink) {
  44937. this._streamSink = streamSink;
  44938. this.fnArray = [];
  44939. this.argsArray = [];
  44940. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  44941. this.optimizer = new QueueOptimizer(this);
  44942. } else {
  44943. this.optimizer = new NullOptimizer(this);
  44944. }
  44945. this.dependencies = new Set();
  44946. this._totalLength = 0;
  44947. this.weight = 0;
  44948. this._resolved = streamSink ? null : Promise.resolve();
  44949. }
  44950. get length() {
  44951. return this.argsArray.length;
  44952. }
  44953. get ready() {
  44954. return this._resolved || this._streamSink.ready;
  44955. }
  44956. get totalLength() {
  44957. return this._totalLength + this.length;
  44958. }
  44959. addOp(fn, args) {
  44960. this.optimizer.push(fn, args);
  44961. this.weight++;
  44962. if (this._streamSink) {
  44963. if (this.weight >= OperatorList.CHUNK_SIZE) {
  44964. this.flush();
  44965. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  44966. this.flush();
  44967. }
  44968. }
  44969. }
  44970. addDependency(dependency) {
  44971. if (this.dependencies.has(dependency)) {
  44972. return;
  44973. }
  44974. this.dependencies.add(dependency);
  44975. this.addOp(_util.OPS.dependency, [dependency]);
  44976. }
  44977. addDependencies(dependencies) {
  44978. for (const dependency of dependencies) {
  44979. this.addDependency(dependency);
  44980. }
  44981. }
  44982. addOpList(opList) {
  44983. if (!(opList instanceof OperatorList)) {
  44984. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  44985. return;
  44986. }
  44987. for (const dependency of opList.dependencies) {
  44988. this.dependencies.add(dependency);
  44989. }
  44990. for (let i = 0, ii = opList.length; i < ii; i++) {
  44991. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  44992. }
  44993. }
  44994. getIR() {
  44995. return {
  44996. fnArray: this.fnArray,
  44997. argsArray: this.argsArray,
  44998. length: this.length
  44999. };
  45000. }
  45001. get _transfers() {
  45002. const transfers = [];
  45003. const {
  45004. fnArray,
  45005. argsArray,
  45006. length
  45007. } = this;
  45008. for (let i = 0; i < length; i++) {
  45009. switch (fnArray[i]) {
  45010. case _util.OPS.paintInlineImageXObject:
  45011. case _util.OPS.paintInlineImageXObjectGroup:
  45012. case _util.OPS.paintImageMaskXObject:
  45013. const arg = argsArray[i][0];
  45014. ;
  45015. if (!arg.cached) {
  45016. transfers.push(arg.data.buffer);
  45017. }
  45018. break;
  45019. }
  45020. }
  45021. return transfers;
  45022. }
  45023. flush(lastChunk = false) {
  45024. this.optimizer.flush();
  45025. const length = this.length;
  45026. this._totalLength += length;
  45027. this._streamSink.enqueue({
  45028. fnArray: this.fnArray,
  45029. argsArray: this.argsArray,
  45030. lastChunk,
  45031. length
  45032. }, 1, this._transfers);
  45033. this.dependencies.clear();
  45034. this.fnArray.length = 0;
  45035. this.argsArray.length = 0;
  45036. this.weight = 0;
  45037. this.optimizer.reset();
  45038. }
  45039. }
  45040. exports.OperatorList = OperatorList;
  45041. /***/ }),
  45042. /* 63 */
  45043. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45044. Object.defineProperty(exports, "__esModule", ({
  45045. value: true
  45046. }));
  45047. exports.PDFImage = void 0;
  45048. var _util = __w_pdfjs_require__(2);
  45049. var _primitives = __w_pdfjs_require__(5);
  45050. var _colorspace = __w_pdfjs_require__(24);
  45051. var _decode_stream = __w_pdfjs_require__(29);
  45052. var _jpeg_stream = __w_pdfjs_require__(37);
  45053. var _jpx = __w_pdfjs_require__(40);
  45054. function decodeAndClamp(value, addend, coefficient, max) {
  45055. value = addend + value * coefficient;
  45056. if (value < 0) {
  45057. value = 0;
  45058. } else if (value > max) {
  45059. value = max;
  45060. }
  45061. return value;
  45062. }
  45063. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  45064. const length = w2 * h2;
  45065. let dest;
  45066. if (bpc <= 8) {
  45067. dest = new Uint8Array(length);
  45068. } else if (bpc <= 16) {
  45069. dest = new Uint16Array(length);
  45070. } else {
  45071. dest = new Uint32Array(length);
  45072. }
  45073. const xRatio = w1 / w2;
  45074. const yRatio = h1 / h2;
  45075. let i,
  45076. j,
  45077. py,
  45078. newIndex = 0,
  45079. oldIndex;
  45080. const xScaled = new Uint16Array(w2);
  45081. const w1Scanline = w1;
  45082. for (i = 0; i < w2; i++) {
  45083. xScaled[i] = Math.floor(i * xRatio);
  45084. }
  45085. for (i = 0; i < h2; i++) {
  45086. py = Math.floor(i * yRatio) * w1Scanline;
  45087. for (j = 0; j < w2; j++) {
  45088. oldIndex = py + xScaled[j];
  45089. dest[newIndex++] = src[oldIndex];
  45090. }
  45091. }
  45092. return dest;
  45093. }
  45094. class PDFImage {
  45095. constructor({
  45096. xref,
  45097. res,
  45098. image,
  45099. isInline = false,
  45100. smask = null,
  45101. mask = null,
  45102. isMask = false,
  45103. pdfFunctionFactory,
  45104. localColorSpaceCache
  45105. }) {
  45106. this.image = image;
  45107. const dict = image.dict;
  45108. const filter = dict.get("Filter");
  45109. if ((0, _primitives.isName)(filter)) {
  45110. switch (filter.name) {
  45111. case "JPXDecode":
  45112. const jpxImage = new _jpx.JpxImage();
  45113. jpxImage.parseImageProperties(image.stream);
  45114. image.stream.reset();
  45115. image.width = jpxImage.width;
  45116. image.height = jpxImage.height;
  45117. image.bitsPerComponent = jpxImage.bitsPerComponent;
  45118. image.numComps = jpxImage.componentsCount;
  45119. break;
  45120. case "JBIG2Decode":
  45121. image.bitsPerComponent = 1;
  45122. image.numComps = 1;
  45123. break;
  45124. }
  45125. }
  45126. let width = dict.get("Width", "W");
  45127. let height = dict.get("Height", "H");
  45128. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  45129. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  45130. width = image.width;
  45131. height = image.height;
  45132. }
  45133. if (width < 1 || height < 1) {
  45134. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  45135. }
  45136. this.width = width;
  45137. this.height = height;
  45138. this.interpolate = dict.get("Interpolate", "I");
  45139. this.imageMask = dict.get("ImageMask", "IM") || false;
  45140. this.matte = dict.get("Matte") || false;
  45141. let bitsPerComponent = image.bitsPerComponent;
  45142. if (!bitsPerComponent) {
  45143. bitsPerComponent = dict.get("BitsPerComponent", "BPC");
  45144. if (!bitsPerComponent) {
  45145. if (this.imageMask) {
  45146. bitsPerComponent = 1;
  45147. } else {
  45148. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  45149. }
  45150. }
  45151. }
  45152. this.bpc = bitsPerComponent;
  45153. if (!this.imageMask) {
  45154. let colorSpace = dict.getRaw("ColorSpace") || dict.getRaw("CS");
  45155. if (!colorSpace) {
  45156. (0, _util.info)("JPX images (which do not require color spaces)");
  45157. switch (image.numComps) {
  45158. case 1:
  45159. colorSpace = _primitives.Name.get("DeviceGray");
  45160. break;
  45161. case 3:
  45162. colorSpace = _primitives.Name.get("DeviceRGB");
  45163. break;
  45164. case 4:
  45165. colorSpace = _primitives.Name.get("DeviceCMYK");
  45166. break;
  45167. default:
  45168. throw new Error(`JPX images with ${image.numComps} ` + "color components not supported.");
  45169. }
  45170. }
  45171. this.colorSpace = _colorspace.ColorSpace.parse({
  45172. cs: colorSpace,
  45173. xref,
  45174. resources: isInline ? res : null,
  45175. pdfFunctionFactory,
  45176. localColorSpaceCache
  45177. });
  45178. this.numComps = this.colorSpace.numComps;
  45179. }
  45180. this.decode = dict.getArray("Decode", "D");
  45181. this.needsDecode = false;
  45182. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  45183. this.needsDecode = true;
  45184. const max = (1 << bitsPerComponent) - 1;
  45185. this.decodeCoefficients = [];
  45186. this.decodeAddends = [];
  45187. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  45188. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  45189. const dmin = this.decode[i];
  45190. const dmax = this.decode[i + 1];
  45191. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  45192. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  45193. }
  45194. }
  45195. if (smask) {
  45196. this.smask = new PDFImage({
  45197. xref,
  45198. res,
  45199. image: smask,
  45200. isInline,
  45201. pdfFunctionFactory,
  45202. localColorSpaceCache
  45203. });
  45204. } else if (mask) {
  45205. if ((0, _primitives.isStream)(mask)) {
  45206. const maskDict = mask.dict,
  45207. imageMask = maskDict.get("ImageMask", "IM");
  45208. if (!imageMask) {
  45209. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  45210. } else {
  45211. this.mask = new PDFImage({
  45212. xref,
  45213. res,
  45214. image: mask,
  45215. isInline,
  45216. isMask: true,
  45217. pdfFunctionFactory,
  45218. localColorSpaceCache
  45219. });
  45220. }
  45221. } else {
  45222. this.mask = mask;
  45223. }
  45224. }
  45225. }
  45226. static async buildImage({
  45227. xref,
  45228. res,
  45229. image,
  45230. isInline = false,
  45231. pdfFunctionFactory,
  45232. localColorSpaceCache
  45233. }) {
  45234. const imageData = image;
  45235. let smaskData = null;
  45236. let maskData = null;
  45237. const smask = image.dict.get("SMask");
  45238. const mask = image.dict.get("Mask");
  45239. if (smask) {
  45240. smaskData = smask;
  45241. } else if (mask) {
  45242. if ((0, _primitives.isStream)(mask) || Array.isArray(mask)) {
  45243. maskData = mask;
  45244. } else {
  45245. (0, _util.warn)("Unsupported mask format.");
  45246. }
  45247. }
  45248. return new PDFImage({
  45249. xref,
  45250. res,
  45251. image: imageData,
  45252. isInline,
  45253. smask: smaskData,
  45254. mask: maskData,
  45255. pdfFunctionFactory,
  45256. localColorSpaceCache
  45257. });
  45258. }
  45259. static createMask({
  45260. imgArray,
  45261. width,
  45262. height,
  45263. imageIsFromDecodeStream,
  45264. inverseDecode,
  45265. interpolate
  45266. }) {
  45267. const computedLength = (width + 7 >> 3) * height;
  45268. const actualLength = imgArray.byteLength;
  45269. const haveFullData = computedLength === actualLength;
  45270. let data, i;
  45271. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  45272. data = imgArray;
  45273. } else if (!inverseDecode) {
  45274. data = new Uint8ClampedArray(actualLength);
  45275. data.set(imgArray);
  45276. } else {
  45277. data = new Uint8ClampedArray(computedLength);
  45278. data.set(imgArray);
  45279. for (i = actualLength; i < computedLength; i++) {
  45280. data[i] = 0xff;
  45281. }
  45282. }
  45283. if (inverseDecode) {
  45284. for (i = 0; i < actualLength; i++) {
  45285. data[i] ^= 0xff;
  45286. }
  45287. }
  45288. return {
  45289. data,
  45290. width,
  45291. height,
  45292. interpolate
  45293. };
  45294. }
  45295. get drawWidth() {
  45296. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  45297. }
  45298. get drawHeight() {
  45299. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  45300. }
  45301. decodeBuffer(buffer) {
  45302. const bpc = this.bpc;
  45303. const numComps = this.numComps;
  45304. const decodeAddends = this.decodeAddends;
  45305. const decodeCoefficients = this.decodeCoefficients;
  45306. const max = (1 << bpc) - 1;
  45307. let i, ii;
  45308. if (bpc === 1) {
  45309. for (i = 0, ii = buffer.length; i < ii; i++) {
  45310. buffer[i] = +!buffer[i];
  45311. }
  45312. return;
  45313. }
  45314. let index = 0;
  45315. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  45316. for (let j = 0; j < numComps; j++) {
  45317. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  45318. index++;
  45319. }
  45320. }
  45321. }
  45322. getComponents(buffer) {
  45323. const bpc = this.bpc;
  45324. if (bpc === 8) {
  45325. return buffer;
  45326. }
  45327. const width = this.width;
  45328. const height = this.height;
  45329. const numComps = this.numComps;
  45330. const length = width * height * numComps;
  45331. let bufferPos = 0;
  45332. let output;
  45333. if (bpc <= 8) {
  45334. output = new Uint8Array(length);
  45335. } else if (bpc <= 16) {
  45336. output = new Uint16Array(length);
  45337. } else {
  45338. output = new Uint32Array(length);
  45339. }
  45340. const rowComps = width * numComps;
  45341. const max = (1 << bpc) - 1;
  45342. let i = 0,
  45343. ii,
  45344. buf;
  45345. if (bpc === 1) {
  45346. let mask, loop1End, loop2End;
  45347. for (let j = 0; j < height; j++) {
  45348. loop1End = i + (rowComps & ~7);
  45349. loop2End = i + rowComps;
  45350. while (i < loop1End) {
  45351. buf = buffer[bufferPos++];
  45352. output[i] = buf >> 7 & 1;
  45353. output[i + 1] = buf >> 6 & 1;
  45354. output[i + 2] = buf >> 5 & 1;
  45355. output[i + 3] = buf >> 4 & 1;
  45356. output[i + 4] = buf >> 3 & 1;
  45357. output[i + 5] = buf >> 2 & 1;
  45358. output[i + 6] = buf >> 1 & 1;
  45359. output[i + 7] = buf & 1;
  45360. i += 8;
  45361. }
  45362. if (i < loop2End) {
  45363. buf = buffer[bufferPos++];
  45364. mask = 128;
  45365. while (i < loop2End) {
  45366. output[i++] = +!!(buf & mask);
  45367. mask >>= 1;
  45368. }
  45369. }
  45370. }
  45371. } else {
  45372. let bits = 0;
  45373. buf = 0;
  45374. for (i = 0, ii = length; i < ii; ++i) {
  45375. if (i % rowComps === 0) {
  45376. buf = 0;
  45377. bits = 0;
  45378. }
  45379. while (bits < bpc) {
  45380. buf = buf << 8 | buffer[bufferPos++];
  45381. bits += 8;
  45382. }
  45383. const remainingBits = bits - bpc;
  45384. let value = buf >> remainingBits;
  45385. if (value < 0) {
  45386. value = 0;
  45387. } else if (value > max) {
  45388. value = max;
  45389. }
  45390. output[i] = value;
  45391. buf &= (1 << remainingBits) - 1;
  45392. bits = remainingBits;
  45393. }
  45394. }
  45395. return output;
  45396. }
  45397. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  45398. const smask = this.smask;
  45399. const mask = this.mask;
  45400. let alphaBuf, sw, sh, i, ii, j;
  45401. if (smask) {
  45402. sw = smask.width;
  45403. sh = smask.height;
  45404. alphaBuf = new Uint8ClampedArray(sw * sh);
  45405. smask.fillGrayBuffer(alphaBuf);
  45406. if (sw !== width || sh !== height) {
  45407. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  45408. }
  45409. } else if (mask) {
  45410. if (mask instanceof PDFImage) {
  45411. sw = mask.width;
  45412. sh = mask.height;
  45413. alphaBuf = new Uint8ClampedArray(sw * sh);
  45414. mask.numComps = 1;
  45415. mask.fillGrayBuffer(alphaBuf);
  45416. for (i = 0, ii = sw * sh; i < ii; ++i) {
  45417. alphaBuf[i] = 255 - alphaBuf[i];
  45418. }
  45419. if (sw !== width || sh !== height) {
  45420. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  45421. }
  45422. } else if (Array.isArray(mask)) {
  45423. alphaBuf = new Uint8ClampedArray(width * height);
  45424. const numComps = this.numComps;
  45425. for (i = 0, ii = width * height; i < ii; ++i) {
  45426. let opacity = 0;
  45427. const imageOffset = i * numComps;
  45428. for (j = 0; j < numComps; ++j) {
  45429. const color = image[imageOffset + j];
  45430. const maskOffset = j * 2;
  45431. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  45432. opacity = 255;
  45433. break;
  45434. }
  45435. }
  45436. alphaBuf[i] = opacity;
  45437. }
  45438. } else {
  45439. throw new _util.FormatError("Unknown mask format.");
  45440. }
  45441. }
  45442. if (alphaBuf) {
  45443. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  45444. rgbaBuf[j] = alphaBuf[i];
  45445. }
  45446. } else {
  45447. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  45448. rgbaBuf[j] = 255;
  45449. }
  45450. }
  45451. }
  45452. undoPreblend(buffer, width, height) {
  45453. const matte = this.smask && this.smask.matte;
  45454. if (!matte) {
  45455. return;
  45456. }
  45457. const matteRgb = this.colorSpace.getRgb(matte, 0);
  45458. const matteR = matteRgb[0];
  45459. const matteG = matteRgb[1];
  45460. const matteB = matteRgb[2];
  45461. const length = width * height * 4;
  45462. for (let i = 0; i < length; i += 4) {
  45463. const alpha = buffer[i + 3];
  45464. if (alpha === 0) {
  45465. buffer[i] = 255;
  45466. buffer[i + 1] = 255;
  45467. buffer[i + 2] = 255;
  45468. continue;
  45469. }
  45470. const k = 255 / alpha;
  45471. buffer[i] = (buffer[i] - matteR) * k + matteR;
  45472. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  45473. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  45474. }
  45475. }
  45476. createImageData(forceRGBA = false) {
  45477. const drawWidth = this.drawWidth;
  45478. const drawHeight = this.drawHeight;
  45479. const imgData = {
  45480. width: drawWidth,
  45481. height: drawHeight,
  45482. interpolate: this.interpolate,
  45483. kind: 0,
  45484. data: null
  45485. };
  45486. const numComps = this.numComps;
  45487. const originalWidth = this.width;
  45488. const originalHeight = this.height;
  45489. const bpc = this.bpc;
  45490. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  45491. let imgArray;
  45492. if (!forceRGBA) {
  45493. let kind;
  45494. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  45495. kind = _util.ImageKind.GRAYSCALE_1BPP;
  45496. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  45497. kind = _util.ImageKind.RGB_24BPP;
  45498. }
  45499. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  45500. imgData.kind = kind;
  45501. imgArray = this.getImageBytes(originalHeight * rowBytes);
  45502. if (this.image instanceof _decode_stream.DecodeStream) {
  45503. imgData.data = imgArray;
  45504. } else {
  45505. const newArray = new Uint8ClampedArray(imgArray.length);
  45506. newArray.set(imgArray);
  45507. imgData.data = newArray;
  45508. }
  45509. if (this.needsDecode) {
  45510. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  45511. const buffer = imgData.data;
  45512. for (let i = 0, ii = buffer.length; i < ii; i++) {
  45513. buffer[i] ^= 0xff;
  45514. }
  45515. }
  45516. return imgData;
  45517. }
  45518. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  45519. let imageLength = originalHeight * rowBytes;
  45520. switch (this.colorSpace.name) {
  45521. case "DeviceGray":
  45522. imageLength *= 3;
  45523. case "DeviceRGB":
  45524. case "DeviceCMYK":
  45525. imgData.kind = _util.ImageKind.RGB_24BPP;
  45526. imgData.data = this.getImageBytes(imageLength, drawWidth, drawHeight, true);
  45527. return imgData;
  45528. }
  45529. }
  45530. }
  45531. imgArray = this.getImageBytes(originalHeight * rowBytes);
  45532. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  45533. const comps = this.getComponents(imgArray);
  45534. let alpha01, maybeUndoPreblend;
  45535. if (!forceRGBA && !this.smask && !this.mask) {
  45536. imgData.kind = _util.ImageKind.RGB_24BPP;
  45537. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  45538. alpha01 = 0;
  45539. maybeUndoPreblend = false;
  45540. } else {
  45541. imgData.kind = _util.ImageKind.RGBA_32BPP;
  45542. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  45543. alpha01 = 1;
  45544. maybeUndoPreblend = true;
  45545. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  45546. }
  45547. if (this.needsDecode) {
  45548. this.decodeBuffer(comps);
  45549. }
  45550. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  45551. if (maybeUndoPreblend) {
  45552. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  45553. }
  45554. return imgData;
  45555. }
  45556. fillGrayBuffer(buffer) {
  45557. const numComps = this.numComps;
  45558. if (numComps !== 1) {
  45559. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  45560. }
  45561. const width = this.width;
  45562. const height = this.height;
  45563. const bpc = this.bpc;
  45564. const rowBytes = width * numComps * bpc + 7 >> 3;
  45565. const imgArray = this.getImageBytes(height * rowBytes);
  45566. const comps = this.getComponents(imgArray);
  45567. let i, length;
  45568. if (bpc === 1) {
  45569. length = width * height;
  45570. if (this.needsDecode) {
  45571. for (i = 0; i < length; ++i) {
  45572. buffer[i] = comps[i] - 1 & 255;
  45573. }
  45574. } else {
  45575. for (i = 0; i < length; ++i) {
  45576. buffer[i] = -comps[i] & 255;
  45577. }
  45578. }
  45579. return;
  45580. }
  45581. if (this.needsDecode) {
  45582. this.decodeBuffer(comps);
  45583. }
  45584. length = width * height;
  45585. const scale = 255 / ((1 << bpc) - 1);
  45586. for (i = 0; i < length; ++i) {
  45587. buffer[i] = scale * comps[i];
  45588. }
  45589. }
  45590. getImageBytes(length, drawWidth, drawHeight, forceRGB = false) {
  45591. this.image.reset();
  45592. this.image.drawWidth = drawWidth || this.width;
  45593. this.image.drawHeight = drawHeight || this.height;
  45594. this.image.forceRGB = !!forceRGB;
  45595. return this.image.getBytes(length, true);
  45596. }
  45597. }
  45598. exports.PDFImage = PDFImage;
  45599. /***/ }),
  45600. /* 64 */
  45601. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45602. Object.defineProperty(exports, "__esModule", ({
  45603. value: true
  45604. }));
  45605. exports.Catalog = void 0;
  45606. var _primitives = __w_pdfjs_require__(5);
  45607. var _core_utils = __w_pdfjs_require__(9);
  45608. var _util = __w_pdfjs_require__(2);
  45609. var _name_number_tree = __w_pdfjs_require__(65);
  45610. var _colorspace = __w_pdfjs_require__(24);
  45611. var _file_spec = __w_pdfjs_require__(66);
  45612. var _image_utils = __w_pdfjs_require__(58);
  45613. var _metadata_parser = __w_pdfjs_require__(67);
  45614. var _struct_tree = __w_pdfjs_require__(69);
  45615. function fetchDestination(dest) {
  45616. if (dest instanceof _primitives.Dict) {
  45617. dest = dest.get("D");
  45618. }
  45619. return Array.isArray(dest) ? dest : null;
  45620. }
  45621. class Catalog {
  45622. constructor(pdfManager, xref) {
  45623. this.pdfManager = pdfManager;
  45624. this.xref = xref;
  45625. this._catDict = xref.getCatalogObj();
  45626. if (!(0, _primitives.isDict)(this._catDict)) {
  45627. throw new _util.FormatError("Catalog object is not a dictionary.");
  45628. }
  45629. this.fontCache = new _primitives.RefSetCache();
  45630. this.builtInCMapCache = new Map();
  45631. this.standardFontDataCache = new Map();
  45632. this.globalImageCache = new _image_utils.GlobalImageCache();
  45633. this.pageKidsCountCache = new _primitives.RefSetCache();
  45634. this.pageIndexCache = new _primitives.RefSetCache();
  45635. this.nonBlendModesSet = new _primitives.RefSet();
  45636. }
  45637. get version() {
  45638. const version = this._catDict.get("Version");
  45639. if (!(0, _primitives.isName)(version)) {
  45640. return (0, _util.shadow)(this, "version", null);
  45641. }
  45642. return (0, _util.shadow)(this, "version", version.name);
  45643. }
  45644. get needsRendering() {
  45645. const needsRendering = this._catDict.get("NeedsRendering");
  45646. if (!(0, _util.isBool)(needsRendering)) {
  45647. return (0, _util.shadow)(this, "needsRendering", false);
  45648. }
  45649. return (0, _util.shadow)(this, "needsRendering", needsRendering);
  45650. }
  45651. get collection() {
  45652. let collection = null;
  45653. try {
  45654. const obj = this._catDict.get("Collection");
  45655. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  45656. collection = obj;
  45657. }
  45658. } catch (ex) {
  45659. if (ex instanceof _core_utils.MissingDataException) {
  45660. throw ex;
  45661. }
  45662. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  45663. }
  45664. return (0, _util.shadow)(this, "collection", collection);
  45665. }
  45666. get acroForm() {
  45667. let acroForm = null;
  45668. try {
  45669. const obj = this._catDict.get("AcroForm");
  45670. if ((0, _primitives.isDict)(obj) && obj.size > 0) {
  45671. acroForm = obj;
  45672. }
  45673. } catch (ex) {
  45674. if (ex instanceof _core_utils.MissingDataException) {
  45675. throw ex;
  45676. }
  45677. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  45678. }
  45679. return (0, _util.shadow)(this, "acroForm", acroForm);
  45680. }
  45681. get acroFormRef() {
  45682. const value = this._catDict.getRaw("AcroForm");
  45683. return (0, _util.shadow)(this, "acroFormRef", (0, _primitives.isRef)(value) ? value : null);
  45684. }
  45685. get metadata() {
  45686. const streamRef = this._catDict.getRaw("Metadata");
  45687. if (!(0, _primitives.isRef)(streamRef)) {
  45688. return (0, _util.shadow)(this, "metadata", null);
  45689. }
  45690. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  45691. const stream = this.xref.fetch(streamRef, suppressEncryption);
  45692. let metadata = null;
  45693. if ((0, _primitives.isStream)(stream) && (0, _primitives.isDict)(stream.dict)) {
  45694. const type = stream.dict.get("Type");
  45695. const subtype = stream.dict.get("Subtype");
  45696. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  45697. try {
  45698. const data = (0, _util.stringToUTF8String)(stream.getString());
  45699. if (data) {
  45700. metadata = new _metadata_parser.MetadataParser(data).serializable;
  45701. }
  45702. } catch (e) {
  45703. if (e instanceof _core_utils.MissingDataException) {
  45704. throw e;
  45705. }
  45706. (0, _util.info)("Skipping invalid metadata.");
  45707. }
  45708. }
  45709. }
  45710. return (0, _util.shadow)(this, "metadata", metadata);
  45711. }
  45712. get markInfo() {
  45713. let markInfo = null;
  45714. try {
  45715. markInfo = this._readMarkInfo();
  45716. } catch (ex) {
  45717. if (ex instanceof _core_utils.MissingDataException) {
  45718. throw ex;
  45719. }
  45720. (0, _util.warn)("Unable to read mark info.");
  45721. }
  45722. return (0, _util.shadow)(this, "markInfo", markInfo);
  45723. }
  45724. _readMarkInfo() {
  45725. const obj = this._catDict.get("MarkInfo");
  45726. if (!(0, _primitives.isDict)(obj)) {
  45727. return null;
  45728. }
  45729. const markInfo = Object.assign(Object.create(null), {
  45730. Marked: false,
  45731. UserProperties: false,
  45732. Suspects: false
  45733. });
  45734. for (const key in markInfo) {
  45735. if (!obj.has(key)) {
  45736. continue;
  45737. }
  45738. const value = obj.get(key);
  45739. if (!(0, _util.isBool)(value)) {
  45740. continue;
  45741. }
  45742. markInfo[key] = value;
  45743. }
  45744. return markInfo;
  45745. }
  45746. get structTreeRoot() {
  45747. let structTree = null;
  45748. try {
  45749. structTree = this._readStructTreeRoot();
  45750. } catch (ex) {
  45751. if (ex instanceof _core_utils.MissingDataException) {
  45752. throw ex;
  45753. }
  45754. (0, _util.warn)("Unable read to structTreeRoot info.");
  45755. }
  45756. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  45757. }
  45758. _readStructTreeRoot() {
  45759. const obj = this._catDict.get("StructTreeRoot");
  45760. if (!(0, _primitives.isDict)(obj)) {
  45761. return null;
  45762. }
  45763. const root = new _struct_tree.StructTreeRoot(obj);
  45764. root.init();
  45765. return root;
  45766. }
  45767. get toplevelPagesDict() {
  45768. const pagesObj = this._catDict.get("Pages");
  45769. if (!(0, _primitives.isDict)(pagesObj)) {
  45770. throw new _util.FormatError("Invalid top-level pages dictionary.");
  45771. }
  45772. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  45773. }
  45774. get documentOutline() {
  45775. let obj = null;
  45776. try {
  45777. obj = this._readDocumentOutline();
  45778. } catch (ex) {
  45779. if (ex instanceof _core_utils.MissingDataException) {
  45780. throw ex;
  45781. }
  45782. (0, _util.warn)("Unable to read document outline.");
  45783. }
  45784. return (0, _util.shadow)(this, "documentOutline", obj);
  45785. }
  45786. _readDocumentOutline() {
  45787. let obj = this._catDict.get("Outlines");
  45788. if (!(0, _primitives.isDict)(obj)) {
  45789. return null;
  45790. }
  45791. obj = obj.getRaw("First");
  45792. if (!(0, _primitives.isRef)(obj)) {
  45793. return null;
  45794. }
  45795. const root = {
  45796. items: []
  45797. };
  45798. const queue = [{
  45799. obj,
  45800. parent: root
  45801. }];
  45802. const processed = new _primitives.RefSet();
  45803. processed.put(obj);
  45804. const xref = this.xref,
  45805. blackColor = new Uint8ClampedArray(3);
  45806. while (queue.length > 0) {
  45807. const i = queue.shift();
  45808. const outlineDict = xref.fetchIfRef(i.obj);
  45809. if (outlineDict === null) {
  45810. continue;
  45811. }
  45812. if (!outlineDict.has("Title")) {
  45813. throw new _util.FormatError("Invalid outline item encountered.");
  45814. }
  45815. const data = {
  45816. url: null,
  45817. dest: null
  45818. };
  45819. Catalog.parseDestDictionary({
  45820. destDict: outlineDict,
  45821. resultObj: data,
  45822. docBaseUrl: this.pdfManager.docBaseUrl
  45823. });
  45824. const title = outlineDict.get("Title");
  45825. const flags = outlineDict.get("F") || 0;
  45826. const color = outlineDict.getArray("C");
  45827. const count = outlineDict.get("Count");
  45828. let rgbColor = blackColor;
  45829. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  45830. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  45831. }
  45832. const outlineItem = {
  45833. dest: data.dest,
  45834. url: data.url,
  45835. unsafeUrl: data.unsafeUrl,
  45836. newWindow: data.newWindow,
  45837. title: (0, _util.stringToPDFString)(title),
  45838. color: rgbColor,
  45839. count: Number.isInteger(count) ? count : undefined,
  45840. bold: !!(flags & 2),
  45841. italic: !!(flags & 1),
  45842. items: []
  45843. };
  45844. i.parent.items.push(outlineItem);
  45845. obj = outlineDict.getRaw("First");
  45846. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  45847. queue.push({
  45848. obj,
  45849. parent: outlineItem
  45850. });
  45851. processed.put(obj);
  45852. }
  45853. obj = outlineDict.getRaw("Next");
  45854. if ((0, _primitives.isRef)(obj) && !processed.has(obj)) {
  45855. queue.push({
  45856. obj,
  45857. parent: i.parent
  45858. });
  45859. processed.put(obj);
  45860. }
  45861. }
  45862. return root.items.length > 0 ? root.items : null;
  45863. }
  45864. get permissions() {
  45865. let permissions = null;
  45866. try {
  45867. permissions = this._readPermissions();
  45868. } catch (ex) {
  45869. if (ex instanceof _core_utils.MissingDataException) {
  45870. throw ex;
  45871. }
  45872. (0, _util.warn)("Unable to read permissions.");
  45873. }
  45874. return (0, _util.shadow)(this, "permissions", permissions);
  45875. }
  45876. _readPermissions() {
  45877. const encrypt = this.xref.trailer.get("Encrypt");
  45878. if (!(0, _primitives.isDict)(encrypt)) {
  45879. return null;
  45880. }
  45881. let flags = encrypt.get("P");
  45882. if (!(0, _util.isNum)(flags)) {
  45883. return null;
  45884. }
  45885. flags += 2 ** 32;
  45886. const permissions = [];
  45887. for (const key in _util.PermissionFlag) {
  45888. const value = _util.PermissionFlag[key];
  45889. if (flags & value) {
  45890. permissions.push(value);
  45891. }
  45892. }
  45893. return permissions;
  45894. }
  45895. get optionalContentConfig() {
  45896. let config = null;
  45897. try {
  45898. const properties = this._catDict.get("OCProperties");
  45899. if (!properties) {
  45900. return (0, _util.shadow)(this, "optionalContentConfig", null);
  45901. }
  45902. const defaultConfig = properties.get("D");
  45903. if (!defaultConfig) {
  45904. return (0, _util.shadow)(this, "optionalContentConfig", null);
  45905. }
  45906. const groupsData = properties.get("OCGs");
  45907. if (!Array.isArray(groupsData)) {
  45908. return (0, _util.shadow)(this, "optionalContentConfig", null);
  45909. }
  45910. const groups = [];
  45911. const groupRefs = [];
  45912. for (const groupRef of groupsData) {
  45913. if (!(0, _primitives.isRef)(groupRef)) {
  45914. continue;
  45915. }
  45916. groupRefs.push(groupRef);
  45917. const group = this.xref.fetchIfRef(groupRef);
  45918. groups.push({
  45919. id: groupRef.toString(),
  45920. name: (0, _util.isString)(group.get("Name")) ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  45921. intent: (0, _util.isString)(group.get("Intent")) ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  45922. });
  45923. }
  45924. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  45925. config.groups = groups;
  45926. } catch (ex) {
  45927. if (ex instanceof _core_utils.MissingDataException) {
  45928. throw ex;
  45929. }
  45930. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  45931. }
  45932. return (0, _util.shadow)(this, "optionalContentConfig", config);
  45933. }
  45934. _readOptionalContentConfig(config, contentGroupRefs) {
  45935. function parseOnOff(refs) {
  45936. const onParsed = [];
  45937. if (Array.isArray(refs)) {
  45938. for (const value of refs) {
  45939. if (!(0, _primitives.isRef)(value)) {
  45940. continue;
  45941. }
  45942. if (contentGroupRefs.includes(value)) {
  45943. onParsed.push(value.toString());
  45944. }
  45945. }
  45946. }
  45947. return onParsed;
  45948. }
  45949. function parseOrder(refs, nestedLevels = 0) {
  45950. if (!Array.isArray(refs)) {
  45951. return null;
  45952. }
  45953. const order = [];
  45954. for (const value of refs) {
  45955. if ((0, _primitives.isRef)(value) && contentGroupRefs.includes(value)) {
  45956. parsedOrderRefs.put(value);
  45957. order.push(value.toString());
  45958. continue;
  45959. }
  45960. const nestedOrder = parseNestedOrder(value, nestedLevels);
  45961. if (nestedOrder) {
  45962. order.push(nestedOrder);
  45963. }
  45964. }
  45965. if (nestedLevels > 0) {
  45966. return order;
  45967. }
  45968. const hiddenGroups = [];
  45969. for (const groupRef of contentGroupRefs) {
  45970. if (parsedOrderRefs.has(groupRef)) {
  45971. continue;
  45972. }
  45973. hiddenGroups.push(groupRef.toString());
  45974. }
  45975. if (hiddenGroups.length) {
  45976. order.push({
  45977. name: null,
  45978. order: hiddenGroups
  45979. });
  45980. }
  45981. return order;
  45982. }
  45983. function parseNestedOrder(ref, nestedLevels) {
  45984. if (++nestedLevels > MAX_NESTED_LEVELS) {
  45985. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  45986. return null;
  45987. }
  45988. const value = xref.fetchIfRef(ref);
  45989. if (!Array.isArray(value)) {
  45990. return null;
  45991. }
  45992. const nestedName = xref.fetchIfRef(value[0]);
  45993. if (typeof nestedName !== "string") {
  45994. return null;
  45995. }
  45996. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  45997. if (!nestedOrder || !nestedOrder.length) {
  45998. return null;
  45999. }
  46000. return {
  46001. name: (0, _util.stringToPDFString)(nestedName),
  46002. order: nestedOrder
  46003. };
  46004. }
  46005. const xref = this.xref,
  46006. parsedOrderRefs = new _primitives.RefSet(),
  46007. MAX_NESTED_LEVELS = 10;
  46008. return {
  46009. name: (0, _util.isString)(config.get("Name")) ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  46010. creator: (0, _util.isString)(config.get("Creator")) ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  46011. baseState: (0, _primitives.isName)(config.get("BaseState")) ? config.get("BaseState").name : null,
  46012. on: parseOnOff(config.get("ON")),
  46013. off: parseOnOff(config.get("OFF")),
  46014. order: parseOrder(config.get("Order")),
  46015. groups: null
  46016. };
  46017. }
  46018. get numPages() {
  46019. const obj = this.toplevelPagesDict.get("Count");
  46020. if (!Number.isInteger(obj)) {
  46021. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  46022. }
  46023. return (0, _util.shadow)(this, "numPages", obj);
  46024. }
  46025. get destinations() {
  46026. const obj = this._readDests(),
  46027. dests = Object.create(null);
  46028. if (obj instanceof _name_number_tree.NameTree) {
  46029. for (const [key, value] of obj.getAll()) {
  46030. const dest = fetchDestination(value);
  46031. if (dest) {
  46032. dests[key] = dest;
  46033. }
  46034. }
  46035. } else if (obj instanceof _primitives.Dict) {
  46036. obj.forEach(function (key, value) {
  46037. const dest = fetchDestination(value);
  46038. if (dest) {
  46039. dests[key] = dest;
  46040. }
  46041. });
  46042. }
  46043. return (0, _util.shadow)(this, "destinations", dests);
  46044. }
  46045. getDestination(id) {
  46046. const obj = this._readDests();
  46047. if (obj instanceof _name_number_tree.NameTree) {
  46048. const dest = fetchDestination(obj.get(id));
  46049. if (dest) {
  46050. return dest;
  46051. }
  46052. const allDest = this.destinations[id];
  46053. if (allDest) {
  46054. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  46055. return allDest;
  46056. }
  46057. } else if (obj instanceof _primitives.Dict) {
  46058. const dest = fetchDestination(obj.get(id));
  46059. if (dest) {
  46060. return dest;
  46061. }
  46062. }
  46063. return null;
  46064. }
  46065. _readDests() {
  46066. const obj = this._catDict.get("Names");
  46067. if (obj && obj.has("Dests")) {
  46068. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  46069. } else if (this._catDict.has("Dests")) {
  46070. return this._catDict.get("Dests");
  46071. }
  46072. return undefined;
  46073. }
  46074. get pageLabels() {
  46075. let obj = null;
  46076. try {
  46077. obj = this._readPageLabels();
  46078. } catch (ex) {
  46079. if (ex instanceof _core_utils.MissingDataException) {
  46080. throw ex;
  46081. }
  46082. (0, _util.warn)("Unable to read page labels.");
  46083. }
  46084. return (0, _util.shadow)(this, "pageLabels", obj);
  46085. }
  46086. _readPageLabels() {
  46087. const obj = this._catDict.getRaw("PageLabels");
  46088. if (!obj) {
  46089. return null;
  46090. }
  46091. const pageLabels = new Array(this.numPages);
  46092. let style = null,
  46093. prefix = "";
  46094. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  46095. const nums = numberTree.getAll();
  46096. let currentLabel = "",
  46097. currentIndex = 1;
  46098. for (let i = 0, ii = this.numPages; i < ii; i++) {
  46099. const labelDict = nums.get(i);
  46100. if (labelDict !== undefined) {
  46101. if (!(0, _primitives.isDict)(labelDict)) {
  46102. throw new _util.FormatError("PageLabel is not a dictionary.");
  46103. }
  46104. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  46105. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  46106. }
  46107. if (labelDict.has("S")) {
  46108. const s = labelDict.get("S");
  46109. if (!(0, _primitives.isName)(s)) {
  46110. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  46111. }
  46112. style = s.name;
  46113. } else {
  46114. style = null;
  46115. }
  46116. if (labelDict.has("P")) {
  46117. const p = labelDict.get("P");
  46118. if (!(0, _util.isString)(p)) {
  46119. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  46120. }
  46121. prefix = (0, _util.stringToPDFString)(p);
  46122. } else {
  46123. prefix = "";
  46124. }
  46125. if (labelDict.has("St")) {
  46126. const st = labelDict.get("St");
  46127. if (!(Number.isInteger(st) && st >= 1)) {
  46128. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  46129. }
  46130. currentIndex = st;
  46131. } else {
  46132. currentIndex = 1;
  46133. }
  46134. }
  46135. switch (style) {
  46136. case "D":
  46137. currentLabel = currentIndex;
  46138. break;
  46139. case "R":
  46140. case "r":
  46141. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  46142. break;
  46143. case "A":
  46144. case "a":
  46145. const LIMIT = 26;
  46146. const A_UPPER_CASE = 0x41,
  46147. A_LOWER_CASE = 0x61;
  46148. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  46149. const letterIndex = currentIndex - 1;
  46150. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  46151. const charBuf = [];
  46152. for (let j = 0, jj = letterIndex / LIMIT | 0; j <= jj; j++) {
  46153. charBuf.push(character);
  46154. }
  46155. currentLabel = charBuf.join("");
  46156. break;
  46157. default:
  46158. if (style) {
  46159. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  46160. }
  46161. currentLabel = "";
  46162. }
  46163. pageLabels[i] = prefix + currentLabel;
  46164. currentIndex++;
  46165. }
  46166. return pageLabels;
  46167. }
  46168. get pageLayout() {
  46169. const obj = this._catDict.get("PageLayout");
  46170. let pageLayout = "";
  46171. if ((0, _primitives.isName)(obj)) {
  46172. switch (obj.name) {
  46173. case "SinglePage":
  46174. case "OneColumn":
  46175. case "TwoColumnLeft":
  46176. case "TwoColumnRight":
  46177. case "TwoPageLeft":
  46178. case "TwoPageRight":
  46179. pageLayout = obj.name;
  46180. }
  46181. }
  46182. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  46183. }
  46184. get pageMode() {
  46185. const obj = this._catDict.get("PageMode");
  46186. let pageMode = "UseNone";
  46187. if ((0, _primitives.isName)(obj)) {
  46188. switch (obj.name) {
  46189. case "UseNone":
  46190. case "UseOutlines":
  46191. case "UseThumbs":
  46192. case "FullScreen":
  46193. case "UseOC":
  46194. case "UseAttachments":
  46195. pageMode = obj.name;
  46196. }
  46197. }
  46198. return (0, _util.shadow)(this, "pageMode", pageMode);
  46199. }
  46200. get viewerPreferences() {
  46201. const ViewerPreferencesValidators = {
  46202. HideToolbar: _util.isBool,
  46203. HideMenubar: _util.isBool,
  46204. HideWindowUI: _util.isBool,
  46205. FitWindow: _util.isBool,
  46206. CenterWindow: _util.isBool,
  46207. DisplayDocTitle: _util.isBool,
  46208. NonFullScreenPageMode: _primitives.isName,
  46209. Direction: _primitives.isName,
  46210. ViewArea: _primitives.isName,
  46211. ViewClip: _primitives.isName,
  46212. PrintArea: _primitives.isName,
  46213. PrintClip: _primitives.isName,
  46214. PrintScaling: _primitives.isName,
  46215. Duplex: _primitives.isName,
  46216. PickTrayByPDFSize: _util.isBool,
  46217. PrintPageRange: Array.isArray,
  46218. NumCopies: Number.isInteger
  46219. };
  46220. const obj = this._catDict.get("ViewerPreferences");
  46221. let prefs = null;
  46222. if ((0, _primitives.isDict)(obj)) {
  46223. for (const key in ViewerPreferencesValidators) {
  46224. if (!obj.has(key)) {
  46225. continue;
  46226. }
  46227. const value = obj.get(key);
  46228. if (!ViewerPreferencesValidators[key](value)) {
  46229. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  46230. continue;
  46231. }
  46232. let prefValue;
  46233. switch (key) {
  46234. case "NonFullScreenPageMode":
  46235. switch (value.name) {
  46236. case "UseNone":
  46237. case "UseOutlines":
  46238. case "UseThumbs":
  46239. case "UseOC":
  46240. prefValue = value.name;
  46241. break;
  46242. default:
  46243. prefValue = "UseNone";
  46244. }
  46245. break;
  46246. case "Direction":
  46247. switch (value.name) {
  46248. case "L2R":
  46249. case "R2L":
  46250. prefValue = value.name;
  46251. break;
  46252. default:
  46253. prefValue = "L2R";
  46254. }
  46255. break;
  46256. case "ViewArea":
  46257. case "ViewClip":
  46258. case "PrintArea":
  46259. case "PrintClip":
  46260. switch (value.name) {
  46261. case "MediaBox":
  46262. case "CropBox":
  46263. case "BleedBox":
  46264. case "TrimBox":
  46265. case "ArtBox":
  46266. prefValue = value.name;
  46267. break;
  46268. default:
  46269. prefValue = "CropBox";
  46270. }
  46271. break;
  46272. case "PrintScaling":
  46273. switch (value.name) {
  46274. case "None":
  46275. case "AppDefault":
  46276. prefValue = value.name;
  46277. break;
  46278. default:
  46279. prefValue = "AppDefault";
  46280. }
  46281. break;
  46282. case "Duplex":
  46283. switch (value.name) {
  46284. case "Simplex":
  46285. case "DuplexFlipShortEdge":
  46286. case "DuplexFlipLongEdge":
  46287. prefValue = value.name;
  46288. break;
  46289. default:
  46290. prefValue = "None";
  46291. }
  46292. break;
  46293. case "PrintPageRange":
  46294. const length = value.length;
  46295. if (length % 2 !== 0) {
  46296. break;
  46297. }
  46298. const isValid = value.every((page, i, arr) => {
  46299. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  46300. });
  46301. if (isValid) {
  46302. prefValue = value;
  46303. }
  46304. break;
  46305. case "NumCopies":
  46306. if (value > 0) {
  46307. prefValue = value;
  46308. }
  46309. break;
  46310. default:
  46311. if (typeof value !== "boolean") {
  46312. throw new _util.FormatError(`viewerPreferences - expected a boolean value for: ${key}`);
  46313. }
  46314. prefValue = value;
  46315. }
  46316. if (prefValue !== undefined) {
  46317. if (!prefs) {
  46318. prefs = Object.create(null);
  46319. }
  46320. prefs[key] = prefValue;
  46321. } else {
  46322. (0, _util.info)(`Bad value in ViewerPreferences for "${key}".`);
  46323. }
  46324. }
  46325. }
  46326. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  46327. }
  46328. get openAction() {
  46329. const obj = this._catDict.get("OpenAction");
  46330. const openAction = Object.create(null);
  46331. if ((0, _primitives.isDict)(obj)) {
  46332. const destDict = new _primitives.Dict(this.xref);
  46333. destDict.set("A", obj);
  46334. const resultObj = {
  46335. url: null,
  46336. dest: null,
  46337. action: null
  46338. };
  46339. Catalog.parseDestDictionary({
  46340. destDict,
  46341. resultObj
  46342. });
  46343. if (Array.isArray(resultObj.dest)) {
  46344. openAction.dest = resultObj.dest;
  46345. } else if (resultObj.action) {
  46346. openAction.action = resultObj.action;
  46347. }
  46348. } else if (Array.isArray(obj)) {
  46349. openAction.dest = obj;
  46350. }
  46351. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  46352. }
  46353. get attachments() {
  46354. const obj = this._catDict.get("Names");
  46355. let attachments = null;
  46356. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  46357. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  46358. for (const [key, value] of nameTree.getAll()) {
  46359. const fs = new _file_spec.FileSpec(value, this.xref);
  46360. if (!attachments) {
  46361. attachments = Object.create(null);
  46362. }
  46363. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  46364. }
  46365. }
  46366. return (0, _util.shadow)(this, "attachments", attachments);
  46367. }
  46368. get xfaImages() {
  46369. const obj = this._catDict.get("Names");
  46370. let xfaImages = null;
  46371. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  46372. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  46373. for (const [key, value] of nameTree.getAll()) {
  46374. if (!xfaImages) {
  46375. xfaImages = new _primitives.Dict(this.xref);
  46376. }
  46377. xfaImages.set(key, value);
  46378. }
  46379. }
  46380. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  46381. }
  46382. _collectJavaScript() {
  46383. const obj = this._catDict.get("Names");
  46384. let javaScript = null;
  46385. function appendIfJavaScriptDict(name, jsDict) {
  46386. if (!(jsDict instanceof _primitives.Dict)) {
  46387. return;
  46388. }
  46389. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  46390. return;
  46391. }
  46392. let js = jsDict.get("JS");
  46393. if ((0, _primitives.isStream)(js)) {
  46394. js = js.getString();
  46395. } else if (typeof js !== "string") {
  46396. return;
  46397. }
  46398. if (javaScript === null) {
  46399. javaScript = new Map();
  46400. }
  46401. javaScript.set(name, (0, _util.stringToPDFString)(js));
  46402. }
  46403. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  46404. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  46405. for (const [key, value] of nameTree.getAll()) {
  46406. appendIfJavaScriptDict(key, value);
  46407. }
  46408. }
  46409. const openAction = this._catDict.get("OpenAction");
  46410. if (openAction) {
  46411. appendIfJavaScriptDict("OpenAction", openAction);
  46412. }
  46413. return javaScript;
  46414. }
  46415. get javaScript() {
  46416. const javaScript = this._collectJavaScript();
  46417. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  46418. }
  46419. get jsActions() {
  46420. const javaScript = this._collectJavaScript();
  46421. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  46422. if (javaScript) {
  46423. if (!actions) {
  46424. actions = Object.create(null);
  46425. }
  46426. for (const [key, val] of javaScript) {
  46427. if (key in actions) {
  46428. actions[key].push(val);
  46429. } else {
  46430. actions[key] = [val];
  46431. }
  46432. }
  46433. }
  46434. return (0, _util.shadow)(this, "jsActions", actions);
  46435. }
  46436. fontFallback(id, handler) {
  46437. const promises = [];
  46438. this.fontCache.forEach(function (promise) {
  46439. promises.push(promise);
  46440. });
  46441. return Promise.all(promises).then(translatedFonts => {
  46442. for (const translatedFont of translatedFonts) {
  46443. if (translatedFont.loadedName === id) {
  46444. translatedFont.fallback(handler);
  46445. return;
  46446. }
  46447. }
  46448. });
  46449. }
  46450. cleanup(manuallyTriggered = false) {
  46451. (0, _primitives.clearPrimitiveCaches)();
  46452. this.globalImageCache.clear(manuallyTriggered);
  46453. this.pageKidsCountCache.clear();
  46454. this.pageIndexCache.clear();
  46455. this.nonBlendModesSet.clear();
  46456. const promises = [];
  46457. this.fontCache.forEach(function (promise) {
  46458. promises.push(promise);
  46459. });
  46460. return Promise.all(promises).then(translatedFonts => {
  46461. for (const {
  46462. dict
  46463. } of translatedFonts) {
  46464. delete dict.cacheKey;
  46465. }
  46466. this.fontCache.clear();
  46467. this.builtInCMapCache.clear();
  46468. this.standardFontDataCache.clear();
  46469. });
  46470. }
  46471. getPageDict(pageIndex) {
  46472. const capability = (0, _util.createPromiseCapability)();
  46473. const nodesToVisit = [this._catDict.getRaw("Pages")];
  46474. const visitedNodes = new _primitives.RefSet();
  46475. const xref = this.xref,
  46476. pageKidsCountCache = this.pageKidsCountCache;
  46477. let count,
  46478. currentPageIndex = 0;
  46479. function next() {
  46480. while (nodesToVisit.length) {
  46481. const currentNode = nodesToVisit.pop();
  46482. if ((0, _primitives.isRef)(currentNode)) {
  46483. count = pageKidsCountCache.get(currentNode);
  46484. if (count > 0 && currentPageIndex + count < pageIndex) {
  46485. currentPageIndex += count;
  46486. continue;
  46487. }
  46488. if (visitedNodes.has(currentNode)) {
  46489. capability.reject(new _util.FormatError("Pages tree contains circular reference."));
  46490. return;
  46491. }
  46492. visitedNodes.put(currentNode);
  46493. xref.fetchAsync(currentNode).then(function (obj) {
  46494. if ((0, _primitives.isDict)(obj, "Page") || (0, _primitives.isDict)(obj) && !obj.has("Kids")) {
  46495. if (pageIndex === currentPageIndex) {
  46496. if (currentNode && !pageKidsCountCache.has(currentNode)) {
  46497. pageKidsCountCache.put(currentNode, 1);
  46498. }
  46499. capability.resolve([obj, currentNode]);
  46500. } else {
  46501. currentPageIndex++;
  46502. next();
  46503. }
  46504. return;
  46505. }
  46506. nodesToVisit.push(obj);
  46507. next();
  46508. }, capability.reject);
  46509. return;
  46510. }
  46511. if (!(0, _primitives.isDict)(currentNode)) {
  46512. capability.reject(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  46513. return;
  46514. }
  46515. count = currentNode.get("Count");
  46516. if (Number.isInteger(count) && count >= 0) {
  46517. const objId = currentNode.objId;
  46518. if (objId && !pageKidsCountCache.has(objId)) {
  46519. pageKidsCountCache.put(objId, count);
  46520. }
  46521. if (currentPageIndex + count <= pageIndex) {
  46522. currentPageIndex += count;
  46523. continue;
  46524. }
  46525. }
  46526. const kids = currentNode.get("Kids");
  46527. if (!Array.isArray(kids)) {
  46528. if ((0, _primitives.isName)(currentNode.get("Type"), "Page") || !currentNode.has("Type") && currentNode.has("Contents")) {
  46529. if (currentPageIndex === pageIndex) {
  46530. capability.resolve([currentNode, null]);
  46531. return;
  46532. }
  46533. currentPageIndex++;
  46534. continue;
  46535. }
  46536. capability.reject(new _util.FormatError("Page dictionary kids object is not an array."));
  46537. return;
  46538. }
  46539. for (let last = kids.length - 1; last >= 0; last--) {
  46540. nodesToVisit.push(kids[last]);
  46541. }
  46542. }
  46543. capability.reject(new Error(`Page index ${pageIndex} not found.`));
  46544. }
  46545. next();
  46546. return capability.promise;
  46547. }
  46548. getPageIndex(pageRef) {
  46549. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  46550. if (cachedPageIndex !== undefined) {
  46551. return Promise.resolve(cachedPageIndex);
  46552. }
  46553. const xref = this.xref;
  46554. function pagesBeforeRef(kidRef) {
  46555. let total = 0,
  46556. parentRef;
  46557. return xref.fetchAsync(kidRef).then(function (node) {
  46558. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !((0, _primitives.isDict)(node) && !node.has("Type") && node.has("Contents"))) {
  46559. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  46560. }
  46561. if (!node) {
  46562. return null;
  46563. }
  46564. if (!(0, _primitives.isDict)(node)) {
  46565. throw new _util.FormatError("Node must be a dictionary.");
  46566. }
  46567. parentRef = node.getRaw("Parent");
  46568. return node.getAsync("Parent");
  46569. }).then(function (parent) {
  46570. if (!parent) {
  46571. return null;
  46572. }
  46573. if (!(0, _primitives.isDict)(parent)) {
  46574. throw new _util.FormatError("Parent must be a dictionary.");
  46575. }
  46576. return parent.getAsync("Kids");
  46577. }).then(function (kids) {
  46578. if (!kids) {
  46579. return null;
  46580. }
  46581. const kidPromises = [];
  46582. let found = false;
  46583. for (let i = 0, ii = kids.length; i < ii; i++) {
  46584. const kid = kids[i];
  46585. if (!(0, _primitives.isRef)(kid)) {
  46586. throw new _util.FormatError("Kid must be a reference.");
  46587. }
  46588. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  46589. found = true;
  46590. break;
  46591. }
  46592. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  46593. if (!(0, _primitives.isDict)(obj)) {
  46594. throw new _util.FormatError("Kid node must be a dictionary.");
  46595. }
  46596. if (obj.has("Count")) {
  46597. total += obj.get("Count");
  46598. } else {
  46599. total++;
  46600. }
  46601. }));
  46602. }
  46603. if (!found) {
  46604. throw new _util.FormatError("Kid reference not found in parent's kids.");
  46605. }
  46606. return Promise.all(kidPromises).then(function () {
  46607. return [total, parentRef];
  46608. });
  46609. });
  46610. }
  46611. let total = 0;
  46612. const next = ref => pagesBeforeRef(ref).then(args => {
  46613. if (!args) {
  46614. this.pageIndexCache.put(pageRef, total);
  46615. return total;
  46616. }
  46617. const [count, parentRef] = args;
  46618. total += count;
  46619. return next(parentRef);
  46620. });
  46621. return next(pageRef);
  46622. }
  46623. static parseDestDictionary(params) {
  46624. const destDict = params.destDict;
  46625. if (!(0, _primitives.isDict)(destDict)) {
  46626. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  46627. return;
  46628. }
  46629. const resultObj = params.resultObj;
  46630. if (typeof resultObj !== "object") {
  46631. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  46632. return;
  46633. }
  46634. const docBaseUrl = params.docBaseUrl || null;
  46635. let action = destDict.get("A"),
  46636. url,
  46637. dest;
  46638. if (!(0, _primitives.isDict)(action)) {
  46639. if (destDict.has("Dest")) {
  46640. action = destDict.get("Dest");
  46641. } else {
  46642. action = destDict.get("AA");
  46643. if ((0, _primitives.isDict)(action)) {
  46644. if (action.has("D")) {
  46645. action = action.get("D");
  46646. } else if (action.has("U")) {
  46647. action = action.get("U");
  46648. }
  46649. }
  46650. }
  46651. }
  46652. if ((0, _primitives.isDict)(action)) {
  46653. const actionType = action.get("S");
  46654. if (!(0, _primitives.isName)(actionType)) {
  46655. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  46656. return;
  46657. }
  46658. const actionName = actionType.name;
  46659. switch (actionName) {
  46660. case "ResetForm":
  46661. const flags = action.get("Flags");
  46662. const include = (((0, _util.isNum)(flags) ? flags : 0) & 1) === 0;
  46663. const fields = [];
  46664. const refs = [];
  46665. for (const obj of action.get("Fields") || []) {
  46666. if ((0, _primitives.isRef)(obj)) {
  46667. refs.push(obj.toString());
  46668. } else if ((0, _util.isString)(obj)) {
  46669. fields.push((0, _util.stringToPDFString)(obj));
  46670. }
  46671. }
  46672. resultObj.resetForm = {
  46673. fields,
  46674. refs,
  46675. include
  46676. };
  46677. break;
  46678. case "URI":
  46679. url = action.get("URI");
  46680. if (url instanceof _primitives.Name) {
  46681. url = "/" + url.name;
  46682. }
  46683. break;
  46684. case "GoTo":
  46685. dest = action.get("D");
  46686. break;
  46687. case "Launch":
  46688. case "GoToR":
  46689. const urlDict = action.get("F");
  46690. if ((0, _primitives.isDict)(urlDict)) {
  46691. url = urlDict.get("F") || null;
  46692. } else if ((0, _util.isString)(urlDict)) {
  46693. url = urlDict;
  46694. }
  46695. let remoteDest = action.get("D");
  46696. if (remoteDest) {
  46697. if ((0, _primitives.isName)(remoteDest)) {
  46698. remoteDest = remoteDest.name;
  46699. }
  46700. if ((0, _util.isString)(url)) {
  46701. const baseUrl = url.split("#")[0];
  46702. if ((0, _util.isString)(remoteDest)) {
  46703. url = baseUrl + "#" + remoteDest;
  46704. } else if (Array.isArray(remoteDest)) {
  46705. url = baseUrl + "#" + JSON.stringify(remoteDest);
  46706. }
  46707. }
  46708. }
  46709. const newWindow = action.get("NewWindow");
  46710. if ((0, _util.isBool)(newWindow)) {
  46711. resultObj.newWindow = newWindow;
  46712. }
  46713. break;
  46714. case "Named":
  46715. const namedAction = action.get("N");
  46716. if ((0, _primitives.isName)(namedAction)) {
  46717. resultObj.action = namedAction.name;
  46718. }
  46719. break;
  46720. case "JavaScript":
  46721. const jsAction = action.get("JS");
  46722. let js;
  46723. if ((0, _primitives.isStream)(jsAction)) {
  46724. js = jsAction.getString();
  46725. } else if ((0, _util.isString)(jsAction)) {
  46726. js = jsAction;
  46727. }
  46728. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  46729. if (jsURL) {
  46730. url = jsURL.url;
  46731. resultObj.newWindow = jsURL.newWindow;
  46732. break;
  46733. }
  46734. default:
  46735. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  46736. break;
  46737. }
  46738. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  46739. break;
  46740. }
  46741. } else if (destDict.has("Dest")) {
  46742. dest = destDict.get("Dest");
  46743. }
  46744. if ((0, _util.isString)(url)) {
  46745. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  46746. addDefaultProtocol: true,
  46747. tryConvertEncoding: true
  46748. });
  46749. if (absoluteUrl) {
  46750. resultObj.url = absoluteUrl.href;
  46751. }
  46752. resultObj.unsafeUrl = url;
  46753. }
  46754. if (dest) {
  46755. if ((0, _primitives.isName)(dest)) {
  46756. dest = dest.name;
  46757. }
  46758. if ((0, _util.isString)(dest) || Array.isArray(dest)) {
  46759. resultObj.dest = dest;
  46760. }
  46761. }
  46762. }
  46763. }
  46764. exports.Catalog = Catalog;
  46765. /***/ }),
  46766. /* 65 */
  46767. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46768. Object.defineProperty(exports, "__esModule", ({
  46769. value: true
  46770. }));
  46771. exports.NumberTree = exports.NameTree = void 0;
  46772. var _util = __w_pdfjs_require__(2);
  46773. var _primitives = __w_pdfjs_require__(5);
  46774. class NameOrNumberTree {
  46775. constructor(root, xref, type) {
  46776. if (this.constructor === NameOrNumberTree) {
  46777. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  46778. }
  46779. this.root = root;
  46780. this.xref = xref;
  46781. this._type = type;
  46782. }
  46783. getAll() {
  46784. const map = new Map();
  46785. if (!this.root) {
  46786. return map;
  46787. }
  46788. const xref = this.xref;
  46789. const processed = new _primitives.RefSet();
  46790. processed.put(this.root);
  46791. const queue = [this.root];
  46792. while (queue.length > 0) {
  46793. const obj = xref.fetchIfRef(queue.shift());
  46794. if (!(0, _primitives.isDict)(obj)) {
  46795. continue;
  46796. }
  46797. if (obj.has("Kids")) {
  46798. const kids = obj.get("Kids");
  46799. for (let i = 0, ii = kids.length; i < ii; i++) {
  46800. const kid = kids[i];
  46801. if (processed.has(kid)) {
  46802. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  46803. }
  46804. queue.push(kid);
  46805. processed.put(kid);
  46806. }
  46807. continue;
  46808. }
  46809. const entries = obj.get(this._type);
  46810. if (!Array.isArray(entries)) {
  46811. continue;
  46812. }
  46813. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  46814. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  46815. }
  46816. }
  46817. return map;
  46818. }
  46819. get(key) {
  46820. if (!this.root) {
  46821. return null;
  46822. }
  46823. const xref = this.xref;
  46824. let kidsOrEntries = xref.fetchIfRef(this.root);
  46825. let loopCount = 0;
  46826. const MAX_LEVELS = 10;
  46827. while (kidsOrEntries.has("Kids")) {
  46828. if (++loopCount > MAX_LEVELS) {
  46829. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  46830. return null;
  46831. }
  46832. const kids = kidsOrEntries.get("Kids");
  46833. if (!Array.isArray(kids)) {
  46834. return null;
  46835. }
  46836. let l = 0,
  46837. r = kids.length - 1;
  46838. while (l <= r) {
  46839. const m = l + r >> 1;
  46840. const kid = xref.fetchIfRef(kids[m]);
  46841. const limits = kid.get("Limits");
  46842. if (key < xref.fetchIfRef(limits[0])) {
  46843. r = m - 1;
  46844. } else if (key > xref.fetchIfRef(limits[1])) {
  46845. l = m + 1;
  46846. } else {
  46847. kidsOrEntries = xref.fetchIfRef(kids[m]);
  46848. break;
  46849. }
  46850. }
  46851. if (l > r) {
  46852. return null;
  46853. }
  46854. }
  46855. const entries = kidsOrEntries.get(this._type);
  46856. if (Array.isArray(entries)) {
  46857. let l = 0,
  46858. r = entries.length - 2;
  46859. while (l <= r) {
  46860. const tmp = l + r >> 1,
  46861. m = tmp + (tmp & 1);
  46862. const currentKey = xref.fetchIfRef(entries[m]);
  46863. if (key < currentKey) {
  46864. r = m - 2;
  46865. } else if (key > currentKey) {
  46866. l = m + 2;
  46867. } else {
  46868. return xref.fetchIfRef(entries[m + 1]);
  46869. }
  46870. }
  46871. }
  46872. return null;
  46873. }
  46874. }
  46875. class NameTree extends NameOrNumberTree {
  46876. constructor(root, xref) {
  46877. super(root, xref, "Names");
  46878. }
  46879. }
  46880. exports.NameTree = NameTree;
  46881. class NumberTree extends NameOrNumberTree {
  46882. constructor(root, xref) {
  46883. super(root, xref, "Nums");
  46884. }
  46885. }
  46886. exports.NumberTree = NumberTree;
  46887. /***/ }),
  46888. /* 66 */
  46889. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46890. Object.defineProperty(exports, "__esModule", ({
  46891. value: true
  46892. }));
  46893. exports.FileSpec = void 0;
  46894. var _primitives = __w_pdfjs_require__(5);
  46895. var _util = __w_pdfjs_require__(2);
  46896. function pickPlatformItem(dict) {
  46897. if (dict.has("UF")) {
  46898. return dict.get("UF");
  46899. } else if (dict.has("F")) {
  46900. return dict.get("F");
  46901. } else if (dict.has("Unix")) {
  46902. return dict.get("Unix");
  46903. } else if (dict.has("Mac")) {
  46904. return dict.get("Mac");
  46905. } else if (dict.has("DOS")) {
  46906. return dict.get("DOS");
  46907. }
  46908. return null;
  46909. }
  46910. class FileSpec {
  46911. constructor(root, xref) {
  46912. if (!root || !(0, _primitives.isDict)(root)) {
  46913. return;
  46914. }
  46915. this.xref = xref;
  46916. this.root = root;
  46917. if (root.has("FS")) {
  46918. this.fs = root.get("FS");
  46919. }
  46920. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  46921. if (root.has("RF")) {
  46922. (0, _util.warn)("Related file specifications are not supported");
  46923. }
  46924. this.contentAvailable = true;
  46925. if (!root.has("EF")) {
  46926. this.contentAvailable = false;
  46927. (0, _util.warn)("Non-embedded file specifications are not supported");
  46928. }
  46929. }
  46930. get filename() {
  46931. if (!this._filename && this.root) {
  46932. const filename = pickPlatformItem(this.root) || "unnamed";
  46933. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  46934. }
  46935. return this._filename;
  46936. }
  46937. get content() {
  46938. if (!this.contentAvailable) {
  46939. return null;
  46940. }
  46941. if (!this.contentRef && this.root) {
  46942. this.contentRef = pickPlatformItem(this.root.get("EF"));
  46943. }
  46944. let content = null;
  46945. if (this.contentRef) {
  46946. const fileObj = this.xref.fetchIfRef(this.contentRef);
  46947. if (fileObj && (0, _primitives.isStream)(fileObj)) {
  46948. content = fileObj.getBytes();
  46949. } else {
  46950. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  46951. }
  46952. } else {
  46953. (0, _util.warn)("Embedded file specification does not have a content");
  46954. }
  46955. return content;
  46956. }
  46957. get serializable() {
  46958. return {
  46959. filename: this.filename,
  46960. content: this.content
  46961. };
  46962. }
  46963. }
  46964. exports.FileSpec = FileSpec;
  46965. /***/ }),
  46966. /* 67 */
  46967. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46968. Object.defineProperty(exports, "__esModule", ({
  46969. value: true
  46970. }));
  46971. exports.MetadataParser = void 0;
  46972. var _xml_parser = __w_pdfjs_require__(68);
  46973. class MetadataParser {
  46974. constructor(data) {
  46975. data = this._repair(data);
  46976. const parser = new _xml_parser.SimpleXMLParser({
  46977. lowerCaseName: true
  46978. });
  46979. const xmlDocument = parser.parseFromString(data);
  46980. this._metadataMap = new Map();
  46981. this._data = data;
  46982. if (xmlDocument) {
  46983. this._parse(xmlDocument);
  46984. }
  46985. }
  46986. _repair(data) {
  46987. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  46988. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  46989. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  46990. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  46991. switch (name) {
  46992. case "amp":
  46993. return "&";
  46994. case "apos":
  46995. return "'";
  46996. case "gt":
  46997. return ">";
  46998. case "lt":
  46999. return "<";
  47000. case "quot":
  47001. return '"';
  47002. }
  47003. throw new Error(`_repair: ${name} isn't defined.`);
  47004. });
  47005. const charBuf = [];
  47006. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  47007. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  47008. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  47009. charBuf.push(String.fromCharCode(code));
  47010. } else {
  47011. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  47012. }
  47013. }
  47014. return ">" + charBuf.join("");
  47015. });
  47016. }
  47017. _getSequence(entry) {
  47018. const name = entry.nodeName;
  47019. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  47020. return null;
  47021. }
  47022. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  47023. }
  47024. _parseArray(entry) {
  47025. if (!entry.hasChildNodes()) {
  47026. return;
  47027. }
  47028. const [seqNode] = entry.childNodes;
  47029. const sequence = this._getSequence(seqNode) || [];
  47030. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  47031. }
  47032. _parse(xmlDocument) {
  47033. let rdf = xmlDocument.documentElement;
  47034. if (rdf.nodeName !== "rdf:rdf") {
  47035. rdf = rdf.firstChild;
  47036. while (rdf && rdf.nodeName !== "rdf:rdf") {
  47037. rdf = rdf.nextSibling;
  47038. }
  47039. }
  47040. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  47041. return;
  47042. }
  47043. for (const desc of rdf.childNodes) {
  47044. if (desc.nodeName !== "rdf:description") {
  47045. continue;
  47046. }
  47047. for (const entry of desc.childNodes) {
  47048. const name = entry.nodeName;
  47049. switch (name) {
  47050. case "#text":
  47051. continue;
  47052. case "dc:creator":
  47053. case "dc:subject":
  47054. this._parseArray(entry);
  47055. continue;
  47056. }
  47057. this._metadataMap.set(name, entry.textContent.trim());
  47058. }
  47059. }
  47060. }
  47061. get serializable() {
  47062. return {
  47063. parsedData: this._metadataMap,
  47064. rawData: this._data
  47065. };
  47066. }
  47067. }
  47068. exports.MetadataParser = MetadataParser;
  47069. /***/ }),
  47070. /* 68 */
  47071. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47072. Object.defineProperty(exports, "__esModule", ({
  47073. value: true
  47074. }));
  47075. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  47076. var _core_utils = __w_pdfjs_require__(9);
  47077. const XMLParserErrorCode = {
  47078. NoError: 0,
  47079. EndOfDocument: -1,
  47080. UnterminatedCdat: -2,
  47081. UnterminatedXmlDeclaration: -3,
  47082. UnterminatedDoctypeDeclaration: -4,
  47083. UnterminatedComment: -5,
  47084. MalformedElement: -6,
  47085. OutOfMemory: -7,
  47086. UnterminatedAttributeValue: -8,
  47087. UnterminatedElement: -9,
  47088. ElementNeverBegun: -10
  47089. };
  47090. exports.XMLParserErrorCode = XMLParserErrorCode;
  47091. function isWhitespace(s, index) {
  47092. const ch = s[index];
  47093. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  47094. }
  47095. function isWhitespaceString(s) {
  47096. for (let i = 0, ii = s.length; i < ii; i++) {
  47097. if (!isWhitespace(s, i)) {
  47098. return false;
  47099. }
  47100. }
  47101. return true;
  47102. }
  47103. class XMLParserBase {
  47104. _resolveEntities(s) {
  47105. return s.replace(/&([^;]+);/g, (all, entity) => {
  47106. if (entity.substring(0, 2) === "#x") {
  47107. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  47108. } else if (entity.substring(0, 1) === "#") {
  47109. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  47110. }
  47111. switch (entity) {
  47112. case "lt":
  47113. return "<";
  47114. case "gt":
  47115. return ">";
  47116. case "amp":
  47117. return "&";
  47118. case "quot":
  47119. return '"';
  47120. case "apos":
  47121. return "'";
  47122. }
  47123. return this.onResolveEntity(entity);
  47124. });
  47125. }
  47126. _parseContent(s, start) {
  47127. const attributes = [];
  47128. let pos = start;
  47129. function skipWs() {
  47130. while (pos < s.length && isWhitespace(s, pos)) {
  47131. ++pos;
  47132. }
  47133. }
  47134. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  47135. ++pos;
  47136. }
  47137. const name = s.substring(start, pos);
  47138. skipWs();
  47139. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  47140. skipWs();
  47141. let attrName = "",
  47142. attrValue = "";
  47143. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  47144. attrName += s[pos];
  47145. ++pos;
  47146. }
  47147. skipWs();
  47148. if (s[pos] !== "=") {
  47149. return null;
  47150. }
  47151. ++pos;
  47152. skipWs();
  47153. const attrEndChar = s[pos];
  47154. if (attrEndChar !== '"' && attrEndChar !== "'") {
  47155. return null;
  47156. }
  47157. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  47158. if (attrEndIndex < 0) {
  47159. return null;
  47160. }
  47161. attrValue = s.substring(pos, attrEndIndex);
  47162. attributes.push({
  47163. name: attrName,
  47164. value: this._resolveEntities(attrValue)
  47165. });
  47166. pos = attrEndIndex + 1;
  47167. skipWs();
  47168. }
  47169. return {
  47170. name,
  47171. attributes,
  47172. parsed: pos - start
  47173. };
  47174. }
  47175. _parseProcessingInstruction(s, start) {
  47176. let pos = start;
  47177. function skipWs() {
  47178. while (pos < s.length && isWhitespace(s, pos)) {
  47179. ++pos;
  47180. }
  47181. }
  47182. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  47183. ++pos;
  47184. }
  47185. const name = s.substring(start, pos);
  47186. skipWs();
  47187. const attrStart = pos;
  47188. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  47189. ++pos;
  47190. }
  47191. const value = s.substring(attrStart, pos);
  47192. return {
  47193. name,
  47194. value,
  47195. parsed: pos - start
  47196. };
  47197. }
  47198. parseXml(s) {
  47199. let i = 0;
  47200. while (i < s.length) {
  47201. const ch = s[i];
  47202. let j = i;
  47203. if (ch === "<") {
  47204. ++j;
  47205. const ch2 = s[j];
  47206. let q;
  47207. switch (ch2) {
  47208. case "/":
  47209. ++j;
  47210. q = s.indexOf(">", j);
  47211. if (q < 0) {
  47212. this.onError(XMLParserErrorCode.UnterminatedElement);
  47213. return;
  47214. }
  47215. this.onEndElement(s.substring(j, q));
  47216. j = q + 1;
  47217. break;
  47218. case "?":
  47219. ++j;
  47220. const pi = this._parseProcessingInstruction(s, j);
  47221. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  47222. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  47223. return;
  47224. }
  47225. this.onPi(pi.name, pi.value);
  47226. j += pi.parsed + 2;
  47227. break;
  47228. case "!":
  47229. if (s.substring(j + 1, j + 3) === "--") {
  47230. q = s.indexOf("-->", j + 3);
  47231. if (q < 0) {
  47232. this.onError(XMLParserErrorCode.UnterminatedComment);
  47233. return;
  47234. }
  47235. this.onComment(s.substring(j + 3, q));
  47236. j = q + 3;
  47237. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  47238. q = s.indexOf("]]>", j + 8);
  47239. if (q < 0) {
  47240. this.onError(XMLParserErrorCode.UnterminatedCdat);
  47241. return;
  47242. }
  47243. this.onCdata(s.substring(j + 8, q));
  47244. j = q + 3;
  47245. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  47246. const q2 = s.indexOf("[", j + 8);
  47247. let complexDoctype = false;
  47248. q = s.indexOf(">", j + 8);
  47249. if (q < 0) {
  47250. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47251. return;
  47252. }
  47253. if (q2 > 0 && q > q2) {
  47254. q = s.indexOf("]>", j + 8);
  47255. if (q < 0) {
  47256. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  47257. return;
  47258. }
  47259. complexDoctype = true;
  47260. }
  47261. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  47262. this.onDoctype(doctypeContent);
  47263. j = q + (complexDoctype ? 2 : 1);
  47264. } else {
  47265. this.onError(XMLParserErrorCode.MalformedElement);
  47266. return;
  47267. }
  47268. break;
  47269. default:
  47270. const content = this._parseContent(s, j);
  47271. if (content === null) {
  47272. this.onError(XMLParserErrorCode.MalformedElement);
  47273. return;
  47274. }
  47275. let isClosed = false;
  47276. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  47277. isClosed = true;
  47278. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  47279. this.onError(XMLParserErrorCode.UnterminatedElement);
  47280. return;
  47281. }
  47282. this.onBeginElement(content.name, content.attributes, isClosed);
  47283. j += content.parsed + (isClosed ? 2 : 1);
  47284. break;
  47285. }
  47286. } else {
  47287. while (j < s.length && s[j] !== "<") {
  47288. j++;
  47289. }
  47290. const text = s.substring(i, j);
  47291. this.onText(this._resolveEntities(text));
  47292. }
  47293. i = j;
  47294. }
  47295. }
  47296. onResolveEntity(name) {
  47297. return `&${name};`;
  47298. }
  47299. onPi(name, value) {}
  47300. onComment(text) {}
  47301. onCdata(text) {}
  47302. onDoctype(doctypeContent) {}
  47303. onText(text) {}
  47304. onBeginElement(name, attributes, isEmpty) {}
  47305. onEndElement(name) {}
  47306. onError(code) {}
  47307. }
  47308. exports.XMLParserBase = XMLParserBase;
  47309. class SimpleDOMNode {
  47310. constructor(nodeName, nodeValue) {
  47311. this.nodeName = nodeName;
  47312. this.nodeValue = nodeValue;
  47313. Object.defineProperty(this, "parentNode", {
  47314. value: null,
  47315. writable: true
  47316. });
  47317. }
  47318. get firstChild() {
  47319. return this.childNodes && this.childNodes[0];
  47320. }
  47321. get nextSibling() {
  47322. const childNodes = this.parentNode.childNodes;
  47323. if (!childNodes) {
  47324. return undefined;
  47325. }
  47326. const index = childNodes.indexOf(this);
  47327. if (index === -1) {
  47328. return undefined;
  47329. }
  47330. return childNodes[index + 1];
  47331. }
  47332. get textContent() {
  47333. if (!this.childNodes) {
  47334. return this.nodeValue || "";
  47335. }
  47336. return this.childNodes.map(function (child) {
  47337. return child.textContent;
  47338. }).join("");
  47339. }
  47340. hasChildNodes() {
  47341. return this.childNodes && this.childNodes.length > 0;
  47342. }
  47343. searchNode(paths, pos) {
  47344. if (pos >= paths.length) {
  47345. return this;
  47346. }
  47347. const component = paths[pos];
  47348. const stack = [];
  47349. let node = this;
  47350. while (true) {
  47351. if (component.name === node.nodeName) {
  47352. if (component.pos === 0) {
  47353. const res = node.searchNode(paths, pos + 1);
  47354. if (res !== null) {
  47355. return res;
  47356. }
  47357. } else if (stack.length === 0) {
  47358. return null;
  47359. } else {
  47360. const [parent] = stack.pop();
  47361. let siblingPos = 0;
  47362. for (const child of parent.childNodes) {
  47363. if (component.name === child.nodeName) {
  47364. if (siblingPos === component.pos) {
  47365. return child.searchNode(paths, pos + 1);
  47366. }
  47367. siblingPos++;
  47368. }
  47369. }
  47370. return node.searchNode(paths, pos + 1);
  47371. }
  47372. }
  47373. if (node.childNodes && node.childNodes.length !== 0) {
  47374. stack.push([node, 0]);
  47375. node = node.childNodes[0];
  47376. } else if (stack.length === 0) {
  47377. return null;
  47378. } else {
  47379. while (stack.length !== 0) {
  47380. const [parent, currentPos] = stack.pop();
  47381. const newPos = currentPos + 1;
  47382. if (newPos < parent.childNodes.length) {
  47383. stack.push([parent, newPos]);
  47384. node = parent.childNodes[newPos];
  47385. break;
  47386. }
  47387. }
  47388. if (stack.length === 0) {
  47389. return null;
  47390. }
  47391. }
  47392. }
  47393. }
  47394. dump(buffer) {
  47395. if (this.nodeName === "#text") {
  47396. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  47397. return;
  47398. }
  47399. buffer.push(`<${this.nodeName}`);
  47400. if (this.attributes) {
  47401. for (const attribute of this.attributes) {
  47402. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  47403. }
  47404. }
  47405. if (this.hasChildNodes()) {
  47406. buffer.push(">");
  47407. for (const child of this.childNodes) {
  47408. child.dump(buffer);
  47409. }
  47410. buffer.push(`</${this.nodeName}>`);
  47411. } else if (this.nodeValue) {
  47412. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  47413. } else {
  47414. buffer.push("/>");
  47415. }
  47416. }
  47417. }
  47418. exports.SimpleDOMNode = SimpleDOMNode;
  47419. class SimpleXMLParser extends XMLParserBase {
  47420. constructor({
  47421. hasAttributes = false,
  47422. lowerCaseName = false
  47423. }) {
  47424. super();
  47425. this._currentFragment = null;
  47426. this._stack = null;
  47427. this._errorCode = XMLParserErrorCode.NoError;
  47428. this._hasAttributes = hasAttributes;
  47429. this._lowerCaseName = lowerCaseName;
  47430. }
  47431. parseFromString(data) {
  47432. this._currentFragment = [];
  47433. this._stack = [];
  47434. this._errorCode = XMLParserErrorCode.NoError;
  47435. this.parseXml(data);
  47436. if (this._errorCode !== XMLParserErrorCode.NoError) {
  47437. return undefined;
  47438. }
  47439. const [documentElement] = this._currentFragment;
  47440. if (!documentElement) {
  47441. return undefined;
  47442. }
  47443. return {
  47444. documentElement
  47445. };
  47446. }
  47447. onText(text) {
  47448. if (isWhitespaceString(text)) {
  47449. return;
  47450. }
  47451. const node = new SimpleDOMNode("#text", text);
  47452. this._currentFragment.push(node);
  47453. }
  47454. onCdata(text) {
  47455. const node = new SimpleDOMNode("#text", text);
  47456. this._currentFragment.push(node);
  47457. }
  47458. onBeginElement(name, attributes, isEmpty) {
  47459. if (this._lowerCaseName) {
  47460. name = name.toLowerCase();
  47461. }
  47462. const node = new SimpleDOMNode(name);
  47463. node.childNodes = [];
  47464. if (this._hasAttributes) {
  47465. node.attributes = attributes;
  47466. }
  47467. this._currentFragment.push(node);
  47468. if (isEmpty) {
  47469. return;
  47470. }
  47471. this._stack.push(this._currentFragment);
  47472. this._currentFragment = node.childNodes;
  47473. }
  47474. onEndElement(name) {
  47475. this._currentFragment = this._stack.pop() || [];
  47476. const lastElement = this._currentFragment[this._currentFragment.length - 1];
  47477. if (!lastElement) {
  47478. return;
  47479. }
  47480. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  47481. lastElement.childNodes[i].parentNode = lastElement;
  47482. }
  47483. }
  47484. onError(code) {
  47485. this._errorCode = code;
  47486. }
  47487. }
  47488. exports.SimpleXMLParser = SimpleXMLParser;
  47489. /***/ }),
  47490. /* 69 */
  47491. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47492. Object.defineProperty(exports, "__esModule", ({
  47493. value: true
  47494. }));
  47495. exports.StructTreeRoot = exports.StructTreePage = void 0;
  47496. var _primitives = __w_pdfjs_require__(5);
  47497. var _util = __w_pdfjs_require__(2);
  47498. var _name_number_tree = __w_pdfjs_require__(65);
  47499. const MAX_DEPTH = 40;
  47500. const StructElementType = {
  47501. PAGE_CONTENT: "PAGE_CONTENT",
  47502. STREAM_CONTENT: "STREAM_CONTENT",
  47503. OBJECT: "OBJECT",
  47504. ELEMENT: "ELEMENT"
  47505. };
  47506. class StructTreeRoot {
  47507. constructor(rootDict) {
  47508. this.dict = rootDict;
  47509. this.roleMap = new Map();
  47510. }
  47511. init() {
  47512. this.readRoleMap();
  47513. }
  47514. readRoleMap() {
  47515. const roleMapDict = this.dict.get("RoleMap");
  47516. if (!(0, _primitives.isDict)(roleMapDict)) {
  47517. return;
  47518. }
  47519. roleMapDict.forEach((key, value) => {
  47520. if (!(0, _primitives.isName)(value)) {
  47521. return;
  47522. }
  47523. this.roleMap.set(key, value.name);
  47524. });
  47525. }
  47526. }
  47527. exports.StructTreeRoot = StructTreeRoot;
  47528. class StructElementNode {
  47529. constructor(tree, dict) {
  47530. this.tree = tree;
  47531. this.dict = dict;
  47532. this.kids = [];
  47533. this.parseKids();
  47534. }
  47535. get role() {
  47536. const nameObj = this.dict.get("S");
  47537. const name = (0, _primitives.isName)(nameObj) ? nameObj.name : "";
  47538. const {
  47539. root
  47540. } = this.tree;
  47541. if (root.roleMap.has(name)) {
  47542. return root.roleMap.get(name);
  47543. }
  47544. return name;
  47545. }
  47546. parseKids() {
  47547. let pageObjId = null;
  47548. const objRef = this.dict.getRaw("Pg");
  47549. if ((0, _primitives.isRef)(objRef)) {
  47550. pageObjId = objRef.toString();
  47551. }
  47552. const kids = this.dict.get("K");
  47553. if (Array.isArray(kids)) {
  47554. for (const kid of kids) {
  47555. const element = this.parseKid(pageObjId, kid);
  47556. if (element) {
  47557. this.kids.push(element);
  47558. }
  47559. }
  47560. } else {
  47561. const element = this.parseKid(pageObjId, kids);
  47562. if (element) {
  47563. this.kids.push(element);
  47564. }
  47565. }
  47566. }
  47567. parseKid(pageObjId, kid) {
  47568. if (Number.isInteger(kid)) {
  47569. if (this.tree.pageDict.objId !== pageObjId) {
  47570. return null;
  47571. }
  47572. return new StructElement({
  47573. type: StructElementType.PAGE_CONTENT,
  47574. mcid: kid,
  47575. pageObjId
  47576. });
  47577. }
  47578. let kidDict = null;
  47579. if ((0, _primitives.isRef)(kid)) {
  47580. kidDict = this.dict.xref.fetch(kid);
  47581. } else if ((0, _primitives.isDict)(kid)) {
  47582. kidDict = kid;
  47583. }
  47584. if (!kidDict) {
  47585. return null;
  47586. }
  47587. const pageRef = kidDict.getRaw("Pg");
  47588. if ((0, _primitives.isRef)(pageRef)) {
  47589. pageObjId = pageRef.toString();
  47590. }
  47591. const type = (0, _primitives.isName)(kidDict.get("Type")) ? kidDict.get("Type").name : null;
  47592. if (type === "MCR") {
  47593. if (this.tree.pageDict.objId !== pageObjId) {
  47594. return null;
  47595. }
  47596. return new StructElement({
  47597. type: StructElementType.STREAM_CONTENT,
  47598. refObjId: (0, _primitives.isRef)(kidDict.getRaw("Stm")) ? kidDict.getRaw("Stm").toString() : null,
  47599. pageObjId,
  47600. mcid: kidDict.get("MCID")
  47601. });
  47602. }
  47603. if (type === "OBJR") {
  47604. if (this.tree.pageDict.objId !== pageObjId) {
  47605. return null;
  47606. }
  47607. return new StructElement({
  47608. type: StructElementType.OBJECT,
  47609. refObjId: (0, _primitives.isRef)(kidDict.getRaw("Obj")) ? kidDict.getRaw("Obj").toString() : null,
  47610. pageObjId
  47611. });
  47612. }
  47613. return new StructElement({
  47614. type: StructElementType.ELEMENT,
  47615. dict: kidDict
  47616. });
  47617. }
  47618. }
  47619. class StructElement {
  47620. constructor({
  47621. type,
  47622. dict = null,
  47623. mcid = null,
  47624. pageObjId = null,
  47625. refObjId = null
  47626. }) {
  47627. this.type = type;
  47628. this.dict = dict;
  47629. this.mcid = mcid;
  47630. this.pageObjId = pageObjId;
  47631. this.refObjId = refObjId;
  47632. this.parentNode = null;
  47633. }
  47634. }
  47635. class StructTreePage {
  47636. constructor(structTreeRoot, pageDict) {
  47637. this.root = structTreeRoot;
  47638. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  47639. this.pageDict = pageDict;
  47640. this.nodes = [];
  47641. }
  47642. parse() {
  47643. if (!this.root || !this.rootDict) {
  47644. return;
  47645. }
  47646. const parentTree = this.rootDict.get("ParentTree");
  47647. if (!parentTree) {
  47648. return;
  47649. }
  47650. const id = this.pageDict.get("StructParents");
  47651. if (!Number.isInteger(id)) {
  47652. return;
  47653. }
  47654. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  47655. const parentArray = numberTree.get(id);
  47656. if (!Array.isArray(parentArray)) {
  47657. return;
  47658. }
  47659. const map = new Map();
  47660. for (const ref of parentArray) {
  47661. if ((0, _primitives.isRef)(ref)) {
  47662. this.addNode(this.rootDict.xref.fetch(ref), map);
  47663. }
  47664. }
  47665. }
  47666. addNode(dict, map, level = 0) {
  47667. if (level > MAX_DEPTH) {
  47668. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  47669. return null;
  47670. }
  47671. if (map.has(dict)) {
  47672. return map.get(dict);
  47673. }
  47674. const element = new StructElementNode(this, dict);
  47675. map.set(dict, element);
  47676. const parent = dict.get("P");
  47677. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  47678. if (!this.addTopLevelNode(dict, element)) {
  47679. map.delete(dict);
  47680. }
  47681. return element;
  47682. }
  47683. const parentNode = this.addNode(parent, map, level + 1);
  47684. if (!parentNode) {
  47685. return element;
  47686. }
  47687. let save = false;
  47688. for (const kid of parentNode.kids) {
  47689. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  47690. kid.parentNode = element;
  47691. save = true;
  47692. }
  47693. }
  47694. if (!save) {
  47695. map.delete(dict);
  47696. }
  47697. return element;
  47698. }
  47699. addTopLevelNode(dict, element) {
  47700. const obj = this.rootDict.get("K");
  47701. if (!obj) {
  47702. return false;
  47703. }
  47704. if ((0, _primitives.isDict)(obj)) {
  47705. if (obj.objId !== dict.objId) {
  47706. return false;
  47707. }
  47708. this.nodes[0] = element;
  47709. return true;
  47710. }
  47711. if (!Array.isArray(obj)) {
  47712. return true;
  47713. }
  47714. let save = false;
  47715. for (let i = 0; i < obj.length; i++) {
  47716. const kidRef = obj[i];
  47717. if (kidRef && kidRef.toString() === dict.objId) {
  47718. this.nodes[i] = element;
  47719. save = true;
  47720. }
  47721. }
  47722. return save;
  47723. }
  47724. get serializable() {
  47725. function nodeToSerializable(node, parent, level = 0) {
  47726. if (level > MAX_DEPTH) {
  47727. (0, _util.warn)("StructTree too deep to be fully serialized.");
  47728. return;
  47729. }
  47730. const obj = Object.create(null);
  47731. obj.role = node.role;
  47732. obj.children = [];
  47733. parent.children.push(obj);
  47734. const alt = node.dict.get("Alt");
  47735. if ((0, _util.isString)(alt)) {
  47736. obj.alt = (0, _util.stringToPDFString)(alt);
  47737. }
  47738. for (const kid of node.kids) {
  47739. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  47740. if (kidElement) {
  47741. nodeToSerializable(kidElement, obj, level + 1);
  47742. continue;
  47743. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  47744. obj.children.push({
  47745. type: "content",
  47746. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  47747. });
  47748. } else if (kid.type === StructElementType.OBJECT) {
  47749. obj.children.push({
  47750. type: "object",
  47751. id: kid.refObjId
  47752. });
  47753. }
  47754. }
  47755. }
  47756. const root = Object.create(null);
  47757. root.children = [];
  47758. root.role = "Root";
  47759. for (const child of this.nodes) {
  47760. if (!child) {
  47761. continue;
  47762. }
  47763. nodeToSerializable(child, root);
  47764. }
  47765. return root;
  47766. }
  47767. }
  47768. exports.StructTreePage = StructTreePage;
  47769. /***/ }),
  47770. /* 70 */
  47771. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47772. Object.defineProperty(exports, "__esModule", ({
  47773. value: true
  47774. }));
  47775. exports.ObjectLoader = void 0;
  47776. var _primitives = __w_pdfjs_require__(5);
  47777. var _core_utils = __w_pdfjs_require__(9);
  47778. var _util = __w_pdfjs_require__(2);
  47779. function mayHaveChildren(value) {
  47780. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || Array.isArray(value) || (0, _primitives.isStream)(value);
  47781. }
  47782. function addChildren(node, nodesToVisit) {
  47783. if (node instanceof _primitives.Dict) {
  47784. node = node.getRawValues();
  47785. } else if ((0, _primitives.isStream)(node)) {
  47786. node = node.dict.getRawValues();
  47787. } else if (!Array.isArray(node)) {
  47788. return;
  47789. }
  47790. for (const rawValue of node) {
  47791. if (mayHaveChildren(rawValue)) {
  47792. nodesToVisit.push(rawValue);
  47793. }
  47794. }
  47795. }
  47796. class ObjectLoader {
  47797. constructor(dict, keys, xref) {
  47798. this.dict = dict;
  47799. this.keys = keys;
  47800. this.xref = xref;
  47801. this.refSet = null;
  47802. }
  47803. async load() {
  47804. if (this.xref.stream.isDataLoaded) {
  47805. return undefined;
  47806. }
  47807. const {
  47808. keys,
  47809. dict
  47810. } = this;
  47811. this.refSet = new _primitives.RefSet();
  47812. const nodesToVisit = [];
  47813. for (let i = 0, ii = keys.length; i < ii; i++) {
  47814. const rawValue = dict.getRaw(keys[i]);
  47815. if (rawValue !== undefined) {
  47816. nodesToVisit.push(rawValue);
  47817. }
  47818. }
  47819. return this._walk(nodesToVisit);
  47820. }
  47821. async _walk(nodesToVisit) {
  47822. const nodesToRevisit = [];
  47823. const pendingRequests = [];
  47824. while (nodesToVisit.length) {
  47825. let currentNode = nodesToVisit.pop();
  47826. if (currentNode instanceof _primitives.Ref) {
  47827. if (this.refSet.has(currentNode)) {
  47828. continue;
  47829. }
  47830. try {
  47831. this.refSet.put(currentNode);
  47832. currentNode = this.xref.fetch(currentNode);
  47833. } catch (ex) {
  47834. if (!(ex instanceof _core_utils.MissingDataException)) {
  47835. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  47836. this.refSet = null;
  47837. const {
  47838. manager
  47839. } = this.xref.stream;
  47840. return manager.requestAllChunks();
  47841. }
  47842. nodesToRevisit.push(currentNode);
  47843. pendingRequests.push({
  47844. begin: ex.begin,
  47845. end: ex.end
  47846. });
  47847. }
  47848. }
  47849. if ((0, _primitives.isStream)(currentNode)) {
  47850. const baseStreams = currentNode.getBaseStreams();
  47851. if (baseStreams) {
  47852. let foundMissingData = false;
  47853. for (const stream of baseStreams) {
  47854. if (stream.isDataLoaded) {
  47855. continue;
  47856. }
  47857. foundMissingData = true;
  47858. pendingRequests.push({
  47859. begin: stream.start,
  47860. end: stream.end
  47861. });
  47862. }
  47863. if (foundMissingData) {
  47864. nodesToRevisit.push(currentNode);
  47865. }
  47866. }
  47867. }
  47868. addChildren(currentNode, nodesToVisit);
  47869. }
  47870. if (pendingRequests.length) {
  47871. await this.xref.stream.manager.requestRanges(pendingRequests);
  47872. for (const node of nodesToRevisit) {
  47873. if (node instanceof _primitives.Ref) {
  47874. this.refSet.remove(node);
  47875. }
  47876. }
  47877. return this._walk(nodesToRevisit);
  47878. }
  47879. this.refSet = null;
  47880. return undefined;
  47881. }
  47882. }
  47883. exports.ObjectLoader = ObjectLoader;
  47884. /***/ }),
  47885. /* 71 */
  47886. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47887. Object.defineProperty(exports, "__esModule", ({
  47888. value: true
  47889. }));
  47890. exports.incrementalUpdate = incrementalUpdate;
  47891. exports.writeDict = writeDict;
  47892. var _util = __w_pdfjs_require__(2);
  47893. var _primitives = __w_pdfjs_require__(5);
  47894. var _core_utils = __w_pdfjs_require__(9);
  47895. var _xml_parser = __w_pdfjs_require__(68);
  47896. var _crypto = __w_pdfjs_require__(72);
  47897. function writeDict(dict, buffer, transform) {
  47898. buffer.push("<<");
  47899. for (const key of dict.getKeys()) {
  47900. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  47901. writeValue(dict.getRaw(key), buffer, transform);
  47902. }
  47903. buffer.push(">>");
  47904. }
  47905. function writeStream(stream, buffer, transform) {
  47906. writeDict(stream.dict, buffer, transform);
  47907. buffer.push(" stream\n");
  47908. let string = stream.getString();
  47909. if (transform !== null) {
  47910. string = transform.encryptString(string);
  47911. }
  47912. buffer.push(string, "\nendstream\n");
  47913. }
  47914. function writeArray(array, buffer, transform) {
  47915. buffer.push("[");
  47916. let first = true;
  47917. for (const val of array) {
  47918. if (!first) {
  47919. buffer.push(" ");
  47920. } else {
  47921. first = false;
  47922. }
  47923. writeValue(val, buffer, transform);
  47924. }
  47925. buffer.push("]");
  47926. }
  47927. function numberToString(value) {
  47928. if (Number.isInteger(value)) {
  47929. return value.toString();
  47930. }
  47931. const roundedValue = Math.round(value * 100);
  47932. if (roundedValue % 100 === 0) {
  47933. return (roundedValue / 100).toString();
  47934. }
  47935. if (roundedValue % 10 === 0) {
  47936. return value.toFixed(1);
  47937. }
  47938. return value.toFixed(2);
  47939. }
  47940. function writeValue(value, buffer, transform) {
  47941. if ((0, _primitives.isName)(value)) {
  47942. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  47943. } else if ((0, _primitives.isRef)(value)) {
  47944. buffer.push(`${value.num} ${value.gen} R`);
  47945. } else if (Array.isArray(value)) {
  47946. writeArray(value, buffer, transform);
  47947. } else if (typeof value === "string") {
  47948. if (transform !== null) {
  47949. value = transform.encryptString(value);
  47950. }
  47951. buffer.push(`(${(0, _util.escapeString)(value)})`);
  47952. } else if (typeof value === "number") {
  47953. buffer.push(numberToString(value));
  47954. } else if (typeof value === "boolean") {
  47955. buffer.push(value.toString());
  47956. } else if ((0, _primitives.isDict)(value)) {
  47957. writeDict(value, buffer, transform);
  47958. } else if ((0, _primitives.isStream)(value)) {
  47959. writeStream(value, buffer, transform);
  47960. } else if (value === null) {
  47961. buffer.push("null");
  47962. } else {
  47963. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  47964. }
  47965. }
  47966. function writeInt(number, size, offset, buffer) {
  47967. for (let i = size + offset - 1; i > offset - 1; i--) {
  47968. buffer[i] = number & 0xff;
  47969. number >>= 8;
  47970. }
  47971. return offset + size;
  47972. }
  47973. function writeString(string, offset, buffer) {
  47974. for (let i = 0, len = string.length; i < len; i++) {
  47975. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  47976. }
  47977. }
  47978. function computeMD5(filesize, xrefInfo) {
  47979. const time = Math.floor(Date.now() / 1000);
  47980. const filename = xrefInfo.filename || "";
  47981. const md5Buffer = [time.toString(), filename, filesize.toString()];
  47982. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  47983. for (const value of Object.values(xrefInfo.info)) {
  47984. md5Buffer.push(value);
  47985. md5BufferLen += value.length;
  47986. }
  47987. const array = new Uint8Array(md5BufferLen);
  47988. let offset = 0;
  47989. for (const str of md5Buffer) {
  47990. writeString(str, offset, array);
  47991. offset += str.length;
  47992. }
  47993. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  47994. }
  47995. function writeXFADataForAcroform(str, newRefs) {
  47996. const xml = new _xml_parser.SimpleXMLParser({
  47997. hasAttributes: true
  47998. }).parseFromString(str);
  47999. for (const {
  48000. xfa
  48001. } of newRefs) {
  48002. if (!xfa) {
  48003. continue;
  48004. }
  48005. const {
  48006. path,
  48007. value
  48008. } = xfa;
  48009. if (!path) {
  48010. continue;
  48011. }
  48012. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  48013. if (node) {
  48014. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  48015. } else {
  48016. (0, _util.warn)(`Node not found for path: ${path}`);
  48017. }
  48018. }
  48019. const buffer = [];
  48020. xml.documentElement.dump(buffer);
  48021. return buffer.join("");
  48022. }
  48023. function updateXFA({
  48024. xfaData,
  48025. xfaDatasetsRef,
  48026. hasXfaDatasetsEntry,
  48027. acroFormRef,
  48028. acroForm,
  48029. newRefs,
  48030. xref,
  48031. xrefInfo
  48032. }) {
  48033. if (xref === null) {
  48034. return;
  48035. }
  48036. if (!hasXfaDatasetsEntry) {
  48037. if (!acroFormRef) {
  48038. (0, _util.warn)("XFA - Cannot save it");
  48039. return;
  48040. }
  48041. const oldXfa = acroForm.get("XFA");
  48042. const newXfa = oldXfa.slice();
  48043. newXfa.splice(2, 0, "datasets");
  48044. newXfa.splice(3, 0, xfaDatasetsRef);
  48045. acroForm.set("XFA", newXfa);
  48046. const encrypt = xref.encrypt;
  48047. let transform = null;
  48048. if (encrypt) {
  48049. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  48050. }
  48051. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  48052. writeDict(acroForm, buffer, transform);
  48053. buffer.push("\n");
  48054. acroForm.set("XFA", oldXfa);
  48055. newRefs.push({
  48056. ref: acroFormRef,
  48057. data: buffer.join("")
  48058. });
  48059. }
  48060. if (xfaData === null) {
  48061. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  48062. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  48063. }
  48064. const encrypt = xref.encrypt;
  48065. if (encrypt) {
  48066. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  48067. xfaData = transform.encryptString(xfaData);
  48068. }
  48069. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  48070. newRefs.push({
  48071. ref: xfaDatasetsRef,
  48072. data
  48073. });
  48074. }
  48075. function incrementalUpdate({
  48076. originalData,
  48077. xrefInfo,
  48078. newRefs,
  48079. xref = null,
  48080. hasXfa = false,
  48081. xfaDatasetsRef = null,
  48082. hasXfaDatasetsEntry = false,
  48083. acroFormRef = null,
  48084. acroForm = null,
  48085. xfaData = null
  48086. }) {
  48087. if (hasXfa) {
  48088. updateXFA({
  48089. xfaData,
  48090. xfaDatasetsRef,
  48091. hasXfaDatasetsEntry,
  48092. acroFormRef,
  48093. acroForm,
  48094. newRefs,
  48095. xref,
  48096. xrefInfo
  48097. });
  48098. }
  48099. const newXref = new _primitives.Dict(null);
  48100. const refForXrefTable = xrefInfo.newRef;
  48101. let buffer, baseOffset;
  48102. const lastByte = originalData[originalData.length - 1];
  48103. if (lastByte === 0x0a || lastByte === 0x0d) {
  48104. buffer = [];
  48105. baseOffset = originalData.length;
  48106. } else {
  48107. buffer = ["\n"];
  48108. baseOffset = originalData.length + 1;
  48109. }
  48110. newXref.set("Size", refForXrefTable.num + 1);
  48111. newXref.set("Prev", xrefInfo.startXRef);
  48112. newXref.set("Type", _primitives.Name.get("XRef"));
  48113. if (xrefInfo.rootRef !== null) {
  48114. newXref.set("Root", xrefInfo.rootRef);
  48115. }
  48116. if (xrefInfo.infoRef !== null) {
  48117. newXref.set("Info", xrefInfo.infoRef);
  48118. }
  48119. if (xrefInfo.encryptRef !== null) {
  48120. newXref.set("Encrypt", xrefInfo.encryptRef);
  48121. }
  48122. newRefs.push({
  48123. ref: refForXrefTable,
  48124. data: ""
  48125. });
  48126. newRefs = newRefs.sort((a, b) => {
  48127. return a.ref.num - b.ref.num;
  48128. });
  48129. const xrefTableData = [[0, 1, 0xffff]];
  48130. const indexes = [0, 1];
  48131. let maxOffset = 0;
  48132. for (const {
  48133. ref,
  48134. data
  48135. } of newRefs) {
  48136. maxOffset = Math.max(maxOffset, baseOffset);
  48137. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  48138. baseOffset += data.length;
  48139. indexes.push(ref.num, 1);
  48140. buffer.push(data);
  48141. }
  48142. newXref.set("Index", indexes);
  48143. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  48144. const md5 = computeMD5(baseOffset, xrefInfo);
  48145. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  48146. }
  48147. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  48148. const sizes = [1, offsetSize, 2];
  48149. const structSize = sizes[0] + sizes[1] + sizes[2];
  48150. const tableLength = structSize * xrefTableData.length;
  48151. newXref.set("W", sizes);
  48152. newXref.set("Length", tableLength);
  48153. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  48154. writeDict(newXref, buffer, null);
  48155. buffer.push(" stream\n");
  48156. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  48157. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  48158. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  48159. array.set(originalData);
  48160. let offset = originalData.length;
  48161. for (const str of buffer) {
  48162. writeString(str, offset, array);
  48163. offset += str.length;
  48164. }
  48165. for (const [type, objOffset, gen] of xrefTableData) {
  48166. offset = writeInt(type, sizes[0], offset, array);
  48167. offset = writeInt(objOffset, sizes[1], offset, array);
  48168. offset = writeInt(gen, sizes[2], offset, array);
  48169. }
  48170. writeString(footer, offset, array);
  48171. return array;
  48172. }
  48173. /***/ }),
  48174. /* 72 */
  48175. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48176. Object.defineProperty(exports, "__esModule", ({
  48177. value: true
  48178. }));
  48179. exports.calculateSHA384 = calculateSHA384;
  48180. exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.calculateSHA512 = exports.calculateSHA256 = exports.calculateMD5 = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  48181. var _util = __w_pdfjs_require__(2);
  48182. var _primitives = __w_pdfjs_require__(5);
  48183. var _decrypt_stream = __w_pdfjs_require__(73);
  48184. class ARCFourCipher {
  48185. constructor(key) {
  48186. this.a = 0;
  48187. this.b = 0;
  48188. const s = new Uint8Array(256);
  48189. const keyLength = key.length;
  48190. for (let i = 0; i < 256; ++i) {
  48191. s[i] = i;
  48192. }
  48193. for (let i = 0, j = 0; i < 256; ++i) {
  48194. const tmp = s[i];
  48195. j = j + tmp + key[i % keyLength] & 0xff;
  48196. s[i] = s[j];
  48197. s[j] = tmp;
  48198. }
  48199. this.s = s;
  48200. }
  48201. encryptBlock(data) {
  48202. let a = this.a,
  48203. b = this.b;
  48204. const s = this.s;
  48205. const n = data.length;
  48206. const output = new Uint8Array(n);
  48207. for (let i = 0; i < n; ++i) {
  48208. a = a + 1 & 0xff;
  48209. const tmp = s[a];
  48210. b = b + tmp & 0xff;
  48211. const tmp2 = s[b];
  48212. s[a] = tmp2;
  48213. s[b] = tmp;
  48214. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  48215. }
  48216. this.a = a;
  48217. this.b = b;
  48218. return output;
  48219. }
  48220. decryptBlock(data) {
  48221. return this.encryptBlock(data);
  48222. }
  48223. encrypt(data) {
  48224. return this.encryptBlock(data);
  48225. }
  48226. }
  48227. exports.ARCFourCipher = ARCFourCipher;
  48228. const calculateMD5 = function calculateMD5Closure() {
  48229. const 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]);
  48230. const 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]);
  48231. function hash(data, offset, length) {
  48232. let h0 = 1732584193,
  48233. h1 = -271733879,
  48234. h2 = -1732584194,
  48235. h3 = 271733878;
  48236. const paddedLength = length + 72 & ~63;
  48237. const padded = new Uint8Array(paddedLength);
  48238. let i, j;
  48239. for (i = 0; i < length; ++i) {
  48240. padded[i] = data[offset++];
  48241. }
  48242. padded[i++] = 0x80;
  48243. const n = paddedLength - 8;
  48244. while (i < n) {
  48245. padded[i++] = 0;
  48246. }
  48247. padded[i++] = length << 3 & 0xff;
  48248. padded[i++] = length >> 5 & 0xff;
  48249. padded[i++] = length >> 13 & 0xff;
  48250. padded[i++] = length >> 21 & 0xff;
  48251. padded[i++] = length >>> 29 & 0xff;
  48252. padded[i++] = 0;
  48253. padded[i++] = 0;
  48254. padded[i++] = 0;
  48255. const w = new Int32Array(16);
  48256. for (i = 0; i < paddedLength;) {
  48257. for (j = 0; j < 16; ++j, i += 4) {
  48258. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  48259. }
  48260. let a = h0,
  48261. b = h1,
  48262. c = h2,
  48263. d = h3,
  48264. f,
  48265. g;
  48266. for (j = 0; j < 64; ++j) {
  48267. if (j < 16) {
  48268. f = b & c | ~b & d;
  48269. g = j;
  48270. } else if (j < 32) {
  48271. f = d & b | ~d & c;
  48272. g = 5 * j + 1 & 15;
  48273. } else if (j < 48) {
  48274. f = b ^ c ^ d;
  48275. g = 3 * j + 5 & 15;
  48276. } else {
  48277. f = c ^ (b | ~d);
  48278. g = 7 * j & 15;
  48279. }
  48280. const tmp = d,
  48281. rotateArg = a + f + k[j] + w[g] | 0,
  48282. rotate = r[j];
  48283. d = c;
  48284. c = b;
  48285. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  48286. a = tmp;
  48287. }
  48288. h0 = h0 + a | 0;
  48289. h1 = h1 + b | 0;
  48290. h2 = h2 + c | 0;
  48291. h3 = h3 + d | 0;
  48292. }
  48293. 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]);
  48294. }
  48295. return hash;
  48296. }();
  48297. exports.calculateMD5 = calculateMD5;
  48298. class Word64 {
  48299. constructor(highInteger, lowInteger) {
  48300. this.high = highInteger | 0;
  48301. this.low = lowInteger | 0;
  48302. }
  48303. and(word) {
  48304. this.high &= word.high;
  48305. this.low &= word.low;
  48306. }
  48307. xor(word) {
  48308. this.high ^= word.high;
  48309. this.low ^= word.low;
  48310. }
  48311. or(word) {
  48312. this.high |= word.high;
  48313. this.low |= word.low;
  48314. }
  48315. shiftRight(places) {
  48316. if (places >= 32) {
  48317. this.low = this.high >>> places - 32 | 0;
  48318. this.high = 0;
  48319. } else {
  48320. this.low = this.low >>> places | this.high << 32 - places;
  48321. this.high = this.high >>> places | 0;
  48322. }
  48323. }
  48324. shiftLeft(places) {
  48325. if (places >= 32) {
  48326. this.high = this.low << places - 32;
  48327. this.low = 0;
  48328. } else {
  48329. this.high = this.high << places | this.low >>> 32 - places;
  48330. this.low <<= places;
  48331. }
  48332. }
  48333. rotateRight(places) {
  48334. let low, high;
  48335. if (places & 32) {
  48336. high = this.low;
  48337. low = this.high;
  48338. } else {
  48339. low = this.low;
  48340. high = this.high;
  48341. }
  48342. places &= 31;
  48343. this.low = low >>> places | high << 32 - places;
  48344. this.high = high >>> places | low << 32 - places;
  48345. }
  48346. not() {
  48347. this.high = ~this.high;
  48348. this.low = ~this.low;
  48349. }
  48350. add(word) {
  48351. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  48352. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  48353. if (lowAdd > 0xffffffff) {
  48354. highAdd += 1;
  48355. }
  48356. this.low = lowAdd | 0;
  48357. this.high = highAdd | 0;
  48358. }
  48359. copyTo(bytes, offset) {
  48360. bytes[offset] = this.high >>> 24 & 0xff;
  48361. bytes[offset + 1] = this.high >> 16 & 0xff;
  48362. bytes[offset + 2] = this.high >> 8 & 0xff;
  48363. bytes[offset + 3] = this.high & 0xff;
  48364. bytes[offset + 4] = this.low >>> 24 & 0xff;
  48365. bytes[offset + 5] = this.low >> 16 & 0xff;
  48366. bytes[offset + 6] = this.low >> 8 & 0xff;
  48367. bytes[offset + 7] = this.low & 0xff;
  48368. }
  48369. assign(word) {
  48370. this.high = word.high;
  48371. this.low = word.low;
  48372. }
  48373. }
  48374. const calculateSHA256 = function calculateSHA256Closure() {
  48375. function rotr(x, n) {
  48376. return x >>> n | x << 32 - n;
  48377. }
  48378. function ch(x, y, z) {
  48379. return x & y ^ ~x & z;
  48380. }
  48381. function maj(x, y, z) {
  48382. return x & y ^ x & z ^ y & z;
  48383. }
  48384. function sigma(x) {
  48385. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  48386. }
  48387. function sigmaPrime(x) {
  48388. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  48389. }
  48390. function littleSigma(x) {
  48391. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  48392. }
  48393. function littleSigmaPrime(x) {
  48394. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  48395. }
  48396. const 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];
  48397. function hash(data, offset, length) {
  48398. let h0 = 0x6a09e667,
  48399. h1 = 0xbb67ae85,
  48400. h2 = 0x3c6ef372,
  48401. h3 = 0xa54ff53a,
  48402. h4 = 0x510e527f,
  48403. h5 = 0x9b05688c,
  48404. h6 = 0x1f83d9ab,
  48405. h7 = 0x5be0cd19;
  48406. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  48407. const padded = new Uint8Array(paddedLength);
  48408. let i, j;
  48409. for (i = 0; i < length; ++i) {
  48410. padded[i] = data[offset++];
  48411. }
  48412. padded[i++] = 0x80;
  48413. const n = paddedLength - 8;
  48414. while (i < n) {
  48415. padded[i++] = 0;
  48416. }
  48417. padded[i++] = 0;
  48418. padded[i++] = 0;
  48419. padded[i++] = 0;
  48420. padded[i++] = length >>> 29 & 0xff;
  48421. padded[i++] = length >> 21 & 0xff;
  48422. padded[i++] = length >> 13 & 0xff;
  48423. padded[i++] = length >> 5 & 0xff;
  48424. padded[i++] = length << 3 & 0xff;
  48425. const w = new Uint32Array(64);
  48426. for (i = 0; i < paddedLength;) {
  48427. for (j = 0; j < 16; ++j) {
  48428. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48429. i += 4;
  48430. }
  48431. for (j = 16; j < 64; ++j) {
  48432. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  48433. }
  48434. let a = h0,
  48435. b = h1,
  48436. c = h2,
  48437. d = h3,
  48438. e = h4,
  48439. f = h5,
  48440. g = h6,
  48441. h = h7,
  48442. t1,
  48443. t2;
  48444. for (j = 0; j < 64; ++j) {
  48445. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  48446. t2 = sigma(a) + maj(a, b, c);
  48447. h = g;
  48448. g = f;
  48449. f = e;
  48450. e = d + t1 | 0;
  48451. d = c;
  48452. c = b;
  48453. b = a;
  48454. a = t1 + t2 | 0;
  48455. }
  48456. h0 = h0 + a | 0;
  48457. h1 = h1 + b | 0;
  48458. h2 = h2 + c | 0;
  48459. h3 = h3 + d | 0;
  48460. h4 = h4 + e | 0;
  48461. h5 = h5 + f | 0;
  48462. h6 = h6 + g | 0;
  48463. h7 = h7 + h | 0;
  48464. }
  48465. 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]);
  48466. }
  48467. return hash;
  48468. }();
  48469. exports.calculateSHA256 = calculateSHA256;
  48470. const calculateSHA512 = function calculateSHA512Closure() {
  48471. function ch(result, x, y, z, tmp) {
  48472. result.assign(x);
  48473. result.and(y);
  48474. tmp.assign(x);
  48475. tmp.not();
  48476. tmp.and(z);
  48477. result.xor(tmp);
  48478. }
  48479. function maj(result, x, y, z, tmp) {
  48480. result.assign(x);
  48481. result.and(y);
  48482. tmp.assign(x);
  48483. tmp.and(z);
  48484. result.xor(tmp);
  48485. tmp.assign(y);
  48486. tmp.and(z);
  48487. result.xor(tmp);
  48488. }
  48489. function sigma(result, x, tmp) {
  48490. result.assign(x);
  48491. result.rotateRight(28);
  48492. tmp.assign(x);
  48493. tmp.rotateRight(34);
  48494. result.xor(tmp);
  48495. tmp.assign(x);
  48496. tmp.rotateRight(39);
  48497. result.xor(tmp);
  48498. }
  48499. function sigmaPrime(result, x, tmp) {
  48500. result.assign(x);
  48501. result.rotateRight(14);
  48502. tmp.assign(x);
  48503. tmp.rotateRight(18);
  48504. result.xor(tmp);
  48505. tmp.assign(x);
  48506. tmp.rotateRight(41);
  48507. result.xor(tmp);
  48508. }
  48509. function littleSigma(result, x, tmp) {
  48510. result.assign(x);
  48511. result.rotateRight(1);
  48512. tmp.assign(x);
  48513. tmp.rotateRight(8);
  48514. result.xor(tmp);
  48515. tmp.assign(x);
  48516. tmp.shiftRight(7);
  48517. result.xor(tmp);
  48518. }
  48519. function littleSigmaPrime(result, x, tmp) {
  48520. result.assign(x);
  48521. result.rotateRight(19);
  48522. tmp.assign(x);
  48523. tmp.rotateRight(61);
  48524. result.xor(tmp);
  48525. tmp.assign(x);
  48526. tmp.shiftRight(6);
  48527. result.xor(tmp);
  48528. }
  48529. const 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)];
  48530. function hash(data, offset, length, mode384 = false) {
  48531. let h0, h1, h2, h3, h4, h5, h6, h7;
  48532. if (!mode384) {
  48533. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  48534. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  48535. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  48536. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  48537. h4 = new Word64(0x510e527f, 0xade682d1);
  48538. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  48539. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  48540. h7 = new Word64(0x5be0cd19, 0x137e2179);
  48541. } else {
  48542. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  48543. h1 = new Word64(0x629a292a, 0x367cd507);
  48544. h2 = new Word64(0x9159015a, 0x3070dd17);
  48545. h3 = new Word64(0x152fecd8, 0xf70e5939);
  48546. h4 = new Word64(0x67332667, 0xffc00b31);
  48547. h5 = new Word64(0x8eb44a87, 0x68581511);
  48548. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  48549. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  48550. }
  48551. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  48552. const padded = new Uint8Array(paddedLength);
  48553. let i, j;
  48554. for (i = 0; i < length; ++i) {
  48555. padded[i] = data[offset++];
  48556. }
  48557. padded[i++] = 0x80;
  48558. const n = paddedLength - 16;
  48559. while (i < n) {
  48560. padded[i++] = 0;
  48561. }
  48562. padded[i++] = 0;
  48563. padded[i++] = 0;
  48564. padded[i++] = 0;
  48565. padded[i++] = 0;
  48566. padded[i++] = 0;
  48567. padded[i++] = 0;
  48568. padded[i++] = 0;
  48569. padded[i++] = 0;
  48570. padded[i++] = 0;
  48571. padded[i++] = 0;
  48572. padded[i++] = 0;
  48573. padded[i++] = length >>> 29 & 0xff;
  48574. padded[i++] = length >> 21 & 0xff;
  48575. padded[i++] = length >> 13 & 0xff;
  48576. padded[i++] = length >> 5 & 0xff;
  48577. padded[i++] = length << 3 & 0xff;
  48578. const w = new Array(80);
  48579. for (i = 0; i < 80; i++) {
  48580. w[i] = new Word64(0, 0);
  48581. }
  48582. let a = new Word64(0, 0),
  48583. b = new Word64(0, 0),
  48584. c = new Word64(0, 0);
  48585. let d = new Word64(0, 0),
  48586. e = new Word64(0, 0),
  48587. f = new Word64(0, 0);
  48588. let g = new Word64(0, 0),
  48589. h = new Word64(0, 0);
  48590. const t1 = new Word64(0, 0),
  48591. t2 = new Word64(0, 0);
  48592. const tmp1 = new Word64(0, 0),
  48593. tmp2 = new Word64(0, 0);
  48594. let tmp3;
  48595. for (i = 0; i < paddedLength;) {
  48596. for (j = 0; j < 16; ++j) {
  48597. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  48598. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  48599. i += 8;
  48600. }
  48601. for (j = 16; j < 80; ++j) {
  48602. tmp3 = w[j];
  48603. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  48604. tmp3.add(w[j - 7]);
  48605. littleSigma(tmp1, w[j - 15], tmp2);
  48606. tmp3.add(tmp1);
  48607. tmp3.add(w[j - 16]);
  48608. }
  48609. a.assign(h0);
  48610. b.assign(h1);
  48611. c.assign(h2);
  48612. d.assign(h3);
  48613. e.assign(h4);
  48614. f.assign(h5);
  48615. g.assign(h6);
  48616. h.assign(h7);
  48617. for (j = 0; j < 80; ++j) {
  48618. t1.assign(h);
  48619. sigmaPrime(tmp1, e, tmp2);
  48620. t1.add(tmp1);
  48621. ch(tmp1, e, f, g, tmp2);
  48622. t1.add(tmp1);
  48623. t1.add(k[j]);
  48624. t1.add(w[j]);
  48625. sigma(t2, a, tmp2);
  48626. maj(tmp1, a, b, c, tmp2);
  48627. t2.add(tmp1);
  48628. tmp3 = h;
  48629. h = g;
  48630. g = f;
  48631. f = e;
  48632. d.add(t1);
  48633. e = d;
  48634. d = c;
  48635. c = b;
  48636. b = a;
  48637. tmp3.assign(t1);
  48638. tmp3.add(t2);
  48639. a = tmp3;
  48640. }
  48641. h0.add(a);
  48642. h1.add(b);
  48643. h2.add(c);
  48644. h3.add(d);
  48645. h4.add(e);
  48646. h5.add(f);
  48647. h6.add(g);
  48648. h7.add(h);
  48649. }
  48650. let result;
  48651. if (!mode384) {
  48652. result = new Uint8Array(64);
  48653. h0.copyTo(result, 0);
  48654. h1.copyTo(result, 8);
  48655. h2.copyTo(result, 16);
  48656. h3.copyTo(result, 24);
  48657. h4.copyTo(result, 32);
  48658. h5.copyTo(result, 40);
  48659. h6.copyTo(result, 48);
  48660. h7.copyTo(result, 56);
  48661. } else {
  48662. result = new Uint8Array(48);
  48663. h0.copyTo(result, 0);
  48664. h1.copyTo(result, 8);
  48665. h2.copyTo(result, 16);
  48666. h3.copyTo(result, 24);
  48667. h4.copyTo(result, 32);
  48668. h5.copyTo(result, 40);
  48669. }
  48670. return result;
  48671. }
  48672. return hash;
  48673. }();
  48674. exports.calculateSHA512 = calculateSHA512;
  48675. function calculateSHA384(data, offset, length) {
  48676. return calculateSHA512(data, offset, length, true);
  48677. }
  48678. class NullCipher {
  48679. decryptBlock(data) {
  48680. return data;
  48681. }
  48682. encrypt(data) {
  48683. return data;
  48684. }
  48685. }
  48686. class AESBaseCipher {
  48687. constructor() {
  48688. if (this.constructor === AESBaseCipher) {
  48689. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  48690. }
  48691. 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]);
  48692. 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]);
  48693. 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]);
  48694. this._mixCol = new Uint8Array(256);
  48695. for (let i = 0; i < 256; i++) {
  48696. if (i < 128) {
  48697. this._mixCol[i] = i << 1;
  48698. } else {
  48699. this._mixCol[i] = i << 1 ^ 0x1b;
  48700. }
  48701. }
  48702. this.buffer = new Uint8Array(16);
  48703. this.bufferPosition = 0;
  48704. }
  48705. _expandKey(cipherKey) {
  48706. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  48707. }
  48708. _decrypt(input, key) {
  48709. let t, u, v;
  48710. const state = new Uint8Array(16);
  48711. state.set(input);
  48712. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48713. state[j] ^= key[k];
  48714. }
  48715. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  48716. t = state[13];
  48717. state[13] = state[9];
  48718. state[9] = state[5];
  48719. state[5] = state[1];
  48720. state[1] = t;
  48721. t = state[14];
  48722. u = state[10];
  48723. state[14] = state[6];
  48724. state[10] = state[2];
  48725. state[6] = t;
  48726. state[2] = u;
  48727. t = state[15];
  48728. u = state[11];
  48729. v = state[7];
  48730. state[15] = state[3];
  48731. state[11] = t;
  48732. state[7] = u;
  48733. state[3] = v;
  48734. for (let j = 0; j < 16; ++j) {
  48735. state[j] = this._inv_s[state[j]];
  48736. }
  48737. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48738. state[j] ^= key[k];
  48739. }
  48740. for (let j = 0; j < 16; j += 4) {
  48741. const s0 = this._mix[state[j]];
  48742. const s1 = this._mix[state[j + 1]];
  48743. const s2 = this._mix[state[j + 2]];
  48744. const s3 = this._mix[state[j + 3]];
  48745. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  48746. state[j] = t >>> 24 & 0xff;
  48747. state[j + 1] = t >> 16 & 0xff;
  48748. state[j + 2] = t >> 8 & 0xff;
  48749. state[j + 3] = t & 0xff;
  48750. }
  48751. }
  48752. t = state[13];
  48753. state[13] = state[9];
  48754. state[9] = state[5];
  48755. state[5] = state[1];
  48756. state[1] = t;
  48757. t = state[14];
  48758. u = state[10];
  48759. state[14] = state[6];
  48760. state[10] = state[2];
  48761. state[6] = t;
  48762. state[2] = u;
  48763. t = state[15];
  48764. u = state[11];
  48765. v = state[7];
  48766. state[15] = state[3];
  48767. state[11] = t;
  48768. state[7] = u;
  48769. state[3] = v;
  48770. for (let j = 0; j < 16; ++j) {
  48771. state[j] = this._inv_s[state[j]];
  48772. state[j] ^= key[j];
  48773. }
  48774. return state;
  48775. }
  48776. _encrypt(input, key) {
  48777. const s = this._s;
  48778. let t, u, v;
  48779. const state = new Uint8Array(16);
  48780. state.set(input);
  48781. for (let j = 0; j < 16; ++j) {
  48782. state[j] ^= key[j];
  48783. }
  48784. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  48785. for (let j = 0; j < 16; ++j) {
  48786. state[j] = s[state[j]];
  48787. }
  48788. v = state[1];
  48789. state[1] = state[5];
  48790. state[5] = state[9];
  48791. state[9] = state[13];
  48792. state[13] = v;
  48793. v = state[2];
  48794. u = state[6];
  48795. state[2] = state[10];
  48796. state[6] = state[14];
  48797. state[10] = v;
  48798. state[14] = u;
  48799. v = state[3];
  48800. u = state[7];
  48801. t = state[11];
  48802. state[3] = state[15];
  48803. state[7] = v;
  48804. state[11] = u;
  48805. state[15] = t;
  48806. for (let j = 0; j < 16; j += 4) {
  48807. const s0 = state[j + 0];
  48808. const s1 = state[j + 1];
  48809. const s2 = state[j + 2];
  48810. const s3 = state[j + 3];
  48811. t = s0 ^ s1 ^ s2 ^ s3;
  48812. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  48813. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  48814. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  48815. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  48816. }
  48817. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  48818. state[j] ^= key[k];
  48819. }
  48820. }
  48821. for (let j = 0; j < 16; ++j) {
  48822. state[j] = s[state[j]];
  48823. }
  48824. v = state[1];
  48825. state[1] = state[5];
  48826. state[5] = state[9];
  48827. state[9] = state[13];
  48828. state[13] = v;
  48829. v = state[2];
  48830. u = state[6];
  48831. state[2] = state[10];
  48832. state[6] = state[14];
  48833. state[10] = v;
  48834. state[14] = u;
  48835. v = state[3];
  48836. u = state[7];
  48837. t = state[11];
  48838. state[3] = state[15];
  48839. state[7] = v;
  48840. state[11] = u;
  48841. state[15] = t;
  48842. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  48843. state[j] ^= key[k];
  48844. }
  48845. return state;
  48846. }
  48847. _decryptBlock2(data, finalize) {
  48848. const sourceLength = data.length;
  48849. let buffer = this.buffer,
  48850. bufferLength = this.bufferPosition;
  48851. const result = [];
  48852. let iv = this.iv;
  48853. for (let i = 0; i < sourceLength; ++i) {
  48854. buffer[bufferLength] = data[i];
  48855. ++bufferLength;
  48856. if (bufferLength < 16) {
  48857. continue;
  48858. }
  48859. const plain = this._decrypt(buffer, this._key);
  48860. for (let j = 0; j < 16; ++j) {
  48861. plain[j] ^= iv[j];
  48862. }
  48863. iv = buffer;
  48864. result.push(plain);
  48865. buffer = new Uint8Array(16);
  48866. bufferLength = 0;
  48867. }
  48868. this.buffer = buffer;
  48869. this.bufferLength = bufferLength;
  48870. this.iv = iv;
  48871. if (result.length === 0) {
  48872. return new Uint8Array(0);
  48873. }
  48874. let outputLength = 16 * result.length;
  48875. if (finalize) {
  48876. const lastBlock = result[result.length - 1];
  48877. let psLen = lastBlock[15];
  48878. if (psLen <= 16) {
  48879. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  48880. if (lastBlock[i] !== psLen) {
  48881. psLen = 0;
  48882. break;
  48883. }
  48884. }
  48885. outputLength -= psLen;
  48886. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  48887. }
  48888. }
  48889. const output = new Uint8Array(outputLength);
  48890. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48891. output.set(result[i], j);
  48892. }
  48893. return output;
  48894. }
  48895. decryptBlock(data, finalize, iv = null) {
  48896. const sourceLength = data.length;
  48897. const buffer = this.buffer;
  48898. let bufferLength = this.bufferPosition;
  48899. if (iv) {
  48900. this.iv = iv;
  48901. } else {
  48902. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  48903. buffer[bufferLength] = data[i];
  48904. }
  48905. if (bufferLength < 16) {
  48906. this.bufferLength = bufferLength;
  48907. return new Uint8Array(0);
  48908. }
  48909. this.iv = buffer;
  48910. data = data.subarray(16);
  48911. }
  48912. this.buffer = new Uint8Array(16);
  48913. this.bufferLength = 0;
  48914. this.decryptBlock = this._decryptBlock2;
  48915. return this.decryptBlock(data, finalize);
  48916. }
  48917. encrypt(data, iv) {
  48918. const sourceLength = data.length;
  48919. let buffer = this.buffer,
  48920. bufferLength = this.bufferPosition;
  48921. const result = [];
  48922. if (!iv) {
  48923. iv = new Uint8Array(16);
  48924. }
  48925. for (let i = 0; i < sourceLength; ++i) {
  48926. buffer[bufferLength] = data[i];
  48927. ++bufferLength;
  48928. if (bufferLength < 16) {
  48929. continue;
  48930. }
  48931. for (let j = 0; j < 16; ++j) {
  48932. buffer[j] ^= iv[j];
  48933. }
  48934. const cipher = this._encrypt(buffer, this._key);
  48935. iv = cipher;
  48936. result.push(cipher);
  48937. buffer = new Uint8Array(16);
  48938. bufferLength = 0;
  48939. }
  48940. this.buffer = buffer;
  48941. this.bufferLength = bufferLength;
  48942. this.iv = iv;
  48943. if (result.length === 0) {
  48944. return new Uint8Array(0);
  48945. }
  48946. const outputLength = 16 * result.length;
  48947. const output = new Uint8Array(outputLength);
  48948. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  48949. output.set(result[i], j);
  48950. }
  48951. return output;
  48952. }
  48953. }
  48954. class AES128Cipher extends AESBaseCipher {
  48955. constructor(key) {
  48956. super();
  48957. this._cyclesOfRepetition = 10;
  48958. this._keySize = 160;
  48959. 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]);
  48960. this._key = this._expandKey(key);
  48961. }
  48962. _expandKey(cipherKey) {
  48963. const b = 176;
  48964. const s = this._s;
  48965. const rcon = this._rcon;
  48966. const result = new Uint8Array(b);
  48967. result.set(cipherKey);
  48968. for (let j = 16, i = 1; j < b; ++i) {
  48969. let t1 = result[j - 3];
  48970. let t2 = result[j - 2];
  48971. let t3 = result[j - 1];
  48972. let t4 = result[j - 4];
  48973. t1 = s[t1];
  48974. t2 = s[t2];
  48975. t3 = s[t3];
  48976. t4 = s[t4];
  48977. t1 ^= rcon[i];
  48978. for (let n = 0; n < 4; ++n) {
  48979. result[j] = t1 ^= result[j - 16];
  48980. j++;
  48981. result[j] = t2 ^= result[j - 16];
  48982. j++;
  48983. result[j] = t3 ^= result[j - 16];
  48984. j++;
  48985. result[j] = t4 ^= result[j - 16];
  48986. j++;
  48987. }
  48988. }
  48989. return result;
  48990. }
  48991. }
  48992. exports.AES128Cipher = AES128Cipher;
  48993. class AES256Cipher extends AESBaseCipher {
  48994. constructor(key) {
  48995. super();
  48996. this._cyclesOfRepetition = 14;
  48997. this._keySize = 224;
  48998. this._key = this._expandKey(key);
  48999. }
  49000. _expandKey(cipherKey) {
  49001. const b = 240;
  49002. const s = this._s;
  49003. const result = new Uint8Array(b);
  49004. result.set(cipherKey);
  49005. let r = 1;
  49006. let t1, t2, t3, t4;
  49007. for (let j = 32, i = 1; j < b; ++i) {
  49008. if (j % 32 === 16) {
  49009. t1 = s[t1];
  49010. t2 = s[t2];
  49011. t3 = s[t3];
  49012. t4 = s[t4];
  49013. } else if (j % 32 === 0) {
  49014. t1 = result[j - 3];
  49015. t2 = result[j - 2];
  49016. t3 = result[j - 1];
  49017. t4 = result[j - 4];
  49018. t1 = s[t1];
  49019. t2 = s[t2];
  49020. t3 = s[t3];
  49021. t4 = s[t4];
  49022. t1 ^= r;
  49023. if ((r <<= 1) >= 256) {
  49024. r = (r ^ 0x1b) & 0xff;
  49025. }
  49026. }
  49027. for (let n = 0; n < 4; ++n) {
  49028. result[j] = t1 ^= result[j - 32];
  49029. j++;
  49030. result[j] = t2 ^= result[j - 32];
  49031. j++;
  49032. result[j] = t3 ^= result[j - 32];
  49033. j++;
  49034. result[j] = t4 ^= result[j - 32];
  49035. j++;
  49036. }
  49037. }
  49038. return result;
  49039. }
  49040. }
  49041. exports.AES256Cipher = AES256Cipher;
  49042. class PDF17 {
  49043. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49044. const hashData = new Uint8Array(password.length + 56);
  49045. hashData.set(password, 0);
  49046. hashData.set(ownerValidationSalt, password.length);
  49047. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49048. const result = calculateSHA256(hashData, 0, hashData.length);
  49049. return (0, _util.isArrayEqual)(result, ownerPassword);
  49050. }
  49051. checkUserPassword(password, userValidationSalt, userPassword) {
  49052. const hashData = new Uint8Array(password.length + 8);
  49053. hashData.set(password, 0);
  49054. hashData.set(userValidationSalt, password.length);
  49055. const result = calculateSHA256(hashData, 0, hashData.length);
  49056. return (0, _util.isArrayEqual)(result, userPassword);
  49057. }
  49058. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49059. const hashData = new Uint8Array(password.length + 56);
  49060. hashData.set(password, 0);
  49061. hashData.set(ownerKeySalt, password.length);
  49062. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49063. const key = calculateSHA256(hashData, 0, hashData.length);
  49064. const cipher = new AES256Cipher(key);
  49065. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49066. }
  49067. getUserKey(password, userKeySalt, userEncryption) {
  49068. const hashData = new Uint8Array(password.length + 8);
  49069. hashData.set(password, 0);
  49070. hashData.set(userKeySalt, password.length);
  49071. const key = calculateSHA256(hashData, 0, hashData.length);
  49072. const cipher = new AES256Cipher(key);
  49073. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49074. }
  49075. }
  49076. exports.PDF17 = PDF17;
  49077. const PDF20 = function PDF20Closure() {
  49078. function calculatePDF20Hash(password, input, userBytes) {
  49079. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  49080. let e = [0];
  49081. let i = 0;
  49082. while (i < 64 || e[e.length - 1] > i - 32) {
  49083. const combinedLength = password.length + k.length + userBytes.length,
  49084. combinedArray = new Uint8Array(combinedLength);
  49085. let writeOffset = 0;
  49086. combinedArray.set(password, writeOffset);
  49087. writeOffset += password.length;
  49088. combinedArray.set(k, writeOffset);
  49089. writeOffset += k.length;
  49090. combinedArray.set(userBytes, writeOffset);
  49091. const k1 = new Uint8Array(combinedLength * 64);
  49092. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  49093. k1.set(combinedArray, pos);
  49094. }
  49095. const cipher = new AES128Cipher(k.subarray(0, 16));
  49096. e = cipher.encrypt(k1, k.subarray(16, 32));
  49097. let remainder = 0;
  49098. for (let z = 0; z < 16; z++) {
  49099. remainder *= 256 % 3;
  49100. remainder %= 3;
  49101. remainder += (e[z] >>> 0) % 3;
  49102. remainder %= 3;
  49103. }
  49104. if (remainder === 0) {
  49105. k = calculateSHA256(e, 0, e.length);
  49106. } else if (remainder === 1) {
  49107. k = calculateSHA384(e, 0, e.length);
  49108. } else if (remainder === 2) {
  49109. k = calculateSHA512(e, 0, e.length);
  49110. }
  49111. i++;
  49112. }
  49113. return k.subarray(0, 32);
  49114. }
  49115. class PDF20 {
  49116. hash(password, concatBytes, userBytes) {
  49117. return calculatePDF20Hash(password, concatBytes, userBytes);
  49118. }
  49119. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  49120. const hashData = new Uint8Array(password.length + 56);
  49121. hashData.set(password, 0);
  49122. hashData.set(ownerValidationSalt, password.length);
  49123. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  49124. const result = calculatePDF20Hash(password, hashData, userBytes);
  49125. return (0, _util.isArrayEqual)(result, ownerPassword);
  49126. }
  49127. checkUserPassword(password, userValidationSalt, userPassword) {
  49128. const hashData = new Uint8Array(password.length + 8);
  49129. hashData.set(password, 0);
  49130. hashData.set(userValidationSalt, password.length);
  49131. const result = calculatePDF20Hash(password, hashData, []);
  49132. return (0, _util.isArrayEqual)(result, userPassword);
  49133. }
  49134. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  49135. const hashData = new Uint8Array(password.length + 56);
  49136. hashData.set(password, 0);
  49137. hashData.set(ownerKeySalt, password.length);
  49138. hashData.set(userBytes, password.length + ownerKeySalt.length);
  49139. const key = calculatePDF20Hash(password, hashData, userBytes);
  49140. const cipher = new AES256Cipher(key);
  49141. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  49142. }
  49143. getUserKey(password, userKeySalt, userEncryption) {
  49144. const hashData = new Uint8Array(password.length + 8);
  49145. hashData.set(password, 0);
  49146. hashData.set(userKeySalt, password.length);
  49147. const key = calculatePDF20Hash(password, hashData, []);
  49148. const cipher = new AES256Cipher(key);
  49149. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  49150. }
  49151. }
  49152. return PDF20;
  49153. }();
  49154. exports.PDF20 = PDF20;
  49155. class CipherTransform {
  49156. constructor(stringCipherConstructor, streamCipherConstructor) {
  49157. this.StringCipherConstructor = stringCipherConstructor;
  49158. this.StreamCipherConstructor = streamCipherConstructor;
  49159. }
  49160. createStream(stream, length) {
  49161. const cipher = new this.StreamCipherConstructor();
  49162. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  49163. return cipher.decryptBlock(data, finalize);
  49164. });
  49165. }
  49166. decryptString(s) {
  49167. const cipher = new this.StringCipherConstructor();
  49168. let data = (0, _util.stringToBytes)(s);
  49169. data = cipher.decryptBlock(data, true);
  49170. return (0, _util.bytesToString)(data);
  49171. }
  49172. encryptString(s) {
  49173. const cipher = new this.StringCipherConstructor();
  49174. if (cipher instanceof AESBaseCipher) {
  49175. const strLen = s.length;
  49176. const pad = 16 - strLen % 16;
  49177. s += String.fromCharCode(pad).repeat(pad);
  49178. const iv = new Uint8Array(16);
  49179. if (typeof crypto !== "undefined") {
  49180. crypto.getRandomValues(iv);
  49181. } else {
  49182. for (let i = 0; i < 16; i++) {
  49183. iv[i] = Math.floor(256 * Math.random());
  49184. }
  49185. }
  49186. let data = (0, _util.stringToBytes)(s);
  49187. data = cipher.encrypt(data, iv);
  49188. const buf = new Uint8Array(16 + data.length);
  49189. buf.set(iv);
  49190. buf.set(data, 16);
  49191. return (0, _util.bytesToString)(buf);
  49192. }
  49193. let data = (0, _util.stringToBytes)(s);
  49194. data = cipher.encrypt(data);
  49195. return (0, _util.bytesToString)(data);
  49196. }
  49197. }
  49198. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  49199. const 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]);
  49200. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  49201. if (password) {
  49202. const passwordLength = Math.min(127, password.length);
  49203. password = password.subarray(0, passwordLength);
  49204. } else {
  49205. password = [];
  49206. }
  49207. let pdfAlgorithm;
  49208. if (revision === 6) {
  49209. pdfAlgorithm = new PDF20();
  49210. } else {
  49211. pdfAlgorithm = new PDF17();
  49212. }
  49213. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  49214. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  49215. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  49216. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  49217. }
  49218. return null;
  49219. }
  49220. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  49221. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  49222. const hashData = new Uint8Array(hashDataSize);
  49223. let i = 0,
  49224. j,
  49225. n;
  49226. if (password) {
  49227. n = Math.min(32, password.length);
  49228. for (; i < n; ++i) {
  49229. hashData[i] = password[i];
  49230. }
  49231. }
  49232. j = 0;
  49233. while (i < 32) {
  49234. hashData[i++] = defaultPasswordBytes[j++];
  49235. }
  49236. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  49237. hashData[i++] = ownerPassword[j];
  49238. }
  49239. hashData[i++] = flags & 0xff;
  49240. hashData[i++] = flags >> 8 & 0xff;
  49241. hashData[i++] = flags >> 16 & 0xff;
  49242. hashData[i++] = flags >>> 24 & 0xff;
  49243. for (j = 0, n = fileId.length; j < n; ++j) {
  49244. hashData[i++] = fileId[j];
  49245. }
  49246. if (revision >= 4 && !encryptMetadata) {
  49247. hashData[i++] = 0xff;
  49248. hashData[i++] = 0xff;
  49249. hashData[i++] = 0xff;
  49250. hashData[i++] = 0xff;
  49251. }
  49252. let hash = calculateMD5(hashData, 0, i);
  49253. const keyLengthInBytes = keyLength >> 3;
  49254. if (revision >= 3) {
  49255. for (j = 0; j < 50; ++j) {
  49256. hash = calculateMD5(hash, 0, keyLengthInBytes);
  49257. }
  49258. }
  49259. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  49260. let cipher, checkData;
  49261. if (revision >= 3) {
  49262. for (i = 0; i < 32; ++i) {
  49263. hashData[i] = defaultPasswordBytes[i];
  49264. }
  49265. for (j = 0, n = fileId.length; j < n; ++j) {
  49266. hashData[i++] = fileId[j];
  49267. }
  49268. cipher = new ARCFourCipher(encryptionKey);
  49269. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  49270. n = encryptionKey.length;
  49271. const derivedKey = new Uint8Array(n);
  49272. for (j = 1; j <= 19; ++j) {
  49273. for (let k = 0; k < n; ++k) {
  49274. derivedKey[k] = encryptionKey[k] ^ j;
  49275. }
  49276. cipher = new ARCFourCipher(derivedKey);
  49277. checkData = cipher.encryptBlock(checkData);
  49278. }
  49279. for (j = 0, n = checkData.length; j < n; ++j) {
  49280. if (userPassword[j] !== checkData[j]) {
  49281. return null;
  49282. }
  49283. }
  49284. } else {
  49285. cipher = new ARCFourCipher(encryptionKey);
  49286. checkData = cipher.encryptBlock(defaultPasswordBytes);
  49287. for (j = 0, n = checkData.length; j < n; ++j) {
  49288. if (userPassword[j] !== checkData[j]) {
  49289. return null;
  49290. }
  49291. }
  49292. }
  49293. return encryptionKey;
  49294. }
  49295. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  49296. const hashData = new Uint8Array(32);
  49297. let i = 0;
  49298. const n = Math.min(32, password.length);
  49299. for (; i < n; ++i) {
  49300. hashData[i] = password[i];
  49301. }
  49302. let j = 0;
  49303. while (i < 32) {
  49304. hashData[i++] = defaultPasswordBytes[j++];
  49305. }
  49306. let hash = calculateMD5(hashData, 0, i);
  49307. const keyLengthInBytes = keyLength >> 3;
  49308. if (revision >= 3) {
  49309. for (j = 0; j < 50; ++j) {
  49310. hash = calculateMD5(hash, 0, hash.length);
  49311. }
  49312. }
  49313. let cipher, userPassword;
  49314. if (revision >= 3) {
  49315. userPassword = ownerPassword;
  49316. const derivedKey = new Uint8Array(keyLengthInBytes);
  49317. for (j = 19; j >= 0; j--) {
  49318. for (let k = 0; k < keyLengthInBytes; ++k) {
  49319. derivedKey[k] = hash[k] ^ j;
  49320. }
  49321. cipher = new ARCFourCipher(derivedKey);
  49322. userPassword = cipher.encryptBlock(userPassword);
  49323. }
  49324. } else {
  49325. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  49326. userPassword = cipher.encryptBlock(ownerPassword);
  49327. }
  49328. return userPassword;
  49329. }
  49330. const identityName = _primitives.Name.get("Identity");
  49331. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  49332. const key = new Uint8Array(encryptionKey.length + 9);
  49333. const n = encryptionKey.length;
  49334. let i;
  49335. for (i = 0; i < n; ++i) {
  49336. key[i] = encryptionKey[i];
  49337. }
  49338. key[i++] = num & 0xff;
  49339. key[i++] = num >> 8 & 0xff;
  49340. key[i++] = num >> 16 & 0xff;
  49341. key[i++] = gen & 0xff;
  49342. key[i++] = gen >> 8 & 0xff;
  49343. if (isAes) {
  49344. key[i++] = 0x73;
  49345. key[i++] = 0x41;
  49346. key[i++] = 0x6c;
  49347. key[i++] = 0x54;
  49348. }
  49349. const hash = calculateMD5(key, 0, i);
  49350. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  49351. }
  49352. function buildCipherConstructor(cf, name, num, gen, key) {
  49353. if (!(0, _primitives.isName)(name)) {
  49354. throw new _util.FormatError("Invalid crypt filter name.");
  49355. }
  49356. const cryptFilter = cf.get(name.name);
  49357. let cfm;
  49358. if (cryptFilter !== null && cryptFilter !== undefined) {
  49359. cfm = cryptFilter.get("CFM");
  49360. }
  49361. if (!cfm || cfm.name === "None") {
  49362. return function cipherTransformFactoryBuildCipherConstructorNone() {
  49363. return new NullCipher();
  49364. };
  49365. }
  49366. if (cfm.name === "V2") {
  49367. return function cipherTransformFactoryBuildCipherConstructorV2() {
  49368. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  49369. };
  49370. }
  49371. if (cfm.name === "AESV2") {
  49372. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  49373. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  49374. };
  49375. }
  49376. if (cfm.name === "AESV3") {
  49377. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  49378. return new AES256Cipher(key);
  49379. };
  49380. }
  49381. throw new _util.FormatError("Unknown crypto method");
  49382. }
  49383. class CipherTransformFactory {
  49384. constructor(dict, fileId, password) {
  49385. const filter = dict.get("Filter");
  49386. if (!(0, _primitives.isName)(filter, "Standard")) {
  49387. throw new _util.FormatError("unknown encryption method");
  49388. }
  49389. this.dict = dict;
  49390. const algorithm = dict.get("V");
  49391. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  49392. throw new _util.FormatError("unsupported encryption algorithm");
  49393. }
  49394. this.algorithm = algorithm;
  49395. let keyLength = dict.get("Length");
  49396. if (!keyLength) {
  49397. if (algorithm <= 3) {
  49398. keyLength = 40;
  49399. } else {
  49400. const cfDict = dict.get("CF");
  49401. const streamCryptoName = dict.get("StmF");
  49402. if ((0, _primitives.isDict)(cfDict) && (0, _primitives.isName)(streamCryptoName)) {
  49403. cfDict.suppressEncryption = true;
  49404. const handlerDict = cfDict.get(streamCryptoName.name);
  49405. keyLength = handlerDict && handlerDict.get("Length") || 128;
  49406. if (keyLength < 40) {
  49407. keyLength <<= 3;
  49408. }
  49409. }
  49410. }
  49411. }
  49412. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  49413. throw new _util.FormatError("invalid key length");
  49414. }
  49415. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  49416. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  49417. const flags = dict.get("P");
  49418. const revision = dict.get("R");
  49419. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  49420. this.encryptMetadata = encryptMetadata;
  49421. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  49422. let passwordBytes;
  49423. if (password) {
  49424. if (revision === 6) {
  49425. try {
  49426. password = (0, _util.utf8StringToString)(password);
  49427. } catch (ex) {
  49428. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  49429. }
  49430. }
  49431. passwordBytes = (0, _util.stringToBytes)(password);
  49432. }
  49433. let encryptionKey;
  49434. if (algorithm !== 5) {
  49435. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49436. } else {
  49437. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  49438. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  49439. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  49440. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  49441. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  49442. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  49443. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  49444. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  49445. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  49446. }
  49447. if (!encryptionKey && !password) {
  49448. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  49449. } else if (!encryptionKey && password) {
  49450. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  49451. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  49452. }
  49453. if (!encryptionKey) {
  49454. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  49455. }
  49456. this.encryptionKey = encryptionKey;
  49457. if (algorithm >= 4) {
  49458. const cf = dict.get("CF");
  49459. if ((0, _primitives.isDict)(cf)) {
  49460. cf.suppressEncryption = true;
  49461. }
  49462. this.cf = cf;
  49463. this.stmf = dict.get("StmF") || identityName;
  49464. this.strf = dict.get("StrF") || identityName;
  49465. this.eff = dict.get("EFF") || this.stmf;
  49466. }
  49467. }
  49468. createCipherTransform(num, gen) {
  49469. if (this.algorithm === 4 || this.algorithm === 5) {
  49470. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  49471. }
  49472. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  49473. const cipherConstructor = function buildCipherCipherConstructor() {
  49474. return new ARCFourCipher(key);
  49475. };
  49476. return new CipherTransform(cipherConstructor, cipherConstructor);
  49477. }
  49478. }
  49479. return CipherTransformFactory;
  49480. }();
  49481. exports.CipherTransformFactory = CipherTransformFactory;
  49482. /***/ }),
  49483. /* 73 */
  49484. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49485. Object.defineProperty(exports, "__esModule", ({
  49486. value: true
  49487. }));
  49488. exports.DecryptStream = void 0;
  49489. var _decode_stream = __w_pdfjs_require__(29);
  49490. const chunkSize = 512;
  49491. class DecryptStream extends _decode_stream.DecodeStream {
  49492. constructor(str, maybeLength, decrypt) {
  49493. super(maybeLength);
  49494. this.str = str;
  49495. this.dict = str.dict;
  49496. this.decrypt = decrypt;
  49497. this.nextChunk = null;
  49498. this.initialized = false;
  49499. }
  49500. readBlock() {
  49501. let chunk;
  49502. if (this.initialized) {
  49503. chunk = this.nextChunk;
  49504. } else {
  49505. chunk = this.str.getBytes(chunkSize);
  49506. this.initialized = true;
  49507. }
  49508. if (!chunk || chunk.length === 0) {
  49509. this.eof = true;
  49510. return;
  49511. }
  49512. this.nextChunk = this.str.getBytes(chunkSize);
  49513. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  49514. const decrypt = this.decrypt;
  49515. chunk = decrypt(chunk, !hasMoreData);
  49516. let bufferLength = this.bufferLength;
  49517. const n = chunk.length,
  49518. buffer = this.ensureBuffer(bufferLength + n);
  49519. for (let i = 0; i < n; i++) {
  49520. buffer[bufferLength++] = chunk[i];
  49521. }
  49522. this.bufferLength = bufferLength;
  49523. }
  49524. }
  49525. exports.DecryptStream = DecryptStream;
  49526. /***/ }),
  49527. /* 74 */
  49528. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49529. Object.defineProperty(exports, "__esModule", ({
  49530. value: true
  49531. }));
  49532. exports.XFAFactory = void 0;
  49533. var _xfa_object = __w_pdfjs_require__(75);
  49534. var _bind = __w_pdfjs_require__(79);
  49535. var _data = __w_pdfjs_require__(85);
  49536. var _fonts = __w_pdfjs_require__(83);
  49537. var _utils = __w_pdfjs_require__(76);
  49538. var _util = __w_pdfjs_require__(2);
  49539. var _parser = __w_pdfjs_require__(86);
  49540. class XFAFactory {
  49541. constructor(data) {
  49542. try {
  49543. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  49544. const binder = new _bind.Binder(this.root);
  49545. this.form = binder.bind();
  49546. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  49547. this.form[_xfa_object.$globalData].template = this.form;
  49548. } catch (e) {
  49549. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  49550. }
  49551. }
  49552. isValid() {
  49553. return this.root && this.form;
  49554. }
  49555. _createPages() {
  49556. try {
  49557. this.pages = this.form[_xfa_object.$toHTML]();
  49558. this.dims = this.pages.children.map(c => {
  49559. const {
  49560. width,
  49561. height
  49562. } = c.attributes.style;
  49563. return [0, 0, parseInt(width), parseInt(height)];
  49564. });
  49565. } catch (e) {
  49566. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  49567. }
  49568. }
  49569. getBoundingBox(pageIndex) {
  49570. return this.dims[pageIndex];
  49571. }
  49572. get numberPages() {
  49573. if (!this.pages) {
  49574. this._createPages();
  49575. }
  49576. return this.dims.length;
  49577. }
  49578. setImages(images) {
  49579. this.form[_xfa_object.$globalData].images = images;
  49580. }
  49581. setFonts(fonts) {
  49582. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  49583. const missingFonts = [];
  49584. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  49585. typeface = (0, _utils.stripQuotes)(typeface);
  49586. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  49587. if (!font) {
  49588. missingFonts.push(typeface);
  49589. }
  49590. }
  49591. if (missingFonts.length > 0) {
  49592. return missingFonts;
  49593. }
  49594. return null;
  49595. }
  49596. appendFonts(fonts, reallyMissingFonts) {
  49597. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  49598. }
  49599. getPages() {
  49600. if (!this.pages) {
  49601. this._createPages();
  49602. }
  49603. const pages = this.pages;
  49604. this.pages = null;
  49605. return pages;
  49606. }
  49607. serializeData(storage) {
  49608. return this.dataHandler.serialize(storage);
  49609. }
  49610. static _createDocument(data) {
  49611. if (!data["/xdp:xdp"]) {
  49612. return data["xdp:xdp"];
  49613. }
  49614. return Object.values(data).join("");
  49615. }
  49616. }
  49617. exports.XFAFactory = XFAFactory;
  49618. /***/ }),
  49619. /* 75 */
  49620. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49621. Object.defineProperty(exports, "__esModule", ({
  49622. value: true
  49623. }));
  49624. 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.$toString = exports.$toHTML = exports.$text = exports.$tabIndex = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$root = exports.$resolvePrototypes = exports.$removeChild = exports.$pushPara = exports.$pushGlyphs = exports.$popPara = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = exports.$nodeName = exports.$namespaceId = exports.$isUsable = exports.$isTransparent = exports.$isThereMoreWidth = exports.$isSplittable = exports.$isNsAgnostic = exports.$isDescendent = exports.$isDataValue = exports.$isCDATAXml = exports.$isBindable = exports.$insertAt = exports.$indexOf = exports.$ids = exports.$hasSettableValue = exports.$globalData = exports.$getTemplateRoot = exports.$getSubformParent = exports.$getRealChildrenByNameIt = exports.$getParent = exports.$getNextPage = exports.$getExtra = exports.$getDataValue = exports.$getContainedChildren = exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributes = exports.$getAttributeIt = exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$cleanPage = exports.$clean = exports.$childrenToHTML = exports.$appendChild = exports.$addHTML = exports.$acceptWhitespace = void 0;
  49625. var _utils = __w_pdfjs_require__(76);
  49626. var _util = __w_pdfjs_require__(2);
  49627. var _core_utils = __w_pdfjs_require__(9);
  49628. var _namespaces = __w_pdfjs_require__(77);
  49629. var _som = __w_pdfjs_require__(78);
  49630. const $acceptWhitespace = Symbol();
  49631. exports.$acceptWhitespace = $acceptWhitespace;
  49632. const $addHTML = Symbol();
  49633. exports.$addHTML = $addHTML;
  49634. const $appendChild = Symbol();
  49635. exports.$appendChild = $appendChild;
  49636. const $childrenToHTML = Symbol();
  49637. exports.$childrenToHTML = $childrenToHTML;
  49638. const $clean = Symbol();
  49639. exports.$clean = $clean;
  49640. const $cleanPage = Symbol();
  49641. exports.$cleanPage = $cleanPage;
  49642. const $cleanup = Symbol();
  49643. exports.$cleanup = $cleanup;
  49644. const $clone = Symbol();
  49645. exports.$clone = $clone;
  49646. const $consumed = Symbol();
  49647. exports.$consumed = $consumed;
  49648. const $content = Symbol("content");
  49649. exports.$content = $content;
  49650. const $data = Symbol("data");
  49651. exports.$data = $data;
  49652. const $dump = Symbol();
  49653. exports.$dump = $dump;
  49654. const $extra = Symbol("extra");
  49655. exports.$extra = $extra;
  49656. const $finalize = Symbol();
  49657. exports.$finalize = $finalize;
  49658. const $flushHTML = Symbol();
  49659. exports.$flushHTML = $flushHTML;
  49660. const $getAttributeIt = Symbol();
  49661. exports.$getAttributeIt = $getAttributeIt;
  49662. const $getAttributes = Symbol();
  49663. exports.$getAttributes = $getAttributes;
  49664. const $getAvailableSpace = Symbol();
  49665. exports.$getAvailableSpace = $getAvailableSpace;
  49666. const $getChildrenByClass = Symbol();
  49667. exports.$getChildrenByClass = $getChildrenByClass;
  49668. const $getChildrenByName = Symbol();
  49669. exports.$getChildrenByName = $getChildrenByName;
  49670. const $getChildrenByNameIt = Symbol();
  49671. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  49672. const $getDataValue = Symbol();
  49673. exports.$getDataValue = $getDataValue;
  49674. const $getExtra = Symbol();
  49675. exports.$getExtra = $getExtra;
  49676. const $getRealChildrenByNameIt = Symbol();
  49677. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  49678. const $getChildren = Symbol();
  49679. exports.$getChildren = $getChildren;
  49680. const $getContainedChildren = Symbol();
  49681. exports.$getContainedChildren = $getContainedChildren;
  49682. const $getNextPage = Symbol();
  49683. exports.$getNextPage = $getNextPage;
  49684. const $getSubformParent = Symbol();
  49685. exports.$getSubformParent = $getSubformParent;
  49686. const $getParent = Symbol();
  49687. exports.$getParent = $getParent;
  49688. const $getTemplateRoot = Symbol();
  49689. exports.$getTemplateRoot = $getTemplateRoot;
  49690. const $globalData = Symbol();
  49691. exports.$globalData = $globalData;
  49692. const $hasSettableValue = Symbol();
  49693. exports.$hasSettableValue = $hasSettableValue;
  49694. const $ids = Symbol();
  49695. exports.$ids = $ids;
  49696. const $indexOf = Symbol();
  49697. exports.$indexOf = $indexOf;
  49698. const $insertAt = Symbol();
  49699. exports.$insertAt = $insertAt;
  49700. const $isCDATAXml = Symbol();
  49701. exports.$isCDATAXml = $isCDATAXml;
  49702. const $isBindable = Symbol();
  49703. exports.$isBindable = $isBindable;
  49704. const $isDataValue = Symbol();
  49705. exports.$isDataValue = $isDataValue;
  49706. const $isDescendent = Symbol();
  49707. exports.$isDescendent = $isDescendent;
  49708. const $isNsAgnostic = Symbol();
  49709. exports.$isNsAgnostic = $isNsAgnostic;
  49710. const $isSplittable = Symbol();
  49711. exports.$isSplittable = $isSplittable;
  49712. const $isThereMoreWidth = Symbol();
  49713. exports.$isThereMoreWidth = $isThereMoreWidth;
  49714. const $isTransparent = Symbol();
  49715. exports.$isTransparent = $isTransparent;
  49716. const $isUsable = Symbol();
  49717. exports.$isUsable = $isUsable;
  49718. const $lastAttribute = Symbol();
  49719. const $namespaceId = Symbol("namespaceId");
  49720. exports.$namespaceId = $namespaceId;
  49721. const $nodeName = Symbol("nodeName");
  49722. exports.$nodeName = $nodeName;
  49723. const $nsAttributes = Symbol();
  49724. exports.$nsAttributes = $nsAttributes;
  49725. const $onChild = Symbol();
  49726. exports.$onChild = $onChild;
  49727. const $onChildCheck = Symbol();
  49728. exports.$onChildCheck = $onChildCheck;
  49729. const $onText = Symbol();
  49730. exports.$onText = $onText;
  49731. const $pushGlyphs = Symbol();
  49732. exports.$pushGlyphs = $pushGlyphs;
  49733. const $popPara = Symbol();
  49734. exports.$popPara = $popPara;
  49735. const $pushPara = Symbol();
  49736. exports.$pushPara = $pushPara;
  49737. const $removeChild = Symbol();
  49738. exports.$removeChild = $removeChild;
  49739. const $root = Symbol("root");
  49740. exports.$root = $root;
  49741. const $resolvePrototypes = Symbol();
  49742. exports.$resolvePrototypes = $resolvePrototypes;
  49743. const $searchNode = Symbol();
  49744. exports.$searchNode = $searchNode;
  49745. const $setId = Symbol();
  49746. exports.$setId = $setId;
  49747. const $setSetAttributes = Symbol();
  49748. exports.$setSetAttributes = $setSetAttributes;
  49749. const $setValue = Symbol();
  49750. exports.$setValue = $setValue;
  49751. const $tabIndex = Symbol();
  49752. exports.$tabIndex = $tabIndex;
  49753. const $text = Symbol();
  49754. exports.$text = $text;
  49755. const $toHTML = Symbol();
  49756. exports.$toHTML = $toHTML;
  49757. const $toString = Symbol();
  49758. exports.$toString = $toString;
  49759. const $toStyle = Symbol();
  49760. exports.$toStyle = $toStyle;
  49761. const $uid = Symbol("uid");
  49762. exports.$uid = $uid;
  49763. const _applyPrototype = Symbol();
  49764. const _attributes = Symbol();
  49765. const _attributeNames = Symbol();
  49766. const _children = Symbol("_children");
  49767. const _cloneAttribute = Symbol();
  49768. const _dataValue = Symbol();
  49769. const _defaultValue = Symbol();
  49770. const _filteredChildrenGenerator = Symbol();
  49771. const _getPrototype = Symbol();
  49772. const _getUnsetAttributes = Symbol();
  49773. const _hasChildren = Symbol();
  49774. const _max = Symbol();
  49775. const _options = Symbol();
  49776. const _parent = Symbol("parent");
  49777. const _resolvePrototypesHelper = Symbol();
  49778. const _setAttributes = Symbol();
  49779. const _validator = Symbol();
  49780. let uid = 0;
  49781. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  49782. class XFAObject {
  49783. constructor(nsId, name, hasChildren = false) {
  49784. this[$namespaceId] = nsId;
  49785. this[$nodeName] = name;
  49786. this[_hasChildren] = hasChildren;
  49787. this[_parent] = null;
  49788. this[_children] = [];
  49789. this[$uid] = `${name}${uid++}`;
  49790. this[$globalData] = null;
  49791. }
  49792. [$onChild](child) {
  49793. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  49794. return false;
  49795. }
  49796. const name = child[$nodeName];
  49797. const node = this[name];
  49798. if (node instanceof XFAObjectArray) {
  49799. if (node.push(child)) {
  49800. this[$appendChild](child);
  49801. return true;
  49802. }
  49803. } else {
  49804. if (node !== null) {
  49805. this[$removeChild](node);
  49806. }
  49807. this[name] = child;
  49808. this[$appendChild](child);
  49809. return true;
  49810. }
  49811. let id = "";
  49812. if (this.id) {
  49813. id = ` (id: ${this.id})`;
  49814. } else if (this.name) {
  49815. id = ` (name: ${this.name} ${this.h.value})`;
  49816. }
  49817. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  49818. return false;
  49819. }
  49820. [$onChildCheck](child) {
  49821. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  49822. }
  49823. [$isNsAgnostic]() {
  49824. return false;
  49825. }
  49826. [$acceptWhitespace]() {
  49827. return false;
  49828. }
  49829. [$isCDATAXml]() {
  49830. return false;
  49831. }
  49832. [$isBindable]() {
  49833. return false;
  49834. }
  49835. [$popPara]() {
  49836. if (this.para) {
  49837. this[$getTemplateRoot]()[$extra].paraStack.pop();
  49838. }
  49839. }
  49840. [$pushPara]() {
  49841. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  49842. }
  49843. [$setId](ids) {
  49844. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  49845. ids.set(this.id, this);
  49846. }
  49847. }
  49848. [$getTemplateRoot]() {
  49849. return this[$globalData].template;
  49850. }
  49851. [$isSplittable]() {
  49852. return false;
  49853. }
  49854. [$isThereMoreWidth]() {
  49855. return false;
  49856. }
  49857. [$appendChild](child) {
  49858. child[_parent] = this;
  49859. this[_children].push(child);
  49860. if (!child[$globalData] && this[$globalData]) {
  49861. child[$globalData] = this[$globalData];
  49862. }
  49863. }
  49864. [$removeChild](child) {
  49865. const i = this[_children].indexOf(child);
  49866. this[_children].splice(i, 1);
  49867. }
  49868. [$hasSettableValue]() {
  49869. return this.hasOwnProperty("value");
  49870. }
  49871. [$setValue](_) {}
  49872. [$onText](_) {}
  49873. [$finalize]() {}
  49874. [$clean](builder) {
  49875. delete this[_hasChildren];
  49876. if (this[$cleanup]) {
  49877. builder.clean(this[$cleanup]);
  49878. delete this[$cleanup];
  49879. }
  49880. }
  49881. [$indexOf](child) {
  49882. return this[_children].indexOf(child);
  49883. }
  49884. [$insertAt](i, child) {
  49885. child[_parent] = this;
  49886. this[_children].splice(i, 0, child);
  49887. if (!child[$globalData] && this[$globalData]) {
  49888. child[$globalData] = this[$globalData];
  49889. }
  49890. }
  49891. [$isTransparent]() {
  49892. return !this.name;
  49893. }
  49894. [$lastAttribute]() {
  49895. return "";
  49896. }
  49897. [$text]() {
  49898. if (this[_children].length === 0) {
  49899. return this[$content];
  49900. }
  49901. return this[_children].map(c => c[$text]()).join("");
  49902. }
  49903. get [_attributeNames]() {
  49904. const proto = Object.getPrototypeOf(this);
  49905. if (!proto._attributes) {
  49906. const attributes = proto._attributes = new Set();
  49907. for (const name of Object.getOwnPropertyNames(this)) {
  49908. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  49909. break;
  49910. }
  49911. attributes.add(name);
  49912. }
  49913. }
  49914. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  49915. }
  49916. [$isDescendent](parent) {
  49917. let node = this;
  49918. while (node) {
  49919. if (node === parent) {
  49920. return true;
  49921. }
  49922. node = node[$getParent]();
  49923. }
  49924. return false;
  49925. }
  49926. [$getParent]() {
  49927. return this[_parent];
  49928. }
  49929. [$getSubformParent]() {
  49930. return this[$getParent]();
  49931. }
  49932. [$getChildren](name = null) {
  49933. if (!name) {
  49934. return this[_children];
  49935. }
  49936. return this[name];
  49937. }
  49938. [$dump]() {
  49939. const dumped = Object.create(null);
  49940. if (this[$content]) {
  49941. dumped.$content = this[$content];
  49942. }
  49943. for (const name of Object.getOwnPropertyNames(this)) {
  49944. const value = this[name];
  49945. if (value === null) {
  49946. continue;
  49947. }
  49948. if (value instanceof XFAObject) {
  49949. dumped[name] = value[$dump]();
  49950. } else if (value instanceof XFAObjectArray) {
  49951. if (!value.isEmpty()) {
  49952. dumped[name] = value.dump();
  49953. }
  49954. } else {
  49955. dumped[name] = value;
  49956. }
  49957. }
  49958. return dumped;
  49959. }
  49960. [$toStyle]() {
  49961. return null;
  49962. }
  49963. [$toHTML]() {
  49964. return _utils.HTMLResult.EMPTY;
  49965. }
  49966. *[$getContainedChildren]() {
  49967. for (const node of this[$getChildren]()) {
  49968. yield node;
  49969. }
  49970. }
  49971. *[_filteredChildrenGenerator](filter, include) {
  49972. for (const node of this[$getContainedChildren]()) {
  49973. if (!filter || include === filter.has(node[$nodeName])) {
  49974. const availableSpace = this[$getAvailableSpace]();
  49975. const res = node[$toHTML](availableSpace);
  49976. if (!res.success) {
  49977. this[$extra].failingNode = node;
  49978. }
  49979. yield res;
  49980. }
  49981. }
  49982. }
  49983. [$flushHTML]() {
  49984. return null;
  49985. }
  49986. [$addHTML](html, bbox) {
  49987. this[$extra].children.push(html);
  49988. }
  49989. [$getAvailableSpace]() {}
  49990. [$childrenToHTML]({
  49991. filter = null,
  49992. include = true
  49993. }) {
  49994. if (!this[$extra].generator) {
  49995. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  49996. } else {
  49997. const availableSpace = this[$getAvailableSpace]();
  49998. const res = this[$extra].failingNode[$toHTML](availableSpace);
  49999. if (!res.success) {
  50000. return res;
  50001. }
  50002. if (res.html) {
  50003. this[$addHTML](res.html, res.bbox);
  50004. }
  50005. delete this[$extra].failingNode;
  50006. }
  50007. while (true) {
  50008. const gen = this[$extra].generator.next();
  50009. if (gen.done) {
  50010. break;
  50011. }
  50012. const res = gen.value;
  50013. if (!res.success) {
  50014. return res;
  50015. }
  50016. if (res.html) {
  50017. this[$addHTML](res.html, res.bbox);
  50018. }
  50019. }
  50020. this[$extra].generator = null;
  50021. return _utils.HTMLResult.EMPTY;
  50022. }
  50023. [$setSetAttributes](attributes) {
  50024. this[_setAttributes] = new Set(Object.keys(attributes));
  50025. }
  50026. [_getUnsetAttributes](protoAttributes) {
  50027. const allAttr = this[_attributeNames];
  50028. const setAttr = this[_setAttributes];
  50029. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  50030. }
  50031. [$resolvePrototypes](ids, ancestors = new Set()) {
  50032. for (const child of this[_children]) {
  50033. child[_resolvePrototypesHelper](ids, ancestors);
  50034. }
  50035. }
  50036. [_resolvePrototypesHelper](ids, ancestors) {
  50037. const proto = this[_getPrototype](ids, ancestors);
  50038. if (proto) {
  50039. this[_applyPrototype](proto, ids, ancestors);
  50040. } else {
  50041. this[$resolvePrototypes](ids, ancestors);
  50042. }
  50043. }
  50044. [_getPrototype](ids, ancestors) {
  50045. const {
  50046. use,
  50047. usehref
  50048. } = this;
  50049. if (!use && !usehref) {
  50050. return null;
  50051. }
  50052. let proto = null;
  50053. let somExpression = null;
  50054. let id = null;
  50055. let ref = use;
  50056. if (usehref) {
  50057. ref = usehref;
  50058. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  50059. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  50060. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  50061. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  50062. } else if (usehref.startsWith("#")) {
  50063. id = usehref.slice(1);
  50064. } else if (usehref.startsWith(".#")) {
  50065. id = usehref.slice(2);
  50066. }
  50067. } else if (use.startsWith("#")) {
  50068. id = use.slice(1);
  50069. } else {
  50070. somExpression = use;
  50071. }
  50072. this.use = this.usehref = "";
  50073. if (id) {
  50074. proto = ids.get(id);
  50075. } else {
  50076. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  50077. if (proto) {
  50078. proto = proto[0];
  50079. }
  50080. }
  50081. if (!proto) {
  50082. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  50083. return null;
  50084. }
  50085. if (proto[$nodeName] !== this[$nodeName]) {
  50086. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  50087. return null;
  50088. }
  50089. if (ancestors.has(proto)) {
  50090. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  50091. return null;
  50092. }
  50093. ancestors.add(proto);
  50094. const protoProto = proto[_getPrototype](ids, ancestors);
  50095. if (protoProto) {
  50096. proto[_applyPrototype](protoProto, ids, ancestors);
  50097. }
  50098. proto[$resolvePrototypes](ids, ancestors);
  50099. ancestors.delete(proto);
  50100. return proto;
  50101. }
  50102. [_applyPrototype](proto, ids, ancestors) {
  50103. if (ancestors.has(proto)) {
  50104. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  50105. return;
  50106. }
  50107. if (!this[$content] && proto[$content]) {
  50108. this[$content] = proto[$content];
  50109. }
  50110. const newAncestors = new Set(ancestors);
  50111. newAncestors.add(proto);
  50112. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  50113. this[unsetAttrName] = proto[unsetAttrName];
  50114. if (this[_setAttributes]) {
  50115. this[_setAttributes].add(unsetAttrName);
  50116. }
  50117. }
  50118. for (const name of Object.getOwnPropertyNames(this)) {
  50119. if (this[_attributeNames].has(name)) {
  50120. continue;
  50121. }
  50122. const value = this[name];
  50123. const protoValue = proto[name];
  50124. if (value instanceof XFAObjectArray) {
  50125. for (const child of value[_children]) {
  50126. child[_resolvePrototypesHelper](ids, ancestors);
  50127. }
  50128. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  50129. const child = proto[_children][i][$clone]();
  50130. if (value.push(child)) {
  50131. child[_parent] = this;
  50132. this[_children].push(child);
  50133. child[_resolvePrototypesHelper](ids, ancestors);
  50134. } else {
  50135. break;
  50136. }
  50137. }
  50138. continue;
  50139. }
  50140. if (value !== null) {
  50141. value[$resolvePrototypes](ids, ancestors);
  50142. if (protoValue) {
  50143. value[_applyPrototype](protoValue, ids, ancestors);
  50144. }
  50145. continue;
  50146. }
  50147. if (protoValue !== null) {
  50148. const child = protoValue[$clone]();
  50149. child[_parent] = this;
  50150. this[name] = child;
  50151. this[_children].push(child);
  50152. child[_resolvePrototypesHelper](ids, ancestors);
  50153. }
  50154. }
  50155. }
  50156. static [_cloneAttribute](obj) {
  50157. if (Array.isArray(obj)) {
  50158. return obj.map(x => XFAObject[_cloneAttribute](x));
  50159. }
  50160. if (typeof obj === "object" && obj !== null) {
  50161. return Object.assign({}, obj);
  50162. }
  50163. return obj;
  50164. }
  50165. [$clone]() {
  50166. const clone = Object.create(Object.getPrototypeOf(this));
  50167. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  50168. try {
  50169. clone[$symbol] = this[$symbol];
  50170. } catch (_) {
  50171. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  50172. }
  50173. }
  50174. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  50175. clone[_children] = [];
  50176. for (const name of Object.getOwnPropertyNames(this)) {
  50177. if (this[_attributeNames].has(name)) {
  50178. clone[name] = XFAObject[_cloneAttribute](this[name]);
  50179. continue;
  50180. }
  50181. const value = this[name];
  50182. if (value instanceof XFAObjectArray) {
  50183. clone[name] = new XFAObjectArray(value[_max]);
  50184. } else {
  50185. clone[name] = null;
  50186. }
  50187. }
  50188. for (const child of this[_children]) {
  50189. const name = child[$nodeName];
  50190. const clonedChild = child[$clone]();
  50191. clone[_children].push(clonedChild);
  50192. clonedChild[_parent] = clone;
  50193. if (clone[name] === null) {
  50194. clone[name] = clonedChild;
  50195. } else {
  50196. clone[name][_children].push(clonedChild);
  50197. }
  50198. }
  50199. return clone;
  50200. }
  50201. [$getChildren](name = null) {
  50202. if (!name) {
  50203. return this[_children];
  50204. }
  50205. return this[_children].filter(c => c[$nodeName] === name);
  50206. }
  50207. [$getChildrenByClass](name) {
  50208. return this[name];
  50209. }
  50210. [$getChildrenByName](name, allTransparent, first = true) {
  50211. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  50212. }
  50213. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  50214. if (name === "parent") {
  50215. yield this[_parent];
  50216. return;
  50217. }
  50218. for (const child of this[_children]) {
  50219. if (child[$nodeName] === name) {
  50220. yield child;
  50221. }
  50222. if (child.name === name) {
  50223. yield child;
  50224. }
  50225. if (allTransparent || child[$isTransparent]()) {
  50226. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  50227. }
  50228. }
  50229. if (first && this[_attributeNames].has(name)) {
  50230. yield new XFAAttribute(this, name, this[name]);
  50231. }
  50232. }
  50233. }
  50234. exports.XFAObject = XFAObject;
  50235. class XFAObjectArray {
  50236. constructor(max = Infinity) {
  50237. this[_max] = max;
  50238. this[_children] = [];
  50239. }
  50240. push(child) {
  50241. const len = this[_children].length;
  50242. if (len <= this[_max]) {
  50243. this[_children].push(child);
  50244. return true;
  50245. }
  50246. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  50247. return false;
  50248. }
  50249. isEmpty() {
  50250. return this[_children].length === 0;
  50251. }
  50252. dump() {
  50253. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  50254. }
  50255. [$clone]() {
  50256. const clone = new XFAObjectArray(this[_max]);
  50257. clone[_children] = this[_children].map(c => c[$clone]());
  50258. return clone;
  50259. }
  50260. get children() {
  50261. return this[_children];
  50262. }
  50263. clear() {
  50264. this[_children].length = 0;
  50265. }
  50266. }
  50267. exports.XFAObjectArray = XFAObjectArray;
  50268. class XFAAttribute {
  50269. constructor(node, name, value) {
  50270. this[_parent] = node;
  50271. this[$nodeName] = name;
  50272. this[$content] = value;
  50273. this[$consumed] = false;
  50274. this[$uid] = `attribute${uid++}`;
  50275. }
  50276. [$getParent]() {
  50277. return this[_parent];
  50278. }
  50279. [$isDataValue]() {
  50280. return true;
  50281. }
  50282. [$getDataValue]() {
  50283. return this[$content].trim();
  50284. }
  50285. [$setValue](value) {
  50286. value = value.value || "";
  50287. this[$content] = value.toString();
  50288. }
  50289. [$text]() {
  50290. return this[$content];
  50291. }
  50292. [$isDescendent](parent) {
  50293. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  50294. }
  50295. }
  50296. exports.XFAAttribute = XFAAttribute;
  50297. class XmlObject extends XFAObject {
  50298. constructor(nsId, name, attributes = {}) {
  50299. super(nsId, name);
  50300. this[$content] = "";
  50301. this[_dataValue] = null;
  50302. if (name !== "#text") {
  50303. const map = new Map();
  50304. this[_attributes] = map;
  50305. for (const [attrName, value] of Object.entries(attributes)) {
  50306. map.set(attrName, new XFAAttribute(this, attrName, value));
  50307. }
  50308. if (attributes.hasOwnProperty($nsAttributes)) {
  50309. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  50310. if (dataNode !== undefined) {
  50311. if (dataNode === "dataGroup") {
  50312. this[_dataValue] = false;
  50313. } else if (dataNode === "dataValue") {
  50314. this[_dataValue] = true;
  50315. }
  50316. }
  50317. }
  50318. }
  50319. this[$consumed] = false;
  50320. }
  50321. [$toString](buf) {
  50322. const tagName = this[$nodeName];
  50323. if (tagName === "#text") {
  50324. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  50325. return;
  50326. }
  50327. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  50328. buf.push(`<${prefix}${tagName}`);
  50329. for (const [name, value] of this[_attributes].entries()) {
  50330. buf.push(` ${name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  50331. }
  50332. if (this[_dataValue] !== null) {
  50333. if (this[_dataValue]) {
  50334. buf.push(` xfa:dataNode="dataValue"`);
  50335. } else {
  50336. buf.push(` xfa:dataNode="dataGroup"`);
  50337. }
  50338. }
  50339. if (!this[$content] && this[_children].length === 0) {
  50340. buf.push("/>");
  50341. return;
  50342. }
  50343. buf.push(">");
  50344. if (this[$content]) {
  50345. if (typeof this[$content] === "string") {
  50346. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  50347. } else {
  50348. this[$content][$toString](buf);
  50349. }
  50350. } else {
  50351. for (const child of this[_children]) {
  50352. child[$toString](buf);
  50353. }
  50354. }
  50355. buf.push(`</${prefix}${tagName}>`);
  50356. }
  50357. [$onChild](child) {
  50358. if (this[$content]) {
  50359. const node = new XmlObject(this[$namespaceId], "#text");
  50360. this[$appendChild](node);
  50361. node[$content] = this[$content];
  50362. this[$content] = "";
  50363. }
  50364. this[$appendChild](child);
  50365. return true;
  50366. }
  50367. [$onText](str) {
  50368. this[$content] += str;
  50369. }
  50370. [$finalize]() {
  50371. if (this[$content] && this[_children].length > 0) {
  50372. const node = new XmlObject(this[$namespaceId], "#text");
  50373. this[$appendChild](node);
  50374. node[$content] = this[$content];
  50375. delete this[$content];
  50376. }
  50377. }
  50378. [$toHTML]() {
  50379. if (this[$nodeName] === "#text") {
  50380. return _utils.HTMLResult.success({
  50381. name: "#text",
  50382. value: this[$content]
  50383. });
  50384. }
  50385. return _utils.HTMLResult.EMPTY;
  50386. }
  50387. [$getChildren](name = null) {
  50388. if (!name) {
  50389. return this[_children];
  50390. }
  50391. return this[_children].filter(c => c[$nodeName] === name);
  50392. }
  50393. [$getAttributes]() {
  50394. return this[_attributes];
  50395. }
  50396. [$getChildrenByClass](name) {
  50397. const value = this[_attributes].get(name);
  50398. if (value !== undefined) {
  50399. return value;
  50400. }
  50401. return this[$getChildren](name);
  50402. }
  50403. *[$getChildrenByNameIt](name, allTransparent) {
  50404. const value = this[_attributes].get(name);
  50405. if (value) {
  50406. yield value;
  50407. }
  50408. for (const child of this[_children]) {
  50409. if (child[$nodeName] === name) {
  50410. yield child;
  50411. }
  50412. if (allTransparent) {
  50413. yield* child[$getChildrenByNameIt](name, allTransparent);
  50414. }
  50415. }
  50416. }
  50417. *[$getAttributeIt](name, skipConsumed) {
  50418. const value = this[_attributes].get(name);
  50419. if (value && (!skipConsumed || !value[$consumed])) {
  50420. yield value;
  50421. }
  50422. for (const child of this[_children]) {
  50423. yield* child[$getAttributeIt](name, skipConsumed);
  50424. }
  50425. }
  50426. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  50427. for (const child of this[_children]) {
  50428. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  50429. yield child;
  50430. }
  50431. if (allTransparent) {
  50432. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  50433. }
  50434. }
  50435. }
  50436. [$isDataValue]() {
  50437. if (this[_dataValue] === null) {
  50438. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  50439. }
  50440. return this[_dataValue];
  50441. }
  50442. [$getDataValue]() {
  50443. if (this[_dataValue] === null) {
  50444. if (this[_children].length === 0) {
  50445. return this[$content].trim();
  50446. }
  50447. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  50448. return this[_children][0][$text]().trim();
  50449. }
  50450. return null;
  50451. }
  50452. return this[$content].trim();
  50453. }
  50454. [$setValue](value) {
  50455. value = value.value || "";
  50456. this[$content] = value.toString();
  50457. }
  50458. [$dump](hasNS = false) {
  50459. const dumped = Object.create(null);
  50460. if (hasNS) {
  50461. dumped.$ns = this[$namespaceId];
  50462. }
  50463. if (this[$content]) {
  50464. dumped.$content = this[$content];
  50465. }
  50466. dumped.$name = this[$nodeName];
  50467. dumped.children = [];
  50468. for (const child of this[_children]) {
  50469. dumped.children.push(child[$dump](hasNS));
  50470. }
  50471. dumped.attributes = Object.create(null);
  50472. for (const [name, value] of this[_attributes]) {
  50473. dumped.attributes[name] = value[$content];
  50474. }
  50475. return dumped;
  50476. }
  50477. }
  50478. exports.XmlObject = XmlObject;
  50479. class ContentObject extends XFAObject {
  50480. constructor(nsId, name) {
  50481. super(nsId, name);
  50482. this[$content] = "";
  50483. }
  50484. [$onText](text) {
  50485. this[$content] += text;
  50486. }
  50487. [$finalize]() {}
  50488. }
  50489. exports.ContentObject = ContentObject;
  50490. class OptionObject extends ContentObject {
  50491. constructor(nsId, name, options) {
  50492. super(nsId, name);
  50493. this[_options] = options;
  50494. }
  50495. [$finalize]() {
  50496. this[$content] = (0, _utils.getKeyword)({
  50497. data: this[$content],
  50498. defaultValue: this[_options][0],
  50499. validate: k => this[_options].includes(k)
  50500. });
  50501. }
  50502. [$clean](builder) {
  50503. super[$clean](builder);
  50504. delete this[_options];
  50505. }
  50506. }
  50507. exports.OptionObject = OptionObject;
  50508. class StringObject extends ContentObject {
  50509. [$finalize]() {
  50510. this[$content] = this[$content].trim();
  50511. }
  50512. }
  50513. exports.StringObject = StringObject;
  50514. class IntegerObject extends ContentObject {
  50515. constructor(nsId, name, defaultValue, validator) {
  50516. super(nsId, name);
  50517. this[_defaultValue] = defaultValue;
  50518. this[_validator] = validator;
  50519. }
  50520. [$finalize]() {
  50521. this[$content] = (0, _utils.getInteger)({
  50522. data: this[$content],
  50523. defaultValue: this[_defaultValue],
  50524. validate: this[_validator]
  50525. });
  50526. }
  50527. [$clean](builder) {
  50528. super[$clean](builder);
  50529. delete this[_defaultValue];
  50530. delete this[_validator];
  50531. }
  50532. }
  50533. exports.IntegerObject = IntegerObject;
  50534. class Option01 extends IntegerObject {
  50535. constructor(nsId, name) {
  50536. super(nsId, name, 0, n => n === 1);
  50537. }
  50538. }
  50539. exports.Option01 = Option01;
  50540. class Option10 extends IntegerObject {
  50541. constructor(nsId, name) {
  50542. super(nsId, name, 1, n => n === 0);
  50543. }
  50544. }
  50545. exports.Option10 = Option10;
  50546. /***/ }),
  50547. /* 76 */
  50548. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50549. Object.defineProperty(exports, "__esModule", ({
  50550. value: true
  50551. }));
  50552. exports.getBBox = getBBox;
  50553. exports.getColor = getColor;
  50554. exports.getFloat = getFloat;
  50555. exports.getInteger = getInteger;
  50556. exports.getKeyword = getKeyword;
  50557. exports.getMeasurement = getMeasurement;
  50558. exports.getRatio = getRatio;
  50559. exports.getRelevant = getRelevant;
  50560. exports.getStringOption = getStringOption;
  50561. exports.stripQuotes = stripQuotes;
  50562. exports.HTMLResult = void 0;
  50563. var _util = __w_pdfjs_require__(2);
  50564. const dimConverters = {
  50565. pt: x => x,
  50566. cm: x => x / 2.54 * 72,
  50567. mm: x => x / (10 * 2.54) * 72,
  50568. in: x => x * 72,
  50569. px: x => x
  50570. };
  50571. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  50572. function stripQuotes(str) {
  50573. if (str.startsWith("'") || str.startsWith('"')) {
  50574. return str.slice(1, str.length - 1);
  50575. }
  50576. return str;
  50577. }
  50578. function getInteger({
  50579. data,
  50580. defaultValue,
  50581. validate
  50582. }) {
  50583. if (!data) {
  50584. return defaultValue;
  50585. }
  50586. data = data.trim();
  50587. const n = parseInt(data, 10);
  50588. if (!isNaN(n) && validate(n)) {
  50589. return n;
  50590. }
  50591. return defaultValue;
  50592. }
  50593. function getFloat({
  50594. data,
  50595. defaultValue,
  50596. validate
  50597. }) {
  50598. if (!data) {
  50599. return defaultValue;
  50600. }
  50601. data = data.trim();
  50602. const n = parseFloat(data);
  50603. if (!isNaN(n) && validate(n)) {
  50604. return n;
  50605. }
  50606. return defaultValue;
  50607. }
  50608. function getKeyword({
  50609. data,
  50610. defaultValue,
  50611. validate
  50612. }) {
  50613. if (!data) {
  50614. return defaultValue;
  50615. }
  50616. data = data.trim();
  50617. if (validate(data)) {
  50618. return data;
  50619. }
  50620. return defaultValue;
  50621. }
  50622. function getStringOption(data, options) {
  50623. return getKeyword({
  50624. data,
  50625. defaultValue: options[0],
  50626. validate: k => options.includes(k)
  50627. });
  50628. }
  50629. function getMeasurement(str, def = "0") {
  50630. def = def || "0";
  50631. if (!str) {
  50632. return getMeasurement(def);
  50633. }
  50634. const match = str.trim().match(measurementPattern);
  50635. if (!match) {
  50636. return getMeasurement(def);
  50637. }
  50638. const [, valueStr, unit] = match;
  50639. const value = parseFloat(valueStr);
  50640. if (isNaN(value)) {
  50641. return getMeasurement(def);
  50642. }
  50643. if (value === 0) {
  50644. return 0;
  50645. }
  50646. const conv = dimConverters[unit];
  50647. if (conv) {
  50648. return conv(value);
  50649. }
  50650. return value;
  50651. }
  50652. function getRatio(data) {
  50653. if (!data) {
  50654. return {
  50655. num: 1,
  50656. den: 1
  50657. };
  50658. }
  50659. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  50660. if (ratio.length === 1) {
  50661. ratio.push(1);
  50662. }
  50663. if (ratio.length === 0) {
  50664. return {
  50665. num: 1,
  50666. den: 1
  50667. };
  50668. }
  50669. const [num, den] = ratio;
  50670. return {
  50671. num,
  50672. den
  50673. };
  50674. }
  50675. function getRelevant(data) {
  50676. if (!data) {
  50677. return [];
  50678. }
  50679. return data.trim().split(/\s+/).map(e => {
  50680. return {
  50681. excluded: e[0] === "-",
  50682. viewname: e.substring(1)
  50683. };
  50684. });
  50685. }
  50686. function getColor(data, def = [0, 0, 0]) {
  50687. let [r, g, b] = def;
  50688. if (!data) {
  50689. return {
  50690. r,
  50691. g,
  50692. b
  50693. };
  50694. }
  50695. 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);
  50696. if (color.length < 3) {
  50697. return {
  50698. r,
  50699. g,
  50700. b
  50701. };
  50702. }
  50703. [r, g, b] = color;
  50704. return {
  50705. r,
  50706. g,
  50707. b
  50708. };
  50709. }
  50710. function getBBox(data) {
  50711. const def = -1;
  50712. if (!data) {
  50713. return {
  50714. x: def,
  50715. y: def,
  50716. width: def,
  50717. height: def
  50718. };
  50719. }
  50720. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  50721. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  50722. return {
  50723. x: def,
  50724. y: def,
  50725. width: def,
  50726. height: def
  50727. };
  50728. }
  50729. const [x, y, width, height] = bbox;
  50730. return {
  50731. x,
  50732. y,
  50733. width,
  50734. height
  50735. };
  50736. }
  50737. class HTMLResult {
  50738. static get FAILURE() {
  50739. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  50740. }
  50741. static get EMPTY() {
  50742. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  50743. }
  50744. constructor(success, html, bbox, breakNode) {
  50745. this.success = success;
  50746. this.html = html;
  50747. this.bbox = bbox;
  50748. this.breakNode = breakNode;
  50749. }
  50750. isBreak() {
  50751. return !!this.breakNode;
  50752. }
  50753. static breakNode(node) {
  50754. return new HTMLResult(false, null, null, node);
  50755. }
  50756. static success(html, bbox = null) {
  50757. return new HTMLResult(true, html, bbox, null);
  50758. }
  50759. }
  50760. exports.HTMLResult = HTMLResult;
  50761. /***/ }),
  50762. /* 77 */
  50763. /***/ ((__unused_webpack_module, exports) => {
  50764. Object.defineProperty(exports, "__esModule", ({
  50765. value: true
  50766. }));
  50767. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  50768. const $buildXFAObject = Symbol();
  50769. exports.$buildXFAObject = $buildXFAObject;
  50770. const NamespaceIds = {
  50771. config: {
  50772. id: 0,
  50773. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  50774. },
  50775. connectionSet: {
  50776. id: 1,
  50777. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  50778. },
  50779. datasets: {
  50780. id: 2,
  50781. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  50782. },
  50783. form: {
  50784. id: 3,
  50785. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  50786. },
  50787. localeSet: {
  50788. id: 4,
  50789. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  50790. },
  50791. pdf: {
  50792. id: 5,
  50793. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  50794. },
  50795. signature: {
  50796. id: 6,
  50797. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  50798. },
  50799. sourceSet: {
  50800. id: 7,
  50801. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  50802. },
  50803. stylesheet: {
  50804. id: 8,
  50805. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  50806. },
  50807. template: {
  50808. id: 9,
  50809. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  50810. },
  50811. xdc: {
  50812. id: 10,
  50813. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  50814. },
  50815. xdp: {
  50816. id: 11,
  50817. check: ns => ns === "http://ns.adobe.com/xdp/"
  50818. },
  50819. xfdf: {
  50820. id: 12,
  50821. check: ns => ns === "http://ns.adobe.com/xfdf/"
  50822. },
  50823. xhtml: {
  50824. id: 13,
  50825. check: ns => ns === "http://www.w3.org/1999/xhtml"
  50826. },
  50827. xmpmeta: {
  50828. id: 14,
  50829. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  50830. }
  50831. };
  50832. exports.NamespaceIds = NamespaceIds;
  50833. /***/ }),
  50834. /* 78 */
  50835. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50836. Object.defineProperty(exports, "__esModule", ({
  50837. value: true
  50838. }));
  50839. exports.createDataNode = createDataNode;
  50840. exports.searchNode = searchNode;
  50841. var _xfa_object = __w_pdfjs_require__(75);
  50842. var _namespaces = __w_pdfjs_require__(77);
  50843. var _util = __w_pdfjs_require__(2);
  50844. const namePattern = /^[^.[]+/;
  50845. const indexPattern = /^[^\]]+/;
  50846. const operators = {
  50847. dot: 0,
  50848. dotDot: 1,
  50849. dotHash: 2,
  50850. dotBracket: 3,
  50851. dotParen: 4
  50852. };
  50853. const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[_xfa_object.$getChildren]()[0]], ["$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]]);
  50854. const somCache = new WeakMap();
  50855. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  50856. function parseIndex(index) {
  50857. index = index.trim();
  50858. if (index === "*") {
  50859. return Infinity;
  50860. }
  50861. return parseInt(index, 10) || 0;
  50862. }
  50863. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  50864. let match = expr.match(namePattern);
  50865. if (!match) {
  50866. return null;
  50867. }
  50868. let [name] = match;
  50869. const parsed = [{
  50870. name,
  50871. cacheName: "." + name,
  50872. index: 0,
  50873. js: null,
  50874. formCalc: null,
  50875. operator: operators.dot
  50876. }];
  50877. let pos = name.length;
  50878. while (pos < expr.length) {
  50879. const spos = pos;
  50880. const char = expr.charAt(pos++);
  50881. if (char === "[") {
  50882. match = expr.slice(pos).match(indexPattern);
  50883. if (!match) {
  50884. (0, _util.warn)("XFA - Invalid index in SOM expression");
  50885. return null;
  50886. }
  50887. parsed[parsed.length - 1].index = parseIndex(match[0]);
  50888. pos += match[0].length + 1;
  50889. continue;
  50890. }
  50891. let operator;
  50892. switch (expr.charAt(pos)) {
  50893. case ".":
  50894. if (!dotDotAllowed) {
  50895. return null;
  50896. }
  50897. pos++;
  50898. operator = operators.dotDot;
  50899. break;
  50900. case "#":
  50901. pos++;
  50902. operator = operators.dotHash;
  50903. break;
  50904. case "[":
  50905. if (noExpr) {
  50906. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  50907. return null;
  50908. }
  50909. operator = operators.dotBracket;
  50910. break;
  50911. case "(":
  50912. if (noExpr) {
  50913. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  50914. return null;
  50915. }
  50916. operator = operators.dotParen;
  50917. break;
  50918. default:
  50919. operator = operators.dot;
  50920. break;
  50921. }
  50922. match = expr.slice(pos).match(namePattern);
  50923. if (!match) {
  50924. break;
  50925. }
  50926. [name] = match;
  50927. pos += name.length;
  50928. parsed.push({
  50929. name,
  50930. cacheName: expr.slice(spos, pos),
  50931. operator,
  50932. index: 0,
  50933. js: null,
  50934. formCalc: null
  50935. });
  50936. }
  50937. return parsed;
  50938. }
  50939. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  50940. const parsed = parseExpression(expr, dotDotAllowed);
  50941. if (!parsed) {
  50942. return null;
  50943. }
  50944. const fn = shortcuts.get(parsed[0].name);
  50945. let i = 0;
  50946. let isQualified;
  50947. if (fn) {
  50948. isQualified = true;
  50949. root = [fn(root, container)];
  50950. i = 1;
  50951. } else {
  50952. isQualified = container === null;
  50953. root = [container || root];
  50954. }
  50955. for (let ii = parsed.length; i < ii; i++) {
  50956. const {
  50957. name,
  50958. cacheName,
  50959. operator,
  50960. index
  50961. } = parsed[i];
  50962. const nodes = [];
  50963. for (const node of root) {
  50964. if (!(node instanceof _xfa_object.XFAObject)) {
  50965. continue;
  50966. }
  50967. let children, cached;
  50968. if (useCache) {
  50969. cached = somCache.get(node);
  50970. if (!cached) {
  50971. cached = new Map();
  50972. somCache.set(node, cached);
  50973. }
  50974. children = cached.get(cacheName);
  50975. }
  50976. if (!children) {
  50977. switch (operator) {
  50978. case operators.dot:
  50979. children = node[_xfa_object.$getChildrenByName](name, false);
  50980. break;
  50981. case operators.dotDot:
  50982. children = node[_xfa_object.$getChildrenByName](name, true);
  50983. break;
  50984. case operators.dotHash:
  50985. children = node[_xfa_object.$getChildrenByClass](name);
  50986. if (children instanceof _xfa_object.XFAObjectArray) {
  50987. children = children.children;
  50988. } else {
  50989. children = [children];
  50990. }
  50991. break;
  50992. default:
  50993. break;
  50994. }
  50995. if (useCache) {
  50996. cached.set(cacheName, children);
  50997. }
  50998. }
  50999. if (children.length > 0) {
  51000. nodes.push(children);
  51001. }
  51002. }
  51003. if (nodes.length === 0 && !isQualified && i === 0) {
  51004. const parent = container[_xfa_object.$getParent]();
  51005. container = parent;
  51006. if (!container) {
  51007. return null;
  51008. }
  51009. i = -1;
  51010. root = [container];
  51011. continue;
  51012. }
  51013. if (isFinite(index)) {
  51014. root = nodes.filter(node => index < node.length).map(node => node[index]);
  51015. } else {
  51016. root = nodes.reduce((acc, node) => acc.concat(node), []);
  51017. }
  51018. }
  51019. if (root.length === 0) {
  51020. return null;
  51021. }
  51022. return root;
  51023. }
  51024. function createNodes(root, path) {
  51025. let node = null;
  51026. for (const {
  51027. name,
  51028. index
  51029. } of path) {
  51030. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  51031. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  51032. node = new _xfa_object.XmlObject(nsId, name);
  51033. root[_xfa_object.$appendChild](node);
  51034. }
  51035. root = node;
  51036. }
  51037. return node;
  51038. }
  51039. function createDataNode(root, container, expr) {
  51040. const parsed = parseExpression(expr);
  51041. if (!parsed) {
  51042. return null;
  51043. }
  51044. if (parsed.some(x => x.operator === operators.dotDot)) {
  51045. return null;
  51046. }
  51047. const fn = shortcuts.get(parsed[0].name);
  51048. let i = 0;
  51049. if (fn) {
  51050. root = fn(root, container);
  51051. i = 1;
  51052. } else {
  51053. root = container || root;
  51054. }
  51055. for (let ii = parsed.length; i < ii; i++) {
  51056. const {
  51057. name,
  51058. operator,
  51059. index
  51060. } = parsed[i];
  51061. if (!isFinite(index)) {
  51062. parsed[i].index = 0;
  51063. return createNodes(root, parsed.slice(i));
  51064. }
  51065. let children;
  51066. switch (operator) {
  51067. case operators.dot:
  51068. children = root[_xfa_object.$getChildrenByName](name, false);
  51069. break;
  51070. case operators.dotDot:
  51071. children = root[_xfa_object.$getChildrenByName](name, true);
  51072. break;
  51073. case operators.dotHash:
  51074. children = root[_xfa_object.$getChildrenByClass](name);
  51075. if (children instanceof _xfa_object.XFAObjectArray) {
  51076. children = children.children;
  51077. } else {
  51078. children = [children];
  51079. }
  51080. break;
  51081. default:
  51082. break;
  51083. }
  51084. if (children.length === 0) {
  51085. return createNodes(root, parsed.slice(i));
  51086. }
  51087. if (index < children.length) {
  51088. const child = children[index];
  51089. if (!(child instanceof _xfa_object.XFAObject)) {
  51090. (0, _util.warn)(`XFA - Cannot create a node.`);
  51091. return null;
  51092. }
  51093. root = child;
  51094. } else {
  51095. parsed[i].index = index - children.length;
  51096. return createNodes(root, parsed.slice(i));
  51097. }
  51098. }
  51099. return null;
  51100. }
  51101. /***/ }),
  51102. /* 79 */
  51103. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51104. Object.defineProperty(exports, "__esModule", ({
  51105. value: true
  51106. }));
  51107. exports.Binder = void 0;
  51108. var _xfa_object = __w_pdfjs_require__(75);
  51109. var _template = __w_pdfjs_require__(80);
  51110. var _som = __w_pdfjs_require__(78);
  51111. var _namespaces = __w_pdfjs_require__(77);
  51112. var _util = __w_pdfjs_require__(2);
  51113. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51114. function createText(content) {
  51115. const node = new _template.Text({});
  51116. node[_xfa_object.$content] = content;
  51117. return node;
  51118. }
  51119. class Binder {
  51120. constructor(root) {
  51121. this.root = root;
  51122. this.datasets = root.datasets;
  51123. if (root.datasets && root.datasets.data) {
  51124. this.data = root.datasets.data;
  51125. } else {
  51126. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  51127. }
  51128. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  51129. this.root.form = this.form = root.template[_xfa_object.$clone]();
  51130. }
  51131. _isConsumeData() {
  51132. return !this.emptyMerge && this._mergeMode;
  51133. }
  51134. _isMatchTemplate() {
  51135. return !this._isConsumeData();
  51136. }
  51137. bind() {
  51138. this._bindElement(this.form, this.data);
  51139. return this.form;
  51140. }
  51141. getData() {
  51142. return this.data;
  51143. }
  51144. _bindValue(formNode, data, picture) {
  51145. formNode[_xfa_object.$data] = data;
  51146. if (formNode[_xfa_object.$hasSettableValue]()) {
  51147. if (data[_xfa_object.$isDataValue]()) {
  51148. const value = data[_xfa_object.$getDataValue]();
  51149. formNode[_xfa_object.$setValue](createText(value));
  51150. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  51151. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  51152. formNode[_xfa_object.$setValue](createText(value));
  51153. } else if (this._isConsumeData()) {
  51154. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  51155. }
  51156. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  51157. this._bindElement(formNode, data);
  51158. } else {
  51159. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  51160. }
  51161. }
  51162. _findDataByNameToConsume(name, isValue, dataNode, global) {
  51163. if (!name) {
  51164. return null;
  51165. }
  51166. let generator, match;
  51167. for (let i = 0; i < 3; i++) {
  51168. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  51169. while (true) {
  51170. match = generator.next().value;
  51171. if (!match) {
  51172. break;
  51173. }
  51174. if (isValue === match[_xfa_object.$isDataValue]()) {
  51175. return match;
  51176. }
  51177. }
  51178. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  51179. break;
  51180. }
  51181. dataNode = dataNode[_xfa_object.$getParent]();
  51182. }
  51183. if (!global) {
  51184. return null;
  51185. }
  51186. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  51187. match = generator.next().value;
  51188. if (match) {
  51189. return match;
  51190. }
  51191. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  51192. match = generator.next().value;
  51193. if (match && match[_xfa_object.$isDataValue]()) {
  51194. return match;
  51195. }
  51196. return null;
  51197. }
  51198. _setProperties(formNode, dataNode) {
  51199. if (!formNode.hasOwnProperty("setProperty")) {
  51200. return;
  51201. }
  51202. for (const {
  51203. ref,
  51204. target,
  51205. connection
  51206. } of formNode.setProperty.children) {
  51207. if (connection) {
  51208. continue;
  51209. }
  51210. if (!ref) {
  51211. continue;
  51212. }
  51213. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  51214. if (!nodes) {
  51215. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  51216. continue;
  51217. }
  51218. const [node] = nodes;
  51219. if (!node[_xfa_object.$isDescendent](this.data)) {
  51220. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  51221. continue;
  51222. }
  51223. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  51224. if (!targetNodes) {
  51225. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  51226. continue;
  51227. }
  51228. const [targetNode] = targetNodes;
  51229. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  51230. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  51231. continue;
  51232. }
  51233. const targetParent = targetNode[_xfa_object.$getParent]();
  51234. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  51235. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  51236. continue;
  51237. }
  51238. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  51239. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  51240. continue;
  51241. }
  51242. const content = node[_xfa_object.$text]();
  51243. const name = targetNode[_xfa_object.$nodeName];
  51244. if (targetNode instanceof _xfa_object.XFAAttribute) {
  51245. const attrs = Object.create(null);
  51246. attrs[name] = content;
  51247. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  51248. targetParent[name] = obj[name];
  51249. continue;
  51250. }
  51251. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  51252. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  51253. continue;
  51254. }
  51255. targetNode[_xfa_object.$data] = node;
  51256. targetNode[_xfa_object.$content] = content;
  51257. targetNode[_xfa_object.$finalize]();
  51258. }
  51259. }
  51260. _bindItems(formNode, dataNode) {
  51261. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  51262. return;
  51263. }
  51264. for (const item of formNode.items.children) {
  51265. formNode[_xfa_object.$removeChild](item);
  51266. }
  51267. formNode.items.clear();
  51268. const labels = new _template.Items({});
  51269. const values = new _template.Items({});
  51270. formNode[_xfa_object.$appendChild](labels);
  51271. formNode.items.push(labels);
  51272. formNode[_xfa_object.$appendChild](values);
  51273. formNode.items.push(values);
  51274. for (const {
  51275. ref,
  51276. labelRef,
  51277. valueRef,
  51278. connection
  51279. } of formNode.bindItems.children) {
  51280. if (connection) {
  51281. continue;
  51282. }
  51283. if (!ref) {
  51284. continue;
  51285. }
  51286. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  51287. if (!nodes) {
  51288. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  51289. continue;
  51290. }
  51291. for (const node of nodes) {
  51292. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  51293. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  51294. continue;
  51295. }
  51296. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  51297. if (!labelNodes) {
  51298. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  51299. continue;
  51300. }
  51301. const [labelNode] = labelNodes;
  51302. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  51303. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  51304. continue;
  51305. }
  51306. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  51307. if (!valueNodes) {
  51308. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  51309. continue;
  51310. }
  51311. const [valueNode] = valueNodes;
  51312. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  51313. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  51314. continue;
  51315. }
  51316. const label = createText(labelNode[_xfa_object.$text]());
  51317. const value = createText(valueNode[_xfa_object.$text]());
  51318. labels[_xfa_object.$appendChild](label);
  51319. labels.text.push(label);
  51320. values[_xfa_object.$appendChild](value);
  51321. values.text.push(value);
  51322. }
  51323. }
  51324. }
  51325. _bindOccurrences(formNode, matches, picture) {
  51326. let baseClone;
  51327. if (matches.length > 1) {
  51328. baseClone = formNode[_xfa_object.$clone]();
  51329. baseClone[_xfa_object.$removeChild](baseClone.occur);
  51330. baseClone.occur = null;
  51331. }
  51332. this._bindValue(formNode, matches[0], picture);
  51333. this._setProperties(formNode, matches[0]);
  51334. this._bindItems(formNode, matches[0]);
  51335. if (matches.length === 1) {
  51336. return;
  51337. }
  51338. const parent = formNode[_xfa_object.$getParent]();
  51339. const name = formNode[_xfa_object.$nodeName];
  51340. const pos = parent[_xfa_object.$indexOf](formNode);
  51341. for (let i = 1, ii = matches.length; i < ii; i++) {
  51342. const match = matches[i];
  51343. const clone = baseClone[_xfa_object.$clone]();
  51344. parent[name].push(clone);
  51345. parent[_xfa_object.$insertAt](pos + i, clone);
  51346. this._bindValue(clone, match, picture);
  51347. this._setProperties(clone, match);
  51348. this._bindItems(clone, match);
  51349. }
  51350. }
  51351. _createOccurrences(formNode) {
  51352. if (!this.emptyMerge) {
  51353. return;
  51354. }
  51355. const {
  51356. occur
  51357. } = formNode;
  51358. if (!occur || occur.initial <= 1) {
  51359. return;
  51360. }
  51361. const parent = formNode[_xfa_object.$getParent]();
  51362. const name = formNode[_xfa_object.$nodeName];
  51363. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  51364. return;
  51365. }
  51366. let currentNumber;
  51367. if (formNode.name) {
  51368. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  51369. } else {
  51370. currentNumber = parent[name].children.length;
  51371. }
  51372. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  51373. const ii = occur.initial - currentNumber;
  51374. if (ii) {
  51375. const nodeClone = formNode[_xfa_object.$clone]();
  51376. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  51377. nodeClone.occur = null;
  51378. parent[name].push(nodeClone);
  51379. parent[_xfa_object.$insertAt](pos, nodeClone);
  51380. for (let i = 1; i < ii; i++) {
  51381. const clone = nodeClone[_xfa_object.$clone]();
  51382. parent[name].push(clone);
  51383. parent[_xfa_object.$insertAt](pos + i, clone);
  51384. }
  51385. }
  51386. }
  51387. _getOccurInfo(formNode) {
  51388. const {
  51389. name,
  51390. occur
  51391. } = formNode;
  51392. if (!occur || !name) {
  51393. return [1, 1];
  51394. }
  51395. const max = occur.max === -1 ? Infinity : occur.max;
  51396. return [occur.min, max];
  51397. }
  51398. _setAndBind(formNode, dataNode) {
  51399. this._setProperties(formNode, dataNode);
  51400. this._bindItems(formNode, dataNode);
  51401. this._bindElement(formNode, dataNode);
  51402. }
  51403. _bindElement(formNode, dataNode) {
  51404. const uselessNodes = [];
  51405. this._createOccurrences(formNode);
  51406. for (const child of formNode[_xfa_object.$getChildren]()) {
  51407. if (child[_xfa_object.$data]) {
  51408. continue;
  51409. }
  51410. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  51411. this._mergeMode = child.mergeMode === "consumeData";
  51412. const dataChildren = dataNode[_xfa_object.$getChildren]();
  51413. if (dataChildren.length > 0) {
  51414. this._bindOccurrences(child, [dataChildren[0]], null);
  51415. } else if (this.emptyMerge) {
  51416. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  51417. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  51418. dataNode[_xfa_object.$appendChild](dataChild);
  51419. this._bindElement(child, dataChild);
  51420. }
  51421. continue;
  51422. }
  51423. if (!child[_xfa_object.$isBindable]()) {
  51424. continue;
  51425. }
  51426. let global = false;
  51427. let picture = null;
  51428. let ref = null;
  51429. let match = null;
  51430. if (child.bind) {
  51431. switch (child.bind.match) {
  51432. case "none":
  51433. this._setAndBind(child, dataNode);
  51434. continue;
  51435. case "global":
  51436. global = true;
  51437. break;
  51438. case "dataRef":
  51439. if (!child.bind.ref) {
  51440. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  51441. this._setAndBind(child, dataNode);
  51442. continue;
  51443. }
  51444. ref = child.bind.ref;
  51445. break;
  51446. default:
  51447. break;
  51448. }
  51449. if (child.bind.picture) {
  51450. picture = child.bind.picture[_xfa_object.$content];
  51451. }
  51452. }
  51453. const [min, max] = this._getOccurInfo(child);
  51454. if (ref) {
  51455. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  51456. if (match === null) {
  51457. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  51458. if (!match) {
  51459. continue;
  51460. }
  51461. if (this._isConsumeData()) {
  51462. match[_xfa_object.$consumed] = true;
  51463. }
  51464. this._setAndBind(child, match);
  51465. continue;
  51466. } else {
  51467. if (this._isConsumeData()) {
  51468. match = match.filter(node => !node[_xfa_object.$consumed]);
  51469. }
  51470. if (match.length > max) {
  51471. match = match.slice(0, max);
  51472. } else if (match.length === 0) {
  51473. match = null;
  51474. }
  51475. if (match && this._isConsumeData()) {
  51476. match.forEach(node => {
  51477. node[_xfa_object.$consumed] = true;
  51478. });
  51479. }
  51480. }
  51481. } else {
  51482. if (!child.name) {
  51483. this._setAndBind(child, dataNode);
  51484. continue;
  51485. }
  51486. if (this._isConsumeData()) {
  51487. const matches = [];
  51488. while (matches.length < max) {
  51489. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  51490. if (!found) {
  51491. break;
  51492. }
  51493. found[_xfa_object.$consumed] = true;
  51494. matches.push(found);
  51495. }
  51496. match = matches.length > 0 ? matches : null;
  51497. } else {
  51498. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  51499. if (!match) {
  51500. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  51501. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  51502. if (this.emptyMerge) {
  51503. match[_xfa_object.$consumed] = true;
  51504. }
  51505. dataNode[_xfa_object.$appendChild](match);
  51506. this._setAndBind(child, match);
  51507. continue;
  51508. }
  51509. if (this.emptyMerge) {
  51510. match[_xfa_object.$consumed] = true;
  51511. }
  51512. match = [match];
  51513. }
  51514. }
  51515. if (match) {
  51516. this._bindOccurrences(child, match, picture);
  51517. } else if (min > 0) {
  51518. this._setAndBind(child, dataNode);
  51519. } else {
  51520. uselessNodes.push(child);
  51521. }
  51522. }
  51523. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  51524. }
  51525. }
  51526. exports.Binder = Binder;
  51527. /***/ }),
  51528. /* 80 */
  51529. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51530. Object.defineProperty(exports, "__esModule", ({
  51531. value: true
  51532. }));
  51533. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  51534. var _xfa_object = __w_pdfjs_require__(75);
  51535. var _namespaces = __w_pdfjs_require__(77);
  51536. var _layout = __w_pdfjs_require__(81);
  51537. var _html_utils = __w_pdfjs_require__(82);
  51538. var _utils = __w_pdfjs_require__(76);
  51539. var _util = __w_pdfjs_require__(2);
  51540. var _fonts = __w_pdfjs_require__(83);
  51541. var _core_utils = __w_pdfjs_require__(9);
  51542. var _som = __w_pdfjs_require__(78);
  51543. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  51544. const SVG_NS = "http://www.w3.org/2000/svg";
  51545. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  51546. const MAX_EMPTY_PAGES = 3;
  51547. const DEFAULT_TAB_INDEX = 5000;
  51548. const HEADING_PATTERN = /^H(\d+)$/;
  51549. const MIMES = new Set(["image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/png", "image/apng", "image/x-png", "image/bmp", "image/x-ms-bmp", "image/tiff", "image/tif"]);
  51550. const IMAGES_HEADERS = [[[0x42, 0x4d], "image/bmp"], [[0xff, 0xd8, 0xff], "image/jpeg"], [[0x49, 0x49, 0x2a, 0x00], "image/tiff"], [[0x4d, 0x4d, 0x00, 0x2a], "image/tiff"], [[0x47, 0x49, 0x46, 0x38, 0x39, 0x61], "image/gif"], [[0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], "image/png"]];
  51551. function getBorderDims(node) {
  51552. if (!node || !node.border) {
  51553. return {
  51554. w: 0,
  51555. h: 0
  51556. };
  51557. }
  51558. const borderExtra = node.border[_xfa_object.$getExtra]();
  51559. if (!borderExtra) {
  51560. return {
  51561. w: 0,
  51562. h: 0
  51563. };
  51564. }
  51565. return {
  51566. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  51567. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  51568. };
  51569. }
  51570. function hasMargin(node) {
  51571. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  51572. }
  51573. function _setValue(templateNode, value) {
  51574. if (!templateNode.value) {
  51575. const nodeValue = new Value({});
  51576. templateNode[_xfa_object.$appendChild](nodeValue);
  51577. templateNode.value = nodeValue;
  51578. }
  51579. templateNode.value[_xfa_object.$setValue](value);
  51580. }
  51581. function* getContainedChildren(node) {
  51582. for (const child of node[_xfa_object.$getChildren]()) {
  51583. if (child instanceof SubformSet) {
  51584. yield* child[_xfa_object.$getContainedChildren]();
  51585. continue;
  51586. }
  51587. yield child;
  51588. }
  51589. }
  51590. function setTabIndex(node) {
  51591. while (node) {
  51592. if (!node.traversal) {
  51593. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  51594. return;
  51595. }
  51596. if (node[_xfa_object.$tabIndex]) {
  51597. return;
  51598. }
  51599. let next = null;
  51600. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  51601. if (child.operation === "next") {
  51602. next = child;
  51603. break;
  51604. }
  51605. }
  51606. if (!next || !next.ref) {
  51607. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  51608. return;
  51609. }
  51610. const root = node[_xfa_object.$getTemplateRoot]();
  51611. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  51612. const ref = root[_xfa_object.$searchNode](next.ref, node);
  51613. if (!ref) {
  51614. return;
  51615. }
  51616. node = ref[0];
  51617. }
  51618. }
  51619. function applyAssist(obj, attributes) {
  51620. const assist = obj.assist;
  51621. if (assist) {
  51622. const assistTitle = assist[_xfa_object.$toHTML]();
  51623. if (assistTitle) {
  51624. attributes.title = assistTitle;
  51625. }
  51626. const role = assist.role;
  51627. const match = role.match(HEADING_PATTERN);
  51628. if (match) {
  51629. const ariaRole = "heading";
  51630. const ariaLevel = match[1];
  51631. attributes.role = ariaRole;
  51632. attributes["aria-level"] = ariaLevel;
  51633. }
  51634. }
  51635. if (obj.layout === "table") {
  51636. attributes.role = "table";
  51637. } else if (obj.layout === "row") {
  51638. attributes.role = "row";
  51639. } else {
  51640. const parent = obj[_xfa_object.$getParent]();
  51641. if (parent.layout === "row") {
  51642. if (parent.assist && parent.assist.role === "TH") {
  51643. attributes.role = "columnheader";
  51644. } else {
  51645. attributes.role = "cell";
  51646. }
  51647. }
  51648. }
  51649. }
  51650. function ariaLabel(obj) {
  51651. if (!obj.assist) {
  51652. return null;
  51653. }
  51654. const assist = obj.assist;
  51655. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  51656. return assist.speak[_xfa_object.$content];
  51657. }
  51658. if (assist.toolTip) {
  51659. return assist.toolTip[_xfa_object.$content];
  51660. }
  51661. return null;
  51662. }
  51663. function valueToHtml(value) {
  51664. return _utils.HTMLResult.success({
  51665. name: "div",
  51666. attributes: {
  51667. class: ["xfaRich"],
  51668. style: Object.create(null)
  51669. },
  51670. children: [{
  51671. name: "span",
  51672. attributes: {
  51673. style: Object.create(null)
  51674. },
  51675. value
  51676. }]
  51677. });
  51678. }
  51679. function setFirstUnsplittable(node) {
  51680. const root = node[_xfa_object.$getTemplateRoot]();
  51681. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  51682. root[_xfa_object.$extra].firstUnsplittable = node;
  51683. root[_xfa_object.$extra].noLayoutFailure = true;
  51684. }
  51685. }
  51686. function unsetFirstUnsplittable(node) {
  51687. const root = node[_xfa_object.$getTemplateRoot]();
  51688. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  51689. root[_xfa_object.$extra].noLayoutFailure = false;
  51690. }
  51691. }
  51692. function handleBreak(node) {
  51693. if (node[_xfa_object.$extra]) {
  51694. return false;
  51695. }
  51696. node[_xfa_object.$extra] = Object.create(null);
  51697. if (node.targetType === "auto") {
  51698. return false;
  51699. }
  51700. const root = node[_xfa_object.$getTemplateRoot]();
  51701. let target = null;
  51702. if (node.target) {
  51703. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  51704. if (!target) {
  51705. return false;
  51706. }
  51707. target = target[0];
  51708. }
  51709. const {
  51710. currentPageArea,
  51711. currentContentArea
  51712. } = root[_xfa_object.$extra];
  51713. if (node.targetType === "pageArea") {
  51714. if (!(target instanceof PageArea)) {
  51715. target = null;
  51716. }
  51717. if (node.startNew) {
  51718. node[_xfa_object.$extra].target = target || currentPageArea;
  51719. return true;
  51720. } else if (target && target !== currentPageArea) {
  51721. node[_xfa_object.$extra].target = target;
  51722. return true;
  51723. }
  51724. return false;
  51725. }
  51726. if (!(target instanceof ContentArea)) {
  51727. target = null;
  51728. }
  51729. const pageArea = target && target[_xfa_object.$getParent]();
  51730. let index;
  51731. if (node.startNew) {
  51732. if (target) {
  51733. const contentAreas = pageArea.contentArea.children;
  51734. index = contentAreas.findIndex(e => e === target) - 1;
  51735. } else {
  51736. index = currentPageArea.contentArea.children.findIndex(e => e === currentContentArea);
  51737. }
  51738. } else if (target && target !== currentContentArea) {
  51739. const contentAreas = pageArea.contentArea.children;
  51740. index = contentAreas.findIndex(e => e === target) - 1;
  51741. } else {
  51742. return false;
  51743. }
  51744. node[_xfa_object.$extra].target = pageArea === currentPageArea ? null : pageArea;
  51745. node[_xfa_object.$extra].index = index;
  51746. return true;
  51747. }
  51748. function handleOverflow(node, extraNode, space) {
  51749. const root = node[_xfa_object.$getTemplateRoot]();
  51750. const saved = root[_xfa_object.$extra].noLayoutFailure;
  51751. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  51752. extraNode[_xfa_object.$getSubformParent] = () => node;
  51753. root[_xfa_object.$extra].noLayoutFailure = true;
  51754. const res = extraNode[_xfa_object.$toHTML](space);
  51755. node[_xfa_object.$addHTML](res.html, res.bbox);
  51756. root[_xfa_object.$extra].noLayoutFailure = saved;
  51757. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  51758. }
  51759. class AppearanceFilter extends _xfa_object.StringObject {
  51760. constructor(attributes) {
  51761. super(TEMPLATE_NS_ID, "appearanceFilter");
  51762. this.id = attributes.id || "";
  51763. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  51764. this.use = attributes.use || "";
  51765. this.usehref = attributes.usehref || "";
  51766. }
  51767. }
  51768. class Arc extends _xfa_object.XFAObject {
  51769. constructor(attributes) {
  51770. super(TEMPLATE_NS_ID, "arc", true);
  51771. this.circular = (0, _utils.getInteger)({
  51772. data: attributes.circular,
  51773. defaultValue: 0,
  51774. validate: x => x === 1
  51775. });
  51776. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  51777. this.id = attributes.id || "";
  51778. this.startAngle = (0, _utils.getFloat)({
  51779. data: attributes.startAngle,
  51780. defaultValue: 0,
  51781. validate: x => true
  51782. });
  51783. this.sweepAngle = (0, _utils.getFloat)({
  51784. data: attributes.sweepAngle,
  51785. defaultValue: 360,
  51786. validate: x => true
  51787. });
  51788. this.use = attributes.use || "";
  51789. this.usehref = attributes.usehref || "";
  51790. this.edge = null;
  51791. this.fill = null;
  51792. }
  51793. [_xfa_object.$toHTML]() {
  51794. const edge = this.edge ? this.edge : new Edge({});
  51795. const edgeStyle = edge[_xfa_object.$toStyle]();
  51796. const style = Object.create(null);
  51797. if (this.fill && this.fill.presence === "visible") {
  51798. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  51799. } else {
  51800. style.fill = "transparent";
  51801. }
  51802. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  51803. style.stroke = edgeStyle.color;
  51804. let arc;
  51805. const attributes = {
  51806. xmlns: SVG_NS,
  51807. style: {
  51808. width: "100%",
  51809. height: "100%",
  51810. overflow: "visible"
  51811. }
  51812. };
  51813. if (this.startAngle === 0 && this.sweepAngle === 360) {
  51814. arc = {
  51815. name: "ellipse",
  51816. attributes: {
  51817. xmlns: SVG_NS,
  51818. cx: "50%",
  51819. cy: "50%",
  51820. rx: "50%",
  51821. ry: "50%",
  51822. style
  51823. }
  51824. };
  51825. } else {
  51826. const startAngle = this.startAngle * Math.PI / 180;
  51827. const sweepAngle = this.sweepAngle * Math.PI / 180;
  51828. const largeArc = this.sweepAngle - this.startAngle > 180 ? 1 : 0;
  51829. const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(sweepAngle)), 50 * (1 - Math.sin(sweepAngle))];
  51830. arc = {
  51831. name: "path",
  51832. attributes: {
  51833. xmlns: SVG_NS,
  51834. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  51835. vectorEffect: "non-scaling-stroke",
  51836. style
  51837. }
  51838. };
  51839. Object.assign(attributes, {
  51840. viewBox: "0 0 100 100",
  51841. preserveAspectRatio: "none"
  51842. });
  51843. }
  51844. const svg = {
  51845. name: "svg",
  51846. children: [arc],
  51847. attributes
  51848. };
  51849. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  51850. if (hasMargin(parent)) {
  51851. return _utils.HTMLResult.success({
  51852. name: "div",
  51853. attributes: {
  51854. style: {
  51855. display: "inline",
  51856. width: "100%",
  51857. height: "100%"
  51858. }
  51859. },
  51860. children: [svg]
  51861. });
  51862. }
  51863. svg.attributes.style.position = "absolute";
  51864. return _utils.HTMLResult.success(svg);
  51865. }
  51866. }
  51867. class Area extends _xfa_object.XFAObject {
  51868. constructor(attributes) {
  51869. super(TEMPLATE_NS_ID, "area", true);
  51870. this.colSpan = (0, _utils.getInteger)({
  51871. data: attributes.colSpan,
  51872. defaultValue: 1,
  51873. validate: n => n >= 1 || n === -1
  51874. });
  51875. this.id = attributes.id || "";
  51876. this.name = attributes.name || "";
  51877. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  51878. this.use = attributes.use || "";
  51879. this.usehref = attributes.usehref || "";
  51880. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  51881. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  51882. this.desc = null;
  51883. this.extras = null;
  51884. this.area = new _xfa_object.XFAObjectArray();
  51885. this.draw = new _xfa_object.XFAObjectArray();
  51886. this.exObject = new _xfa_object.XFAObjectArray();
  51887. this.exclGroup = new _xfa_object.XFAObjectArray();
  51888. this.field = new _xfa_object.XFAObjectArray();
  51889. this.subform = new _xfa_object.XFAObjectArray();
  51890. this.subformSet = new _xfa_object.XFAObjectArray();
  51891. }
  51892. *[_xfa_object.$getContainedChildren]() {
  51893. yield* getContainedChildren(this);
  51894. }
  51895. [_xfa_object.$isTransparent]() {
  51896. return true;
  51897. }
  51898. [_xfa_object.$isBindable]() {
  51899. return true;
  51900. }
  51901. [_xfa_object.$addHTML](html, bbox) {
  51902. const [x, y, w, h] = bbox;
  51903. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  51904. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  51905. this[_xfa_object.$extra].children.push(html);
  51906. }
  51907. [_xfa_object.$getAvailableSpace]() {
  51908. return this[_xfa_object.$extra].availableSpace;
  51909. }
  51910. [_xfa_object.$toHTML](availableSpace) {
  51911. const style = (0, _html_utils.toStyle)(this, "position");
  51912. const attributes = {
  51913. style,
  51914. id: this[_xfa_object.$uid],
  51915. class: ["xfaArea"]
  51916. };
  51917. if ((0, _html_utils.isPrintOnly)(this)) {
  51918. attributes.class.push("xfaPrintOnly");
  51919. }
  51920. if (this.name) {
  51921. attributes.xfaName = this.name;
  51922. }
  51923. const children = [];
  51924. this[_xfa_object.$extra] = {
  51925. children,
  51926. width: 0,
  51927. height: 0,
  51928. availableSpace
  51929. };
  51930. const result = this[_xfa_object.$childrenToHTML]({
  51931. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  51932. include: true
  51933. });
  51934. if (!result.success) {
  51935. if (result.isBreak()) {
  51936. return result;
  51937. }
  51938. delete this[_xfa_object.$extra];
  51939. return _utils.HTMLResult.FAILURE;
  51940. }
  51941. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  51942. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  51943. const html = {
  51944. name: "div",
  51945. attributes,
  51946. children
  51947. };
  51948. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  51949. delete this[_xfa_object.$extra];
  51950. return _utils.HTMLResult.success(html, bbox);
  51951. }
  51952. }
  51953. class Assist extends _xfa_object.XFAObject {
  51954. constructor(attributes) {
  51955. super(TEMPLATE_NS_ID, "assist", true);
  51956. this.id = attributes.id || "";
  51957. this.role = attributes.role || "";
  51958. this.use = attributes.use || "";
  51959. this.usehref = attributes.usehref || "";
  51960. this.speak = null;
  51961. this.toolTip = null;
  51962. }
  51963. [_xfa_object.$toHTML]() {
  51964. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  51965. }
  51966. }
  51967. class Barcode extends _xfa_object.XFAObject {
  51968. constructor(attributes) {
  51969. super(TEMPLATE_NS_ID, "barcode", true);
  51970. this.charEncoding = (0, _utils.getKeyword)({
  51971. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  51972. defaultValue: "",
  51973. 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-\d{2}/)
  51974. });
  51975. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  51976. this.dataColumnCount = (0, _utils.getInteger)({
  51977. data: attributes.dataColumnCount,
  51978. defaultValue: -1,
  51979. validate: x => x >= 0
  51980. });
  51981. this.dataLength = (0, _utils.getInteger)({
  51982. data: attributes.dataLength,
  51983. defaultValue: -1,
  51984. validate: x => x >= 0
  51985. });
  51986. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  51987. this.dataRowCount = (0, _utils.getInteger)({
  51988. data: attributes.dataRowCount,
  51989. defaultValue: -1,
  51990. validate: x => x >= 0
  51991. });
  51992. this.endChar = attributes.endChar || "";
  51993. this.errorCorrectionLevel = (0, _utils.getInteger)({
  51994. data: attributes.errorCorrectionLevel,
  51995. defaultValue: -1,
  51996. validate: x => x >= 0 && x <= 8
  51997. });
  51998. this.id = attributes.id || "";
  51999. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  52000. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  52001. this.printCheckDigit = (0, _utils.getInteger)({
  52002. data: attributes.printCheckDigit,
  52003. defaultValue: 0,
  52004. validate: x => x === 1
  52005. });
  52006. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  52007. this.startChar = attributes.startChar || "";
  52008. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  52009. this.truncate = (0, _utils.getInteger)({
  52010. data: attributes.truncate,
  52011. defaultValue: 0,
  52012. validate: x => x === 1
  52013. });
  52014. 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"]);
  52015. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  52016. this.use = attributes.use || "";
  52017. this.usehref = attributes.usehref || "";
  52018. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  52019. this.encrypt = null;
  52020. this.extras = null;
  52021. }
  52022. }
  52023. class Bind extends _xfa_object.XFAObject {
  52024. constructor(attributes) {
  52025. super(TEMPLATE_NS_ID, "bind", true);
  52026. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  52027. this.ref = attributes.ref || "";
  52028. this.picture = null;
  52029. }
  52030. }
  52031. class BindItems extends _xfa_object.XFAObject {
  52032. constructor(attributes) {
  52033. super(TEMPLATE_NS_ID, "bindItems");
  52034. this.connection = attributes.connection || "";
  52035. this.labelRef = attributes.labelRef || "";
  52036. this.ref = attributes.ref || "";
  52037. this.valueRef = attributes.valueRef || "";
  52038. }
  52039. }
  52040. exports.BindItems = BindItems;
  52041. class Bookend extends _xfa_object.XFAObject {
  52042. constructor(attributes) {
  52043. super(TEMPLATE_NS_ID, "bookend");
  52044. this.id = attributes.id || "";
  52045. this.leader = attributes.leader || "";
  52046. this.trailer = attributes.trailer || "";
  52047. this.use = attributes.use || "";
  52048. this.usehref = attributes.usehref || "";
  52049. }
  52050. }
  52051. class BooleanElement extends _xfa_object.Option01 {
  52052. constructor(attributes) {
  52053. super(TEMPLATE_NS_ID, "boolean");
  52054. this.id = attributes.id || "";
  52055. this.name = attributes.name || "";
  52056. this.use = attributes.use || "";
  52057. this.usehref = attributes.usehref || "";
  52058. }
  52059. [_xfa_object.$toHTML](availableSpace) {
  52060. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  52061. }
  52062. }
  52063. class Border extends _xfa_object.XFAObject {
  52064. constructor(attributes) {
  52065. super(TEMPLATE_NS_ID, "border", true);
  52066. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  52067. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  52068. this.id = attributes.id || "";
  52069. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52070. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52071. this.use = attributes.use || "";
  52072. this.usehref = attributes.usehref || "";
  52073. this.corner = new _xfa_object.XFAObjectArray(4);
  52074. this.edge = new _xfa_object.XFAObjectArray(4);
  52075. this.extras = null;
  52076. this.fill = null;
  52077. this.margin = null;
  52078. }
  52079. [_xfa_object.$getExtra]() {
  52080. if (!this[_xfa_object.$extra]) {
  52081. const edges = this.edge.children.slice();
  52082. if (edges.length < 4) {
  52083. const defaultEdge = edges[edges.length - 1] || new Edge({});
  52084. for (let i = edges.length; i < 4; i++) {
  52085. edges.push(defaultEdge);
  52086. }
  52087. }
  52088. const widths = edges.map(edge => edge.thickness);
  52089. const insets = [0, 0, 0, 0];
  52090. if (this.margin) {
  52091. insets[0] = this.margin.topInset;
  52092. insets[1] = this.margin.rightInset;
  52093. insets[2] = this.margin.bottomInset;
  52094. insets[3] = this.margin.leftInset;
  52095. }
  52096. this[_xfa_object.$extra] = {
  52097. widths,
  52098. insets,
  52099. edges
  52100. };
  52101. }
  52102. return this[_xfa_object.$extra];
  52103. }
  52104. [_xfa_object.$toStyle]() {
  52105. const {
  52106. edges
  52107. } = this[_xfa_object.$getExtra]();
  52108. const edgeStyles = edges.map(node => {
  52109. const style = node[_xfa_object.$toStyle]();
  52110. style.color = style.color || "#000000";
  52111. return style;
  52112. });
  52113. const style = Object.create(null);
  52114. if (this.margin) {
  52115. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  52116. }
  52117. if (this.fill && this.fill.presence === "visible") {
  52118. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  52119. }
  52120. if (this.corner.children.some(node => node.radius !== 0)) {
  52121. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  52122. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  52123. const last = cornerStyles[cornerStyles.length - 1];
  52124. for (let i = cornerStyles.length; i < 4; i++) {
  52125. cornerStyles.push(last);
  52126. }
  52127. }
  52128. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  52129. }
  52130. switch (this.presence) {
  52131. case "invisible":
  52132. case "hidden":
  52133. style.borderStyle = "";
  52134. break;
  52135. case "inactive":
  52136. style.borderStyle = "none";
  52137. break;
  52138. default:
  52139. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  52140. break;
  52141. }
  52142. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  52143. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  52144. return style;
  52145. }
  52146. }
  52147. class Break extends _xfa_object.XFAObject {
  52148. constructor(attributes) {
  52149. super(TEMPLATE_NS_ID, "break", true);
  52150. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  52151. this.afterTarget = attributes.afterTarget || "";
  52152. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  52153. this.beforeTarget = attributes.beforeTarget || "";
  52154. this.bookendLeader = attributes.bookendLeader || "";
  52155. this.bookendTrailer = attributes.bookendTrailer || "";
  52156. this.id = attributes.id || "";
  52157. this.overflowLeader = attributes.overflowLeader || "";
  52158. this.overflowTarget = attributes.overflowTarget || "";
  52159. this.overflowTrailer = attributes.overflowTrailer || "";
  52160. this.startNew = (0, _utils.getInteger)({
  52161. data: attributes.startNew,
  52162. defaultValue: 0,
  52163. validate: x => x === 1
  52164. });
  52165. this.use = attributes.use || "";
  52166. this.usehref = attributes.usehref || "";
  52167. this.extras = null;
  52168. }
  52169. }
  52170. class BreakAfter extends _xfa_object.XFAObject {
  52171. constructor(attributes) {
  52172. super(TEMPLATE_NS_ID, "breakAfter", true);
  52173. this.id = attributes.id || "";
  52174. this.leader = attributes.leader || "";
  52175. this.startNew = (0, _utils.getInteger)({
  52176. data: attributes.startNew,
  52177. defaultValue: 0,
  52178. validate: x => x === 1
  52179. });
  52180. this.target = attributes.target || "";
  52181. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  52182. this.trailer = attributes.trailer || "";
  52183. this.use = attributes.use || "";
  52184. this.usehref = attributes.usehref || "";
  52185. this.script = null;
  52186. }
  52187. }
  52188. class BreakBefore extends _xfa_object.XFAObject {
  52189. constructor(attributes) {
  52190. super(TEMPLATE_NS_ID, "breakBefore", true);
  52191. this.id = attributes.id || "";
  52192. this.leader = attributes.leader || "";
  52193. this.startNew = (0, _utils.getInteger)({
  52194. data: attributes.startNew,
  52195. defaultValue: 0,
  52196. validate: x => x === 1
  52197. });
  52198. this.target = attributes.target || "";
  52199. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  52200. this.trailer = attributes.trailer || "";
  52201. this.use = attributes.use || "";
  52202. this.usehref = attributes.usehref || "";
  52203. this.script = null;
  52204. }
  52205. [_xfa_object.$toHTML](availableSpace) {
  52206. this[_xfa_object.$extra] = {};
  52207. return _utils.HTMLResult.FAILURE;
  52208. }
  52209. }
  52210. class Button extends _xfa_object.XFAObject {
  52211. constructor(attributes) {
  52212. super(TEMPLATE_NS_ID, "button", true);
  52213. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  52214. this.id = attributes.id || "";
  52215. this.use = attributes.use || "";
  52216. this.usehref = attributes.usehref || "";
  52217. this.extras = null;
  52218. }
  52219. [_xfa_object.$toHTML](availableSpace) {
  52220. const parent = this[_xfa_object.$getParent]();
  52221. const grandpa = parent[_xfa_object.$getParent]();
  52222. const htmlButton = {
  52223. name: "button",
  52224. attributes: {
  52225. id: this[_xfa_object.$uid],
  52226. class: ["xfaButton"],
  52227. style: {}
  52228. },
  52229. children: []
  52230. };
  52231. for (const event of grandpa.event.children) {
  52232. if (event.activity !== "click" || !event.script) {
  52233. continue;
  52234. }
  52235. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  52236. if (!jsURL) {
  52237. continue;
  52238. }
  52239. const href = (0, _html_utils.fixURL)(jsURL.url);
  52240. if (!href) {
  52241. continue;
  52242. }
  52243. htmlButton.children.push({
  52244. name: "a",
  52245. attributes: {
  52246. id: "link" + this[_xfa_object.$uid],
  52247. href,
  52248. newWindow: jsURL.newWindow,
  52249. class: ["xfaLink"],
  52250. style: {}
  52251. },
  52252. children: []
  52253. });
  52254. }
  52255. return _utils.HTMLResult.success(htmlButton);
  52256. }
  52257. }
  52258. class Calculate extends _xfa_object.XFAObject {
  52259. constructor(attributes) {
  52260. super(TEMPLATE_NS_ID, "calculate", true);
  52261. this.id = attributes.id || "";
  52262. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  52263. this.use = attributes.use || "";
  52264. this.usehref = attributes.usehref || "";
  52265. this.extras = null;
  52266. this.message = null;
  52267. this.script = null;
  52268. }
  52269. }
  52270. class Caption extends _xfa_object.XFAObject {
  52271. constructor(attributes) {
  52272. super(TEMPLATE_NS_ID, "caption", true);
  52273. this.id = attributes.id || "";
  52274. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  52275. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52276. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  52277. this.use = attributes.use || "";
  52278. this.usehref = attributes.usehref || "";
  52279. this.extras = null;
  52280. this.font = null;
  52281. this.margin = null;
  52282. this.para = null;
  52283. this.value = null;
  52284. }
  52285. [_xfa_object.$setValue](value) {
  52286. _setValue(this, value);
  52287. }
  52288. [_xfa_object.$getExtra](availableSpace) {
  52289. if (!this[_xfa_object.$extra]) {
  52290. let {
  52291. width,
  52292. height
  52293. } = availableSpace;
  52294. switch (this.placement) {
  52295. case "left":
  52296. case "right":
  52297. case "inline":
  52298. width = this.reserve <= 0 ? width : this.reserve;
  52299. break;
  52300. case "top":
  52301. case "bottom":
  52302. height = this.reserve <= 0 ? height : this.reserve;
  52303. break;
  52304. }
  52305. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  52306. width,
  52307. height
  52308. });
  52309. }
  52310. return this[_xfa_object.$extra];
  52311. }
  52312. [_xfa_object.$toHTML](availableSpace) {
  52313. if (!this.value) {
  52314. return _utils.HTMLResult.EMPTY;
  52315. }
  52316. this[_xfa_object.$pushPara]();
  52317. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  52318. if (!value) {
  52319. this[_xfa_object.$popPara]();
  52320. return _utils.HTMLResult.EMPTY;
  52321. }
  52322. const savedReserve = this.reserve;
  52323. if (this.reserve <= 0) {
  52324. const {
  52325. w,
  52326. h
  52327. } = this[_xfa_object.$getExtra](availableSpace);
  52328. switch (this.placement) {
  52329. case "left":
  52330. case "right":
  52331. case "inline":
  52332. this.reserve = w;
  52333. break;
  52334. case "top":
  52335. case "bottom":
  52336. this.reserve = h;
  52337. break;
  52338. }
  52339. }
  52340. const children = [];
  52341. if (typeof value === "string") {
  52342. children.push({
  52343. name: "#text",
  52344. value
  52345. });
  52346. } else {
  52347. children.push(value);
  52348. }
  52349. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  52350. switch (this.placement) {
  52351. case "left":
  52352. case "right":
  52353. if (this.reserve > 0) {
  52354. style.width = (0, _html_utils.measureToString)(this.reserve);
  52355. }
  52356. break;
  52357. case "top":
  52358. case "bottom":
  52359. if (this.reserve > 0) {
  52360. style.height = (0, _html_utils.measureToString)(this.reserve);
  52361. }
  52362. break;
  52363. }
  52364. (0, _html_utils.setPara)(this, null, value);
  52365. this[_xfa_object.$popPara]();
  52366. this.reserve = savedReserve;
  52367. return _utils.HTMLResult.success({
  52368. name: "div",
  52369. attributes: {
  52370. style,
  52371. class: ["xfaCaption"]
  52372. },
  52373. children
  52374. });
  52375. }
  52376. }
  52377. class Certificate extends _xfa_object.StringObject {
  52378. constructor(attributes) {
  52379. super(TEMPLATE_NS_ID, "certificate");
  52380. this.id = attributes.id || "";
  52381. this.name = attributes.name || "";
  52382. this.use = attributes.use || "";
  52383. this.usehref = attributes.usehref || "";
  52384. }
  52385. }
  52386. class Certificates extends _xfa_object.XFAObject {
  52387. constructor(attributes) {
  52388. super(TEMPLATE_NS_ID, "certificates", true);
  52389. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  52390. this.id = attributes.id || "";
  52391. this.url = attributes.url || "";
  52392. this.urlPolicy = attributes.urlPolicy || "";
  52393. this.use = attributes.use || "";
  52394. this.usehref = attributes.usehref || "";
  52395. this.encryption = null;
  52396. this.issuers = null;
  52397. this.keyUsage = null;
  52398. this.oids = null;
  52399. this.signing = null;
  52400. this.subjectDNs = null;
  52401. }
  52402. }
  52403. class CheckButton extends _xfa_object.XFAObject {
  52404. constructor(attributes) {
  52405. super(TEMPLATE_NS_ID, "checkButton", true);
  52406. this.id = attributes.id || "";
  52407. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  52408. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  52409. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  52410. this.use = attributes.use || "";
  52411. this.usehref = attributes.usehref || "";
  52412. this.border = null;
  52413. this.extras = null;
  52414. this.margin = null;
  52415. }
  52416. [_xfa_object.$toHTML](availableSpace) {
  52417. const style = (0, _html_utils.toStyle)("margin");
  52418. const size = (0, _html_utils.measureToString)(this.size);
  52419. style.width = style.height = size;
  52420. let type;
  52421. let className;
  52422. let groupId;
  52423. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  52424. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  52425. const exportedValue = {
  52426. on: (items[0] !== undefined ? items[0] : "on").toString(),
  52427. off: (items[1] !== undefined ? items[1] : "off").toString()
  52428. };
  52429. const value = field.value && field.value[_xfa_object.$text]() || "off";
  52430. const checked = value === exportedValue.on || undefined;
  52431. const container = field[_xfa_object.$getSubformParent]();
  52432. const fieldId = field[_xfa_object.$uid];
  52433. let dataId;
  52434. if (container instanceof ExclGroup) {
  52435. groupId = container[_xfa_object.$uid];
  52436. type = "radio";
  52437. className = "xfaRadio";
  52438. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  52439. } else {
  52440. type = "checkbox";
  52441. className = "xfaCheckbox";
  52442. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  52443. }
  52444. const input = {
  52445. name: "input",
  52446. attributes: {
  52447. class: [className],
  52448. style,
  52449. fieldId,
  52450. dataId,
  52451. type,
  52452. checked,
  52453. xfaOn: exportedValue.on,
  52454. xfaOff: exportedValue.off,
  52455. "aria-label": ariaLabel(field)
  52456. }
  52457. };
  52458. if (groupId) {
  52459. input.attributes.name = groupId;
  52460. }
  52461. return _utils.HTMLResult.success({
  52462. name: "label",
  52463. attributes: {
  52464. class: ["xfaLabel"]
  52465. },
  52466. children: [input]
  52467. });
  52468. }
  52469. }
  52470. class ChoiceList extends _xfa_object.XFAObject {
  52471. constructor(attributes) {
  52472. super(TEMPLATE_NS_ID, "choiceList", true);
  52473. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  52474. this.id = attributes.id || "";
  52475. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  52476. this.textEntry = (0, _utils.getInteger)({
  52477. data: attributes.textEntry,
  52478. defaultValue: 0,
  52479. validate: x => x === 1
  52480. });
  52481. this.use = attributes.use || "";
  52482. this.usehref = attributes.usehref || "";
  52483. this.border = null;
  52484. this.extras = null;
  52485. this.margin = null;
  52486. }
  52487. [_xfa_object.$toHTML](availableSpace) {
  52488. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  52489. const ui = this[_xfa_object.$getParent]();
  52490. const field = ui[_xfa_object.$getParent]();
  52491. const fontSize = field.font && field.font.size || 10;
  52492. const optionStyle = {
  52493. fontSize: `calc(${fontSize}px * var(--zoom-factor))`
  52494. };
  52495. const children = [];
  52496. if (field.items.children.length > 0) {
  52497. const items = field.items;
  52498. let displayedIndex = 0;
  52499. let saveIndex = 0;
  52500. if (items.children.length === 2) {
  52501. displayedIndex = items.children[0].save;
  52502. saveIndex = 1 - displayedIndex;
  52503. }
  52504. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  52505. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  52506. let selected = false;
  52507. const value = field.value && field.value[_xfa_object.$text]() || "";
  52508. for (let i = 0, ii = displayed.length; i < ii; i++) {
  52509. const option = {
  52510. name: "option",
  52511. attributes: {
  52512. value: values[i] || displayed[i],
  52513. style: optionStyle
  52514. },
  52515. value: displayed[i]
  52516. };
  52517. if (values[i] === value) {
  52518. option.attributes.selected = selected = true;
  52519. }
  52520. children.push(option);
  52521. }
  52522. if (!selected) {
  52523. children.splice(0, 0, {
  52524. name: "option",
  52525. attributes: {
  52526. hidden: true,
  52527. selected: true
  52528. },
  52529. value: " "
  52530. });
  52531. }
  52532. }
  52533. const selectAttributes = {
  52534. class: ["xfaSelect"],
  52535. fieldId: field[_xfa_object.$uid],
  52536. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  52537. style,
  52538. "aria-label": ariaLabel(field)
  52539. };
  52540. if (this.open === "multiSelect") {
  52541. selectAttributes.multiple = true;
  52542. }
  52543. return _utils.HTMLResult.success({
  52544. name: "label",
  52545. attributes: {
  52546. class: ["xfaLabel"]
  52547. },
  52548. children: [{
  52549. name: "select",
  52550. children,
  52551. attributes: selectAttributes
  52552. }]
  52553. });
  52554. }
  52555. }
  52556. class Color extends _xfa_object.XFAObject {
  52557. constructor(attributes) {
  52558. super(TEMPLATE_NS_ID, "color", true);
  52559. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  52560. this.id = attributes.id || "";
  52561. this.use = attributes.use || "";
  52562. this.usehref = attributes.usehref || "";
  52563. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  52564. this.extras = null;
  52565. }
  52566. [_xfa_object.$hasSettableValue]() {
  52567. return false;
  52568. }
  52569. [_xfa_object.$toStyle]() {
  52570. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  52571. }
  52572. }
  52573. class Comb extends _xfa_object.XFAObject {
  52574. constructor(attributes) {
  52575. super(TEMPLATE_NS_ID, "comb");
  52576. this.id = attributes.id || "";
  52577. this.numberOfCells = (0, _utils.getInteger)({
  52578. data: attributes.numberOfCells,
  52579. defaultValue: 0,
  52580. validate: x => x >= 0
  52581. });
  52582. this.use = attributes.use || "";
  52583. this.usehref = attributes.usehref || "";
  52584. }
  52585. }
  52586. class Connect extends _xfa_object.XFAObject {
  52587. constructor(attributes) {
  52588. super(TEMPLATE_NS_ID, "connect", true);
  52589. this.connection = attributes.connection || "";
  52590. this.id = attributes.id || "";
  52591. this.ref = attributes.ref || "";
  52592. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  52593. this.use = attributes.use || "";
  52594. this.usehref = attributes.usehref || "";
  52595. this.picture = null;
  52596. }
  52597. }
  52598. class ContentArea extends _xfa_object.XFAObject {
  52599. constructor(attributes) {
  52600. super(TEMPLATE_NS_ID, "contentArea", true);
  52601. this.h = (0, _utils.getMeasurement)(attributes.h);
  52602. this.id = attributes.id || "";
  52603. this.name = attributes.name || "";
  52604. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52605. this.use = attributes.use || "";
  52606. this.usehref = attributes.usehref || "";
  52607. this.w = (0, _utils.getMeasurement)(attributes.w);
  52608. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52609. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52610. this.desc = null;
  52611. this.extras = null;
  52612. }
  52613. [_xfa_object.$toHTML](availableSpace) {
  52614. const left = (0, _html_utils.measureToString)(this.x);
  52615. const top = (0, _html_utils.measureToString)(this.y);
  52616. const style = {
  52617. left,
  52618. top,
  52619. width: (0, _html_utils.measureToString)(this.w),
  52620. height: (0, _html_utils.measureToString)(this.h)
  52621. };
  52622. const classNames = ["xfaContentarea"];
  52623. if ((0, _html_utils.isPrintOnly)(this)) {
  52624. classNames.push("xfaPrintOnly");
  52625. }
  52626. return _utils.HTMLResult.success({
  52627. name: "div",
  52628. children: [],
  52629. attributes: {
  52630. style,
  52631. class: classNames,
  52632. id: this[_xfa_object.$uid]
  52633. }
  52634. });
  52635. }
  52636. }
  52637. class Corner extends _xfa_object.XFAObject {
  52638. constructor(attributes) {
  52639. super(TEMPLATE_NS_ID, "corner", true);
  52640. this.id = attributes.id || "";
  52641. this.inverted = (0, _utils.getInteger)({
  52642. data: attributes.inverted,
  52643. defaultValue: 0,
  52644. validate: x => x === 1
  52645. });
  52646. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  52647. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52648. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  52649. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  52650. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  52651. this.use = attributes.use || "";
  52652. this.usehref = attributes.usehref || "";
  52653. this.color = null;
  52654. this.extras = null;
  52655. }
  52656. [_xfa_object.$toStyle]() {
  52657. const style = (0, _html_utils.toStyle)(this, "visibility");
  52658. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  52659. return style;
  52660. }
  52661. }
  52662. class DateElement extends _xfa_object.ContentObject {
  52663. constructor(attributes) {
  52664. super(TEMPLATE_NS_ID, "date");
  52665. this.id = attributes.id || "";
  52666. this.name = attributes.name || "";
  52667. this.use = attributes.use || "";
  52668. this.usehref = attributes.usehref || "";
  52669. }
  52670. [_xfa_object.$finalize]() {
  52671. const date = this[_xfa_object.$content].trim();
  52672. this[_xfa_object.$content] = date ? new Date(date) : null;
  52673. }
  52674. [_xfa_object.$toHTML](availableSpace) {
  52675. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  52676. }
  52677. }
  52678. class DateTime extends _xfa_object.ContentObject {
  52679. constructor(attributes) {
  52680. super(TEMPLATE_NS_ID, "dateTime");
  52681. this.id = attributes.id || "";
  52682. this.name = attributes.name || "";
  52683. this.use = attributes.use || "";
  52684. this.usehref = attributes.usehref || "";
  52685. }
  52686. [_xfa_object.$finalize]() {
  52687. const date = this[_xfa_object.$content].trim();
  52688. this[_xfa_object.$content] = date ? new Date(date) : null;
  52689. }
  52690. [_xfa_object.$toHTML](availableSpace) {
  52691. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  52692. }
  52693. }
  52694. class DateTimeEdit extends _xfa_object.XFAObject {
  52695. constructor(attributes) {
  52696. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  52697. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  52698. this.id = attributes.id || "";
  52699. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  52700. this.use = attributes.use || "";
  52701. this.usehref = attributes.usehref || "";
  52702. this.border = null;
  52703. this.comb = null;
  52704. this.extras = null;
  52705. this.margin = null;
  52706. }
  52707. [_xfa_object.$toHTML](availableSpace) {
  52708. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  52709. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  52710. const html = {
  52711. name: "input",
  52712. attributes: {
  52713. type: "text",
  52714. fieldId: field[_xfa_object.$uid],
  52715. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  52716. class: ["xfaTextfield"],
  52717. style,
  52718. "aria-label": ariaLabel(field)
  52719. }
  52720. };
  52721. return _utils.HTMLResult.success({
  52722. name: "label",
  52723. attributes: {
  52724. class: ["xfaLabel"]
  52725. },
  52726. children: [html]
  52727. });
  52728. }
  52729. }
  52730. class Decimal extends _xfa_object.ContentObject {
  52731. constructor(attributes) {
  52732. super(TEMPLATE_NS_ID, "decimal");
  52733. this.fracDigits = (0, _utils.getInteger)({
  52734. data: attributes.fracDigits,
  52735. defaultValue: 2,
  52736. validate: x => true
  52737. });
  52738. this.id = attributes.id || "";
  52739. this.leadDigits = (0, _utils.getInteger)({
  52740. data: attributes.leadDigits,
  52741. defaultValue: -1,
  52742. validate: x => true
  52743. });
  52744. this.name = attributes.name || "";
  52745. this.use = attributes.use || "";
  52746. this.usehref = attributes.usehref || "";
  52747. }
  52748. [_xfa_object.$finalize]() {
  52749. const number = parseFloat(this[_xfa_object.$content].trim());
  52750. this[_xfa_object.$content] = isNaN(number) ? null : number;
  52751. }
  52752. [_xfa_object.$toHTML](availableSpace) {
  52753. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  52754. }
  52755. }
  52756. class DefaultUi extends _xfa_object.XFAObject {
  52757. constructor(attributes) {
  52758. super(TEMPLATE_NS_ID, "defaultUi", true);
  52759. this.id = attributes.id || "";
  52760. this.use = attributes.use || "";
  52761. this.usehref = attributes.usehref || "";
  52762. this.extras = null;
  52763. }
  52764. }
  52765. class Desc extends _xfa_object.XFAObject {
  52766. constructor(attributes) {
  52767. super(TEMPLATE_NS_ID, "desc", true);
  52768. this.id = attributes.id || "";
  52769. this.use = attributes.use || "";
  52770. this.usehref = attributes.usehref || "";
  52771. this.boolean = new _xfa_object.XFAObjectArray();
  52772. this.date = new _xfa_object.XFAObjectArray();
  52773. this.dateTime = new _xfa_object.XFAObjectArray();
  52774. this.decimal = new _xfa_object.XFAObjectArray();
  52775. this.exData = new _xfa_object.XFAObjectArray();
  52776. this.float = new _xfa_object.XFAObjectArray();
  52777. this.image = new _xfa_object.XFAObjectArray();
  52778. this.integer = new _xfa_object.XFAObjectArray();
  52779. this.text = new _xfa_object.XFAObjectArray();
  52780. this.time = new _xfa_object.XFAObjectArray();
  52781. }
  52782. }
  52783. class DigestMethod extends _xfa_object.OptionObject {
  52784. constructor(attributes) {
  52785. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  52786. this.id = attributes.id || "";
  52787. this.use = attributes.use || "";
  52788. this.usehref = attributes.usehref || "";
  52789. }
  52790. }
  52791. class DigestMethods extends _xfa_object.XFAObject {
  52792. constructor(attributes) {
  52793. super(TEMPLATE_NS_ID, "digestMethods", true);
  52794. this.id = attributes.id || "";
  52795. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52796. this.use = attributes.use || "";
  52797. this.usehref = attributes.usehref || "";
  52798. this.digestMethod = new _xfa_object.XFAObjectArray();
  52799. }
  52800. }
  52801. class Draw extends _xfa_object.XFAObject {
  52802. constructor(attributes) {
  52803. super(TEMPLATE_NS_ID, "draw", true);
  52804. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  52805. this.colSpan = (0, _utils.getInteger)({
  52806. data: attributes.colSpan,
  52807. defaultValue: 1,
  52808. validate: n => n >= 1 || n === -1
  52809. });
  52810. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  52811. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  52812. this.id = attributes.id || "";
  52813. this.locale = attributes.locale || "";
  52814. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  52815. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  52816. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  52817. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  52818. this.name = attributes.name || "";
  52819. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52820. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52821. this.rotate = (0, _utils.getInteger)({
  52822. data: attributes.rotate,
  52823. defaultValue: 0,
  52824. validate: x => x % 90 === 0
  52825. });
  52826. this.use = attributes.use || "";
  52827. this.usehref = attributes.usehref || "";
  52828. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  52829. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52830. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52831. this.assist = null;
  52832. this.border = null;
  52833. this.caption = null;
  52834. this.desc = null;
  52835. this.extras = null;
  52836. this.font = null;
  52837. this.keep = null;
  52838. this.margin = null;
  52839. this.para = null;
  52840. this.traversal = null;
  52841. this.ui = null;
  52842. this.value = null;
  52843. this.setProperty = new _xfa_object.XFAObjectArray();
  52844. }
  52845. [_xfa_object.$setValue](value) {
  52846. _setValue(this, value);
  52847. }
  52848. [_xfa_object.$toHTML](availableSpace) {
  52849. setTabIndex(this);
  52850. if (this.presence === "hidden" || this.presence === "inactive") {
  52851. return _utils.HTMLResult.EMPTY;
  52852. }
  52853. (0, _html_utils.fixDimensions)(this);
  52854. this[_xfa_object.$pushPara]();
  52855. const savedW = this.w;
  52856. const savedH = this.h;
  52857. const {
  52858. w,
  52859. h,
  52860. isBroken
  52861. } = (0, _html_utils.layoutNode)(this, availableSpace);
  52862. if (w && this.w === "") {
  52863. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  52864. this[_xfa_object.$popPara]();
  52865. return _utils.HTMLResult.FAILURE;
  52866. }
  52867. this.w = w;
  52868. }
  52869. if (h && this.h === "") {
  52870. this.h = h;
  52871. }
  52872. setFirstUnsplittable(this);
  52873. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  52874. this.w = savedW;
  52875. this.h = savedH;
  52876. this[_xfa_object.$popPara]();
  52877. return _utils.HTMLResult.FAILURE;
  52878. }
  52879. unsetFirstUnsplittable(this);
  52880. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  52881. (0, _html_utils.setMinMaxDimensions)(this, style);
  52882. if (style.margin) {
  52883. style.padding = style.margin;
  52884. delete style.margin;
  52885. }
  52886. const classNames = ["xfaDraw"];
  52887. if (this.font) {
  52888. classNames.push("xfaFont");
  52889. }
  52890. if ((0, _html_utils.isPrintOnly)(this)) {
  52891. classNames.push("xfaPrintOnly");
  52892. }
  52893. const attributes = {
  52894. style,
  52895. id: this[_xfa_object.$uid],
  52896. class: classNames
  52897. };
  52898. if (this.name) {
  52899. attributes.xfaName = this.name;
  52900. }
  52901. const html = {
  52902. name: "div",
  52903. attributes,
  52904. children: []
  52905. };
  52906. applyAssist(this, attributes);
  52907. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  52908. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  52909. if (value === null) {
  52910. this.w = savedW;
  52911. this.h = savedH;
  52912. this[_xfa_object.$popPara]();
  52913. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  52914. }
  52915. html.children.push(value);
  52916. (0, _html_utils.setPara)(this, style, value);
  52917. this.w = savedW;
  52918. this.h = savedH;
  52919. this[_xfa_object.$popPara]();
  52920. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  52921. }
  52922. }
  52923. class Edge extends _xfa_object.XFAObject {
  52924. constructor(attributes) {
  52925. super(TEMPLATE_NS_ID, "edge", true);
  52926. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  52927. this.id = attributes.id || "";
  52928. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  52929. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  52930. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  52931. this.use = attributes.use || "";
  52932. this.usehref = attributes.usehref || "";
  52933. this.color = null;
  52934. this.extras = null;
  52935. }
  52936. [_xfa_object.$toStyle]() {
  52937. const style = (0, _html_utils.toStyle)(this, "visibility");
  52938. Object.assign(style, {
  52939. linecap: this.cap,
  52940. width: (0, _html_utils.measureToString)(this.thickness),
  52941. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  52942. style: ""
  52943. });
  52944. if (this.presence !== "visible") {
  52945. style.style = "none";
  52946. } else {
  52947. switch (this.stroke) {
  52948. case "solid":
  52949. style.style = "solid";
  52950. break;
  52951. case "dashDot":
  52952. style.style = "dashed";
  52953. break;
  52954. case "dashDotDot":
  52955. style.style = "dashed";
  52956. break;
  52957. case "dashed":
  52958. style.style = "dashed";
  52959. break;
  52960. case "dotted":
  52961. style.style = "dotted";
  52962. break;
  52963. case "embossed":
  52964. style.style = "ridge";
  52965. break;
  52966. case "etched":
  52967. style.style = "groove";
  52968. break;
  52969. case "lowered":
  52970. style.style = "inset";
  52971. break;
  52972. case "raised":
  52973. style.style = "outset";
  52974. break;
  52975. }
  52976. }
  52977. return style;
  52978. }
  52979. }
  52980. class Encoding extends _xfa_object.OptionObject {
  52981. constructor(attributes) {
  52982. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  52983. this.id = attributes.id || "";
  52984. this.use = attributes.use || "";
  52985. this.usehref = attributes.usehref || "";
  52986. }
  52987. }
  52988. class Encodings extends _xfa_object.XFAObject {
  52989. constructor(attributes) {
  52990. super(TEMPLATE_NS_ID, "encodings", true);
  52991. this.id = attributes.id || "";
  52992. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52993. this.use = attributes.use || "";
  52994. this.usehref = attributes.usehref || "";
  52995. this.encoding = new _xfa_object.XFAObjectArray();
  52996. }
  52997. }
  52998. class Encrypt extends _xfa_object.XFAObject {
  52999. constructor(attributes) {
  53000. super(TEMPLATE_NS_ID, "encrypt", true);
  53001. this.id = attributes.id || "";
  53002. this.use = attributes.use || "";
  53003. this.usehref = attributes.usehref || "";
  53004. this.certificate = null;
  53005. }
  53006. }
  53007. class EncryptData extends _xfa_object.XFAObject {
  53008. constructor(attributes) {
  53009. super(TEMPLATE_NS_ID, "encryptData", true);
  53010. this.id = attributes.id || "";
  53011. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  53012. this.target = attributes.target || "";
  53013. this.use = attributes.use || "";
  53014. this.usehref = attributes.usehref || "";
  53015. this.filter = null;
  53016. this.manifest = null;
  53017. }
  53018. }
  53019. class Encryption extends _xfa_object.XFAObject {
  53020. constructor(attributes) {
  53021. super(TEMPLATE_NS_ID, "encryption", true);
  53022. this.id = attributes.id || "";
  53023. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53024. this.use = attributes.use || "";
  53025. this.usehref = attributes.usehref || "";
  53026. this.certificate = new _xfa_object.XFAObjectArray();
  53027. }
  53028. }
  53029. class EncryptionMethod extends _xfa_object.OptionObject {
  53030. constructor(attributes) {
  53031. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  53032. this.id = attributes.id || "";
  53033. this.use = attributes.use || "";
  53034. this.usehref = attributes.usehref || "";
  53035. }
  53036. }
  53037. class EncryptionMethods extends _xfa_object.XFAObject {
  53038. constructor(attributes) {
  53039. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  53040. this.id = attributes.id || "";
  53041. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53042. this.use = attributes.use || "";
  53043. this.usehref = attributes.usehref || "";
  53044. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  53045. }
  53046. }
  53047. class Event extends _xfa_object.XFAObject {
  53048. constructor(attributes) {
  53049. super(TEMPLATE_NS_ID, "event", true);
  53050. 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"]);
  53051. this.id = attributes.id || "";
  53052. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  53053. this.name = attributes.name || "";
  53054. this.ref = attributes.ref || "";
  53055. this.use = attributes.use || "";
  53056. this.usehref = attributes.usehref || "";
  53057. this.extras = null;
  53058. this.encryptData = null;
  53059. this.execute = null;
  53060. this.script = null;
  53061. this.signData = null;
  53062. this.submit = null;
  53063. }
  53064. }
  53065. class ExData extends _xfa_object.ContentObject {
  53066. constructor(attributes) {
  53067. super(TEMPLATE_NS_ID, "exData");
  53068. this.contentType = attributes.contentType || "";
  53069. this.href = attributes.href || "";
  53070. this.id = attributes.id || "";
  53071. this.maxLength = (0, _utils.getInteger)({
  53072. data: attributes.maxLength,
  53073. defaultValue: -1,
  53074. validate: x => x >= -1
  53075. });
  53076. this.name = attributes.name || "";
  53077. this.rid = attributes.rid || "";
  53078. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  53079. this.use = attributes.use || "";
  53080. this.usehref = attributes.usehref || "";
  53081. }
  53082. [_xfa_object.$isCDATAXml]() {
  53083. return this.contentType === "text/html";
  53084. }
  53085. [_xfa_object.$onChild](child) {
  53086. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  53087. this[_xfa_object.$content] = child;
  53088. return true;
  53089. }
  53090. if (this.contentType === "text/xml") {
  53091. this[_xfa_object.$content] = child;
  53092. return true;
  53093. }
  53094. return false;
  53095. }
  53096. [_xfa_object.$toHTML](availableSpace) {
  53097. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  53098. return _utils.HTMLResult.EMPTY;
  53099. }
  53100. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  53101. }
  53102. }
  53103. class ExObject extends _xfa_object.XFAObject {
  53104. constructor(attributes) {
  53105. super(TEMPLATE_NS_ID, "exObject", true);
  53106. this.archive = attributes.archive || "";
  53107. this.classId = attributes.classId || "";
  53108. this.codeBase = attributes.codeBase || "";
  53109. this.codeType = attributes.codeType || "";
  53110. this.id = attributes.id || "";
  53111. this.name = attributes.name || "";
  53112. this.use = attributes.use || "";
  53113. this.usehref = attributes.usehref || "";
  53114. this.extras = null;
  53115. this.boolean = new _xfa_object.XFAObjectArray();
  53116. this.date = new _xfa_object.XFAObjectArray();
  53117. this.dateTime = new _xfa_object.XFAObjectArray();
  53118. this.decimal = new _xfa_object.XFAObjectArray();
  53119. this.exData = new _xfa_object.XFAObjectArray();
  53120. this.exObject = new _xfa_object.XFAObjectArray();
  53121. this.float = new _xfa_object.XFAObjectArray();
  53122. this.image = new _xfa_object.XFAObjectArray();
  53123. this.integer = new _xfa_object.XFAObjectArray();
  53124. this.text = new _xfa_object.XFAObjectArray();
  53125. this.time = new _xfa_object.XFAObjectArray();
  53126. }
  53127. }
  53128. class ExclGroup extends _xfa_object.XFAObject {
  53129. constructor(attributes) {
  53130. super(TEMPLATE_NS_ID, "exclGroup", true);
  53131. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  53132. this.accessKey = attributes.accessKey || "";
  53133. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53134. this.colSpan = (0, _utils.getInteger)({
  53135. data: attributes.colSpan,
  53136. defaultValue: 1,
  53137. validate: n => n >= 1 || n === -1
  53138. });
  53139. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  53140. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53141. this.id = attributes.id || "";
  53142. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  53143. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  53144. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  53145. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  53146. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  53147. this.name = attributes.name || "";
  53148. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53149. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53150. this.use = attributes.use || "";
  53151. this.usehref = attributes.usehref || "";
  53152. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  53153. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53154. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53155. this.assist = null;
  53156. this.bind = null;
  53157. this.border = null;
  53158. this.calculate = null;
  53159. this.caption = null;
  53160. this.desc = null;
  53161. this.extras = null;
  53162. this.margin = null;
  53163. this.para = null;
  53164. this.traversal = null;
  53165. this.validate = null;
  53166. this.connect = new _xfa_object.XFAObjectArray();
  53167. this.event = new _xfa_object.XFAObjectArray();
  53168. this.field = new _xfa_object.XFAObjectArray();
  53169. this.setProperty = new _xfa_object.XFAObjectArray();
  53170. }
  53171. [_xfa_object.$isBindable]() {
  53172. return true;
  53173. }
  53174. [_xfa_object.$hasSettableValue]() {
  53175. return true;
  53176. }
  53177. [_xfa_object.$setValue](value) {
  53178. for (const field of this.field.children) {
  53179. if (!field.value) {
  53180. const nodeValue = new Value({});
  53181. field[_xfa_object.$appendChild](nodeValue);
  53182. field.value = nodeValue;
  53183. }
  53184. field.value[_xfa_object.$setValue](value);
  53185. }
  53186. }
  53187. [_xfa_object.$isThereMoreWidth]() {
  53188. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  53189. }
  53190. [_xfa_object.$isSplittable]() {
  53191. const parent = this[_xfa_object.$getSubformParent]();
  53192. if (!parent[_xfa_object.$isSplittable]()) {
  53193. return false;
  53194. }
  53195. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  53196. return this[_xfa_object.$extra]._isSplittable;
  53197. }
  53198. if (this.layout === "position" || this.layout.includes("row")) {
  53199. this[_xfa_object.$extra]._isSplittable = false;
  53200. return false;
  53201. }
  53202. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  53203. return false;
  53204. }
  53205. this[_xfa_object.$extra]._isSplittable = true;
  53206. return true;
  53207. }
  53208. [_xfa_object.$flushHTML]() {
  53209. return (0, _layout.flushHTML)(this);
  53210. }
  53211. [_xfa_object.$addHTML](html, bbox) {
  53212. (0, _layout.addHTML)(this, html, bbox);
  53213. }
  53214. [_xfa_object.$getAvailableSpace]() {
  53215. return (0, _layout.getAvailableSpace)(this);
  53216. }
  53217. [_xfa_object.$toHTML](availableSpace) {
  53218. setTabIndex(this);
  53219. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  53220. return _utils.HTMLResult.EMPTY;
  53221. }
  53222. (0, _html_utils.fixDimensions)(this);
  53223. const children = [];
  53224. const attributes = {
  53225. id: this[_xfa_object.$uid],
  53226. class: []
  53227. };
  53228. (0, _html_utils.setAccess)(this, attributes.class);
  53229. if (!this[_xfa_object.$extra]) {
  53230. this[_xfa_object.$extra] = Object.create(null);
  53231. }
  53232. Object.assign(this[_xfa_object.$extra], {
  53233. children,
  53234. attributes,
  53235. attempt: 0,
  53236. line: null,
  53237. numberInLine: 0,
  53238. availableSpace: {
  53239. width: Math.min(this.w || Infinity, availableSpace.width),
  53240. height: Math.min(this.h || Infinity, availableSpace.height)
  53241. },
  53242. width: 0,
  53243. height: 0,
  53244. prevHeight: 0,
  53245. currentWidth: 0
  53246. });
  53247. const isSplittable = this[_xfa_object.$isSplittable]();
  53248. if (!isSplittable) {
  53249. setFirstUnsplittable(this);
  53250. }
  53251. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  53252. return _utils.HTMLResult.FAILURE;
  53253. }
  53254. const filter = new Set(["field"]);
  53255. if (this.layout.includes("row")) {
  53256. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  53257. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  53258. this[_xfa_object.$extra].columnWidths = columnWidths;
  53259. this[_xfa_object.$extra].currentColumn = 0;
  53260. }
  53261. }
  53262. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  53263. const classNames = ["xfaExclgroup"];
  53264. const cl = (0, _html_utils.layoutClass)(this);
  53265. if (cl) {
  53266. classNames.push(cl);
  53267. }
  53268. if ((0, _html_utils.isPrintOnly)(this)) {
  53269. classNames.push("xfaPrintOnly");
  53270. }
  53271. attributes.style = style;
  53272. attributes.class = classNames;
  53273. if (this.name) {
  53274. attributes.xfaName = this.name;
  53275. }
  53276. this[_xfa_object.$pushPara]();
  53277. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  53278. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  53279. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  53280. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  53281. this[_xfa_object.$extra].numberInLine = 0;
  53282. }
  53283. const result = this[_xfa_object.$childrenToHTML]({
  53284. filter,
  53285. include: true
  53286. });
  53287. if (result.success) {
  53288. break;
  53289. }
  53290. if (result.isBreak()) {
  53291. this[_xfa_object.$popPara]();
  53292. return result;
  53293. }
  53294. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  53295. this[_xfa_object.$extra].attempt = maxRun;
  53296. break;
  53297. }
  53298. }
  53299. this[_xfa_object.$popPara]();
  53300. if (!isSplittable) {
  53301. unsetFirstUnsplittable(this);
  53302. }
  53303. if (this[_xfa_object.$extra].attempt === maxRun) {
  53304. if (!isSplittable) {
  53305. delete this[_xfa_object.$extra];
  53306. }
  53307. return _utils.HTMLResult.FAILURE;
  53308. }
  53309. let marginH = 0;
  53310. let marginV = 0;
  53311. if (this.margin) {
  53312. marginH = this.margin.leftInset + this.margin.rightInset;
  53313. marginV = this.margin.topInset + this.margin.bottomInset;
  53314. }
  53315. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  53316. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  53317. const bbox = [this.x, this.y, width, height];
  53318. if (this.w === "") {
  53319. style.width = (0, _html_utils.measureToString)(width);
  53320. }
  53321. if (this.h === "") {
  53322. style.height = (0, _html_utils.measureToString)(height);
  53323. }
  53324. const html = {
  53325. name: "div",
  53326. attributes,
  53327. children
  53328. };
  53329. applyAssist(this, attributes);
  53330. delete this[_xfa_object.$extra];
  53331. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53332. }
  53333. }
  53334. class Execute extends _xfa_object.XFAObject {
  53335. constructor(attributes) {
  53336. super(TEMPLATE_NS_ID, "execute");
  53337. this.connection = attributes.connection || "";
  53338. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  53339. this.id = attributes.id || "";
  53340. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  53341. this.use = attributes.use || "";
  53342. this.usehref = attributes.usehref || "";
  53343. }
  53344. }
  53345. class Extras extends _xfa_object.XFAObject {
  53346. constructor(attributes) {
  53347. super(TEMPLATE_NS_ID, "extras", true);
  53348. this.id = attributes.id || "";
  53349. this.name = attributes.name || "";
  53350. this.use = attributes.use || "";
  53351. this.usehref = attributes.usehref || "";
  53352. this.boolean = new _xfa_object.XFAObjectArray();
  53353. this.date = new _xfa_object.XFAObjectArray();
  53354. this.dateTime = new _xfa_object.XFAObjectArray();
  53355. this.decimal = new _xfa_object.XFAObjectArray();
  53356. this.exData = new _xfa_object.XFAObjectArray();
  53357. this.extras = new _xfa_object.XFAObjectArray();
  53358. this.float = new _xfa_object.XFAObjectArray();
  53359. this.image = new _xfa_object.XFAObjectArray();
  53360. this.integer = new _xfa_object.XFAObjectArray();
  53361. this.text = new _xfa_object.XFAObjectArray();
  53362. this.time = new _xfa_object.XFAObjectArray();
  53363. }
  53364. }
  53365. class Field extends _xfa_object.XFAObject {
  53366. constructor(attributes) {
  53367. super(TEMPLATE_NS_ID, "field", true);
  53368. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  53369. this.accessKey = attributes.accessKey || "";
  53370. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53371. this.colSpan = (0, _utils.getInteger)({
  53372. data: attributes.colSpan,
  53373. defaultValue: 1,
  53374. validate: n => n >= 1 || n === -1
  53375. });
  53376. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  53377. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53378. this.id = attributes.id || "";
  53379. this.locale = attributes.locale || "";
  53380. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  53381. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  53382. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  53383. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  53384. this.name = attributes.name || "";
  53385. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53386. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53387. this.rotate = (0, _utils.getInteger)({
  53388. data: attributes.rotate,
  53389. defaultValue: 0,
  53390. validate: x => x % 90 === 0
  53391. });
  53392. this.use = attributes.use || "";
  53393. this.usehref = attributes.usehref || "";
  53394. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  53395. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53396. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53397. this.assist = null;
  53398. this.bind = null;
  53399. this.border = null;
  53400. this.calculate = null;
  53401. this.caption = null;
  53402. this.desc = null;
  53403. this.extras = null;
  53404. this.font = null;
  53405. this.format = null;
  53406. this.items = new _xfa_object.XFAObjectArray(2);
  53407. this.keep = null;
  53408. this.margin = null;
  53409. this.para = null;
  53410. this.traversal = null;
  53411. this.ui = null;
  53412. this.validate = null;
  53413. this.value = null;
  53414. this.bindItems = new _xfa_object.XFAObjectArray();
  53415. this.connect = new _xfa_object.XFAObjectArray();
  53416. this.event = new _xfa_object.XFAObjectArray();
  53417. this.setProperty = new _xfa_object.XFAObjectArray();
  53418. }
  53419. [_xfa_object.$isBindable]() {
  53420. return true;
  53421. }
  53422. [_xfa_object.$setValue](value) {
  53423. _setValue(this, value);
  53424. }
  53425. [_xfa_object.$toHTML](availableSpace) {
  53426. setTabIndex(this);
  53427. if (!this.ui) {
  53428. this.ui = new Ui({});
  53429. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  53430. this[_xfa_object.$appendChild](this.ui);
  53431. let node;
  53432. switch (this.items.children.length) {
  53433. case 0:
  53434. node = new TextEdit({});
  53435. this.ui.textEdit = node;
  53436. break;
  53437. case 1:
  53438. node = new CheckButton({});
  53439. this.ui.checkButton = node;
  53440. break;
  53441. case 2:
  53442. node = new ChoiceList({});
  53443. this.ui.choiceList = node;
  53444. break;
  53445. }
  53446. this.ui[_xfa_object.$appendChild](node);
  53447. }
  53448. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  53449. return _utils.HTMLResult.EMPTY;
  53450. }
  53451. if (this.caption) {
  53452. delete this.caption[_xfa_object.$extra];
  53453. }
  53454. this[_xfa_object.$pushPara]();
  53455. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  53456. const savedW = this.w;
  53457. const savedH = this.h;
  53458. let marginH = 0;
  53459. let marginV = 0;
  53460. if (this.margin) {
  53461. marginH = this.margin.leftInset + this.margin.rightInset;
  53462. marginV = this.margin.topInset + this.margin.bottomInset;
  53463. }
  53464. let borderDims = null;
  53465. if (this.w === "" || this.h === "") {
  53466. let width = null;
  53467. let height = null;
  53468. let uiW = 0;
  53469. let uiH = 0;
  53470. if (this.ui.checkButton) {
  53471. uiW = uiH = this.ui.checkButton.size;
  53472. } else {
  53473. const {
  53474. w,
  53475. h
  53476. } = (0, _html_utils.layoutNode)(this, availableSpace);
  53477. if (w !== null) {
  53478. uiW = w;
  53479. uiH = h;
  53480. } else {
  53481. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  53482. }
  53483. }
  53484. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  53485. uiW += borderDims.w;
  53486. uiH += borderDims.h;
  53487. if (this.caption) {
  53488. const {
  53489. w,
  53490. h,
  53491. isBroken
  53492. } = this.caption[_xfa_object.$getExtra](availableSpace);
  53493. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  53494. this[_xfa_object.$popPara]();
  53495. return _utils.HTMLResult.FAILURE;
  53496. }
  53497. width = w;
  53498. height = h;
  53499. switch (this.caption.placement) {
  53500. case "left":
  53501. case "right":
  53502. case "inline":
  53503. width += uiW;
  53504. break;
  53505. case "top":
  53506. case "bottom":
  53507. height += uiH;
  53508. break;
  53509. }
  53510. } else {
  53511. width = uiW;
  53512. height = uiH;
  53513. }
  53514. if (width && this.w === "") {
  53515. width += marginH;
  53516. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  53517. }
  53518. if (height && this.h === "") {
  53519. height += marginV;
  53520. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  53521. }
  53522. }
  53523. this[_xfa_object.$popPara]();
  53524. (0, _html_utils.fixDimensions)(this);
  53525. setFirstUnsplittable(this);
  53526. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  53527. this.w = savedW;
  53528. this.h = savedH;
  53529. this[_xfa_object.$popPara]();
  53530. return _utils.HTMLResult.FAILURE;
  53531. }
  53532. unsetFirstUnsplittable(this);
  53533. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  53534. (0, _html_utils.setMinMaxDimensions)(this, style);
  53535. const classNames = ["xfaField"];
  53536. if (this.font) {
  53537. classNames.push("xfaFont");
  53538. }
  53539. if ((0, _html_utils.isPrintOnly)(this)) {
  53540. classNames.push("xfaPrintOnly");
  53541. }
  53542. const attributes = {
  53543. style,
  53544. id: this[_xfa_object.$uid],
  53545. class: classNames
  53546. };
  53547. if (style.margin) {
  53548. style.padding = style.margin;
  53549. delete style.margin;
  53550. }
  53551. (0, _html_utils.setAccess)(this, classNames);
  53552. if (this.name) {
  53553. attributes.xfaName = this.name;
  53554. }
  53555. const children = [];
  53556. const html = {
  53557. name: "div",
  53558. attributes,
  53559. children
  53560. };
  53561. applyAssist(this, attributes);
  53562. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  53563. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  53564. const ui = this.ui[_xfa_object.$toHTML]().html;
  53565. if (!ui) {
  53566. Object.assign(style, borderStyle);
  53567. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53568. }
  53569. if (this[_xfa_object.$tabIndex]) {
  53570. if (ui.children && ui.children[0]) {
  53571. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  53572. } else {
  53573. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  53574. }
  53575. }
  53576. if (!ui.attributes.style) {
  53577. ui.attributes.style = Object.create(null);
  53578. }
  53579. let aElement = null;
  53580. if (this.ui.button) {
  53581. if (ui.children.length === 1) {
  53582. [aElement] = ui.children.splice(0, 1);
  53583. }
  53584. Object.assign(ui.attributes.style, borderStyle);
  53585. } else {
  53586. Object.assign(style, borderStyle);
  53587. }
  53588. children.push(ui);
  53589. if (this.value) {
  53590. if (this.ui.imageEdit) {
  53591. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  53592. } else if (!this.ui.button) {
  53593. let value = "";
  53594. if (this.value.exData) {
  53595. value = this.value.exData[_xfa_object.$text]();
  53596. } else if (this.value.text) {
  53597. value = this.value.text[_xfa_object.$getExtra]();
  53598. } else {
  53599. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  53600. if (htmlValue !== null) {
  53601. value = htmlValue.children[0].value;
  53602. }
  53603. }
  53604. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  53605. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  53606. }
  53607. if (value) {
  53608. if (this.ui.numericEdit) {
  53609. value = parseFloat(value);
  53610. value = isNaN(value) ? "" : value.toString();
  53611. }
  53612. if (ui.children[0].name === "textarea") {
  53613. ui.children[0].attributes.textContent = value;
  53614. } else {
  53615. ui.children[0].attributes.value = value;
  53616. }
  53617. }
  53618. }
  53619. }
  53620. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  53621. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  53622. let captionHeight = 0;
  53623. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  53624. captionHeight = this.caption.reserve;
  53625. if (captionHeight <= 0) {
  53626. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  53627. }
  53628. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  53629. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  53630. } else {
  53631. ui.children[0].attributes.style.height = "100%";
  53632. }
  53633. }
  53634. if (aElement) {
  53635. ui.children.push(aElement);
  53636. }
  53637. if (!caption) {
  53638. if (ui.attributes.class) {
  53639. ui.attributes.class.push("xfaLeft");
  53640. }
  53641. this.w = savedW;
  53642. this.h = savedH;
  53643. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53644. }
  53645. if (this.ui.button) {
  53646. if (style.padding) {
  53647. delete style.padding;
  53648. }
  53649. if (caption.name === "div") {
  53650. caption.name = "span";
  53651. }
  53652. ui.children.push(caption);
  53653. return _utils.HTMLResult.success(html, bbox);
  53654. } else if (this.ui.checkButton) {
  53655. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  53656. }
  53657. if (!ui.attributes.class) {
  53658. ui.attributes.class = [];
  53659. }
  53660. ui.children.splice(0, 0, caption);
  53661. switch (this.caption.placement) {
  53662. case "left":
  53663. ui.attributes.class.push("xfaLeft");
  53664. break;
  53665. case "right":
  53666. ui.attributes.class.push("xfaRight");
  53667. break;
  53668. case "top":
  53669. ui.attributes.class.push("xfaTop");
  53670. break;
  53671. case "bottom":
  53672. ui.attributes.class.push("xfaBottom");
  53673. break;
  53674. case "inline":
  53675. ui.attributes.class.push("xfaLeft");
  53676. break;
  53677. }
  53678. this.w = savedW;
  53679. this.h = savedH;
  53680. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53681. }
  53682. }
  53683. exports.Field = Field;
  53684. class Fill extends _xfa_object.XFAObject {
  53685. constructor(attributes) {
  53686. super(TEMPLATE_NS_ID, "fill", true);
  53687. this.id = attributes.id || "";
  53688. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53689. this.use = attributes.use || "";
  53690. this.usehref = attributes.usehref || "";
  53691. this.color = null;
  53692. this.extras = null;
  53693. this.linear = null;
  53694. this.pattern = null;
  53695. this.radial = null;
  53696. this.solid = null;
  53697. this.stipple = null;
  53698. }
  53699. [_xfa_object.$toStyle]() {
  53700. const parent = this[_xfa_object.$getParent]();
  53701. const grandpa = parent[_xfa_object.$getParent]();
  53702. const ggrandpa = grandpa[_xfa_object.$getParent]();
  53703. const style = Object.create(null);
  53704. let propName = "color";
  53705. let altPropName = propName;
  53706. if (parent instanceof Border) {
  53707. propName = "background-color";
  53708. altPropName = "background";
  53709. if (ggrandpa instanceof Ui) {
  53710. style.backgroundColor = "white";
  53711. }
  53712. }
  53713. if (parent instanceof Rectangle || parent instanceof Arc) {
  53714. propName = altPropName = "fill";
  53715. style.fill = "white";
  53716. }
  53717. for (const name of Object.getOwnPropertyNames(this)) {
  53718. if (name === "extras" || name === "color") {
  53719. continue;
  53720. }
  53721. const obj = this[name];
  53722. if (!(obj instanceof _xfa_object.XFAObject)) {
  53723. continue;
  53724. }
  53725. const color = obj[_xfa_object.$toStyle](this.color);
  53726. if (color) {
  53727. style[color.startsWith("#") ? propName : altPropName] = color;
  53728. }
  53729. return style;
  53730. }
  53731. if (this.color && this.color.value) {
  53732. const color = this.color[_xfa_object.$toStyle]();
  53733. style[color.startsWith("#") ? propName : altPropName] = color;
  53734. }
  53735. return style;
  53736. }
  53737. }
  53738. class Filter extends _xfa_object.XFAObject {
  53739. constructor(attributes) {
  53740. super(TEMPLATE_NS_ID, "filter", true);
  53741. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  53742. this.id = attributes.id || "";
  53743. this.name = attributes.name || "";
  53744. this.use = attributes.use || "";
  53745. this.usehref = attributes.usehref || "";
  53746. this.version = (0, _utils.getInteger)({
  53747. data: this.version,
  53748. defaultValue: 5,
  53749. validate: x => x >= 1 && x <= 5
  53750. });
  53751. this.appearanceFilter = null;
  53752. this.certificates = null;
  53753. this.digestMethods = null;
  53754. this.encodings = null;
  53755. this.encryptionMethods = null;
  53756. this.handler = null;
  53757. this.lockDocument = null;
  53758. this.mdp = null;
  53759. this.reasons = null;
  53760. this.timeStamp = null;
  53761. }
  53762. }
  53763. class Float extends _xfa_object.ContentObject {
  53764. constructor(attributes) {
  53765. super(TEMPLATE_NS_ID, "float");
  53766. this.id = attributes.id || "";
  53767. this.name = attributes.name || "";
  53768. this.use = attributes.use || "";
  53769. this.usehref = attributes.usehref || "";
  53770. }
  53771. [_xfa_object.$finalize]() {
  53772. const number = parseFloat(this[_xfa_object.$content].trim());
  53773. this[_xfa_object.$content] = isNaN(number) ? null : number;
  53774. }
  53775. [_xfa_object.$toHTML](availableSpace) {
  53776. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  53777. }
  53778. }
  53779. class Font extends _xfa_object.XFAObject {
  53780. constructor(attributes) {
  53781. super(TEMPLATE_NS_ID, "font", true);
  53782. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  53783. this.fontHorizontalScale = (0, _utils.getFloat)({
  53784. data: attributes.fontHorizontalScale,
  53785. defaultValue: 100,
  53786. validate: x => x >= 0
  53787. });
  53788. this.fontVerticalScale = (0, _utils.getFloat)({
  53789. data: attributes.fontVerticalScale,
  53790. defaultValue: 100,
  53791. validate: x => x >= 0
  53792. });
  53793. this.id = attributes.id || "";
  53794. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  53795. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  53796. this.lineThrough = (0, _utils.getInteger)({
  53797. data: attributes.lineThrough,
  53798. defaultValue: 0,
  53799. validate: x => x === 1 || x === 2
  53800. });
  53801. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  53802. this.overline = (0, _utils.getInteger)({
  53803. data: attributes.overline,
  53804. defaultValue: 0,
  53805. validate: x => x === 1 || x === 2
  53806. });
  53807. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  53808. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  53809. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  53810. this.typeface = attributes.typeface || "Courier";
  53811. this.underline = (0, _utils.getInteger)({
  53812. data: attributes.underline,
  53813. defaultValue: 0,
  53814. validate: x => x === 1 || x === 2
  53815. });
  53816. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  53817. this.use = attributes.use || "";
  53818. this.usehref = attributes.usehref || "";
  53819. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  53820. this.extras = null;
  53821. this.fill = null;
  53822. }
  53823. [_xfa_object.$clean](builder) {
  53824. super[_xfa_object.$clean](builder);
  53825. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  53826. }
  53827. [_xfa_object.$toStyle]() {
  53828. const style = (0, _html_utils.toStyle)(this, "fill");
  53829. const color = style.color;
  53830. if (color) {
  53831. if (color === "#000000") {
  53832. delete style.color;
  53833. } else if (!color.startsWith("#")) {
  53834. style.background = color;
  53835. style.backgroundClip = "text";
  53836. style.color = "transparent";
  53837. }
  53838. }
  53839. if (this.baselineShift) {
  53840. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  53841. }
  53842. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  53843. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  53844. if (this.lineThrough !== 0) {
  53845. style.textDecoration = "line-through";
  53846. if (this.lineThrough === 2) {
  53847. style.textDecorationStyle = "double";
  53848. }
  53849. }
  53850. if (this.overline !== 0) {
  53851. style.textDecoration = "overline";
  53852. if (this.overline === 2) {
  53853. style.textDecorationStyle = "double";
  53854. }
  53855. }
  53856. style.fontStyle = this.posture;
  53857. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  53858. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  53859. if (this.underline !== 0) {
  53860. style.textDecoration = "underline";
  53861. if (this.underline === 2) {
  53862. style.textDecorationStyle = "double";
  53863. }
  53864. }
  53865. style.fontWeight = this.weight;
  53866. return style;
  53867. }
  53868. }
  53869. class Format extends _xfa_object.XFAObject {
  53870. constructor(attributes) {
  53871. super(TEMPLATE_NS_ID, "format", true);
  53872. this.id = attributes.id || "";
  53873. this.use = attributes.use || "";
  53874. this.usehref = attributes.usehref || "";
  53875. this.extras = null;
  53876. this.picture = null;
  53877. }
  53878. }
  53879. class Handler extends _xfa_object.StringObject {
  53880. constructor(attributes) {
  53881. super(TEMPLATE_NS_ID, "handler");
  53882. this.id = attributes.id || "";
  53883. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53884. this.use = attributes.use || "";
  53885. this.usehref = attributes.usehref || "";
  53886. }
  53887. }
  53888. class Hyphenation extends _xfa_object.XFAObject {
  53889. constructor(attributes) {
  53890. super(TEMPLATE_NS_ID, "hyphenation");
  53891. this.excludeAllCaps = (0, _utils.getInteger)({
  53892. data: attributes.excludeAllCaps,
  53893. defaultValue: 0,
  53894. validate: x => x === 1
  53895. });
  53896. this.excludeInitialCap = (0, _utils.getInteger)({
  53897. data: attributes.excludeInitialCap,
  53898. defaultValue: 0,
  53899. validate: x => x === 1
  53900. });
  53901. this.hyphenate = (0, _utils.getInteger)({
  53902. data: attributes.hyphenate,
  53903. defaultValue: 0,
  53904. validate: x => x === 1
  53905. });
  53906. this.id = attributes.id || "";
  53907. this.pushCharacterCount = (0, _utils.getInteger)({
  53908. data: attributes.pushCharacterCount,
  53909. defaultValue: 3,
  53910. validate: x => x >= 0
  53911. });
  53912. this.remainCharacterCount = (0, _utils.getInteger)({
  53913. data: attributes.remainCharacterCount,
  53914. defaultValue: 3,
  53915. validate: x => x >= 0
  53916. });
  53917. this.use = attributes.use || "";
  53918. this.usehref = attributes.usehref || "";
  53919. this.wordCharacterCount = (0, _utils.getInteger)({
  53920. data: attributes.wordCharacterCount,
  53921. defaultValue: 7,
  53922. validate: x => x >= 0
  53923. });
  53924. }
  53925. }
  53926. class Image extends _xfa_object.StringObject {
  53927. constructor(attributes) {
  53928. super(TEMPLATE_NS_ID, "image");
  53929. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  53930. this.contentType = attributes.contentType || "";
  53931. this.href = attributes.href || "";
  53932. this.id = attributes.id || "";
  53933. this.name = attributes.name || "";
  53934. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  53935. this.use = attributes.use || "";
  53936. this.usehref = attributes.usehref || "";
  53937. }
  53938. [_xfa_object.$toHTML]() {
  53939. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  53940. return _utils.HTMLResult.EMPTY;
  53941. }
  53942. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  53943. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  53944. return _utils.HTMLResult.EMPTY;
  53945. }
  53946. if (!buffer && this.transferEncoding === "base64") {
  53947. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  53948. }
  53949. if (!buffer) {
  53950. return _utils.HTMLResult.EMPTY;
  53951. }
  53952. if (!this.contentType) {
  53953. for (const [header, type] of IMAGES_HEADERS) {
  53954. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  53955. this.contentType = type;
  53956. break;
  53957. }
  53958. }
  53959. if (!this.contentType) {
  53960. return _utils.HTMLResult.EMPTY;
  53961. }
  53962. }
  53963. const blob = new Blob([buffer], {
  53964. type: this.contentType
  53965. });
  53966. let style;
  53967. switch (this.aspect) {
  53968. case "fit":
  53969. case "actual":
  53970. break;
  53971. case "height":
  53972. style = {
  53973. height: "100%",
  53974. objectFit: "fill"
  53975. };
  53976. break;
  53977. case "none":
  53978. style = {
  53979. width: "100%",
  53980. height: "100%",
  53981. objectFit: "fill"
  53982. };
  53983. break;
  53984. case "width":
  53985. style = {
  53986. width: "100%",
  53987. objectFit: "fill"
  53988. };
  53989. break;
  53990. }
  53991. const parent = this[_xfa_object.$getParent]();
  53992. return _utils.HTMLResult.success({
  53993. name: "img",
  53994. attributes: {
  53995. class: ["xfaImage"],
  53996. style,
  53997. src: URL.createObjectURL(blob),
  53998. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  53999. }
  54000. });
  54001. }
  54002. }
  54003. class ImageEdit extends _xfa_object.XFAObject {
  54004. constructor(attributes) {
  54005. super(TEMPLATE_NS_ID, "imageEdit", true);
  54006. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  54007. this.id = attributes.id || "";
  54008. this.use = attributes.use || "";
  54009. this.usehref = attributes.usehref || "";
  54010. this.border = null;
  54011. this.extras = null;
  54012. this.margin = null;
  54013. }
  54014. [_xfa_object.$toHTML](availableSpace) {
  54015. if (this.data === "embed") {
  54016. return _utils.HTMLResult.success({
  54017. name: "div",
  54018. children: [],
  54019. attributes: {}
  54020. });
  54021. }
  54022. return _utils.HTMLResult.EMPTY;
  54023. }
  54024. }
  54025. class Integer extends _xfa_object.ContentObject {
  54026. constructor(attributes) {
  54027. super(TEMPLATE_NS_ID, "integer");
  54028. this.id = attributes.id || "";
  54029. this.name = attributes.name || "";
  54030. this.use = attributes.use || "";
  54031. this.usehref = attributes.usehref || "";
  54032. }
  54033. [_xfa_object.$finalize]() {
  54034. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  54035. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54036. }
  54037. [_xfa_object.$toHTML](availableSpace) {
  54038. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54039. }
  54040. }
  54041. class Issuers extends _xfa_object.XFAObject {
  54042. constructor(attributes) {
  54043. super(TEMPLATE_NS_ID, "issuers", true);
  54044. this.id = attributes.id || "";
  54045. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54046. this.use = attributes.use || "";
  54047. this.usehref = attributes.usehref || "";
  54048. this.certificate = new _xfa_object.XFAObjectArray();
  54049. }
  54050. }
  54051. class Items extends _xfa_object.XFAObject {
  54052. constructor(attributes) {
  54053. super(TEMPLATE_NS_ID, "items", true);
  54054. this.id = attributes.id || "";
  54055. this.name = attributes.name || "";
  54056. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54057. this.ref = attributes.ref || "";
  54058. this.save = (0, _utils.getInteger)({
  54059. data: attributes.save,
  54060. defaultValue: 0,
  54061. validate: x => x === 1
  54062. });
  54063. this.use = attributes.use || "";
  54064. this.usehref = attributes.usehref || "";
  54065. this.boolean = new _xfa_object.XFAObjectArray();
  54066. this.date = new _xfa_object.XFAObjectArray();
  54067. this.dateTime = new _xfa_object.XFAObjectArray();
  54068. this.decimal = new _xfa_object.XFAObjectArray();
  54069. this.exData = new _xfa_object.XFAObjectArray();
  54070. this.float = new _xfa_object.XFAObjectArray();
  54071. this.image = new _xfa_object.XFAObjectArray();
  54072. this.integer = new _xfa_object.XFAObjectArray();
  54073. this.text = new _xfa_object.XFAObjectArray();
  54074. this.time = new _xfa_object.XFAObjectArray();
  54075. }
  54076. [_xfa_object.$toHTML]() {
  54077. const output = [];
  54078. for (const child of this[_xfa_object.$getChildren]()) {
  54079. output.push(child[_xfa_object.$text]());
  54080. }
  54081. return _utils.HTMLResult.success(output);
  54082. }
  54083. }
  54084. exports.Items = Items;
  54085. class Keep extends _xfa_object.XFAObject {
  54086. constructor(attributes) {
  54087. super(TEMPLATE_NS_ID, "keep", true);
  54088. this.id = attributes.id || "";
  54089. const options = ["none", "contentArea", "pageArea"];
  54090. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  54091. this.next = (0, _utils.getStringOption)(attributes.next, options);
  54092. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  54093. this.use = attributes.use || "";
  54094. this.usehref = attributes.usehref || "";
  54095. this.extras = null;
  54096. }
  54097. }
  54098. class KeyUsage extends _xfa_object.XFAObject {
  54099. constructor(attributes) {
  54100. super(TEMPLATE_NS_ID, "keyUsage");
  54101. const options = ["", "yes", "no"];
  54102. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  54103. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  54104. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  54105. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  54106. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  54107. this.id = attributes.id || "";
  54108. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  54109. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  54110. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  54111. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  54112. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54113. this.use = attributes.use || "";
  54114. this.usehref = attributes.usehref || "";
  54115. }
  54116. }
  54117. class Line extends _xfa_object.XFAObject {
  54118. constructor(attributes) {
  54119. super(TEMPLATE_NS_ID, "line", true);
  54120. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54121. this.id = attributes.id || "";
  54122. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  54123. this.use = attributes.use || "";
  54124. this.usehref = attributes.usehref || "";
  54125. this.edge = null;
  54126. }
  54127. [_xfa_object.$toHTML]() {
  54128. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54129. const edge = this.edge ? this.edge : new Edge({});
  54130. const edgeStyle = edge[_xfa_object.$toStyle]();
  54131. const style = Object.create(null);
  54132. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  54133. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  54134. style.stroke = edgeStyle.color;
  54135. let x1, y1, x2, y2;
  54136. let width = "100%";
  54137. let height = "100%";
  54138. if (parent.w <= thickness) {
  54139. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  54140. width = style.strokeWidth;
  54141. } else if (parent.h <= thickness) {
  54142. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  54143. height = style.strokeWidth;
  54144. } else {
  54145. if (this.slope === "\\") {
  54146. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  54147. } else {
  54148. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  54149. }
  54150. }
  54151. const line = {
  54152. name: "line",
  54153. attributes: {
  54154. xmlns: SVG_NS,
  54155. x1,
  54156. y1,
  54157. x2,
  54158. y2,
  54159. style
  54160. }
  54161. };
  54162. const svg = {
  54163. name: "svg",
  54164. children: [line],
  54165. attributes: {
  54166. xmlns: SVG_NS,
  54167. width,
  54168. height,
  54169. style: {
  54170. overflow: "visible"
  54171. }
  54172. }
  54173. };
  54174. if (hasMargin(parent)) {
  54175. return _utils.HTMLResult.success({
  54176. name: "div",
  54177. attributes: {
  54178. style: {
  54179. display: "inline",
  54180. width: "100%",
  54181. height: "100%"
  54182. }
  54183. },
  54184. children: [svg]
  54185. });
  54186. }
  54187. svg.attributes.style.position = "absolute";
  54188. return _utils.HTMLResult.success(svg);
  54189. }
  54190. }
  54191. class Linear extends _xfa_object.XFAObject {
  54192. constructor(attributes) {
  54193. super(TEMPLATE_NS_ID, "linear", true);
  54194. this.id = attributes.id || "";
  54195. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  54196. this.use = attributes.use || "";
  54197. this.usehref = attributes.usehref || "";
  54198. this.color = null;
  54199. this.extras = null;
  54200. }
  54201. [_xfa_object.$toStyle](startColor) {
  54202. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  54203. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  54204. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  54205. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  54206. }
  54207. }
  54208. class LockDocument extends _xfa_object.ContentObject {
  54209. constructor(attributes) {
  54210. super(TEMPLATE_NS_ID, "lockDocument");
  54211. this.id = attributes.id || "";
  54212. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54213. this.use = attributes.use || "";
  54214. this.usehref = attributes.usehref || "";
  54215. }
  54216. [_xfa_object.$finalize]() {
  54217. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  54218. }
  54219. }
  54220. class Manifest extends _xfa_object.XFAObject {
  54221. constructor(attributes) {
  54222. super(TEMPLATE_NS_ID, "manifest", true);
  54223. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  54224. this.id = attributes.id || "";
  54225. this.name = attributes.name || "";
  54226. this.use = attributes.use || "";
  54227. this.usehref = attributes.usehref || "";
  54228. this.extras = null;
  54229. this.ref = new _xfa_object.XFAObjectArray();
  54230. }
  54231. }
  54232. class Margin extends _xfa_object.XFAObject {
  54233. constructor(attributes) {
  54234. super(TEMPLATE_NS_ID, "margin", true);
  54235. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  54236. this.id = attributes.id || "";
  54237. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  54238. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  54239. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  54240. this.use = attributes.use || "";
  54241. this.usehref = attributes.usehref || "";
  54242. this.extras = null;
  54243. }
  54244. [_xfa_object.$toStyle]() {
  54245. return {
  54246. margin: (0, _html_utils.measureToString)(this.topInset) + " " + (0, _html_utils.measureToString)(this.rightInset) + " " + (0, _html_utils.measureToString)(this.bottomInset) + " " + (0, _html_utils.measureToString)(this.leftInset)
  54247. };
  54248. }
  54249. }
  54250. class Mdp extends _xfa_object.XFAObject {
  54251. constructor(attributes) {
  54252. super(TEMPLATE_NS_ID, "mdp");
  54253. this.id = attributes.id || "";
  54254. this.permissions = (0, _utils.getInteger)({
  54255. data: attributes.permissions,
  54256. defaultValue: 2,
  54257. validate: x => x === 1 || x === 3
  54258. });
  54259. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  54260. this.use = attributes.use || "";
  54261. this.usehref = attributes.usehref || "";
  54262. }
  54263. }
  54264. class Medium extends _xfa_object.XFAObject {
  54265. constructor(attributes) {
  54266. super(TEMPLATE_NS_ID, "medium");
  54267. this.id = attributes.id || "";
  54268. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  54269. this.long = (0, _utils.getMeasurement)(attributes.long);
  54270. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  54271. this.short = (0, _utils.getMeasurement)(attributes.short);
  54272. this.stock = attributes.stock || "";
  54273. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  54274. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  54275. this.use = attributes.use || "";
  54276. this.usehref = attributes.usehref || "";
  54277. }
  54278. }
  54279. class Message extends _xfa_object.XFAObject {
  54280. constructor(attributes) {
  54281. super(TEMPLATE_NS_ID, "message", true);
  54282. this.id = attributes.id || "";
  54283. this.use = attributes.use || "";
  54284. this.usehref = attributes.usehref || "";
  54285. this.text = new _xfa_object.XFAObjectArray();
  54286. }
  54287. }
  54288. class NumericEdit extends _xfa_object.XFAObject {
  54289. constructor(attributes) {
  54290. super(TEMPLATE_NS_ID, "numericEdit", true);
  54291. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54292. this.id = attributes.id || "";
  54293. this.use = attributes.use || "";
  54294. this.usehref = attributes.usehref || "";
  54295. this.border = null;
  54296. this.comb = null;
  54297. this.extras = null;
  54298. this.margin = null;
  54299. }
  54300. [_xfa_object.$toHTML](availableSpace) {
  54301. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  54302. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54303. const html = {
  54304. name: "input",
  54305. attributes: {
  54306. type: "text",
  54307. fieldId: field[_xfa_object.$uid],
  54308. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  54309. class: ["xfaTextfield"],
  54310. style,
  54311. "aria-label": ariaLabel(field)
  54312. }
  54313. };
  54314. return _utils.HTMLResult.success({
  54315. name: "label",
  54316. attributes: {
  54317. class: ["xfaLabel"]
  54318. },
  54319. children: [html]
  54320. });
  54321. }
  54322. }
  54323. class Occur extends _xfa_object.XFAObject {
  54324. constructor(attributes) {
  54325. super(TEMPLATE_NS_ID, "occur", true);
  54326. this.id = attributes.id || "";
  54327. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  54328. data: attributes.initial,
  54329. defaultValue: "",
  54330. validate: x => true
  54331. }) : "";
  54332. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  54333. data: attributes.max,
  54334. defaultValue: 1,
  54335. validate: x => true
  54336. }) : "";
  54337. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  54338. data: attributes.min,
  54339. defaultValue: 1,
  54340. validate: x => true
  54341. }) : "";
  54342. this.use = attributes.use || "";
  54343. this.usehref = attributes.usehref || "";
  54344. this.extras = null;
  54345. }
  54346. [_xfa_object.$clean]() {
  54347. const parent = this[_xfa_object.$getParent]();
  54348. const originalMin = this.min;
  54349. if (this.min === "") {
  54350. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  54351. }
  54352. if (this.max === "") {
  54353. if (originalMin === "") {
  54354. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  54355. } else {
  54356. this.max = this.min;
  54357. }
  54358. }
  54359. if (this.max !== -1 && this.max < this.min) {
  54360. this.max = this.min;
  54361. }
  54362. if (this.initial === "") {
  54363. this.initial = parent instanceof Template ? 1 : this.min;
  54364. }
  54365. }
  54366. }
  54367. class Oid extends _xfa_object.StringObject {
  54368. constructor(attributes) {
  54369. super(TEMPLATE_NS_ID, "oid");
  54370. this.id = attributes.id || "";
  54371. this.name = attributes.name || "";
  54372. this.use = attributes.use || "";
  54373. this.usehref = attributes.usehref || "";
  54374. }
  54375. }
  54376. class Oids extends _xfa_object.XFAObject {
  54377. constructor(attributes) {
  54378. super(TEMPLATE_NS_ID, "oids", true);
  54379. this.id = attributes.id || "";
  54380. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54381. this.use = attributes.use || "";
  54382. this.usehref = attributes.usehref || "";
  54383. this.oid = new _xfa_object.XFAObjectArray();
  54384. }
  54385. }
  54386. class Overflow extends _xfa_object.XFAObject {
  54387. constructor(attributes) {
  54388. super(TEMPLATE_NS_ID, "overflow");
  54389. this.id = attributes.id || "";
  54390. this.leader = attributes.leader || "";
  54391. this.target = attributes.target || "";
  54392. this.trailer = attributes.trailer || "";
  54393. this.use = attributes.use || "";
  54394. this.usehref = attributes.usehref || "";
  54395. }
  54396. [_xfa_object.$getExtra]() {
  54397. if (!this[_xfa_object.$extra]) {
  54398. const parent = this[_xfa_object.$getParent]();
  54399. const root = this[_xfa_object.$getTemplateRoot]();
  54400. const target = root[_xfa_object.$searchNode](this.target, parent);
  54401. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  54402. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  54403. this[_xfa_object.$extra] = {
  54404. target: target && target[0] || null,
  54405. leader: leader && leader[0] || null,
  54406. trailer: trailer && trailer[0] || null,
  54407. addLeader: false,
  54408. addTrailer: false
  54409. };
  54410. }
  54411. return this[_xfa_object.$extra];
  54412. }
  54413. }
  54414. class PageArea extends _xfa_object.XFAObject {
  54415. constructor(attributes) {
  54416. super(TEMPLATE_NS_ID, "pageArea", true);
  54417. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  54418. this.id = attributes.id || "";
  54419. this.initialNumber = (0, _utils.getInteger)({
  54420. data: attributes.initialNumber,
  54421. defaultValue: 1,
  54422. validate: x => true
  54423. });
  54424. this.name = attributes.name || "";
  54425. this.numbered = (0, _utils.getInteger)({
  54426. data: attributes.numbered,
  54427. defaultValue: 1,
  54428. validate: x => true
  54429. });
  54430. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  54431. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  54432. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54433. this.use = attributes.use || "";
  54434. this.usehref = attributes.usehref || "";
  54435. this.desc = null;
  54436. this.extras = null;
  54437. this.medium = null;
  54438. this.occur = null;
  54439. this.area = new _xfa_object.XFAObjectArray();
  54440. this.contentArea = new _xfa_object.XFAObjectArray();
  54441. this.draw = new _xfa_object.XFAObjectArray();
  54442. this.exclGroup = new _xfa_object.XFAObjectArray();
  54443. this.field = new _xfa_object.XFAObjectArray();
  54444. this.subform = new _xfa_object.XFAObjectArray();
  54445. }
  54446. [_xfa_object.$isUsable]() {
  54447. if (!this[_xfa_object.$extra]) {
  54448. this[_xfa_object.$extra] = {
  54449. numberOfUse: 0
  54450. };
  54451. return true;
  54452. }
  54453. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  54454. }
  54455. [_xfa_object.$cleanPage]() {
  54456. delete this[_xfa_object.$extra];
  54457. }
  54458. [_xfa_object.$getNextPage]() {
  54459. if (!this[_xfa_object.$extra]) {
  54460. this[_xfa_object.$extra] = {
  54461. numberOfUse: 0
  54462. };
  54463. }
  54464. const parent = this[_xfa_object.$getParent]();
  54465. if (parent.relation === "orderedOccurrence") {
  54466. if (this[_xfa_object.$isUsable]()) {
  54467. this[_xfa_object.$extra].numberOfUse += 1;
  54468. return this;
  54469. }
  54470. }
  54471. return parent[_xfa_object.$getNextPage]();
  54472. }
  54473. [_xfa_object.$getAvailableSpace]() {
  54474. return this[_xfa_object.$extra].space || {
  54475. width: 0,
  54476. height: 0
  54477. };
  54478. }
  54479. [_xfa_object.$toHTML]() {
  54480. if (!this[_xfa_object.$extra]) {
  54481. this[_xfa_object.$extra] = {
  54482. numberOfUse: 1
  54483. };
  54484. }
  54485. const children = [];
  54486. this[_xfa_object.$extra].children = children;
  54487. const style = Object.create(null);
  54488. if (this.medium && this.medium.short && this.medium.long) {
  54489. style.width = (0, _html_utils.measureToString)(this.medium.short);
  54490. style.height = (0, _html_utils.measureToString)(this.medium.long);
  54491. this[_xfa_object.$extra].space = {
  54492. width: this.medium.short,
  54493. height: this.medium.long
  54494. };
  54495. if (this.medium.orientation === "landscape") {
  54496. const x = style.width;
  54497. style.width = style.height;
  54498. style.height = x;
  54499. this[_xfa_object.$extra].space = {
  54500. width: this.medium.long,
  54501. height: this.medium.short
  54502. };
  54503. }
  54504. } else {
  54505. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  54506. }
  54507. this[_xfa_object.$childrenToHTML]({
  54508. filter: new Set(["area", "draw", "field", "subform"]),
  54509. include: true
  54510. });
  54511. this[_xfa_object.$childrenToHTML]({
  54512. filter: new Set(["contentArea"]),
  54513. include: true
  54514. });
  54515. return _utils.HTMLResult.success({
  54516. name: "div",
  54517. children,
  54518. attributes: {
  54519. class: ["xfaPage"],
  54520. id: this[_xfa_object.$uid],
  54521. style,
  54522. xfaName: this.name
  54523. }
  54524. });
  54525. }
  54526. }
  54527. class PageSet extends _xfa_object.XFAObject {
  54528. constructor(attributes) {
  54529. super(TEMPLATE_NS_ID, "pageSet", true);
  54530. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  54531. this.id = attributes.id || "";
  54532. this.name = attributes.name || "";
  54533. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  54534. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54535. this.use = attributes.use || "";
  54536. this.usehref = attributes.usehref || "";
  54537. this.extras = null;
  54538. this.occur = null;
  54539. this.pageArea = new _xfa_object.XFAObjectArray();
  54540. this.pageSet = new _xfa_object.XFAObjectArray();
  54541. }
  54542. [_xfa_object.$cleanPage]() {
  54543. for (const page of this.pageArea.children) {
  54544. page[_xfa_object.$cleanPage]();
  54545. }
  54546. for (const page of this.pageSet.children) {
  54547. page[_xfa_object.$cleanPage]();
  54548. }
  54549. }
  54550. [_xfa_object.$isUsable]() {
  54551. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  54552. }
  54553. [_xfa_object.$getNextPage]() {
  54554. if (!this[_xfa_object.$extra]) {
  54555. this[_xfa_object.$extra] = {
  54556. numberOfUse: 1,
  54557. pageIndex: -1,
  54558. pageSetIndex: -1
  54559. };
  54560. }
  54561. if (this.relation === "orderedOccurrence") {
  54562. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  54563. this[_xfa_object.$extra].pageIndex += 1;
  54564. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  54565. return pageArea[_xfa_object.$getNextPage]();
  54566. }
  54567. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  54568. this[_xfa_object.$extra].pageSetIndex += 1;
  54569. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  54570. }
  54571. if (this[_xfa_object.$isUsable]()) {
  54572. this[_xfa_object.$extra].numberOfUse += 1;
  54573. this[_xfa_object.$extra].pageIndex = -1;
  54574. this[_xfa_object.$extra].pageSetIndex = -1;
  54575. return this[_xfa_object.$getNextPage]();
  54576. }
  54577. const parent = this[_xfa_object.$getParent]();
  54578. if (parent instanceof PageSet) {
  54579. return parent[_xfa_object.$getNextPage]();
  54580. }
  54581. this[_xfa_object.$cleanPage]();
  54582. return this[_xfa_object.$getNextPage]();
  54583. }
  54584. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  54585. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  54586. const position = pageNumber === 0 ? "first" : "rest";
  54587. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  54588. if (page) {
  54589. return page;
  54590. }
  54591. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  54592. if (page) {
  54593. return page;
  54594. }
  54595. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  54596. if (page) {
  54597. return page;
  54598. }
  54599. return this.pageArea.children[0];
  54600. }
  54601. }
  54602. class Para extends _xfa_object.XFAObject {
  54603. constructor(attributes) {
  54604. super(TEMPLATE_NS_ID, "para", true);
  54605. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54606. this.id = attributes.id || "";
  54607. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  54608. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  54609. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  54610. this.orphans = (0, _utils.getInteger)({
  54611. data: attributes.orphans,
  54612. defaultValue: 0,
  54613. validate: x => x >= 0
  54614. });
  54615. this.preserve = attributes.preserve || "";
  54616. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  54617. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  54618. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  54619. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  54620. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  54621. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  54622. this.use = attributes.use || "";
  54623. this.usehref = attributes.usehref || "";
  54624. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  54625. this.widows = (0, _utils.getInteger)({
  54626. data: attributes.widows,
  54627. defaultValue: 0,
  54628. validate: x => x >= 0
  54629. });
  54630. this.hyphenation = null;
  54631. }
  54632. [_xfa_object.$toStyle]() {
  54633. const style = (0, _html_utils.toStyle)(this, "hAlign");
  54634. if (this.marginLeft !== "") {
  54635. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  54636. }
  54637. if (this.marginRight !== "") {
  54638. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  54639. }
  54640. if (this.spaceAbove !== "") {
  54641. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  54642. }
  54643. if (this.spaceBelow !== "") {
  54644. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  54645. }
  54646. if (this.textIndent !== "") {
  54647. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  54648. (0, _html_utils.fixTextIndent)(style);
  54649. }
  54650. if (this.lineHeight > 0) {
  54651. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  54652. }
  54653. if (this.tabDefault !== "") {
  54654. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  54655. }
  54656. if (this.tabStops.length > 0) {}
  54657. if (this.hyphenatation) {
  54658. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  54659. }
  54660. return style;
  54661. }
  54662. }
  54663. class PasswordEdit extends _xfa_object.XFAObject {
  54664. constructor(attributes) {
  54665. super(TEMPLATE_NS_ID, "passwordEdit", true);
  54666. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  54667. this.id = attributes.id || "";
  54668. this.passwordChar = attributes.passwordChar || "*";
  54669. this.use = attributes.use || "";
  54670. this.usehref = attributes.usehref || "";
  54671. this.border = null;
  54672. this.extras = null;
  54673. this.margin = null;
  54674. }
  54675. }
  54676. class Pattern extends _xfa_object.XFAObject {
  54677. constructor(attributes) {
  54678. super(TEMPLATE_NS_ID, "pattern", true);
  54679. this.id = attributes.id || "";
  54680. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  54681. this.use = attributes.use || "";
  54682. this.usehref = attributes.usehref || "";
  54683. this.color = null;
  54684. this.extras = null;
  54685. }
  54686. [_xfa_object.$toStyle](startColor) {
  54687. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  54688. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  54689. const width = 5;
  54690. const cmd = "repeating-linear-gradient";
  54691. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  54692. switch (this.type) {
  54693. case "crossHatch":
  54694. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  54695. case "crossDiagonal":
  54696. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  54697. case "diagonalLeft":
  54698. return `${cmd}(45deg,${colors})`;
  54699. case "diagonalRight":
  54700. return `${cmd}(-45deg,${colors})`;
  54701. case "horizontal":
  54702. return `${cmd}(to top,${colors})`;
  54703. case "vertical":
  54704. return `${cmd}(to right,${colors})`;
  54705. }
  54706. return "";
  54707. }
  54708. }
  54709. class Picture extends _xfa_object.StringObject {
  54710. constructor(attributes) {
  54711. super(TEMPLATE_NS_ID, "picture");
  54712. this.id = attributes.id || "";
  54713. this.use = attributes.use || "";
  54714. this.usehref = attributes.usehref || "";
  54715. }
  54716. }
  54717. class Proto extends _xfa_object.XFAObject {
  54718. constructor(attributes) {
  54719. super(TEMPLATE_NS_ID, "proto", true);
  54720. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  54721. this.arc = new _xfa_object.XFAObjectArray();
  54722. this.area = new _xfa_object.XFAObjectArray();
  54723. this.assist = new _xfa_object.XFAObjectArray();
  54724. this.barcode = new _xfa_object.XFAObjectArray();
  54725. this.bindItems = new _xfa_object.XFAObjectArray();
  54726. this.bookend = new _xfa_object.XFAObjectArray();
  54727. this.boolean = new _xfa_object.XFAObjectArray();
  54728. this.border = new _xfa_object.XFAObjectArray();
  54729. this.break = new _xfa_object.XFAObjectArray();
  54730. this.breakAfter = new _xfa_object.XFAObjectArray();
  54731. this.breakBefore = new _xfa_object.XFAObjectArray();
  54732. this.button = new _xfa_object.XFAObjectArray();
  54733. this.calculate = new _xfa_object.XFAObjectArray();
  54734. this.caption = new _xfa_object.XFAObjectArray();
  54735. this.certificate = new _xfa_object.XFAObjectArray();
  54736. this.certificates = new _xfa_object.XFAObjectArray();
  54737. this.checkButton = new _xfa_object.XFAObjectArray();
  54738. this.choiceList = new _xfa_object.XFAObjectArray();
  54739. this.color = new _xfa_object.XFAObjectArray();
  54740. this.comb = new _xfa_object.XFAObjectArray();
  54741. this.connect = new _xfa_object.XFAObjectArray();
  54742. this.contentArea = new _xfa_object.XFAObjectArray();
  54743. this.corner = new _xfa_object.XFAObjectArray();
  54744. this.date = new _xfa_object.XFAObjectArray();
  54745. this.dateTime = new _xfa_object.XFAObjectArray();
  54746. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  54747. this.decimal = new _xfa_object.XFAObjectArray();
  54748. this.defaultUi = new _xfa_object.XFAObjectArray();
  54749. this.desc = new _xfa_object.XFAObjectArray();
  54750. this.digestMethod = new _xfa_object.XFAObjectArray();
  54751. this.digestMethods = new _xfa_object.XFAObjectArray();
  54752. this.draw = new _xfa_object.XFAObjectArray();
  54753. this.edge = new _xfa_object.XFAObjectArray();
  54754. this.encoding = new _xfa_object.XFAObjectArray();
  54755. this.encodings = new _xfa_object.XFAObjectArray();
  54756. this.encrypt = new _xfa_object.XFAObjectArray();
  54757. this.encryptData = new _xfa_object.XFAObjectArray();
  54758. this.encryption = new _xfa_object.XFAObjectArray();
  54759. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  54760. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  54761. this.event = new _xfa_object.XFAObjectArray();
  54762. this.exData = new _xfa_object.XFAObjectArray();
  54763. this.exObject = new _xfa_object.XFAObjectArray();
  54764. this.exclGroup = new _xfa_object.XFAObjectArray();
  54765. this.execute = new _xfa_object.XFAObjectArray();
  54766. this.extras = new _xfa_object.XFAObjectArray();
  54767. this.field = new _xfa_object.XFAObjectArray();
  54768. this.fill = new _xfa_object.XFAObjectArray();
  54769. this.filter = new _xfa_object.XFAObjectArray();
  54770. this.float = new _xfa_object.XFAObjectArray();
  54771. this.font = new _xfa_object.XFAObjectArray();
  54772. this.format = new _xfa_object.XFAObjectArray();
  54773. this.handler = new _xfa_object.XFAObjectArray();
  54774. this.hyphenation = new _xfa_object.XFAObjectArray();
  54775. this.image = new _xfa_object.XFAObjectArray();
  54776. this.imageEdit = new _xfa_object.XFAObjectArray();
  54777. this.integer = new _xfa_object.XFAObjectArray();
  54778. this.issuers = new _xfa_object.XFAObjectArray();
  54779. this.items = new _xfa_object.XFAObjectArray();
  54780. this.keep = new _xfa_object.XFAObjectArray();
  54781. this.keyUsage = new _xfa_object.XFAObjectArray();
  54782. this.line = new _xfa_object.XFAObjectArray();
  54783. this.linear = new _xfa_object.XFAObjectArray();
  54784. this.lockDocument = new _xfa_object.XFAObjectArray();
  54785. this.manifest = new _xfa_object.XFAObjectArray();
  54786. this.margin = new _xfa_object.XFAObjectArray();
  54787. this.mdp = new _xfa_object.XFAObjectArray();
  54788. this.medium = new _xfa_object.XFAObjectArray();
  54789. this.message = new _xfa_object.XFAObjectArray();
  54790. this.numericEdit = new _xfa_object.XFAObjectArray();
  54791. this.occur = new _xfa_object.XFAObjectArray();
  54792. this.oid = new _xfa_object.XFAObjectArray();
  54793. this.oids = new _xfa_object.XFAObjectArray();
  54794. this.overflow = new _xfa_object.XFAObjectArray();
  54795. this.pageArea = new _xfa_object.XFAObjectArray();
  54796. this.pageSet = new _xfa_object.XFAObjectArray();
  54797. this.para = new _xfa_object.XFAObjectArray();
  54798. this.passwordEdit = new _xfa_object.XFAObjectArray();
  54799. this.pattern = new _xfa_object.XFAObjectArray();
  54800. this.picture = new _xfa_object.XFAObjectArray();
  54801. this.radial = new _xfa_object.XFAObjectArray();
  54802. this.reason = new _xfa_object.XFAObjectArray();
  54803. this.reasons = new _xfa_object.XFAObjectArray();
  54804. this.rectangle = new _xfa_object.XFAObjectArray();
  54805. this.ref = new _xfa_object.XFAObjectArray();
  54806. this.script = new _xfa_object.XFAObjectArray();
  54807. this.setProperty = new _xfa_object.XFAObjectArray();
  54808. this.signData = new _xfa_object.XFAObjectArray();
  54809. this.signature = new _xfa_object.XFAObjectArray();
  54810. this.signing = new _xfa_object.XFAObjectArray();
  54811. this.solid = new _xfa_object.XFAObjectArray();
  54812. this.speak = new _xfa_object.XFAObjectArray();
  54813. this.stipple = new _xfa_object.XFAObjectArray();
  54814. this.subform = new _xfa_object.XFAObjectArray();
  54815. this.subformSet = new _xfa_object.XFAObjectArray();
  54816. this.subjectDN = new _xfa_object.XFAObjectArray();
  54817. this.subjectDNs = new _xfa_object.XFAObjectArray();
  54818. this.submit = new _xfa_object.XFAObjectArray();
  54819. this.text = new _xfa_object.XFAObjectArray();
  54820. this.textEdit = new _xfa_object.XFAObjectArray();
  54821. this.time = new _xfa_object.XFAObjectArray();
  54822. this.timeStamp = new _xfa_object.XFAObjectArray();
  54823. this.toolTip = new _xfa_object.XFAObjectArray();
  54824. this.traversal = new _xfa_object.XFAObjectArray();
  54825. this.traverse = new _xfa_object.XFAObjectArray();
  54826. this.ui = new _xfa_object.XFAObjectArray();
  54827. this.validate = new _xfa_object.XFAObjectArray();
  54828. this.value = new _xfa_object.XFAObjectArray();
  54829. this.variables = new _xfa_object.XFAObjectArray();
  54830. }
  54831. }
  54832. class Radial extends _xfa_object.XFAObject {
  54833. constructor(attributes) {
  54834. super(TEMPLATE_NS_ID, "radial", true);
  54835. this.id = attributes.id || "";
  54836. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  54837. this.use = attributes.use || "";
  54838. this.usehref = attributes.usehref || "";
  54839. this.color = null;
  54840. this.extras = null;
  54841. }
  54842. [_xfa_object.$toStyle](startColor) {
  54843. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  54844. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  54845. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  54846. return `radial-gradient(circle at center, ${colors})`;
  54847. }
  54848. }
  54849. class Reason extends _xfa_object.StringObject {
  54850. constructor(attributes) {
  54851. super(TEMPLATE_NS_ID, "reason");
  54852. this.id = attributes.id || "";
  54853. this.name = attributes.name || "";
  54854. this.use = attributes.use || "";
  54855. this.usehref = attributes.usehref || "";
  54856. }
  54857. }
  54858. class Reasons extends _xfa_object.XFAObject {
  54859. constructor(attributes) {
  54860. super(TEMPLATE_NS_ID, "reasons", true);
  54861. this.id = attributes.id || "";
  54862. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54863. this.use = attributes.use || "";
  54864. this.usehref = attributes.usehref || "";
  54865. this.reason = new _xfa_object.XFAObjectArray();
  54866. }
  54867. }
  54868. class Rectangle extends _xfa_object.XFAObject {
  54869. constructor(attributes) {
  54870. super(TEMPLATE_NS_ID, "rectangle", true);
  54871. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  54872. this.id = attributes.id || "";
  54873. this.use = attributes.use || "";
  54874. this.usehref = attributes.usehref || "";
  54875. this.corner = new _xfa_object.XFAObjectArray(4);
  54876. this.edge = new _xfa_object.XFAObjectArray(4);
  54877. this.fill = null;
  54878. }
  54879. [_xfa_object.$toHTML]() {
  54880. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  54881. const edgeStyle = edge[_xfa_object.$toStyle]();
  54882. const style = Object.create(null);
  54883. if (this.fill && this.fill.presence === "visible") {
  54884. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  54885. } else {
  54886. style.fill = "transparent";
  54887. }
  54888. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  54889. style.stroke = edgeStyle.color;
  54890. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  54891. const cornerStyle = corner[_xfa_object.$toStyle]();
  54892. const rect = {
  54893. name: "rect",
  54894. attributes: {
  54895. xmlns: SVG_NS,
  54896. width: "100%",
  54897. height: "100%",
  54898. x: 0,
  54899. y: 0,
  54900. rx: cornerStyle.radius,
  54901. ry: cornerStyle.radius,
  54902. style
  54903. }
  54904. };
  54905. const svg = {
  54906. name: "svg",
  54907. children: [rect],
  54908. attributes: {
  54909. xmlns: SVG_NS,
  54910. style: {
  54911. overflow: "visible"
  54912. },
  54913. width: "100%",
  54914. height: "100%"
  54915. }
  54916. };
  54917. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  54918. if (hasMargin(parent)) {
  54919. return _utils.HTMLResult.success({
  54920. name: "div",
  54921. attributes: {
  54922. style: {
  54923. display: "inline",
  54924. width: "100%",
  54925. height: "100%"
  54926. }
  54927. },
  54928. children: [svg]
  54929. });
  54930. }
  54931. svg.attributes.style.position = "absolute";
  54932. return _utils.HTMLResult.success(svg);
  54933. }
  54934. }
  54935. class RefElement extends _xfa_object.StringObject {
  54936. constructor(attributes) {
  54937. super(TEMPLATE_NS_ID, "ref");
  54938. this.id = attributes.id || "";
  54939. this.use = attributes.use || "";
  54940. this.usehref = attributes.usehref || "";
  54941. }
  54942. }
  54943. class Script extends _xfa_object.StringObject {
  54944. constructor(attributes) {
  54945. super(TEMPLATE_NS_ID, "script");
  54946. this.binding = attributes.binding || "";
  54947. this.contentType = attributes.contentType || "";
  54948. this.id = attributes.id || "";
  54949. this.name = attributes.name || "";
  54950. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  54951. this.use = attributes.use || "";
  54952. this.usehref = attributes.usehref || "";
  54953. }
  54954. }
  54955. class SetProperty extends _xfa_object.XFAObject {
  54956. constructor(attributes) {
  54957. super(TEMPLATE_NS_ID, "setProperty");
  54958. this.connection = attributes.connection || "";
  54959. this.ref = attributes.ref || "";
  54960. this.target = attributes.target || "";
  54961. }
  54962. }
  54963. exports.SetProperty = SetProperty;
  54964. class SignData extends _xfa_object.XFAObject {
  54965. constructor(attributes) {
  54966. super(TEMPLATE_NS_ID, "signData", true);
  54967. this.id = attributes.id || "";
  54968. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  54969. this.ref = attributes.ref || "";
  54970. this.target = attributes.target || "";
  54971. this.use = attributes.use || "";
  54972. this.usehref = attributes.usehref || "";
  54973. this.filter = null;
  54974. this.manifest = null;
  54975. }
  54976. }
  54977. class Signature extends _xfa_object.XFAObject {
  54978. constructor(attributes) {
  54979. super(TEMPLATE_NS_ID, "signature", true);
  54980. this.id = attributes.id || "";
  54981. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  54982. this.use = attributes.use || "";
  54983. this.usehref = attributes.usehref || "";
  54984. this.border = null;
  54985. this.extras = null;
  54986. this.filter = null;
  54987. this.manifest = null;
  54988. this.margin = null;
  54989. }
  54990. }
  54991. class Signing extends _xfa_object.XFAObject {
  54992. constructor(attributes) {
  54993. super(TEMPLATE_NS_ID, "signing", true);
  54994. this.id = attributes.id || "";
  54995. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54996. this.use = attributes.use || "";
  54997. this.usehref = attributes.usehref || "";
  54998. this.certificate = new _xfa_object.XFAObjectArray();
  54999. }
  55000. }
  55001. class Solid extends _xfa_object.XFAObject {
  55002. constructor(attributes) {
  55003. super(TEMPLATE_NS_ID, "solid", true);
  55004. this.id = attributes.id || "";
  55005. this.use = attributes.use || "";
  55006. this.usehref = attributes.usehref || "";
  55007. this.extras = null;
  55008. }
  55009. [_xfa_object.$toStyle](startColor) {
  55010. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55011. }
  55012. }
  55013. class Speak extends _xfa_object.StringObject {
  55014. constructor(attributes) {
  55015. super(TEMPLATE_NS_ID, "speak");
  55016. this.disable = (0, _utils.getInteger)({
  55017. data: attributes.disable,
  55018. defaultValue: 0,
  55019. validate: x => x === 1
  55020. });
  55021. this.id = attributes.id || "";
  55022. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  55023. this.rid = attributes.rid || "";
  55024. this.use = attributes.use || "";
  55025. this.usehref = attributes.usehref || "";
  55026. }
  55027. }
  55028. class Stipple extends _xfa_object.XFAObject {
  55029. constructor(attributes) {
  55030. super(TEMPLATE_NS_ID, "stipple", true);
  55031. this.id = attributes.id || "";
  55032. this.rate = (0, _utils.getInteger)({
  55033. data: attributes.rate,
  55034. defaultValue: 50,
  55035. validate: x => x >= 0 && x <= 100
  55036. });
  55037. this.use = attributes.use || "";
  55038. this.usehref = attributes.usehref || "";
  55039. this.color = null;
  55040. this.extras = null;
  55041. }
  55042. [_xfa_object.$toStyle](bgColor) {
  55043. const alpha = this.rate / 100;
  55044. 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));
  55045. }
  55046. }
  55047. class Subform extends _xfa_object.XFAObject {
  55048. constructor(attributes) {
  55049. super(TEMPLATE_NS_ID, "subform", true);
  55050. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  55051. this.allowMacro = (0, _utils.getInteger)({
  55052. data: attributes.allowMacro,
  55053. defaultValue: 0,
  55054. validate: x => x === 1
  55055. });
  55056. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  55057. this.colSpan = (0, _utils.getInteger)({
  55058. data: attributes.colSpan,
  55059. defaultValue: 1,
  55060. validate: n => n >= 1 || n === -1
  55061. });
  55062. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  55063. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  55064. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55065. this.id = attributes.id || "";
  55066. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  55067. this.locale = attributes.locale || "";
  55068. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  55069. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  55070. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  55071. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  55072. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  55073. this.name = attributes.name || "";
  55074. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55075. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55076. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  55077. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  55078. this.use = attributes.use || "";
  55079. this.usehref = attributes.usehref || "";
  55080. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  55081. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  55082. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  55083. this.assist = null;
  55084. this.bind = null;
  55085. this.bookend = null;
  55086. this.border = null;
  55087. this.break = null;
  55088. this.calculate = null;
  55089. this.desc = null;
  55090. this.extras = null;
  55091. this.keep = null;
  55092. this.margin = null;
  55093. this.occur = null;
  55094. this.overflow = null;
  55095. this.pageSet = null;
  55096. this.para = null;
  55097. this.traversal = null;
  55098. this.validate = null;
  55099. this.variables = null;
  55100. this.area = new _xfa_object.XFAObjectArray();
  55101. this.breakAfter = new _xfa_object.XFAObjectArray();
  55102. this.breakBefore = new _xfa_object.XFAObjectArray();
  55103. this.connect = new _xfa_object.XFAObjectArray();
  55104. this.draw = new _xfa_object.XFAObjectArray();
  55105. this.event = new _xfa_object.XFAObjectArray();
  55106. this.exObject = new _xfa_object.XFAObjectArray();
  55107. this.exclGroup = new _xfa_object.XFAObjectArray();
  55108. this.field = new _xfa_object.XFAObjectArray();
  55109. this.proto = new _xfa_object.XFAObjectArray();
  55110. this.setProperty = new _xfa_object.XFAObjectArray();
  55111. this.subform = new _xfa_object.XFAObjectArray();
  55112. this.subformSet = new _xfa_object.XFAObjectArray();
  55113. }
  55114. [_xfa_object.$getSubformParent]() {
  55115. const parent = this[_xfa_object.$getParent]();
  55116. if (parent instanceof SubformSet) {
  55117. return parent[_xfa_object.$getSubformParent]();
  55118. }
  55119. return parent;
  55120. }
  55121. [_xfa_object.$isBindable]() {
  55122. return true;
  55123. }
  55124. [_xfa_object.$isThereMoreWidth]() {
  55125. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  55126. }
  55127. *[_xfa_object.$getContainedChildren]() {
  55128. yield* getContainedChildren(this);
  55129. }
  55130. [_xfa_object.$flushHTML]() {
  55131. return (0, _layout.flushHTML)(this);
  55132. }
  55133. [_xfa_object.$addHTML](html, bbox) {
  55134. (0, _layout.addHTML)(this, html, bbox);
  55135. }
  55136. [_xfa_object.$getAvailableSpace]() {
  55137. return (0, _layout.getAvailableSpace)(this);
  55138. }
  55139. [_xfa_object.$isSplittable]() {
  55140. const parent = this[_xfa_object.$getSubformParent]();
  55141. if (!parent[_xfa_object.$isSplittable]()) {
  55142. return false;
  55143. }
  55144. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  55145. return this[_xfa_object.$extra]._isSplittable;
  55146. }
  55147. if (this.layout === "position" || this.layout.includes("row")) {
  55148. this[_xfa_object.$extra]._isSplittable = false;
  55149. return false;
  55150. }
  55151. if (this.keep && this.keep.intact !== "none") {
  55152. this[_xfa_object.$extra]._isSplittable = false;
  55153. return false;
  55154. }
  55155. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  55156. return false;
  55157. }
  55158. this[_xfa_object.$extra]._isSplittable = true;
  55159. return true;
  55160. }
  55161. [_xfa_object.$toHTML](availableSpace) {
  55162. setTabIndex(this);
  55163. if (this.break) {
  55164. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  55165. const node = new BreakAfter({
  55166. targetType: this.break.after,
  55167. target: this.break.afterTarget,
  55168. startNew: this.break.startNew.toString()
  55169. });
  55170. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55171. this[_xfa_object.$appendChild](node);
  55172. this.breakAfter.push(node);
  55173. }
  55174. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  55175. const node = new BreakBefore({
  55176. targetType: this.break.before,
  55177. target: this.break.beforeTarget,
  55178. startNew: this.break.startNew.toString()
  55179. });
  55180. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55181. this[_xfa_object.$appendChild](node);
  55182. this.breakBefore.push(node);
  55183. }
  55184. if (this.break.overflowTarget !== "") {
  55185. const node = new Overflow({
  55186. target: this.break.overflowTarget,
  55187. leader: this.break.overflowLeader,
  55188. trailer: this.break.overflowTrailer
  55189. });
  55190. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  55191. this[_xfa_object.$appendChild](node);
  55192. this.overflow.push(node);
  55193. }
  55194. this[_xfa_object.$removeChild](this.break);
  55195. this.break = null;
  55196. }
  55197. if (this.presence === "hidden" || this.presence === "inactive") {
  55198. return _utils.HTMLResult.EMPTY;
  55199. }
  55200. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  55201. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  55202. }
  55203. if (this.breakBefore.children.length >= 1) {
  55204. const breakBefore = this.breakBefore.children[0];
  55205. if (handleBreak(breakBefore)) {
  55206. return _utils.HTMLResult.breakNode(breakBefore);
  55207. }
  55208. }
  55209. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  55210. return _utils.HTMLResult.EMPTY;
  55211. }
  55212. (0, _html_utils.fixDimensions)(this);
  55213. const children = [];
  55214. const attributes = {
  55215. id: this[_xfa_object.$uid],
  55216. class: []
  55217. };
  55218. (0, _html_utils.setAccess)(this, attributes.class);
  55219. if (!this[_xfa_object.$extra]) {
  55220. this[_xfa_object.$extra] = Object.create(null);
  55221. }
  55222. Object.assign(this[_xfa_object.$extra], {
  55223. children,
  55224. line: null,
  55225. attributes,
  55226. attempt: 0,
  55227. numberInLine: 0,
  55228. availableSpace: {
  55229. width: Math.min(this.w || Infinity, availableSpace.width),
  55230. height: Math.min(this.h || Infinity, availableSpace.height)
  55231. },
  55232. width: 0,
  55233. height: 0,
  55234. prevHeight: 0,
  55235. currentWidth: 0
  55236. });
  55237. const root = this[_xfa_object.$getTemplateRoot]();
  55238. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  55239. const isSplittable = this[_xfa_object.$isSplittable]();
  55240. if (!isSplittable) {
  55241. setFirstUnsplittable(this);
  55242. }
  55243. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  55244. return _utils.HTMLResult.FAILURE;
  55245. }
  55246. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  55247. if (this.layout.includes("row")) {
  55248. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  55249. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  55250. this[_xfa_object.$extra].columnWidths = columnWidths;
  55251. this[_xfa_object.$extra].currentColumn = 0;
  55252. }
  55253. }
  55254. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  55255. const classNames = ["xfaSubform"];
  55256. const cl = (0, _html_utils.layoutClass)(this);
  55257. if (cl) {
  55258. classNames.push(cl);
  55259. }
  55260. attributes.style = style;
  55261. attributes.class = classNames;
  55262. if (this.name) {
  55263. attributes.xfaName = this.name;
  55264. }
  55265. if (this.overflow) {
  55266. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  55267. if (overflowExtra.addLeader) {
  55268. overflowExtra.addLeader = false;
  55269. handleOverflow(this, overflowExtra.leader, availableSpace);
  55270. }
  55271. }
  55272. this[_xfa_object.$pushPara]();
  55273. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  55274. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  55275. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  55276. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  55277. this[_xfa_object.$extra].numberInLine = 0;
  55278. }
  55279. const result = this[_xfa_object.$childrenToHTML]({
  55280. filter,
  55281. include: true
  55282. });
  55283. if (result.success) {
  55284. break;
  55285. }
  55286. if (result.isBreak()) {
  55287. this[_xfa_object.$popPara]();
  55288. return result;
  55289. }
  55290. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  55291. this[_xfa_object.$extra].attempt = maxRun;
  55292. break;
  55293. }
  55294. }
  55295. this[_xfa_object.$popPara]();
  55296. if (!isSplittable) {
  55297. unsetFirstUnsplittable(this);
  55298. }
  55299. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  55300. if (this[_xfa_object.$extra].attempt === maxRun) {
  55301. if (this.overflow) {
  55302. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  55303. }
  55304. if (!isSplittable) {
  55305. delete this[_xfa_object.$extra];
  55306. }
  55307. return _utils.HTMLResult.FAILURE;
  55308. }
  55309. if (this.overflow) {
  55310. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  55311. if (overflowExtra.addTrailer) {
  55312. overflowExtra.addTrailer = false;
  55313. handleOverflow(this, overflowExtra.trailer, availableSpace);
  55314. }
  55315. }
  55316. let marginH = 0;
  55317. let marginV = 0;
  55318. if (this.margin) {
  55319. marginH = this.margin.leftInset + this.margin.rightInset;
  55320. marginV = this.margin.topInset + this.margin.bottomInset;
  55321. }
  55322. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  55323. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  55324. const bbox = [this.x, this.y, width, height];
  55325. if (this.w === "") {
  55326. style.width = (0, _html_utils.measureToString)(width);
  55327. }
  55328. if (this.h === "") {
  55329. style.height = (0, _html_utils.measureToString)(height);
  55330. }
  55331. const html = {
  55332. name: "div",
  55333. attributes,
  55334. children
  55335. };
  55336. applyAssist(this, attributes);
  55337. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  55338. if (this.breakAfter.children.length >= 1) {
  55339. const breakAfter = this.breakAfter.children[0];
  55340. if (handleBreak(breakAfter)) {
  55341. this[_xfa_object.$extra].afterBreakAfter = result;
  55342. return _utils.HTMLResult.breakNode(breakAfter);
  55343. }
  55344. }
  55345. delete this[_xfa_object.$extra];
  55346. return result;
  55347. }
  55348. }
  55349. class SubformSet extends _xfa_object.XFAObject {
  55350. constructor(attributes) {
  55351. super(TEMPLATE_NS_ID, "subformSet", true);
  55352. this.id = attributes.id || "";
  55353. this.name = attributes.name || "";
  55354. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  55355. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55356. this.use = attributes.use || "";
  55357. this.usehref = attributes.usehref || "";
  55358. this.bookend = null;
  55359. this.break = null;
  55360. this.desc = null;
  55361. this.extras = null;
  55362. this.occur = null;
  55363. this.overflow = null;
  55364. this.breakAfter = new _xfa_object.XFAObjectArray();
  55365. this.breakBefore = new _xfa_object.XFAObjectArray();
  55366. this.subform = new _xfa_object.XFAObjectArray();
  55367. this.subformSet = new _xfa_object.XFAObjectArray();
  55368. }
  55369. *[_xfa_object.$getContainedChildren]() {
  55370. yield* getContainedChildren(this);
  55371. }
  55372. [_xfa_object.$getSubformParent]() {
  55373. let parent = this[_xfa_object.$getParent]();
  55374. while (!(parent instanceof Subform)) {
  55375. parent = parent[_xfa_object.$getParent]();
  55376. }
  55377. return parent;
  55378. }
  55379. [_xfa_object.$isBindable]() {
  55380. return true;
  55381. }
  55382. }
  55383. class SubjectDN extends _xfa_object.ContentObject {
  55384. constructor(attributes) {
  55385. super(TEMPLATE_NS_ID, "subjectDN");
  55386. this.delimiter = attributes.delimiter || ",";
  55387. this.id = attributes.id || "";
  55388. this.name = attributes.name || "";
  55389. this.use = attributes.use || "";
  55390. this.usehref = attributes.usehref || "";
  55391. }
  55392. [_xfa_object.$finalize]() {
  55393. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  55394. kv = kv.split("=", 2);
  55395. kv[0] = kv[0].trim();
  55396. return kv;
  55397. }));
  55398. }
  55399. }
  55400. class SubjectDNs extends _xfa_object.XFAObject {
  55401. constructor(attributes) {
  55402. super(TEMPLATE_NS_ID, "subjectDNs", true);
  55403. this.id = attributes.id || "";
  55404. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55405. this.use = attributes.use || "";
  55406. this.usehref = attributes.usehref || "";
  55407. this.subjectDN = new _xfa_object.XFAObjectArray();
  55408. }
  55409. }
  55410. class Submit extends _xfa_object.XFAObject {
  55411. constructor(attributes) {
  55412. super(TEMPLATE_NS_ID, "submit", true);
  55413. this.embedPDF = (0, _utils.getInteger)({
  55414. data: attributes.embedPDF,
  55415. defaultValue: 0,
  55416. validate: x => x === 1
  55417. });
  55418. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  55419. this.id = attributes.id || "";
  55420. this.target = attributes.target || "";
  55421. this.textEncoding = (0, _utils.getKeyword)({
  55422. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  55423. defaultValue: "",
  55424. 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-\d{2}/)
  55425. });
  55426. this.use = attributes.use || "";
  55427. this.usehref = attributes.usehref || "";
  55428. this.xdpContent = attributes.xdpContent || "";
  55429. this.encrypt = null;
  55430. this.encryptData = new _xfa_object.XFAObjectArray();
  55431. this.signData = new _xfa_object.XFAObjectArray();
  55432. }
  55433. }
  55434. class Template extends _xfa_object.XFAObject {
  55435. constructor(attributes) {
  55436. super(TEMPLATE_NS_ID, "template", true);
  55437. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  55438. this.extras = null;
  55439. this.subform = new _xfa_object.XFAObjectArray();
  55440. }
  55441. [_xfa_object.$finalize]() {
  55442. if (this.subform.children.length === 0) {
  55443. (0, _util.warn)("XFA - No subforms in template node.");
  55444. }
  55445. if (this.subform.children.length >= 2) {
  55446. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  55447. }
  55448. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  55449. }
  55450. [_xfa_object.$isSplittable]() {
  55451. return true;
  55452. }
  55453. [_xfa_object.$searchNode](expr, container) {
  55454. if (expr.startsWith("#")) {
  55455. return [this[_xfa_object.$ids].get(expr.slice(1))];
  55456. }
  55457. return (0, _som.searchNode)(this, container, expr, true, true);
  55458. }
  55459. [_xfa_object.$toHTML]() {
  55460. if (!this.subform.children.length) {
  55461. return _utils.HTMLResult.success({
  55462. name: "div",
  55463. children: []
  55464. });
  55465. }
  55466. this[_xfa_object.$extra] = {
  55467. overflowNode: null,
  55468. firstUnsplittable: null,
  55469. currentContentArea: null,
  55470. currentPageArea: null,
  55471. noLayoutFailure: false,
  55472. pageNumber: 1,
  55473. pagePosition: "first",
  55474. oddOrEven: "odd",
  55475. blankOrNotBlank: "nonBlank",
  55476. paraStack: []
  55477. };
  55478. const root = this.subform.children[0];
  55479. root.pageSet[_xfa_object.$cleanPage]();
  55480. const pageAreas = root.pageSet.pageArea.children;
  55481. const mainHtml = {
  55482. name: "div",
  55483. children: []
  55484. };
  55485. let pageArea = null;
  55486. let breakBefore = null;
  55487. let breakBeforeTarget = null;
  55488. if (root.breakBefore.children.length >= 1) {
  55489. breakBefore = root.breakBefore.children[0];
  55490. breakBeforeTarget = breakBefore.target;
  55491. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  55492. breakBefore = root.subform.children[0].breakBefore.children[0];
  55493. breakBeforeTarget = breakBefore.target;
  55494. } else if (root.break && root.break.beforeTarget) {
  55495. breakBefore = root.break;
  55496. breakBeforeTarget = breakBefore.beforeTarget;
  55497. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  55498. breakBefore = root.subform.children[0].break;
  55499. breakBeforeTarget = breakBefore.beforeTarget;
  55500. }
  55501. if (breakBefore) {
  55502. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  55503. if (target instanceof PageArea) {
  55504. pageArea = target;
  55505. breakBefore[_xfa_object.$extra] = {};
  55506. }
  55507. }
  55508. if (!pageArea) {
  55509. pageArea = pageAreas[0];
  55510. }
  55511. pageArea[_xfa_object.$extra] = {
  55512. numberOfUse: 1
  55513. };
  55514. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  55515. pageAreaParent[_xfa_object.$extra] = {
  55516. numberOfUse: 1,
  55517. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  55518. pageSetIndex: 0
  55519. };
  55520. let targetPageArea;
  55521. let leader = null;
  55522. let trailer = null;
  55523. let hasSomething = true;
  55524. let hasSomethingCounter = 0;
  55525. let startIndex = 0;
  55526. while (true) {
  55527. if (!hasSomething) {
  55528. mainHtml.children.pop();
  55529. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  55530. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  55531. return mainHtml;
  55532. }
  55533. } else {
  55534. hasSomethingCounter = 0;
  55535. }
  55536. targetPageArea = null;
  55537. this[_xfa_object.$extra].currentPageArea = pageArea;
  55538. const page = pageArea[_xfa_object.$toHTML]().html;
  55539. mainHtml.children.push(page);
  55540. if (leader) {
  55541. this[_xfa_object.$extra].noLayoutFailure = true;
  55542. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  55543. leader = null;
  55544. }
  55545. if (trailer) {
  55546. this[_xfa_object.$extra].noLayoutFailure = true;
  55547. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  55548. trailer = null;
  55549. }
  55550. const contentAreas = pageArea.contentArea.children;
  55551. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  55552. hasSomething = false;
  55553. this[_xfa_object.$extra].firstUnsplittable = null;
  55554. this[_xfa_object.$extra].noLayoutFailure = false;
  55555. const flush = index => {
  55556. const html = root[_xfa_object.$flushHTML]();
  55557. if (html) {
  55558. hasSomething = hasSomething || html.children && html.children.length !== 0;
  55559. htmlContentAreas[index].children.push(html);
  55560. }
  55561. };
  55562. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  55563. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  55564. const space = {
  55565. width: contentArea.w,
  55566. height: contentArea.h
  55567. };
  55568. startIndex = 0;
  55569. if (leader) {
  55570. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  55571. leader = null;
  55572. }
  55573. if (trailer) {
  55574. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  55575. trailer = null;
  55576. }
  55577. const html = root[_xfa_object.$toHTML](space);
  55578. if (html.success) {
  55579. if (html.html) {
  55580. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  55581. htmlContentAreas[i].children.push(html.html);
  55582. } else if (!hasSomething) {
  55583. mainHtml.children.pop();
  55584. }
  55585. return mainHtml;
  55586. }
  55587. if (html.isBreak()) {
  55588. const node = html.breakNode;
  55589. flush(i);
  55590. if (node.targetType === "auto") {
  55591. continue;
  55592. }
  55593. if (node.leader) {
  55594. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  55595. leader = leader ? leader[0] : null;
  55596. }
  55597. if (node.trailer) {
  55598. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  55599. trailer = trailer ? trailer[0] : null;
  55600. }
  55601. if (node.targetType === "pageArea") {
  55602. targetPageArea = node[_xfa_object.$extra].target;
  55603. i = Infinity;
  55604. } else if (!node[_xfa_object.$extra].target) {
  55605. i = node[_xfa_object.$extra].index;
  55606. } else {
  55607. targetPageArea = node[_xfa_object.$extra].target;
  55608. startIndex = node[_xfa_object.$extra].index + 1;
  55609. i = Infinity;
  55610. }
  55611. continue;
  55612. }
  55613. if (this[_xfa_object.$extra].overflowNode) {
  55614. const node = this[_xfa_object.$extra].overflowNode;
  55615. this[_xfa_object.$extra].overflowNode = null;
  55616. const overflowExtra = node[_xfa_object.$getExtra]();
  55617. const target = overflowExtra.target;
  55618. overflowExtra.addLeader = overflowExtra.leader !== null;
  55619. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  55620. flush(i);
  55621. const currentIndex = i;
  55622. i = Infinity;
  55623. if (target instanceof PageArea) {
  55624. targetPageArea = target;
  55625. } else if (target instanceof ContentArea) {
  55626. const index = contentAreas.findIndex(e => e === target);
  55627. if (index !== -1) {
  55628. if (index > currentIndex) {
  55629. i = index - 1;
  55630. } else {
  55631. startIndex = index;
  55632. }
  55633. } else {
  55634. targetPageArea = target[_xfa_object.$getParent]();
  55635. startIndex = targetPageArea.contentArea.children.findIndex(e => e === target);
  55636. }
  55637. }
  55638. continue;
  55639. }
  55640. flush(i);
  55641. }
  55642. this[_xfa_object.$extra].pageNumber += 1;
  55643. if (targetPageArea) {
  55644. if (targetPageArea[_xfa_object.$isUsable]()) {
  55645. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  55646. } else {
  55647. targetPageArea = null;
  55648. }
  55649. }
  55650. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  55651. }
  55652. }
  55653. }
  55654. exports.Template = Template;
  55655. class Text extends _xfa_object.ContentObject {
  55656. constructor(attributes) {
  55657. super(TEMPLATE_NS_ID, "text");
  55658. this.id = attributes.id || "";
  55659. this.maxChars = (0, _utils.getInteger)({
  55660. data: attributes.maxChars,
  55661. defaultValue: 0,
  55662. validate: x => x >= 0
  55663. });
  55664. this.name = attributes.name || "";
  55665. this.rid = attributes.rid || "";
  55666. this.use = attributes.use || "";
  55667. this.usehref = attributes.usehref || "";
  55668. }
  55669. [_xfa_object.$acceptWhitespace]() {
  55670. return true;
  55671. }
  55672. [_xfa_object.$onChild](child) {
  55673. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  55674. this[_xfa_object.$content] = child;
  55675. return true;
  55676. }
  55677. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  55678. return false;
  55679. }
  55680. [_xfa_object.$onText](str) {
  55681. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  55682. return;
  55683. }
  55684. super[_xfa_object.$onText](str);
  55685. }
  55686. [_xfa_object.$finalize]() {
  55687. if (typeof this[_xfa_object.$content] === "string") {
  55688. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  55689. }
  55690. }
  55691. [_xfa_object.$getExtra]() {
  55692. if (typeof this[_xfa_object.$content] === "string") {
  55693. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  55694. if (line) {
  55695. acc.push(line);
  55696. }
  55697. return acc;
  55698. }, []).join("\n");
  55699. }
  55700. return this[_xfa_object.$content][_xfa_object.$text]();
  55701. }
  55702. [_xfa_object.$toHTML](availableSpace) {
  55703. if (typeof this[_xfa_object.$content] === "string") {
  55704. const html = valueToHtml(this[_xfa_object.$content]).html;
  55705. if (this[_xfa_object.$content].includes("\u2029")) {
  55706. html.name = "div";
  55707. html.children = [];
  55708. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  55709. acc.push({
  55710. name: "span",
  55711. value: line
  55712. }, {
  55713. name: "br"
  55714. });
  55715. return acc;
  55716. }, [])).forEach(lines => {
  55717. html.children.push({
  55718. name: "p",
  55719. children: lines
  55720. });
  55721. });
  55722. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  55723. html.name = "div";
  55724. html.children = [];
  55725. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  55726. html.children.push({
  55727. name: "span",
  55728. value: line
  55729. }, {
  55730. name: "br"
  55731. });
  55732. });
  55733. }
  55734. return _utils.HTMLResult.success(html);
  55735. }
  55736. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  55737. }
  55738. }
  55739. exports.Text = Text;
  55740. class TextEdit extends _xfa_object.XFAObject {
  55741. constructor(attributes) {
  55742. super(TEMPLATE_NS_ID, "textEdit", true);
  55743. this.allowRichText = (0, _utils.getInteger)({
  55744. data: attributes.allowRichText,
  55745. defaultValue: 0,
  55746. validate: x => x === 1
  55747. });
  55748. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  55749. this.id = attributes.id || "";
  55750. this.multiLine = (0, _utils.getInteger)({
  55751. data: attributes.multiLine,
  55752. defaultValue: "",
  55753. validate: x => x === 0 || x === 1
  55754. });
  55755. this.use = attributes.use || "";
  55756. this.usehref = attributes.usehref || "";
  55757. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  55758. this.border = null;
  55759. this.comb = null;
  55760. this.extras = null;
  55761. this.margin = null;
  55762. }
  55763. [_xfa_object.$toHTML](availableSpace) {
  55764. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  55765. let html;
  55766. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55767. if (this.multiLine === "") {
  55768. this.multiLine = field instanceof Draw ? 1 : 0;
  55769. }
  55770. if (this.multiLine === 1) {
  55771. html = {
  55772. name: "textarea",
  55773. attributes: {
  55774. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  55775. fieldId: field[_xfa_object.$uid],
  55776. class: ["xfaTextfield"],
  55777. style,
  55778. "aria-label": ariaLabel(field)
  55779. }
  55780. };
  55781. } else {
  55782. html = {
  55783. name: "input",
  55784. attributes: {
  55785. type: "text",
  55786. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  55787. fieldId: field[_xfa_object.$uid],
  55788. class: ["xfaTextfield"],
  55789. style,
  55790. "aria-label": ariaLabel(field)
  55791. }
  55792. };
  55793. }
  55794. return _utils.HTMLResult.success({
  55795. name: "label",
  55796. attributes: {
  55797. class: ["xfaLabel"]
  55798. },
  55799. children: [html]
  55800. });
  55801. }
  55802. }
  55803. class Time extends _xfa_object.StringObject {
  55804. constructor(attributes) {
  55805. super(TEMPLATE_NS_ID, "time");
  55806. this.id = attributes.id || "";
  55807. this.name = attributes.name || "";
  55808. this.use = attributes.use || "";
  55809. this.usehref = attributes.usehref || "";
  55810. }
  55811. [_xfa_object.$finalize]() {
  55812. const date = this[_xfa_object.$content].trim();
  55813. this[_xfa_object.$content] = date ? new Date(date) : null;
  55814. }
  55815. [_xfa_object.$toHTML](availableSpace) {
  55816. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  55817. }
  55818. }
  55819. class TimeStamp extends _xfa_object.XFAObject {
  55820. constructor(attributes) {
  55821. super(TEMPLATE_NS_ID, "timeStamp");
  55822. this.id = attributes.id || "";
  55823. this.server = attributes.server || "";
  55824. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55825. this.use = attributes.use || "";
  55826. this.usehref = attributes.usehref || "";
  55827. }
  55828. }
  55829. class ToolTip extends _xfa_object.StringObject {
  55830. constructor(attributes) {
  55831. super(TEMPLATE_NS_ID, "toolTip");
  55832. this.id = attributes.id || "";
  55833. this.rid = attributes.rid || "";
  55834. this.use = attributes.use || "";
  55835. this.usehref = attributes.usehref || "";
  55836. }
  55837. }
  55838. class Traversal extends _xfa_object.XFAObject {
  55839. constructor(attributes) {
  55840. super(TEMPLATE_NS_ID, "traversal", true);
  55841. this.id = attributes.id || "";
  55842. this.use = attributes.use || "";
  55843. this.usehref = attributes.usehref || "";
  55844. this.extras = null;
  55845. this.traverse = new _xfa_object.XFAObjectArray();
  55846. }
  55847. }
  55848. class Traverse extends _xfa_object.XFAObject {
  55849. constructor(attributes) {
  55850. super(TEMPLATE_NS_ID, "traverse", true);
  55851. this.id = attributes.id || "";
  55852. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  55853. this.ref = attributes.ref || "";
  55854. this.use = attributes.use || "";
  55855. this.usehref = attributes.usehref || "";
  55856. this.extras = null;
  55857. this.script = null;
  55858. }
  55859. get name() {
  55860. return this.operation;
  55861. }
  55862. [_xfa_object.$isTransparent]() {
  55863. return false;
  55864. }
  55865. }
  55866. class Ui extends _xfa_object.XFAObject {
  55867. constructor(attributes) {
  55868. super(TEMPLATE_NS_ID, "ui", true);
  55869. this.id = attributes.id || "";
  55870. this.use = attributes.use || "";
  55871. this.usehref = attributes.usehref || "";
  55872. this.extras = null;
  55873. this.picture = null;
  55874. this.barcode = null;
  55875. this.button = null;
  55876. this.checkButton = null;
  55877. this.choiceList = null;
  55878. this.dateTimeEdit = null;
  55879. this.defaultUi = null;
  55880. this.imageEdit = null;
  55881. this.numericEdit = null;
  55882. this.passwordEdit = null;
  55883. this.signature = null;
  55884. this.textEdit = null;
  55885. }
  55886. [_xfa_object.$getExtra]() {
  55887. if (this[_xfa_object.$extra] === undefined) {
  55888. for (const name of Object.getOwnPropertyNames(this)) {
  55889. if (name === "extras" || name === "picture") {
  55890. continue;
  55891. }
  55892. const obj = this[name];
  55893. if (!(obj instanceof _xfa_object.XFAObject)) {
  55894. continue;
  55895. }
  55896. this[_xfa_object.$extra] = obj;
  55897. return obj;
  55898. }
  55899. this[_xfa_object.$extra] = null;
  55900. }
  55901. return this[_xfa_object.$extra];
  55902. }
  55903. [_xfa_object.$toHTML](availableSpace) {
  55904. const obj = this[_xfa_object.$getExtra]();
  55905. if (obj) {
  55906. return obj[_xfa_object.$toHTML](availableSpace);
  55907. }
  55908. return _utils.HTMLResult.EMPTY;
  55909. }
  55910. }
  55911. class Validate extends _xfa_object.XFAObject {
  55912. constructor(attributes) {
  55913. super(TEMPLATE_NS_ID, "validate", true);
  55914. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  55915. this.id = attributes.id || "";
  55916. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  55917. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  55918. this.use = attributes.use || "";
  55919. this.usehref = attributes.usehref || "";
  55920. this.extras = null;
  55921. this.message = null;
  55922. this.picture = null;
  55923. this.script = null;
  55924. }
  55925. }
  55926. class Value extends _xfa_object.XFAObject {
  55927. constructor(attributes) {
  55928. super(TEMPLATE_NS_ID, "value", true);
  55929. this.id = attributes.id || "";
  55930. this.override = (0, _utils.getInteger)({
  55931. data: attributes.override,
  55932. defaultValue: 0,
  55933. validate: x => x === 1
  55934. });
  55935. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55936. this.use = attributes.use || "";
  55937. this.usehref = attributes.usehref || "";
  55938. this.arc = null;
  55939. this.boolean = null;
  55940. this.date = null;
  55941. this.dateTime = null;
  55942. this.decimal = null;
  55943. this.exData = null;
  55944. this.float = null;
  55945. this.image = null;
  55946. this.integer = null;
  55947. this.line = null;
  55948. this.rectangle = null;
  55949. this.text = null;
  55950. this.time = null;
  55951. }
  55952. [_xfa_object.$setValue](value) {
  55953. const parent = this[_xfa_object.$getParent]();
  55954. if (parent instanceof Field) {
  55955. if (parent.ui && parent.ui.imageEdit) {
  55956. if (!this.image) {
  55957. this.image = new Image({});
  55958. this[_xfa_object.$appendChild](this.image);
  55959. }
  55960. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  55961. return;
  55962. }
  55963. }
  55964. const valueName = value[_xfa_object.$nodeName];
  55965. if (this[valueName] !== null) {
  55966. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  55967. return;
  55968. }
  55969. for (const name of Object.getOwnPropertyNames(this)) {
  55970. const obj = this[name];
  55971. if (obj instanceof _xfa_object.XFAObject) {
  55972. this[name] = null;
  55973. this[_xfa_object.$removeChild](obj);
  55974. }
  55975. }
  55976. this[value[_xfa_object.$nodeName]] = value;
  55977. this[_xfa_object.$appendChild](value);
  55978. }
  55979. [_xfa_object.$text]() {
  55980. if (this.exData) {
  55981. if (typeof this.exData[_xfa_object.$content] === "string") {
  55982. return this.exData[_xfa_object.$content].trim();
  55983. }
  55984. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  55985. }
  55986. for (const name of Object.getOwnPropertyNames(this)) {
  55987. if (name === "image") {
  55988. continue;
  55989. }
  55990. const obj = this[name];
  55991. if (obj instanceof _xfa_object.XFAObject) {
  55992. return (obj[_xfa_object.$content] || "").toString().trim();
  55993. }
  55994. }
  55995. return null;
  55996. }
  55997. [_xfa_object.$toHTML](availableSpace) {
  55998. for (const name of Object.getOwnPropertyNames(this)) {
  55999. const obj = this[name];
  56000. if (!(obj instanceof _xfa_object.XFAObject)) {
  56001. continue;
  56002. }
  56003. return obj[_xfa_object.$toHTML](availableSpace);
  56004. }
  56005. return _utils.HTMLResult.EMPTY;
  56006. }
  56007. }
  56008. exports.Value = Value;
  56009. class Variables extends _xfa_object.XFAObject {
  56010. constructor(attributes) {
  56011. super(TEMPLATE_NS_ID, "variables", true);
  56012. this.id = attributes.id || "";
  56013. this.use = attributes.use || "";
  56014. this.usehref = attributes.usehref || "";
  56015. this.boolean = new _xfa_object.XFAObjectArray();
  56016. this.date = new _xfa_object.XFAObjectArray();
  56017. this.dateTime = new _xfa_object.XFAObjectArray();
  56018. this.decimal = new _xfa_object.XFAObjectArray();
  56019. this.exData = new _xfa_object.XFAObjectArray();
  56020. this.float = new _xfa_object.XFAObjectArray();
  56021. this.image = new _xfa_object.XFAObjectArray();
  56022. this.integer = new _xfa_object.XFAObjectArray();
  56023. this.manifest = new _xfa_object.XFAObjectArray();
  56024. this.script = new _xfa_object.XFAObjectArray();
  56025. this.text = new _xfa_object.XFAObjectArray();
  56026. this.time = new _xfa_object.XFAObjectArray();
  56027. }
  56028. [_xfa_object.$isTransparent]() {
  56029. return true;
  56030. }
  56031. }
  56032. class TemplateNamespace {
  56033. static [_namespaces.$buildXFAObject](name, attributes) {
  56034. if (TemplateNamespace.hasOwnProperty(name)) {
  56035. const node = TemplateNamespace[name](attributes);
  56036. node[_xfa_object.$setSetAttributes](attributes);
  56037. return node;
  56038. }
  56039. return undefined;
  56040. }
  56041. static appearanceFilter(attrs) {
  56042. return new AppearanceFilter(attrs);
  56043. }
  56044. static arc(attrs) {
  56045. return new Arc(attrs);
  56046. }
  56047. static area(attrs) {
  56048. return new Area(attrs);
  56049. }
  56050. static assist(attrs) {
  56051. return new Assist(attrs);
  56052. }
  56053. static barcode(attrs) {
  56054. return new Barcode(attrs);
  56055. }
  56056. static bind(attrs) {
  56057. return new Bind(attrs);
  56058. }
  56059. static bindItems(attrs) {
  56060. return new BindItems(attrs);
  56061. }
  56062. static bookend(attrs) {
  56063. return new Bookend(attrs);
  56064. }
  56065. static boolean(attrs) {
  56066. return new BooleanElement(attrs);
  56067. }
  56068. static border(attrs) {
  56069. return new Border(attrs);
  56070. }
  56071. static break(attrs) {
  56072. return new Break(attrs);
  56073. }
  56074. static breakAfter(attrs) {
  56075. return new BreakAfter(attrs);
  56076. }
  56077. static breakBefore(attrs) {
  56078. return new BreakBefore(attrs);
  56079. }
  56080. static button(attrs) {
  56081. return new Button(attrs);
  56082. }
  56083. static calculate(attrs) {
  56084. return new Calculate(attrs);
  56085. }
  56086. static caption(attrs) {
  56087. return new Caption(attrs);
  56088. }
  56089. static certificate(attrs) {
  56090. return new Certificate(attrs);
  56091. }
  56092. static certificates(attrs) {
  56093. return new Certificates(attrs);
  56094. }
  56095. static checkButton(attrs) {
  56096. return new CheckButton(attrs);
  56097. }
  56098. static choiceList(attrs) {
  56099. return new ChoiceList(attrs);
  56100. }
  56101. static color(attrs) {
  56102. return new Color(attrs);
  56103. }
  56104. static comb(attrs) {
  56105. return new Comb(attrs);
  56106. }
  56107. static connect(attrs) {
  56108. return new Connect(attrs);
  56109. }
  56110. static contentArea(attrs) {
  56111. return new ContentArea(attrs);
  56112. }
  56113. static corner(attrs) {
  56114. return new Corner(attrs);
  56115. }
  56116. static date(attrs) {
  56117. return new DateElement(attrs);
  56118. }
  56119. static dateTime(attrs) {
  56120. return new DateTime(attrs);
  56121. }
  56122. static dateTimeEdit(attrs) {
  56123. return new DateTimeEdit(attrs);
  56124. }
  56125. static decimal(attrs) {
  56126. return new Decimal(attrs);
  56127. }
  56128. static defaultUi(attrs) {
  56129. return new DefaultUi(attrs);
  56130. }
  56131. static desc(attrs) {
  56132. return new Desc(attrs);
  56133. }
  56134. static digestMethod(attrs) {
  56135. return new DigestMethod(attrs);
  56136. }
  56137. static digestMethods(attrs) {
  56138. return new DigestMethods(attrs);
  56139. }
  56140. static draw(attrs) {
  56141. return new Draw(attrs);
  56142. }
  56143. static edge(attrs) {
  56144. return new Edge(attrs);
  56145. }
  56146. static encoding(attrs) {
  56147. return new Encoding(attrs);
  56148. }
  56149. static encodings(attrs) {
  56150. return new Encodings(attrs);
  56151. }
  56152. static encrypt(attrs) {
  56153. return new Encrypt(attrs);
  56154. }
  56155. static encryptData(attrs) {
  56156. return new EncryptData(attrs);
  56157. }
  56158. static encryption(attrs) {
  56159. return new Encryption(attrs);
  56160. }
  56161. static encryptionMethod(attrs) {
  56162. return new EncryptionMethod(attrs);
  56163. }
  56164. static encryptionMethods(attrs) {
  56165. return new EncryptionMethods(attrs);
  56166. }
  56167. static event(attrs) {
  56168. return new Event(attrs);
  56169. }
  56170. static exData(attrs) {
  56171. return new ExData(attrs);
  56172. }
  56173. static exObject(attrs) {
  56174. return new ExObject(attrs);
  56175. }
  56176. static exclGroup(attrs) {
  56177. return new ExclGroup(attrs);
  56178. }
  56179. static execute(attrs) {
  56180. return new Execute(attrs);
  56181. }
  56182. static extras(attrs) {
  56183. return new Extras(attrs);
  56184. }
  56185. static field(attrs) {
  56186. return new Field(attrs);
  56187. }
  56188. static fill(attrs) {
  56189. return new Fill(attrs);
  56190. }
  56191. static filter(attrs) {
  56192. return new Filter(attrs);
  56193. }
  56194. static float(attrs) {
  56195. return new Float(attrs);
  56196. }
  56197. static font(attrs) {
  56198. return new Font(attrs);
  56199. }
  56200. static format(attrs) {
  56201. return new Format(attrs);
  56202. }
  56203. static handler(attrs) {
  56204. return new Handler(attrs);
  56205. }
  56206. static hyphenation(attrs) {
  56207. return new Hyphenation(attrs);
  56208. }
  56209. static image(attrs) {
  56210. return new Image(attrs);
  56211. }
  56212. static imageEdit(attrs) {
  56213. return new ImageEdit(attrs);
  56214. }
  56215. static integer(attrs) {
  56216. return new Integer(attrs);
  56217. }
  56218. static issuers(attrs) {
  56219. return new Issuers(attrs);
  56220. }
  56221. static items(attrs) {
  56222. return new Items(attrs);
  56223. }
  56224. static keep(attrs) {
  56225. return new Keep(attrs);
  56226. }
  56227. static keyUsage(attrs) {
  56228. return new KeyUsage(attrs);
  56229. }
  56230. static line(attrs) {
  56231. return new Line(attrs);
  56232. }
  56233. static linear(attrs) {
  56234. return new Linear(attrs);
  56235. }
  56236. static lockDocument(attrs) {
  56237. return new LockDocument(attrs);
  56238. }
  56239. static manifest(attrs) {
  56240. return new Manifest(attrs);
  56241. }
  56242. static margin(attrs) {
  56243. return new Margin(attrs);
  56244. }
  56245. static mdp(attrs) {
  56246. return new Mdp(attrs);
  56247. }
  56248. static medium(attrs) {
  56249. return new Medium(attrs);
  56250. }
  56251. static message(attrs) {
  56252. return new Message(attrs);
  56253. }
  56254. static numericEdit(attrs) {
  56255. return new NumericEdit(attrs);
  56256. }
  56257. static occur(attrs) {
  56258. return new Occur(attrs);
  56259. }
  56260. static oid(attrs) {
  56261. return new Oid(attrs);
  56262. }
  56263. static oids(attrs) {
  56264. return new Oids(attrs);
  56265. }
  56266. static overflow(attrs) {
  56267. return new Overflow(attrs);
  56268. }
  56269. static pageArea(attrs) {
  56270. return new PageArea(attrs);
  56271. }
  56272. static pageSet(attrs) {
  56273. return new PageSet(attrs);
  56274. }
  56275. static para(attrs) {
  56276. return new Para(attrs);
  56277. }
  56278. static passwordEdit(attrs) {
  56279. return new PasswordEdit(attrs);
  56280. }
  56281. static pattern(attrs) {
  56282. return new Pattern(attrs);
  56283. }
  56284. static picture(attrs) {
  56285. return new Picture(attrs);
  56286. }
  56287. static proto(attrs) {
  56288. return new Proto(attrs);
  56289. }
  56290. static radial(attrs) {
  56291. return new Radial(attrs);
  56292. }
  56293. static reason(attrs) {
  56294. return new Reason(attrs);
  56295. }
  56296. static reasons(attrs) {
  56297. return new Reasons(attrs);
  56298. }
  56299. static rectangle(attrs) {
  56300. return new Rectangle(attrs);
  56301. }
  56302. static ref(attrs) {
  56303. return new RefElement(attrs);
  56304. }
  56305. static script(attrs) {
  56306. return new Script(attrs);
  56307. }
  56308. static setProperty(attrs) {
  56309. return new SetProperty(attrs);
  56310. }
  56311. static signData(attrs) {
  56312. return new SignData(attrs);
  56313. }
  56314. static signature(attrs) {
  56315. return new Signature(attrs);
  56316. }
  56317. static signing(attrs) {
  56318. return new Signing(attrs);
  56319. }
  56320. static solid(attrs) {
  56321. return new Solid(attrs);
  56322. }
  56323. static speak(attrs) {
  56324. return new Speak(attrs);
  56325. }
  56326. static stipple(attrs) {
  56327. return new Stipple(attrs);
  56328. }
  56329. static subform(attrs) {
  56330. return new Subform(attrs);
  56331. }
  56332. static subformSet(attrs) {
  56333. return new SubformSet(attrs);
  56334. }
  56335. static subjectDN(attrs) {
  56336. return new SubjectDN(attrs);
  56337. }
  56338. static subjectDNs(attrs) {
  56339. return new SubjectDNs(attrs);
  56340. }
  56341. static submit(attrs) {
  56342. return new Submit(attrs);
  56343. }
  56344. static template(attrs) {
  56345. return new Template(attrs);
  56346. }
  56347. static text(attrs) {
  56348. return new Text(attrs);
  56349. }
  56350. static textEdit(attrs) {
  56351. return new TextEdit(attrs);
  56352. }
  56353. static time(attrs) {
  56354. return new Time(attrs);
  56355. }
  56356. static timeStamp(attrs) {
  56357. return new TimeStamp(attrs);
  56358. }
  56359. static toolTip(attrs) {
  56360. return new ToolTip(attrs);
  56361. }
  56362. static traversal(attrs) {
  56363. return new Traversal(attrs);
  56364. }
  56365. static traverse(attrs) {
  56366. return new Traverse(attrs);
  56367. }
  56368. static ui(attrs) {
  56369. return new Ui(attrs);
  56370. }
  56371. static validate(attrs) {
  56372. return new Validate(attrs);
  56373. }
  56374. static value(attrs) {
  56375. return new Value(attrs);
  56376. }
  56377. static variables(attrs) {
  56378. return new Variables(attrs);
  56379. }
  56380. }
  56381. exports.TemplateNamespace = TemplateNamespace;
  56382. /***/ }),
  56383. /* 81 */
  56384. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56385. Object.defineProperty(exports, "__esModule", ({
  56386. value: true
  56387. }));
  56388. exports.addHTML = addHTML;
  56389. exports.checkDimensions = checkDimensions;
  56390. exports.flushHTML = flushHTML;
  56391. exports.getAvailableSpace = getAvailableSpace;
  56392. var _xfa_object = __w_pdfjs_require__(75);
  56393. var _html_utils = __w_pdfjs_require__(82);
  56394. function createLine(node, children) {
  56395. return {
  56396. name: "div",
  56397. attributes: {
  56398. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  56399. },
  56400. children
  56401. };
  56402. }
  56403. function flushHTML(node) {
  56404. if (!node[_xfa_object.$extra]) {
  56405. return null;
  56406. }
  56407. const attributes = node[_xfa_object.$extra].attributes;
  56408. const html = {
  56409. name: "div",
  56410. attributes,
  56411. children: node[_xfa_object.$extra].children
  56412. };
  56413. if (node[_xfa_object.$extra].failingNode) {
  56414. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  56415. if (htmlFromFailing) {
  56416. if (node.layout.endsWith("-tb")) {
  56417. html.children.push(createLine(node, [htmlFromFailing]));
  56418. } else {
  56419. html.children.push(htmlFromFailing);
  56420. }
  56421. }
  56422. }
  56423. if (html.children.length === 0) {
  56424. return null;
  56425. }
  56426. return html;
  56427. }
  56428. function addHTML(node, html, bbox) {
  56429. const extra = node[_xfa_object.$extra];
  56430. const availableSpace = extra.availableSpace;
  56431. const [x, y, w, h] = bbox;
  56432. switch (node.layout) {
  56433. case "position":
  56434. {
  56435. extra.width = Math.max(extra.width, x + w);
  56436. extra.height = Math.max(extra.height, y + h);
  56437. extra.children.push(html);
  56438. break;
  56439. }
  56440. case "lr-tb":
  56441. case "rl-tb":
  56442. if (!extra.line || extra.attempt === 1) {
  56443. extra.line = createLine(node, []);
  56444. extra.children.push(extra.line);
  56445. extra.numberInLine = 0;
  56446. }
  56447. extra.numberInLine += 1;
  56448. extra.line.children.push(html);
  56449. if (extra.attempt === 0) {
  56450. extra.currentWidth += w;
  56451. extra.height = Math.max(extra.height, extra.prevHeight + h);
  56452. } else {
  56453. extra.currentWidth = w;
  56454. extra.prevHeight = extra.height;
  56455. extra.height += h;
  56456. extra.attempt = 0;
  56457. }
  56458. extra.width = Math.max(extra.width, extra.currentWidth);
  56459. break;
  56460. case "rl-row":
  56461. case "row":
  56462. {
  56463. extra.children.push(html);
  56464. extra.width += w;
  56465. extra.height = Math.max(extra.height, h);
  56466. const height = (0, _html_utils.measureToString)(extra.height);
  56467. for (const child of extra.children) {
  56468. child.attributes.style.height = height;
  56469. }
  56470. break;
  56471. }
  56472. case "table":
  56473. {
  56474. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  56475. extra.height += h;
  56476. extra.children.push(html);
  56477. break;
  56478. }
  56479. case "tb":
  56480. {
  56481. extra.width = availableSpace.width;
  56482. extra.height += h;
  56483. extra.children.push(html);
  56484. break;
  56485. }
  56486. }
  56487. }
  56488. function getAvailableSpace(node) {
  56489. const availableSpace = node[_xfa_object.$extra].availableSpace;
  56490. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  56491. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  56492. switch (node.layout) {
  56493. case "lr-tb":
  56494. case "rl-tb":
  56495. if (node[_xfa_object.$extra].attempt === 0) {
  56496. return {
  56497. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  56498. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  56499. };
  56500. }
  56501. return {
  56502. width: availableSpace.width - marginH,
  56503. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  56504. };
  56505. case "rl-row":
  56506. case "row":
  56507. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  56508. return {
  56509. width,
  56510. height: availableSpace.height - marginH
  56511. };
  56512. case "table":
  56513. case "tb":
  56514. return {
  56515. width: availableSpace.width - marginH,
  56516. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  56517. };
  56518. case "position":
  56519. default:
  56520. return availableSpace;
  56521. }
  56522. }
  56523. function getTransformedBBox(node) {
  56524. let w = node.w === "" ? NaN : node.w;
  56525. let h = node.h === "" ? NaN : node.h;
  56526. let [centerX, centerY] = [0, 0];
  56527. switch (node.anchorType || "") {
  56528. case "bottomCenter":
  56529. [centerX, centerY] = [w / 2, h];
  56530. break;
  56531. case "bottomLeft":
  56532. [centerX, centerY] = [0, h];
  56533. break;
  56534. case "bottomRight":
  56535. [centerX, centerY] = [w, h];
  56536. break;
  56537. case "middleCenter":
  56538. [centerX, centerY] = [w / 2, h / 2];
  56539. break;
  56540. case "middleLeft":
  56541. [centerX, centerY] = [0, h / 2];
  56542. break;
  56543. case "middleRight":
  56544. [centerX, centerY] = [w, h / 2];
  56545. break;
  56546. case "topCenter":
  56547. [centerX, centerY] = [w / 2, 0];
  56548. break;
  56549. case "topRight":
  56550. [centerX, centerY] = [w, 0];
  56551. break;
  56552. }
  56553. let x, y;
  56554. switch (node.rotate || 0) {
  56555. case 0:
  56556. [x, y] = [-centerX, -centerY];
  56557. break;
  56558. case 90:
  56559. [x, y] = [-centerY, centerX];
  56560. [w, h] = [h, -w];
  56561. break;
  56562. case 180:
  56563. [x, y] = [centerX, centerY];
  56564. [w, h] = [-w, -h];
  56565. break;
  56566. case 270:
  56567. [x, y] = [centerY, -centerX];
  56568. [w, h] = [-h, w];
  56569. break;
  56570. }
  56571. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  56572. }
  56573. function checkDimensions(node, space) {
  56574. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  56575. return true;
  56576. }
  56577. if (node.w === 0 || node.h === 0) {
  56578. return true;
  56579. }
  56580. const ERROR = 2;
  56581. const parent = node[_xfa_object.$getSubformParent]();
  56582. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  56583. const [, y, w, h] = getTransformedBBox(node);
  56584. switch (parent.layout) {
  56585. case "lr-tb":
  56586. case "rl-tb":
  56587. if (attempt === 0) {
  56588. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  56589. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  56590. return false;
  56591. }
  56592. if (node.w !== "") {
  56593. if (Math.round(w - space.width) <= ERROR) {
  56594. return true;
  56595. }
  56596. if (parent[_xfa_object.$extra].numberInLine === 0) {
  56597. return space.height > ERROR;
  56598. }
  56599. return false;
  56600. }
  56601. return space.width > ERROR;
  56602. }
  56603. if (node.w !== "") {
  56604. return Math.round(w - space.width) <= ERROR;
  56605. }
  56606. return space.width > ERROR;
  56607. }
  56608. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  56609. return true;
  56610. }
  56611. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  56612. return false;
  56613. }
  56614. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  56615. return space.height > ERROR;
  56616. }
  56617. if (parent[_xfa_object.$isThereMoreWidth]()) {
  56618. return false;
  56619. }
  56620. return space.height > ERROR;
  56621. case "table":
  56622. case "tb":
  56623. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  56624. return true;
  56625. }
  56626. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  56627. return Math.round(h - space.height) <= ERROR;
  56628. }
  56629. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  56630. return space.height > ERROR;
  56631. }
  56632. if (parent[_xfa_object.$isThereMoreWidth]()) {
  56633. return false;
  56634. }
  56635. return space.height > ERROR;
  56636. case "position":
  56637. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  56638. return true;
  56639. }
  56640. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  56641. return true;
  56642. }
  56643. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  56644. return h + y > area.h;
  56645. case "rl-row":
  56646. case "row":
  56647. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  56648. return true;
  56649. }
  56650. if (node.h !== "") {
  56651. return Math.round(h - space.height) <= ERROR;
  56652. }
  56653. return true;
  56654. default:
  56655. return true;
  56656. }
  56657. }
  56658. /***/ }),
  56659. /* 82 */
  56660. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  56661. Object.defineProperty(exports, "__esModule", ({
  56662. value: true
  56663. }));
  56664. exports.computeBbox = computeBbox;
  56665. exports.createWrapper = createWrapper;
  56666. exports.fixDimensions = fixDimensions;
  56667. exports.fixTextIndent = fixTextIndent;
  56668. exports.fixURL = fixURL;
  56669. exports.isPrintOnly = isPrintOnly;
  56670. exports.layoutClass = layoutClass;
  56671. exports.layoutNode = layoutNode;
  56672. exports.measureToString = measureToString;
  56673. exports.setAccess = setAccess;
  56674. exports.setFontFamily = setFontFamily;
  56675. exports.setMinMaxDimensions = setMinMaxDimensions;
  56676. exports.setPara = setPara;
  56677. exports.toStyle = toStyle;
  56678. var _xfa_object = __w_pdfjs_require__(75);
  56679. var _util = __w_pdfjs_require__(2);
  56680. var _utils = __w_pdfjs_require__(76);
  56681. var _fonts = __w_pdfjs_require__(83);
  56682. var _text = __w_pdfjs_require__(84);
  56683. function measureToString(m) {
  56684. if (typeof m === "string") {
  56685. return "0px";
  56686. }
  56687. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  56688. }
  56689. const converters = {
  56690. anchorType(node, style) {
  56691. const parent = node[_xfa_object.$getSubformParent]();
  56692. if (!parent || parent.layout && parent.layout !== "position") {
  56693. return;
  56694. }
  56695. if (!("transform" in style)) {
  56696. style.transform = "";
  56697. }
  56698. switch (node.anchorType) {
  56699. case "bottomCenter":
  56700. style.transform += "translate(-50%, -100%)";
  56701. break;
  56702. case "bottomLeft":
  56703. style.transform += "translate(0,-100%)";
  56704. break;
  56705. case "bottomRight":
  56706. style.transform += "translate(-100%,-100%)";
  56707. break;
  56708. case "middleCenter":
  56709. style.transform += "translate(-50%,-50%)";
  56710. break;
  56711. case "middleLeft":
  56712. style.transform += "translate(0,-50%)";
  56713. break;
  56714. case "middleRight":
  56715. style.transform += "translate(-100%,-50%)";
  56716. break;
  56717. case "topCenter":
  56718. style.transform += "translate(-50%,0)";
  56719. break;
  56720. case "topRight":
  56721. style.transform += "translate(-100%,0)";
  56722. break;
  56723. }
  56724. },
  56725. dimensions(node, style) {
  56726. const parent = node[_xfa_object.$getSubformParent]();
  56727. let width = node.w;
  56728. const height = node.h;
  56729. if (parent.layout && parent.layout.includes("row")) {
  56730. const extra = parent[_xfa_object.$extra];
  56731. const colSpan = node.colSpan;
  56732. let w;
  56733. if (colSpan === -1) {
  56734. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  56735. extra.currentColumn = 0;
  56736. } else {
  56737. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  56738. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  56739. }
  56740. if (!isNaN(w)) {
  56741. width = node.w = w;
  56742. }
  56743. }
  56744. if (width !== "") {
  56745. style.width = measureToString(width);
  56746. } else {
  56747. style.width = "auto";
  56748. }
  56749. if (height !== "") {
  56750. style.height = measureToString(height);
  56751. } else {
  56752. style.height = "auto";
  56753. }
  56754. },
  56755. position(node, style) {
  56756. const parent = node[_xfa_object.$getSubformParent]();
  56757. if (parent && parent.layout && parent.layout !== "position") {
  56758. return;
  56759. }
  56760. style.position = "absolute";
  56761. style.left = measureToString(node.x);
  56762. style.top = measureToString(node.y);
  56763. },
  56764. rotate(node, style) {
  56765. if (node.rotate) {
  56766. if (!("transform" in style)) {
  56767. style.transform = "";
  56768. }
  56769. style.transform += `rotate(-${node.rotate}deg)`;
  56770. style.transformOrigin = "top left";
  56771. }
  56772. },
  56773. presence(node, style) {
  56774. switch (node.presence) {
  56775. case "invisible":
  56776. style.visibility = "hidden";
  56777. break;
  56778. case "hidden":
  56779. case "inactive":
  56780. style.display = "none";
  56781. break;
  56782. }
  56783. },
  56784. hAlign(node, style) {
  56785. if (node[_xfa_object.$nodeName] === "para") {
  56786. switch (node.hAlign) {
  56787. case "justifyAll":
  56788. style.textAlign = "justify-all";
  56789. break;
  56790. case "radix":
  56791. style.textAlign = "left";
  56792. break;
  56793. default:
  56794. style.textAlign = node.hAlign;
  56795. }
  56796. } else {
  56797. switch (node.hAlign) {
  56798. case "left":
  56799. style.alignSelf = "start";
  56800. break;
  56801. case "center":
  56802. style.alignSelf = "center";
  56803. break;
  56804. case "right":
  56805. style.alignSelf = "end";
  56806. break;
  56807. }
  56808. }
  56809. },
  56810. margin(node, style) {
  56811. if (node.margin) {
  56812. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  56813. }
  56814. }
  56815. };
  56816. function setMinMaxDimensions(node, style) {
  56817. const parent = node[_xfa_object.$getSubformParent]();
  56818. if (parent.layout === "position") {
  56819. if (node.minW > 0) {
  56820. style.minWidth = measureToString(node.minW);
  56821. }
  56822. if (node.maxW > 0) {
  56823. style.maxWidth = measureToString(node.maxW);
  56824. }
  56825. if (node.minH > 0) {
  56826. style.minHeight = measureToString(node.minH);
  56827. }
  56828. if (node.maxH > 0) {
  56829. style.maxHeight = measureToString(node.maxH);
  56830. }
  56831. }
  56832. }
  56833. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  56834. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  56835. if (typeof text === "string") {
  56836. measure.addString(text);
  56837. } else {
  56838. text[_xfa_object.$pushGlyphs](measure);
  56839. }
  56840. return measure.compute(width);
  56841. }
  56842. function layoutNode(node, availableSpace) {
  56843. let height = null;
  56844. let width = null;
  56845. let isBroken = false;
  56846. if ((!node.w || !node.h) && node.value) {
  56847. let marginH = 0;
  56848. let marginV = 0;
  56849. if (node.margin) {
  56850. marginH = node.margin.leftInset + node.margin.rightInset;
  56851. marginV = node.margin.topInset + node.margin.bottomInset;
  56852. }
  56853. let lineHeight = null;
  56854. let margin = null;
  56855. if (node.para) {
  56856. margin = Object.create(null);
  56857. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  56858. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  56859. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  56860. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  56861. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  56862. }
  56863. let font = node.font;
  56864. if (!font) {
  56865. const root = node[_xfa_object.$getTemplateRoot]();
  56866. let parent = node[_xfa_object.$getParent]();
  56867. while (parent !== root) {
  56868. if (parent.font) {
  56869. font = parent.font;
  56870. break;
  56871. }
  56872. parent = parent[_xfa_object.$getParent]();
  56873. }
  56874. }
  56875. const maxWidth = (!node.w ? availableSpace.width : node.w) - marginH;
  56876. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  56877. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  56878. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  56879. width = res.width;
  56880. height = res.height;
  56881. isBroken = res.isBroken;
  56882. } else {
  56883. const text = node.value[_xfa_object.$text]();
  56884. if (text) {
  56885. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  56886. width = res.width;
  56887. height = res.height;
  56888. isBroken = res.isBroken;
  56889. }
  56890. }
  56891. if (width !== null && !node.w) {
  56892. width += marginH;
  56893. }
  56894. if (height !== null && !node.h) {
  56895. height += marginV;
  56896. }
  56897. }
  56898. return {
  56899. w: width,
  56900. h: height,
  56901. isBroken
  56902. };
  56903. }
  56904. function computeBbox(node, html, availableSpace) {
  56905. let bbox;
  56906. if (node.w !== "" && node.h !== "") {
  56907. bbox = [node.x, node.y, node.w, node.h];
  56908. } else {
  56909. if (!availableSpace) {
  56910. return null;
  56911. }
  56912. let width = node.w;
  56913. if (width === "") {
  56914. if (node.maxW === 0) {
  56915. const parent = node[_xfa_object.$getSubformParent]();
  56916. if (parent.layout === "position" && parent.w !== "") {
  56917. width = 0;
  56918. } else {
  56919. width = node.minW;
  56920. }
  56921. } else {
  56922. width = Math.min(node.maxW, availableSpace.width);
  56923. }
  56924. html.attributes.style.width = measureToString(width);
  56925. }
  56926. let height = node.h;
  56927. if (height === "") {
  56928. if (node.maxH === 0) {
  56929. const parent = node[_xfa_object.$getSubformParent]();
  56930. if (parent.layout === "position" && parent.h !== "") {
  56931. height = 0;
  56932. } else {
  56933. height = node.minH;
  56934. }
  56935. } else {
  56936. height = Math.min(node.maxH, availableSpace.height);
  56937. }
  56938. html.attributes.style.height = measureToString(height);
  56939. }
  56940. bbox = [node.x, node.y, width, height];
  56941. }
  56942. return bbox;
  56943. }
  56944. function fixDimensions(node) {
  56945. const parent = node[_xfa_object.$getSubformParent]();
  56946. if (parent.layout && parent.layout.includes("row")) {
  56947. const extra = parent[_xfa_object.$extra];
  56948. const colSpan = node.colSpan;
  56949. let width;
  56950. if (colSpan === -1) {
  56951. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  56952. } else {
  56953. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  56954. }
  56955. if (!isNaN(width)) {
  56956. node.w = width;
  56957. }
  56958. }
  56959. if (parent.layout && parent.layout !== "position") {
  56960. node.x = node.y = 0;
  56961. }
  56962. if (node.layout === "table") {
  56963. if (node.w === "" && Array.isArray(node.columnWidths)) {
  56964. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  56965. }
  56966. }
  56967. }
  56968. function layoutClass(node) {
  56969. switch (node.layout) {
  56970. case "position":
  56971. return "xfaPosition";
  56972. case "lr-tb":
  56973. return "xfaLrTb";
  56974. case "rl-row":
  56975. return "xfaRlRow";
  56976. case "rl-tb":
  56977. return "xfaRlTb";
  56978. case "row":
  56979. return "xfaRow";
  56980. case "table":
  56981. return "xfaTable";
  56982. case "tb":
  56983. return "xfaTb";
  56984. default:
  56985. return "xfaPosition";
  56986. }
  56987. }
  56988. function toStyle(node, ...names) {
  56989. const style = Object.create(null);
  56990. for (const name of names) {
  56991. const value = node[name];
  56992. if (value === null) {
  56993. continue;
  56994. }
  56995. if (converters.hasOwnProperty(name)) {
  56996. converters[name](node, style);
  56997. continue;
  56998. }
  56999. if (value instanceof _xfa_object.XFAObject) {
  57000. const newStyle = value[_xfa_object.$toStyle]();
  57001. if (newStyle) {
  57002. Object.assign(style, newStyle);
  57003. } else {
  57004. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  57005. }
  57006. }
  57007. }
  57008. return style;
  57009. }
  57010. function createWrapper(node, html) {
  57011. const {
  57012. attributes
  57013. } = html;
  57014. const {
  57015. style
  57016. } = attributes;
  57017. const wrapper = {
  57018. name: "div",
  57019. attributes: {
  57020. class: ["xfaWrapper"],
  57021. style: Object.create(null)
  57022. },
  57023. children: []
  57024. };
  57025. attributes.class.push("xfaWrapped");
  57026. if (node.border) {
  57027. const {
  57028. widths,
  57029. insets
  57030. } = node.border[_xfa_object.$extra];
  57031. let width, height;
  57032. let top = insets[0];
  57033. let left = insets[3];
  57034. const insetsH = insets[0] + insets[2];
  57035. const insetsW = insets[1] + insets[3];
  57036. switch (node.border.hand) {
  57037. case "even":
  57038. top -= widths[0] / 2;
  57039. left -= widths[3] / 2;
  57040. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  57041. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  57042. break;
  57043. case "left":
  57044. top -= widths[0];
  57045. left -= widths[3];
  57046. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  57047. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  57048. break;
  57049. case "right":
  57050. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  57051. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  57052. break;
  57053. }
  57054. const classNames = ["xfaBorder"];
  57055. if (isPrintOnly(node.border)) {
  57056. classNames.push("xfaPrintOnly");
  57057. }
  57058. const border = {
  57059. name: "div",
  57060. attributes: {
  57061. class: classNames,
  57062. style: {
  57063. top: `${top}px`,
  57064. left: `${left}px`,
  57065. width,
  57066. height
  57067. }
  57068. },
  57069. children: []
  57070. };
  57071. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  57072. if (style[key] !== undefined) {
  57073. border.attributes.style[key] = style[key];
  57074. delete style[key];
  57075. }
  57076. }
  57077. wrapper.children.push(border, html);
  57078. } else {
  57079. wrapper.children.push(html);
  57080. }
  57081. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  57082. if (style[key] !== undefined) {
  57083. wrapper.attributes.style[key] = style[key];
  57084. delete style[key];
  57085. }
  57086. }
  57087. if (style.position === "absolute") {
  57088. wrapper.attributes.style.position = "absolute";
  57089. } else {
  57090. wrapper.attributes.style.position = "relative";
  57091. }
  57092. delete style.position;
  57093. if (style.alignSelf) {
  57094. wrapper.attributes.style.alignSelf = style.alignSelf;
  57095. delete style.alignSelf;
  57096. }
  57097. return wrapper;
  57098. }
  57099. function fixTextIndent(styles) {
  57100. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  57101. if (indent >= 0) {
  57102. return;
  57103. }
  57104. const align = styles.textAlign === "right" ? "right" : "left";
  57105. const name = "padding" + (align === "left" ? "Left" : "Right");
  57106. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  57107. styles[name] = `${padding - indent}px`;
  57108. }
  57109. function setAccess(node, classNames) {
  57110. switch (node.access) {
  57111. case "nonInteractive":
  57112. classNames.push("xfaNonInteractive");
  57113. break;
  57114. case "readOnly":
  57115. classNames.push("xfaReadOnly");
  57116. break;
  57117. case "protected":
  57118. classNames.push("xfaDisabled");
  57119. break;
  57120. }
  57121. }
  57122. function isPrintOnly(node) {
  57123. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  57124. }
  57125. function getCurrentPara(node) {
  57126. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  57127. return stack.length ? stack[stack.length - 1] : null;
  57128. }
  57129. function setPara(node, nodeStyle, value) {
  57130. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  57131. if (nodeStyle) {
  57132. if (node.h === "") {
  57133. nodeStyle.height = "auto";
  57134. }
  57135. if (node.w === "") {
  57136. nodeStyle.width = "auto";
  57137. }
  57138. }
  57139. const para = getCurrentPara(node);
  57140. if (para) {
  57141. const valueStyle = value.attributes.style;
  57142. valueStyle.display = "flex";
  57143. valueStyle.flexDirection = "column";
  57144. switch (para.vAlign) {
  57145. case "top":
  57146. valueStyle.justifyContent = "start";
  57147. break;
  57148. case "bottom":
  57149. valueStyle.justifyContent = "end";
  57150. break;
  57151. case "middle":
  57152. valueStyle.justifyContent = "center";
  57153. break;
  57154. }
  57155. const paraStyle = para[_xfa_object.$toStyle]();
  57156. for (const [key, val] of Object.entries(paraStyle)) {
  57157. if (!(key in valueStyle)) {
  57158. valueStyle[key] = val;
  57159. }
  57160. }
  57161. }
  57162. }
  57163. }
  57164. function setFontFamily(xfaFont, node, fontFinder, style) {
  57165. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  57166. const typeface = fontFinder.find(name);
  57167. style.fontFamily = `"${name}"`;
  57168. if (typeface) {
  57169. const {
  57170. fontFamily
  57171. } = typeface.regular.cssFontInfo;
  57172. if (fontFamily !== name) {
  57173. style.fontFamily = `"${fontFamily}"`;
  57174. }
  57175. const para = getCurrentPara(node);
  57176. if (para && para.lineHeight !== "") {
  57177. return;
  57178. }
  57179. if (style.lineHeight) {
  57180. return;
  57181. }
  57182. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  57183. if (pdfFont) {
  57184. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  57185. }
  57186. }
  57187. }
  57188. function fixURL(str) {
  57189. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  57190. addDefaultProtocol: true,
  57191. tryConvertEncoding: true
  57192. });
  57193. return absoluteUrl ? absoluteUrl.href : null;
  57194. }
  57195. /***/ }),
  57196. /* 83 */
  57197. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57198. Object.defineProperty(exports, "__esModule", ({
  57199. value: true
  57200. }));
  57201. exports.getMetrics = getMetrics;
  57202. exports.selectFont = selectFont;
  57203. exports.FontFinder = void 0;
  57204. var _xfa_object = __w_pdfjs_require__(75);
  57205. var _utils = __w_pdfjs_require__(76);
  57206. var _util = __w_pdfjs_require__(2);
  57207. class FontFinder {
  57208. constructor(pdfFonts) {
  57209. this.fonts = new Map();
  57210. this.cache = new Map();
  57211. this.warned = new Set();
  57212. this.defaultFont = null;
  57213. this.add(pdfFonts);
  57214. }
  57215. add(pdfFonts, reallyMissingFonts = null) {
  57216. for (const pdfFont of pdfFonts) {
  57217. this.addPdfFont(pdfFont);
  57218. }
  57219. for (const pdfFont of this.fonts.values()) {
  57220. if (!pdfFont.regular) {
  57221. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  57222. }
  57223. }
  57224. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  57225. return;
  57226. }
  57227. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  57228. for (const missing of reallyMissingFonts) {
  57229. this.fonts.set(missing, myriad);
  57230. }
  57231. }
  57232. addPdfFont(pdfFont) {
  57233. const cssFontInfo = pdfFont.cssFontInfo;
  57234. const name = cssFontInfo.fontFamily;
  57235. let font = this.fonts.get(name);
  57236. if (!font) {
  57237. font = Object.create(null);
  57238. this.fonts.set(name, font);
  57239. if (!this.defaultFont) {
  57240. this.defaultFont = font;
  57241. }
  57242. }
  57243. let property = "";
  57244. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  57245. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  57246. property = fontWeight >= 700 ? "bolditalic" : "italic";
  57247. } else if (fontWeight >= 700) {
  57248. property = "bold";
  57249. }
  57250. if (!property) {
  57251. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  57252. property = "bold";
  57253. }
  57254. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  57255. property += "italic";
  57256. }
  57257. }
  57258. if (!property) {
  57259. property = "regular";
  57260. }
  57261. font[property] = pdfFont;
  57262. }
  57263. getDefault() {
  57264. return this.defaultFont;
  57265. }
  57266. find(fontName, mustWarn = true) {
  57267. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  57268. if (font) {
  57269. return font;
  57270. }
  57271. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  57272. let name = fontName.replace(pattern, "");
  57273. font = this.fonts.get(name);
  57274. if (font) {
  57275. this.cache.set(fontName, font);
  57276. return font;
  57277. }
  57278. name = name.toLowerCase();
  57279. const maybe = [];
  57280. for (const [family, pdfFont] of this.fonts.entries()) {
  57281. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  57282. maybe.push(pdfFont);
  57283. }
  57284. }
  57285. if (maybe.length === 0) {
  57286. for (const [, pdfFont] of this.fonts.entries()) {
  57287. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  57288. maybe.push(pdfFont);
  57289. }
  57290. }
  57291. }
  57292. if (maybe.length === 0) {
  57293. name = name.replace(/psmt|mt/gi, "");
  57294. for (const [family, pdfFont] of this.fonts.entries()) {
  57295. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  57296. maybe.push(pdfFont);
  57297. }
  57298. }
  57299. }
  57300. if (maybe.length === 0) {
  57301. for (const pdfFont of this.fonts.values()) {
  57302. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  57303. maybe.push(pdfFont);
  57304. }
  57305. }
  57306. }
  57307. if (maybe.length >= 1) {
  57308. if (maybe.length !== 1 && mustWarn) {
  57309. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  57310. }
  57311. this.cache.set(fontName, maybe[0]);
  57312. return maybe[0];
  57313. }
  57314. if (mustWarn && !this.warned.has(fontName)) {
  57315. this.warned.add(fontName);
  57316. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  57317. }
  57318. return null;
  57319. }
  57320. }
  57321. exports.FontFinder = FontFinder;
  57322. function selectFont(xfaFont, typeface) {
  57323. if (xfaFont.posture === "italic") {
  57324. if (xfaFont.weight === "bold") {
  57325. return typeface.bolditalic;
  57326. }
  57327. return typeface.italic;
  57328. } else if (xfaFont.weight === "bold") {
  57329. return typeface.bold;
  57330. }
  57331. return typeface.regular;
  57332. }
  57333. function getMetrics(xfaFont, real = false) {
  57334. let pdfFont = null;
  57335. if (xfaFont) {
  57336. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  57337. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  57338. pdfFont = selectFont(xfaFont, typeface);
  57339. }
  57340. if (!pdfFont) {
  57341. return {
  57342. lineHeight: 12,
  57343. lineGap: 2,
  57344. lineNoGap: 10
  57345. };
  57346. }
  57347. const size = xfaFont.size || 10;
  57348. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  57349. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  57350. return {
  57351. lineHeight: lineHeight * size,
  57352. lineGap: lineGap * size,
  57353. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  57354. };
  57355. }
  57356. /***/ }),
  57357. /* 84 */
  57358. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57359. Object.defineProperty(exports, "__esModule", ({
  57360. value: true
  57361. }));
  57362. exports.TextMeasure = void 0;
  57363. var _fonts = __w_pdfjs_require__(83);
  57364. const WIDTH_FACTOR = 1.02;
  57365. class FontInfo {
  57366. constructor(xfaFont, margin, lineHeight, fontFinder) {
  57367. this.lineHeight = lineHeight;
  57368. this.paraMargin = margin || {
  57369. top: 0,
  57370. bottom: 0,
  57371. left: 0,
  57372. right: 0
  57373. };
  57374. if (!xfaFont) {
  57375. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  57376. return;
  57377. }
  57378. this.xfaFont = {
  57379. typeface: xfaFont.typeface,
  57380. posture: xfaFont.posture,
  57381. weight: xfaFont.weight,
  57382. size: xfaFont.size,
  57383. letterSpacing: xfaFont.letterSpacing
  57384. };
  57385. const typeface = fontFinder.find(xfaFont.typeface);
  57386. if (!typeface) {
  57387. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  57388. return;
  57389. }
  57390. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  57391. if (!this.pdfFont) {
  57392. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  57393. }
  57394. }
  57395. defaultFont(fontFinder) {
  57396. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  57397. if (font && font.regular) {
  57398. const pdfFont = font.regular;
  57399. const info = pdfFont.cssFontInfo;
  57400. const xfaFont = {
  57401. typeface: info.fontFamily,
  57402. posture: "normal",
  57403. weight: "normal",
  57404. size: 10,
  57405. letterSpacing: 0
  57406. };
  57407. return [pdfFont, xfaFont];
  57408. }
  57409. const xfaFont = {
  57410. typeface: "Courier",
  57411. posture: "normal",
  57412. weight: "normal",
  57413. size: 10,
  57414. letterSpacing: 0
  57415. };
  57416. return [null, xfaFont];
  57417. }
  57418. }
  57419. class FontSelector {
  57420. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  57421. this.fontFinder = fontFinder;
  57422. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  57423. }
  57424. pushData(xfaFont, margin, lineHeight) {
  57425. const lastFont = this.stack[this.stack.length - 1];
  57426. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  57427. if (!xfaFont[name]) {
  57428. xfaFont[name] = lastFont.xfaFont[name];
  57429. }
  57430. }
  57431. for (const name of ["top", "bottom", "left", "right"]) {
  57432. if (isNaN(margin[name])) {
  57433. margin[name] = lastFont.paraMargin[name];
  57434. }
  57435. }
  57436. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  57437. if (!fontInfo.pdfFont) {
  57438. fontInfo.pdfFont = lastFont.pdfFont;
  57439. }
  57440. this.stack.push(fontInfo);
  57441. }
  57442. popFont() {
  57443. this.stack.pop();
  57444. }
  57445. topFont() {
  57446. return this.stack[this.stack.length - 1];
  57447. }
  57448. }
  57449. class TextMeasure {
  57450. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  57451. this.glyphs = [];
  57452. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  57453. this.extraHeight = 0;
  57454. }
  57455. pushData(xfaFont, margin, lineHeight) {
  57456. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  57457. }
  57458. popFont(xfaFont) {
  57459. return this.fontSelector.popFont();
  57460. }
  57461. addPara() {
  57462. const lastFont = this.fontSelector.topFont();
  57463. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  57464. }
  57465. addString(str) {
  57466. if (!str) {
  57467. return;
  57468. }
  57469. const lastFont = this.fontSelector.topFont();
  57470. const fontSize = lastFont.xfaFont.size;
  57471. if (lastFont.pdfFont) {
  57472. const letterSpacing = lastFont.xfaFont.letterSpacing;
  57473. const pdfFont = lastFont.pdfFont;
  57474. const fontLineHeight = pdfFont.lineHeight || 1.2;
  57475. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  57476. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  57477. const noGap = fontLineHeight - lineGap;
  57478. const firstLineHeight = Math.max(1, noGap) * fontSize;
  57479. const scale = fontSize / 1000;
  57480. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  57481. for (const line of str.split(/[\u2029\n]/)) {
  57482. const encodedLine = pdfFont.encodeString(line).join("");
  57483. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  57484. for (const glyph of glyphs) {
  57485. const width = glyph.width || fallbackWidth;
  57486. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  57487. }
  57488. this.glyphs.push([0, 0, 0, "\n", true]);
  57489. }
  57490. this.glyphs.pop();
  57491. return;
  57492. }
  57493. for (const line of str.split(/[\u2029\n]/)) {
  57494. for (const char of line.split("")) {
  57495. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  57496. }
  57497. this.glyphs.push([0, 0, 0, "\n", true]);
  57498. }
  57499. this.glyphs.pop();
  57500. }
  57501. compute(maxWidth) {
  57502. let lastSpacePos = -1,
  57503. lastSpaceWidth = 0,
  57504. width = 0,
  57505. height = 0,
  57506. currentLineWidth = 0,
  57507. currentLineHeight = 0;
  57508. let isBroken = false;
  57509. let isFirstLine = true;
  57510. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  57511. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  57512. const isSpace = char === " ";
  57513. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  57514. if (isEOL) {
  57515. width = Math.max(width, currentLineWidth);
  57516. currentLineWidth = 0;
  57517. height += currentLineHeight;
  57518. currentLineHeight = glyphHeight;
  57519. lastSpacePos = -1;
  57520. lastSpaceWidth = 0;
  57521. isFirstLine = false;
  57522. continue;
  57523. }
  57524. if (isSpace) {
  57525. if (currentLineWidth + glyphWidth > maxWidth) {
  57526. width = Math.max(width, currentLineWidth);
  57527. currentLineWidth = 0;
  57528. height += currentLineHeight;
  57529. currentLineHeight = glyphHeight;
  57530. lastSpacePos = -1;
  57531. lastSpaceWidth = 0;
  57532. isBroken = true;
  57533. isFirstLine = false;
  57534. } else {
  57535. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  57536. lastSpaceWidth = currentLineWidth;
  57537. currentLineWidth += glyphWidth;
  57538. lastSpacePos = i;
  57539. }
  57540. continue;
  57541. }
  57542. if (currentLineWidth + glyphWidth > maxWidth) {
  57543. height += currentLineHeight;
  57544. currentLineHeight = glyphHeight;
  57545. if (lastSpacePos !== -1) {
  57546. i = lastSpacePos;
  57547. width = Math.max(width, lastSpaceWidth);
  57548. currentLineWidth = 0;
  57549. lastSpacePos = -1;
  57550. lastSpaceWidth = 0;
  57551. } else {
  57552. width = Math.max(width, currentLineWidth);
  57553. currentLineWidth = glyphWidth;
  57554. }
  57555. isBroken = true;
  57556. isFirstLine = false;
  57557. continue;
  57558. }
  57559. currentLineWidth += glyphWidth;
  57560. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  57561. }
  57562. width = Math.max(width, currentLineWidth);
  57563. height += currentLineHeight + this.extraHeight;
  57564. return {
  57565. width: WIDTH_FACTOR * width,
  57566. height,
  57567. isBroken
  57568. };
  57569. }
  57570. }
  57571. exports.TextMeasure = TextMeasure;
  57572. /***/ }),
  57573. /* 85 */
  57574. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57575. Object.defineProperty(exports, "__esModule", ({
  57576. value: true
  57577. }));
  57578. exports.DataHandler = void 0;
  57579. var _xfa_object = __w_pdfjs_require__(75);
  57580. class DataHandler {
  57581. constructor(root, data) {
  57582. this.data = data;
  57583. this.dataset = root.datasets || null;
  57584. }
  57585. serialize(storage) {
  57586. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  57587. while (stack.length > 0) {
  57588. const last = stack[stack.length - 1];
  57589. const [i, children] = last;
  57590. if (i + 1 === children.length) {
  57591. stack.pop();
  57592. continue;
  57593. }
  57594. const child = children[++last[0]];
  57595. const storageEntry = storage.get(child[_xfa_object.$uid]);
  57596. if (storageEntry) {
  57597. child[_xfa_object.$setValue](storageEntry);
  57598. } else {
  57599. const attributes = child[_xfa_object.$getAttributes]();
  57600. for (const value of attributes.values()) {
  57601. const entry = storage.get(value[_xfa_object.$uid]);
  57602. if (entry) {
  57603. value[_xfa_object.$setValue](entry);
  57604. break;
  57605. }
  57606. }
  57607. }
  57608. const nodes = child[_xfa_object.$getChildren]();
  57609. if (nodes.length > 0) {
  57610. stack.push([-1, nodes]);
  57611. }
  57612. }
  57613. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  57614. if (this.dataset) {
  57615. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  57616. if (child[_xfa_object.$nodeName] !== "data") {
  57617. child[_xfa_object.$toString](buf);
  57618. }
  57619. }
  57620. }
  57621. this.data[_xfa_object.$toString](buf);
  57622. buf.push("</xfa:datasets>");
  57623. return buf.join("");
  57624. }
  57625. }
  57626. exports.DataHandler = DataHandler;
  57627. /***/ }),
  57628. /* 86 */
  57629. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57630. Object.defineProperty(exports, "__esModule", ({
  57631. value: true
  57632. }));
  57633. exports.XFAParser = void 0;
  57634. var _xfa_object = __w_pdfjs_require__(75);
  57635. var _xml_parser = __w_pdfjs_require__(68);
  57636. var _builder = __w_pdfjs_require__(87);
  57637. var _util = __w_pdfjs_require__(2);
  57638. class XFAParser extends _xml_parser.XMLParserBase {
  57639. constructor() {
  57640. super();
  57641. this._builder = new _builder.Builder();
  57642. this._stack = [];
  57643. this._globalData = {
  57644. usedTypefaces: new Set()
  57645. };
  57646. this._ids = new Map();
  57647. this._current = this._builder.buildRoot(this._ids);
  57648. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  57649. this._whiteRegex = /^\s+$/;
  57650. this._nbsps = /\xa0+/g;
  57651. }
  57652. parse(data) {
  57653. this.parseXml(data);
  57654. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  57655. return undefined;
  57656. }
  57657. this._current[_xfa_object.$finalize]();
  57658. return this._current.element;
  57659. }
  57660. onText(text) {
  57661. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  57662. if (this._current[_xfa_object.$acceptWhitespace]()) {
  57663. this._current[_xfa_object.$onText](text);
  57664. return;
  57665. }
  57666. if (this._whiteRegex.test(text)) {
  57667. return;
  57668. }
  57669. this._current[_xfa_object.$onText](text.trim());
  57670. }
  57671. onCdata(text) {
  57672. this._current[_xfa_object.$onText](text);
  57673. }
  57674. _mkAttributes(attributes, tagName) {
  57675. let namespace = null;
  57676. let prefixes = null;
  57677. const attributeObj = Object.create({});
  57678. for (const {
  57679. name,
  57680. value
  57681. } of attributes) {
  57682. if (name === "xmlns") {
  57683. if (!namespace) {
  57684. namespace = value;
  57685. } else {
  57686. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  57687. }
  57688. } else if (name.startsWith("xmlns:")) {
  57689. const prefix = name.substring("xmlns:".length);
  57690. if (!prefixes) {
  57691. prefixes = [];
  57692. }
  57693. prefixes.push({
  57694. prefix,
  57695. value
  57696. });
  57697. } else {
  57698. const i = name.indexOf(":");
  57699. if (i === -1) {
  57700. attributeObj[name] = value;
  57701. } else {
  57702. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  57703. if (!nsAttrs) {
  57704. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  57705. }
  57706. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  57707. let attrs = nsAttrs[ns];
  57708. if (!attrs) {
  57709. attrs = nsAttrs[ns] = Object.create(null);
  57710. }
  57711. attrs[attrName] = value;
  57712. }
  57713. }
  57714. }
  57715. return [namespace, prefixes, attributeObj];
  57716. }
  57717. _getNameAndPrefix(name, nsAgnostic) {
  57718. const i = name.indexOf(":");
  57719. if (i === -1) {
  57720. return [name, null];
  57721. }
  57722. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  57723. }
  57724. onBeginElement(tagName, attributes, isEmpty) {
  57725. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  57726. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  57727. const node = this._builder.build({
  57728. nsPrefix,
  57729. name,
  57730. attributes: attributesObj,
  57731. namespace,
  57732. prefixes
  57733. });
  57734. node[_xfa_object.$globalData] = this._globalData;
  57735. if (isEmpty) {
  57736. node[_xfa_object.$finalize]();
  57737. if (this._current[_xfa_object.$onChild](node)) {
  57738. node[_xfa_object.$setId](this._ids);
  57739. }
  57740. node[_xfa_object.$clean](this._builder);
  57741. return;
  57742. }
  57743. this._stack.push(this._current);
  57744. this._current = node;
  57745. }
  57746. onEndElement(name) {
  57747. const node = this._current;
  57748. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  57749. const parser = new XFAParser();
  57750. parser._globalData = this._globalData;
  57751. const root = parser.parse(node[_xfa_object.$content]);
  57752. node[_xfa_object.$content] = null;
  57753. node[_xfa_object.$onChild](root);
  57754. }
  57755. node[_xfa_object.$finalize]();
  57756. this._current = this._stack.pop();
  57757. if (this._current[_xfa_object.$onChild](node)) {
  57758. node[_xfa_object.$setId](this._ids);
  57759. }
  57760. node[_xfa_object.$clean](this._builder);
  57761. }
  57762. onError(code) {
  57763. this._errorCode = code;
  57764. }
  57765. }
  57766. exports.XFAParser = XFAParser;
  57767. /***/ }),
  57768. /* 87 */
  57769. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57770. Object.defineProperty(exports, "__esModule", ({
  57771. value: true
  57772. }));
  57773. exports.Builder = void 0;
  57774. var _namespaces = __w_pdfjs_require__(77);
  57775. var _xfa_object = __w_pdfjs_require__(75);
  57776. var _setup = __w_pdfjs_require__(88);
  57777. var _template = __w_pdfjs_require__(80);
  57778. var _unknown = __w_pdfjs_require__(97);
  57779. var _util = __w_pdfjs_require__(2);
  57780. class Root extends _xfa_object.XFAObject {
  57781. constructor(ids) {
  57782. super(-1, "root", Object.create(null));
  57783. this.element = null;
  57784. this[_xfa_object.$ids] = ids;
  57785. }
  57786. [_xfa_object.$onChild](child) {
  57787. this.element = child;
  57788. return true;
  57789. }
  57790. [_xfa_object.$finalize]() {
  57791. super[_xfa_object.$finalize]();
  57792. if (this.element.template instanceof _template.Template) {
  57793. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  57794. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  57795. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  57796. }
  57797. }
  57798. }
  57799. class Empty extends _xfa_object.XFAObject {
  57800. constructor() {
  57801. super(-1, "", Object.create(null));
  57802. }
  57803. [_xfa_object.$onChild](_) {
  57804. return false;
  57805. }
  57806. }
  57807. class Builder {
  57808. constructor() {
  57809. this._namespaceStack = [];
  57810. this._nsAgnosticLevel = 0;
  57811. this._namespacePrefixes = new Map();
  57812. this._namespaces = new Map();
  57813. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  57814. id
  57815. }) => id));
  57816. this._currentNamespace = new _unknown.UnknownNamespace(++this._nextNsId);
  57817. }
  57818. buildRoot(ids) {
  57819. return new Root(ids);
  57820. }
  57821. build({
  57822. nsPrefix,
  57823. name,
  57824. attributes,
  57825. namespace,
  57826. prefixes
  57827. }) {
  57828. const hasNamespaceDef = namespace !== null;
  57829. if (hasNamespaceDef) {
  57830. this._namespaceStack.push(this._currentNamespace);
  57831. this._currentNamespace = this._searchNamespace(namespace);
  57832. }
  57833. if (prefixes) {
  57834. this._addNamespacePrefix(prefixes);
  57835. }
  57836. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  57837. const dataTemplate = _setup.NamespaceSetUp.datasets;
  57838. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  57839. let xfaAttrs = null;
  57840. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  57841. const nsToUse = this._getNamespaceToUse(ns);
  57842. if (nsToUse === dataTemplate) {
  57843. xfaAttrs = {
  57844. xfa: attrs
  57845. };
  57846. break;
  57847. }
  57848. }
  57849. if (xfaAttrs) {
  57850. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  57851. } else {
  57852. delete attributes[_xfa_object.$nsAttributes];
  57853. }
  57854. }
  57855. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  57856. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  57857. if (node[_xfa_object.$isNsAgnostic]()) {
  57858. this._nsAgnosticLevel++;
  57859. }
  57860. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  57861. node[_xfa_object.$cleanup] = {
  57862. hasNamespace: hasNamespaceDef,
  57863. prefixes,
  57864. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  57865. };
  57866. }
  57867. return node;
  57868. }
  57869. isNsAgnostic() {
  57870. return this._nsAgnosticLevel > 0;
  57871. }
  57872. _searchNamespace(nsName) {
  57873. let ns = this._namespaces.get(nsName);
  57874. if (ns) {
  57875. return ns;
  57876. }
  57877. for (const [name, {
  57878. check
  57879. }] of Object.entries(_namespaces.NamespaceIds)) {
  57880. if (check(nsName)) {
  57881. ns = _setup.NamespaceSetUp[name];
  57882. if (ns) {
  57883. this._namespaces.set(nsName, ns);
  57884. return ns;
  57885. }
  57886. break;
  57887. }
  57888. }
  57889. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  57890. this._namespaces.set(nsName, ns);
  57891. return ns;
  57892. }
  57893. _addNamespacePrefix(prefixes) {
  57894. for (const {
  57895. prefix,
  57896. value
  57897. } of prefixes) {
  57898. const namespace = this._searchNamespace(value);
  57899. let prefixStack = this._namespacePrefixes.get(prefix);
  57900. if (!prefixStack) {
  57901. prefixStack = [];
  57902. this._namespacePrefixes.set(prefix, prefixStack);
  57903. }
  57904. prefixStack.push(namespace);
  57905. }
  57906. }
  57907. _getNamespaceToUse(prefix) {
  57908. if (!prefix) {
  57909. return this._currentNamespace;
  57910. }
  57911. const prefixStack = this._namespacePrefixes.get(prefix);
  57912. if (prefixStack && prefixStack.length > 0) {
  57913. return prefixStack[prefixStack.length - 1];
  57914. }
  57915. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  57916. return null;
  57917. }
  57918. clean(data) {
  57919. const {
  57920. hasNamespace,
  57921. prefixes,
  57922. nsAgnostic
  57923. } = data;
  57924. if (hasNamespace) {
  57925. this._currentNamespace = this._namespaceStack.pop();
  57926. }
  57927. if (prefixes) {
  57928. prefixes.forEach(({
  57929. prefix
  57930. }) => {
  57931. this._namespacePrefixes.get(prefix).pop();
  57932. });
  57933. }
  57934. if (nsAgnostic) {
  57935. this._nsAgnosticLevel--;
  57936. }
  57937. }
  57938. }
  57939. exports.Builder = Builder;
  57940. /***/ }),
  57941. /* 88 */
  57942. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57943. Object.defineProperty(exports, "__esModule", ({
  57944. value: true
  57945. }));
  57946. exports.NamespaceSetUp = void 0;
  57947. var _config = __w_pdfjs_require__(89);
  57948. var _connection_set = __w_pdfjs_require__(90);
  57949. var _datasets = __w_pdfjs_require__(91);
  57950. var _locale_set = __w_pdfjs_require__(92);
  57951. var _signature = __w_pdfjs_require__(93);
  57952. var _stylesheet = __w_pdfjs_require__(94);
  57953. var _template = __w_pdfjs_require__(80);
  57954. var _xdp = __w_pdfjs_require__(95);
  57955. var _xhtml = __w_pdfjs_require__(96);
  57956. const NamespaceSetUp = {
  57957. config: _config.ConfigNamespace,
  57958. connection: _connection_set.ConnectionSetNamespace,
  57959. datasets: _datasets.DatasetsNamespace,
  57960. localeSet: _locale_set.LocaleSetNamespace,
  57961. signature: _signature.SignatureNamespace,
  57962. stylesheet: _stylesheet.StylesheetNamespace,
  57963. template: _template.TemplateNamespace,
  57964. xdp: _xdp.XdpNamespace,
  57965. xhtml: _xhtml.XhtmlNamespace
  57966. };
  57967. exports.NamespaceSetUp = NamespaceSetUp;
  57968. /***/ }),
  57969. /* 89 */
  57970. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57971. Object.defineProperty(exports, "__esModule", ({
  57972. value: true
  57973. }));
  57974. exports.ConfigNamespace = void 0;
  57975. var _namespaces = __w_pdfjs_require__(77);
  57976. var _xfa_object = __w_pdfjs_require__(75);
  57977. var _utils = __w_pdfjs_require__(76);
  57978. var _util = __w_pdfjs_require__(2);
  57979. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  57980. class Acrobat extends _xfa_object.XFAObject {
  57981. constructor(attributes) {
  57982. super(CONFIG_NS_ID, "acrobat", true);
  57983. this.acrobat7 = null;
  57984. this.autoSave = null;
  57985. this.common = null;
  57986. this.validate = null;
  57987. this.validateApprovalSignatures = null;
  57988. this.submitUrl = new _xfa_object.XFAObjectArray();
  57989. }
  57990. }
  57991. class Acrobat7 extends _xfa_object.XFAObject {
  57992. constructor(attributes) {
  57993. super(CONFIG_NS_ID, "acrobat7", true);
  57994. this.dynamicRender = null;
  57995. }
  57996. }
  57997. class ADBE_JSConsole extends _xfa_object.OptionObject {
  57998. constructor(attributes) {
  57999. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  58000. }
  58001. }
  58002. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  58003. constructor(attributes) {
  58004. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  58005. }
  58006. }
  58007. class AddSilentPrint extends _xfa_object.Option01 {
  58008. constructor(attributes) {
  58009. super(CONFIG_NS_ID, "addSilentPrint");
  58010. }
  58011. }
  58012. class AddViewerPreferences extends _xfa_object.Option01 {
  58013. constructor(attributes) {
  58014. super(CONFIG_NS_ID, "addViewerPreferences");
  58015. }
  58016. }
  58017. class AdjustData extends _xfa_object.Option10 {
  58018. constructor(attributes) {
  58019. super(CONFIG_NS_ID, "adjustData");
  58020. }
  58021. }
  58022. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  58023. constructor(attributes) {
  58024. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  58025. }
  58026. }
  58027. class Agent extends _xfa_object.XFAObject {
  58028. constructor(attributes) {
  58029. super(CONFIG_NS_ID, "agent", true);
  58030. this.name = attributes.name ? attributes.name.trim() : "";
  58031. this.common = new _xfa_object.XFAObjectArray();
  58032. }
  58033. }
  58034. class AlwaysEmbed extends _xfa_object.ContentObject {
  58035. constructor(attributes) {
  58036. super(CONFIG_NS_ID, "alwaysEmbed");
  58037. }
  58038. }
  58039. class Amd extends _xfa_object.StringObject {
  58040. constructor(attributes) {
  58041. super(CONFIG_NS_ID, "amd");
  58042. }
  58043. }
  58044. class Area extends _xfa_object.XFAObject {
  58045. constructor(attributes) {
  58046. super(CONFIG_NS_ID, "area");
  58047. this.level = (0, _utils.getInteger)({
  58048. data: attributes.level,
  58049. defaultValue: 0,
  58050. validate: n => n >= 1 && n <= 3
  58051. });
  58052. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  58053. }
  58054. }
  58055. class Attributes extends _xfa_object.OptionObject {
  58056. constructor(attributes) {
  58057. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  58058. }
  58059. }
  58060. class AutoSave extends _xfa_object.OptionObject {
  58061. constructor(attributes) {
  58062. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  58063. }
  58064. }
  58065. class Base extends _xfa_object.StringObject {
  58066. constructor(attributes) {
  58067. super(CONFIG_NS_ID, "base");
  58068. }
  58069. }
  58070. class BatchOutput extends _xfa_object.XFAObject {
  58071. constructor(attributes) {
  58072. super(CONFIG_NS_ID, "batchOutput");
  58073. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  58074. }
  58075. }
  58076. class BehaviorOverride extends _xfa_object.ContentObject {
  58077. constructor(attributes) {
  58078. super(CONFIG_NS_ID, "behaviorOverride");
  58079. }
  58080. [_xfa_object.$finalize]() {
  58081. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  58082. }
  58083. }
  58084. class Cache extends _xfa_object.XFAObject {
  58085. constructor(attributes) {
  58086. super(CONFIG_NS_ID, "cache", true);
  58087. this.templateCache = null;
  58088. }
  58089. }
  58090. class Change extends _xfa_object.Option01 {
  58091. constructor(attributes) {
  58092. super(CONFIG_NS_ID, "change");
  58093. }
  58094. }
  58095. class Common extends _xfa_object.XFAObject {
  58096. constructor(attributes) {
  58097. super(CONFIG_NS_ID, "common", true);
  58098. this.data = null;
  58099. this.locale = null;
  58100. this.localeSet = null;
  58101. this.messaging = null;
  58102. this.suppressBanner = null;
  58103. this.template = null;
  58104. this.validationMessaging = null;
  58105. this.versionControl = null;
  58106. this.log = new _xfa_object.XFAObjectArray();
  58107. }
  58108. }
  58109. class Compress extends _xfa_object.XFAObject {
  58110. constructor(attributes) {
  58111. super(CONFIG_NS_ID, "compress");
  58112. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  58113. }
  58114. }
  58115. class CompressLogicalStructure extends _xfa_object.Option01 {
  58116. constructor(attributes) {
  58117. super(CONFIG_NS_ID, "compressLogicalStructure");
  58118. }
  58119. }
  58120. class CompressObjectStream extends _xfa_object.Option10 {
  58121. constructor(attributes) {
  58122. super(CONFIG_NS_ID, "compressObjectStream");
  58123. }
  58124. }
  58125. class Compression extends _xfa_object.XFAObject {
  58126. constructor(attributes) {
  58127. super(CONFIG_NS_ID, "compression", true);
  58128. this.compressLogicalStructure = null;
  58129. this.compressObjectStream = null;
  58130. this.level = null;
  58131. this.type = null;
  58132. }
  58133. }
  58134. class Config extends _xfa_object.XFAObject {
  58135. constructor(attributes) {
  58136. super(CONFIG_NS_ID, "config", true);
  58137. this.acrobat = null;
  58138. this.present = null;
  58139. this.trace = null;
  58140. this.agent = new _xfa_object.XFAObjectArray();
  58141. }
  58142. }
  58143. class Conformance extends _xfa_object.OptionObject {
  58144. constructor(attributes) {
  58145. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  58146. }
  58147. }
  58148. class ContentCopy extends _xfa_object.Option01 {
  58149. constructor(attributes) {
  58150. super(CONFIG_NS_ID, "contentCopy");
  58151. }
  58152. }
  58153. class Copies extends _xfa_object.IntegerObject {
  58154. constructor(attributes) {
  58155. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  58156. }
  58157. }
  58158. class Creator extends _xfa_object.StringObject {
  58159. constructor(attributes) {
  58160. super(CONFIG_NS_ID, "creator");
  58161. }
  58162. }
  58163. class CurrentPage extends _xfa_object.IntegerObject {
  58164. constructor(attributes) {
  58165. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  58166. }
  58167. }
  58168. class Data extends _xfa_object.XFAObject {
  58169. constructor(attributes) {
  58170. super(CONFIG_NS_ID, "data", true);
  58171. this.adjustData = null;
  58172. this.attributes = null;
  58173. this.incrementalLoad = null;
  58174. this.outputXSL = null;
  58175. this.range = null;
  58176. this.record = null;
  58177. this.startNode = null;
  58178. this.uri = null;
  58179. this.window = null;
  58180. this.xsl = null;
  58181. this.excludeNS = new _xfa_object.XFAObjectArray();
  58182. this.transform = new _xfa_object.XFAObjectArray();
  58183. }
  58184. }
  58185. class Debug extends _xfa_object.XFAObject {
  58186. constructor(attributes) {
  58187. super(CONFIG_NS_ID, "debug", true);
  58188. this.uri = null;
  58189. }
  58190. }
  58191. class DefaultTypeface extends _xfa_object.ContentObject {
  58192. constructor(attributes) {
  58193. super(CONFIG_NS_ID, "defaultTypeface");
  58194. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  58195. }
  58196. }
  58197. class Destination extends _xfa_object.OptionObject {
  58198. constructor(attributes) {
  58199. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  58200. }
  58201. }
  58202. class DocumentAssembly extends _xfa_object.Option01 {
  58203. constructor(attributes) {
  58204. super(CONFIG_NS_ID, "documentAssembly");
  58205. }
  58206. }
  58207. class Driver extends _xfa_object.XFAObject {
  58208. constructor(attributes) {
  58209. super(CONFIG_NS_ID, "driver", true);
  58210. this.name = attributes.name ? attributes.name.trim() : "";
  58211. this.fontInfo = null;
  58212. this.xdc = null;
  58213. }
  58214. }
  58215. class DuplexOption extends _xfa_object.OptionObject {
  58216. constructor(attributes) {
  58217. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  58218. }
  58219. }
  58220. class DynamicRender extends _xfa_object.OptionObject {
  58221. constructor(attributes) {
  58222. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  58223. }
  58224. }
  58225. class Embed extends _xfa_object.Option01 {
  58226. constructor(attributes) {
  58227. super(CONFIG_NS_ID, "embed");
  58228. }
  58229. }
  58230. class Encrypt extends _xfa_object.Option01 {
  58231. constructor(attributes) {
  58232. super(CONFIG_NS_ID, "encrypt");
  58233. }
  58234. }
  58235. class Encryption extends _xfa_object.XFAObject {
  58236. constructor(attributes) {
  58237. super(CONFIG_NS_ID, "encryption", true);
  58238. this.encrypt = null;
  58239. this.encryptionLevel = null;
  58240. this.permissions = null;
  58241. }
  58242. }
  58243. class EncryptionLevel extends _xfa_object.OptionObject {
  58244. constructor(attributes) {
  58245. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  58246. }
  58247. }
  58248. class Enforce extends _xfa_object.StringObject {
  58249. constructor(attributes) {
  58250. super(CONFIG_NS_ID, "enforce");
  58251. }
  58252. }
  58253. class Equate extends _xfa_object.XFAObject {
  58254. constructor(attributes) {
  58255. super(CONFIG_NS_ID, "equate");
  58256. this.force = (0, _utils.getInteger)({
  58257. data: attributes.force,
  58258. defaultValue: 1,
  58259. validate: n => n === 0
  58260. });
  58261. this.from = attributes.from || "";
  58262. this.to = attributes.to || "";
  58263. }
  58264. }
  58265. class EquateRange extends _xfa_object.XFAObject {
  58266. constructor(attributes) {
  58267. super(CONFIG_NS_ID, "equateRange");
  58268. this.from = attributes.from || "";
  58269. this.to = attributes.to || "";
  58270. this._unicodeRange = attributes.unicodeRange || "";
  58271. }
  58272. get unicodeRange() {
  58273. const ranges = [];
  58274. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  58275. const unicodeRange = this._unicodeRange;
  58276. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  58277. range = range.split("-", 2).map(x => {
  58278. const found = x.match(unicodeRegex);
  58279. if (!found) {
  58280. return 0;
  58281. }
  58282. return parseInt(found[1], 16);
  58283. });
  58284. if (range.length === 1) {
  58285. range.push(range[0]);
  58286. }
  58287. ranges.push(range);
  58288. }
  58289. return (0, _util.shadow)(this, "unicodeRange", ranges);
  58290. }
  58291. }
  58292. class Exclude extends _xfa_object.ContentObject {
  58293. constructor(attributes) {
  58294. super(CONFIG_NS_ID, "exclude");
  58295. }
  58296. [_xfa_object.$finalize]() {
  58297. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  58298. }
  58299. }
  58300. class ExcludeNS extends _xfa_object.StringObject {
  58301. constructor(attributes) {
  58302. super(CONFIG_NS_ID, "excludeNS");
  58303. }
  58304. }
  58305. class FlipLabel extends _xfa_object.OptionObject {
  58306. constructor(attributes) {
  58307. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  58308. }
  58309. }
  58310. class FontInfo extends _xfa_object.XFAObject {
  58311. constructor(attributes) {
  58312. super(CONFIG_NS_ID, "fontInfo", true);
  58313. this.embed = null;
  58314. this.map = null;
  58315. this.subsetBelow = null;
  58316. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  58317. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  58318. this.neverEmbed = new _xfa_object.XFAObjectArray();
  58319. }
  58320. }
  58321. class FormFieldFilling extends _xfa_object.Option01 {
  58322. constructor(attributes) {
  58323. super(CONFIG_NS_ID, "formFieldFilling");
  58324. }
  58325. }
  58326. class GroupParent extends _xfa_object.StringObject {
  58327. constructor(attributes) {
  58328. super(CONFIG_NS_ID, "groupParent");
  58329. }
  58330. }
  58331. class IfEmpty extends _xfa_object.OptionObject {
  58332. constructor(attributes) {
  58333. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  58334. }
  58335. }
  58336. class IncludeXDPContent extends _xfa_object.StringObject {
  58337. constructor(attributes) {
  58338. super(CONFIG_NS_ID, "includeXDPContent");
  58339. }
  58340. }
  58341. class IncrementalLoad extends _xfa_object.OptionObject {
  58342. constructor(attributes) {
  58343. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  58344. }
  58345. }
  58346. class IncrementalMerge extends _xfa_object.Option01 {
  58347. constructor(attributes) {
  58348. super(CONFIG_NS_ID, "incrementalMerge");
  58349. }
  58350. }
  58351. class Interactive extends _xfa_object.Option01 {
  58352. constructor(attributes) {
  58353. super(CONFIG_NS_ID, "interactive");
  58354. }
  58355. }
  58356. class Jog extends _xfa_object.OptionObject {
  58357. constructor(attributes) {
  58358. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  58359. }
  58360. }
  58361. class LabelPrinter extends _xfa_object.XFAObject {
  58362. constructor(attributes) {
  58363. super(CONFIG_NS_ID, "labelPrinter", true);
  58364. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  58365. this.batchOutput = null;
  58366. this.flipLabel = null;
  58367. this.fontInfo = null;
  58368. this.xdc = null;
  58369. }
  58370. }
  58371. class Layout extends _xfa_object.OptionObject {
  58372. constructor(attributes) {
  58373. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  58374. }
  58375. }
  58376. class Level extends _xfa_object.IntegerObject {
  58377. constructor(attributes) {
  58378. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  58379. }
  58380. }
  58381. class Linearized extends _xfa_object.Option01 {
  58382. constructor(attributes) {
  58383. super(CONFIG_NS_ID, "linearized");
  58384. }
  58385. }
  58386. class Locale extends _xfa_object.StringObject {
  58387. constructor(attributes) {
  58388. super(CONFIG_NS_ID, "locale");
  58389. }
  58390. }
  58391. class LocaleSet extends _xfa_object.StringObject {
  58392. constructor(attributes) {
  58393. super(CONFIG_NS_ID, "localeSet");
  58394. }
  58395. }
  58396. class Log extends _xfa_object.XFAObject {
  58397. constructor(attributes) {
  58398. super(CONFIG_NS_ID, "log", true);
  58399. this.mode = null;
  58400. this.threshold = null;
  58401. this.to = null;
  58402. this.uri = null;
  58403. }
  58404. }
  58405. class MapElement extends _xfa_object.XFAObject {
  58406. constructor(attributes) {
  58407. super(CONFIG_NS_ID, "map", true);
  58408. this.equate = new _xfa_object.XFAObjectArray();
  58409. this.equateRange = new _xfa_object.XFAObjectArray();
  58410. }
  58411. }
  58412. class MediumInfo extends _xfa_object.XFAObject {
  58413. constructor(attributes) {
  58414. super(CONFIG_NS_ID, "mediumInfo", true);
  58415. this.map = null;
  58416. }
  58417. }
  58418. class Message extends _xfa_object.XFAObject {
  58419. constructor(attributes) {
  58420. super(CONFIG_NS_ID, "message", true);
  58421. this.msgId = null;
  58422. this.severity = null;
  58423. }
  58424. }
  58425. class Messaging extends _xfa_object.XFAObject {
  58426. constructor(attributes) {
  58427. super(CONFIG_NS_ID, "messaging", true);
  58428. this.message = new _xfa_object.XFAObjectArray();
  58429. }
  58430. }
  58431. class Mode extends _xfa_object.OptionObject {
  58432. constructor(attributes) {
  58433. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  58434. }
  58435. }
  58436. class ModifyAnnots extends _xfa_object.Option01 {
  58437. constructor(attributes) {
  58438. super(CONFIG_NS_ID, "modifyAnnots");
  58439. }
  58440. }
  58441. class MsgId extends _xfa_object.IntegerObject {
  58442. constructor(attributes) {
  58443. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  58444. }
  58445. }
  58446. class NameAttr extends _xfa_object.StringObject {
  58447. constructor(attributes) {
  58448. super(CONFIG_NS_ID, "nameAttr");
  58449. }
  58450. }
  58451. class NeverEmbed extends _xfa_object.ContentObject {
  58452. constructor(attributes) {
  58453. super(CONFIG_NS_ID, "neverEmbed");
  58454. }
  58455. }
  58456. class NumberOfCopies extends _xfa_object.IntegerObject {
  58457. constructor(attributes) {
  58458. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  58459. }
  58460. }
  58461. class OpenAction extends _xfa_object.XFAObject {
  58462. constructor(attributes) {
  58463. super(CONFIG_NS_ID, "openAction", true);
  58464. this.destination = null;
  58465. }
  58466. }
  58467. class Output extends _xfa_object.XFAObject {
  58468. constructor(attributes) {
  58469. super(CONFIG_NS_ID, "output", true);
  58470. this.to = null;
  58471. this.type = null;
  58472. this.uri = null;
  58473. }
  58474. }
  58475. class OutputBin extends _xfa_object.StringObject {
  58476. constructor(attributes) {
  58477. super(CONFIG_NS_ID, "outputBin");
  58478. }
  58479. }
  58480. class OutputXSL extends _xfa_object.XFAObject {
  58481. constructor(attributes) {
  58482. super(CONFIG_NS_ID, "outputXSL", true);
  58483. this.uri = null;
  58484. }
  58485. }
  58486. class Overprint extends _xfa_object.OptionObject {
  58487. constructor(attributes) {
  58488. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  58489. }
  58490. }
  58491. class Packets extends _xfa_object.StringObject {
  58492. constructor(attributes) {
  58493. super(CONFIG_NS_ID, "packets");
  58494. }
  58495. [_xfa_object.$finalize]() {
  58496. if (this[_xfa_object.$content] === "*") {
  58497. return;
  58498. }
  58499. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  58500. }
  58501. }
  58502. class PageOffset extends _xfa_object.XFAObject {
  58503. constructor(attributes) {
  58504. super(CONFIG_NS_ID, "pageOffset");
  58505. this.x = (0, _utils.getInteger)({
  58506. data: attributes.x,
  58507. defaultValue: "useXDCSetting",
  58508. validate: n => true
  58509. });
  58510. this.y = (0, _utils.getInteger)({
  58511. data: attributes.y,
  58512. defaultValue: "useXDCSetting",
  58513. validate: n => true
  58514. });
  58515. }
  58516. }
  58517. class PageRange extends _xfa_object.StringObject {
  58518. constructor(attributes) {
  58519. super(CONFIG_NS_ID, "pageRange");
  58520. }
  58521. [_xfa_object.$finalize]() {
  58522. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  58523. const ranges = [];
  58524. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  58525. ranges.push(numbers.slice(i, i + 2));
  58526. }
  58527. this[_xfa_object.$content] = ranges;
  58528. }
  58529. }
  58530. class Pagination extends _xfa_object.OptionObject {
  58531. constructor(attributes) {
  58532. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  58533. }
  58534. }
  58535. class PaginationOverride extends _xfa_object.OptionObject {
  58536. constructor(attributes) {
  58537. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  58538. }
  58539. }
  58540. class Part extends _xfa_object.IntegerObject {
  58541. constructor(attributes) {
  58542. super(CONFIG_NS_ID, "part", 1, n => false);
  58543. }
  58544. }
  58545. class Pcl extends _xfa_object.XFAObject {
  58546. constructor(attributes) {
  58547. super(CONFIG_NS_ID, "pcl", true);
  58548. this.name = attributes.name || "";
  58549. this.batchOutput = null;
  58550. this.fontInfo = null;
  58551. this.jog = null;
  58552. this.mediumInfo = null;
  58553. this.outputBin = null;
  58554. this.pageOffset = null;
  58555. this.staple = null;
  58556. this.xdc = null;
  58557. }
  58558. }
  58559. class Pdf extends _xfa_object.XFAObject {
  58560. constructor(attributes) {
  58561. super(CONFIG_NS_ID, "pdf", true);
  58562. this.name = attributes.name || "";
  58563. this.adobeExtensionLevel = null;
  58564. this.batchOutput = null;
  58565. this.compression = null;
  58566. this.creator = null;
  58567. this.encryption = null;
  58568. this.fontInfo = null;
  58569. this.interactive = null;
  58570. this.linearized = null;
  58571. this.openAction = null;
  58572. this.pdfa = null;
  58573. this.producer = null;
  58574. this.renderPolicy = null;
  58575. this.scriptModel = null;
  58576. this.silentPrint = null;
  58577. this.submitFormat = null;
  58578. this.tagged = null;
  58579. this.version = null;
  58580. this.viewerPreferences = null;
  58581. this.xdc = null;
  58582. }
  58583. }
  58584. class Pdfa extends _xfa_object.XFAObject {
  58585. constructor(attributes) {
  58586. super(CONFIG_NS_ID, "pdfa", true);
  58587. this.amd = null;
  58588. this.conformance = null;
  58589. this.includeXDPContent = null;
  58590. this.part = null;
  58591. }
  58592. }
  58593. class Permissions extends _xfa_object.XFAObject {
  58594. constructor(attributes) {
  58595. super(CONFIG_NS_ID, "permissions", true);
  58596. this.accessibleContent = null;
  58597. this.change = null;
  58598. this.contentCopy = null;
  58599. this.documentAssembly = null;
  58600. this.formFieldFilling = null;
  58601. this.modifyAnnots = null;
  58602. this.plaintextMetadata = null;
  58603. this.print = null;
  58604. this.printHighQuality = null;
  58605. }
  58606. }
  58607. class PickTrayByPDFSize extends _xfa_object.Option01 {
  58608. constructor(attributes) {
  58609. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  58610. }
  58611. }
  58612. class Picture extends _xfa_object.StringObject {
  58613. constructor(attributes) {
  58614. super(CONFIG_NS_ID, "picture");
  58615. }
  58616. }
  58617. class PlaintextMetadata extends _xfa_object.Option01 {
  58618. constructor(attributes) {
  58619. super(CONFIG_NS_ID, "plaintextMetadata");
  58620. }
  58621. }
  58622. class Presence extends _xfa_object.OptionObject {
  58623. constructor(attributes) {
  58624. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  58625. }
  58626. }
  58627. class Present extends _xfa_object.XFAObject {
  58628. constructor(attributes) {
  58629. super(CONFIG_NS_ID, "present", true);
  58630. this.behaviorOverride = null;
  58631. this.cache = null;
  58632. this.common = null;
  58633. this.copies = null;
  58634. this.destination = null;
  58635. this.incrementalMerge = null;
  58636. this.layout = null;
  58637. this.output = null;
  58638. this.overprint = null;
  58639. this.pagination = null;
  58640. this.paginationOverride = null;
  58641. this.script = null;
  58642. this.validate = null;
  58643. this.xdp = null;
  58644. this.driver = new _xfa_object.XFAObjectArray();
  58645. this.labelPrinter = new _xfa_object.XFAObjectArray();
  58646. this.pcl = new _xfa_object.XFAObjectArray();
  58647. this.pdf = new _xfa_object.XFAObjectArray();
  58648. this.ps = new _xfa_object.XFAObjectArray();
  58649. this.submitUrl = new _xfa_object.XFAObjectArray();
  58650. this.webClient = new _xfa_object.XFAObjectArray();
  58651. this.zpl = new _xfa_object.XFAObjectArray();
  58652. }
  58653. }
  58654. class Print extends _xfa_object.Option01 {
  58655. constructor(attributes) {
  58656. super(CONFIG_NS_ID, "print");
  58657. }
  58658. }
  58659. class PrintHighQuality extends _xfa_object.Option01 {
  58660. constructor(attributes) {
  58661. super(CONFIG_NS_ID, "printHighQuality");
  58662. }
  58663. }
  58664. class PrintScaling extends _xfa_object.OptionObject {
  58665. constructor(attributes) {
  58666. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  58667. }
  58668. }
  58669. class PrinterName extends _xfa_object.StringObject {
  58670. constructor(attributes) {
  58671. super(CONFIG_NS_ID, "printerName");
  58672. }
  58673. }
  58674. class Producer extends _xfa_object.StringObject {
  58675. constructor(attributes) {
  58676. super(CONFIG_NS_ID, "producer");
  58677. }
  58678. }
  58679. class Ps extends _xfa_object.XFAObject {
  58680. constructor(attributes) {
  58681. super(CONFIG_NS_ID, "ps", true);
  58682. this.name = attributes.name || "";
  58683. this.batchOutput = null;
  58684. this.fontInfo = null;
  58685. this.jog = null;
  58686. this.mediumInfo = null;
  58687. this.outputBin = null;
  58688. this.staple = null;
  58689. this.xdc = null;
  58690. }
  58691. }
  58692. class Range extends _xfa_object.ContentObject {
  58693. constructor(attributes) {
  58694. super(CONFIG_NS_ID, "range");
  58695. }
  58696. [_xfa_object.$finalize]() {
  58697. 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 => {
  58698. if (range.length === 1) {
  58699. range.push(range[0]);
  58700. }
  58701. return range;
  58702. });
  58703. }
  58704. }
  58705. class Record extends _xfa_object.ContentObject {
  58706. constructor(attributes) {
  58707. super(CONFIG_NS_ID, "record");
  58708. }
  58709. [_xfa_object.$finalize]() {
  58710. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  58711. const n = parseInt(this[_xfa_object.$content], 10);
  58712. if (!isNaN(n) && n >= 0) {
  58713. this[_xfa_object.$content] = n;
  58714. }
  58715. }
  58716. }
  58717. class Relevant extends _xfa_object.ContentObject {
  58718. constructor(attributes) {
  58719. super(CONFIG_NS_ID, "relevant");
  58720. }
  58721. [_xfa_object.$finalize]() {
  58722. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  58723. }
  58724. }
  58725. class Rename extends _xfa_object.ContentObject {
  58726. constructor(attributes) {
  58727. super(CONFIG_NS_ID, "rename");
  58728. }
  58729. [_xfa_object.$finalize]() {
  58730. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  58731. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  58732. (0, _util.warn)("XFA - Rename: invalid XFA name");
  58733. }
  58734. }
  58735. }
  58736. class RenderPolicy extends _xfa_object.OptionObject {
  58737. constructor(attributes) {
  58738. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  58739. }
  58740. }
  58741. class RunScripts extends _xfa_object.OptionObject {
  58742. constructor(attributes) {
  58743. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  58744. }
  58745. }
  58746. class Script extends _xfa_object.XFAObject {
  58747. constructor(attributes) {
  58748. super(CONFIG_NS_ID, "script", true);
  58749. this.currentPage = null;
  58750. this.exclude = null;
  58751. this.runScripts = null;
  58752. }
  58753. }
  58754. class ScriptModel extends _xfa_object.OptionObject {
  58755. constructor(attributes) {
  58756. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  58757. }
  58758. }
  58759. class Severity extends _xfa_object.OptionObject {
  58760. constructor(attributes) {
  58761. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  58762. }
  58763. }
  58764. class SilentPrint extends _xfa_object.XFAObject {
  58765. constructor(attributes) {
  58766. super(CONFIG_NS_ID, "silentPrint", true);
  58767. this.addSilentPrint = null;
  58768. this.printerName = null;
  58769. }
  58770. }
  58771. class Staple extends _xfa_object.XFAObject {
  58772. constructor(attributes) {
  58773. super(CONFIG_NS_ID, "staple");
  58774. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  58775. }
  58776. }
  58777. class StartNode extends _xfa_object.StringObject {
  58778. constructor(attributes) {
  58779. super(CONFIG_NS_ID, "startNode");
  58780. }
  58781. }
  58782. class StartPage extends _xfa_object.IntegerObject {
  58783. constructor(attributes) {
  58784. super(CONFIG_NS_ID, "startPage", 0, n => true);
  58785. }
  58786. }
  58787. class SubmitFormat extends _xfa_object.OptionObject {
  58788. constructor(attributes) {
  58789. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  58790. }
  58791. }
  58792. class SubmitUrl extends _xfa_object.StringObject {
  58793. constructor(attributes) {
  58794. super(CONFIG_NS_ID, "submitUrl");
  58795. }
  58796. }
  58797. class SubsetBelow extends _xfa_object.IntegerObject {
  58798. constructor(attributes) {
  58799. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  58800. }
  58801. }
  58802. class SuppressBanner extends _xfa_object.Option01 {
  58803. constructor(attributes) {
  58804. super(CONFIG_NS_ID, "suppressBanner");
  58805. }
  58806. }
  58807. class Tagged extends _xfa_object.Option01 {
  58808. constructor(attributes) {
  58809. super(CONFIG_NS_ID, "tagged");
  58810. }
  58811. }
  58812. class Template extends _xfa_object.XFAObject {
  58813. constructor(attributes) {
  58814. super(CONFIG_NS_ID, "template", true);
  58815. this.base = null;
  58816. this.relevant = null;
  58817. this.startPage = null;
  58818. this.uri = null;
  58819. this.xsl = null;
  58820. }
  58821. }
  58822. class Threshold extends _xfa_object.OptionObject {
  58823. constructor(attributes) {
  58824. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  58825. }
  58826. }
  58827. class To extends _xfa_object.OptionObject {
  58828. constructor(attributes) {
  58829. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  58830. }
  58831. }
  58832. class TemplateCache extends _xfa_object.XFAObject {
  58833. constructor(attributes) {
  58834. super(CONFIG_NS_ID, "templateCache");
  58835. this.maxEntries = (0, _utils.getInteger)({
  58836. data: attributes.maxEntries,
  58837. defaultValue: 5,
  58838. validate: n => n >= 0
  58839. });
  58840. }
  58841. }
  58842. class Trace extends _xfa_object.XFAObject {
  58843. constructor(attributes) {
  58844. super(CONFIG_NS_ID, "trace", true);
  58845. this.area = new _xfa_object.XFAObjectArray();
  58846. }
  58847. }
  58848. class Transform extends _xfa_object.XFAObject {
  58849. constructor(attributes) {
  58850. super(CONFIG_NS_ID, "transform", true);
  58851. this.groupParent = null;
  58852. this.ifEmpty = null;
  58853. this.nameAttr = null;
  58854. this.picture = null;
  58855. this.presence = null;
  58856. this.rename = null;
  58857. this.whitespace = null;
  58858. }
  58859. }
  58860. class Type extends _xfa_object.OptionObject {
  58861. constructor(attributes) {
  58862. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  58863. }
  58864. }
  58865. class Uri extends _xfa_object.StringObject {
  58866. constructor(attributes) {
  58867. super(CONFIG_NS_ID, "uri");
  58868. }
  58869. }
  58870. class Validate extends _xfa_object.OptionObject {
  58871. constructor(attributes) {
  58872. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  58873. }
  58874. }
  58875. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  58876. constructor(attributes) {
  58877. super(CONFIG_NS_ID, "validateApprovalSignatures");
  58878. }
  58879. [_xfa_object.$finalize]() {
  58880. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  58881. }
  58882. }
  58883. class ValidationMessaging extends _xfa_object.OptionObject {
  58884. constructor(attributes) {
  58885. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  58886. }
  58887. }
  58888. class Version extends _xfa_object.OptionObject {
  58889. constructor(attributes) {
  58890. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  58891. }
  58892. }
  58893. class VersionControl extends _xfa_object.XFAObject {
  58894. constructor(attributes) {
  58895. super(CONFIG_NS_ID, "VersionControl");
  58896. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  58897. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  58898. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  58899. }
  58900. }
  58901. class ViewerPreferences extends _xfa_object.XFAObject {
  58902. constructor(attributes) {
  58903. super(CONFIG_NS_ID, "viewerPreferences", true);
  58904. this.ADBE_JSConsole = null;
  58905. this.ADBE_JSDebugger = null;
  58906. this.addViewerPreferences = null;
  58907. this.duplexOption = null;
  58908. this.enforce = null;
  58909. this.numberOfCopies = null;
  58910. this.pageRange = null;
  58911. this.pickTrayByPDFSize = null;
  58912. this.printScaling = null;
  58913. }
  58914. }
  58915. class WebClient extends _xfa_object.XFAObject {
  58916. constructor(attributes) {
  58917. super(CONFIG_NS_ID, "webClient", true);
  58918. this.name = attributes.name ? attributes.name.trim() : "";
  58919. this.fontInfo = null;
  58920. this.xdc = null;
  58921. }
  58922. }
  58923. class Whitespace extends _xfa_object.OptionObject {
  58924. constructor(attributes) {
  58925. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  58926. }
  58927. }
  58928. class Window extends _xfa_object.ContentObject {
  58929. constructor(attributes) {
  58930. super(CONFIG_NS_ID, "window");
  58931. }
  58932. [_xfa_object.$finalize]() {
  58933. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  58934. if (pair.some(x => isNaN(x))) {
  58935. this[_xfa_object.$content] = [0, 0];
  58936. return;
  58937. }
  58938. if (pair.length === 1) {
  58939. pair.push(pair[0]);
  58940. }
  58941. this[_xfa_object.$content] = pair;
  58942. }
  58943. }
  58944. class Xdc extends _xfa_object.XFAObject {
  58945. constructor(attributes) {
  58946. super(CONFIG_NS_ID, "xdc", true);
  58947. this.uri = new _xfa_object.XFAObjectArray();
  58948. this.xsl = new _xfa_object.XFAObjectArray();
  58949. }
  58950. }
  58951. class Xdp extends _xfa_object.XFAObject {
  58952. constructor(attributes) {
  58953. super(CONFIG_NS_ID, "xdp", true);
  58954. this.packets = null;
  58955. }
  58956. }
  58957. class Xsl extends _xfa_object.XFAObject {
  58958. constructor(attributes) {
  58959. super(CONFIG_NS_ID, "xsl", true);
  58960. this.debug = null;
  58961. this.uri = null;
  58962. }
  58963. }
  58964. class Zpl extends _xfa_object.XFAObject {
  58965. constructor(attributes) {
  58966. super(CONFIG_NS_ID, "zpl", true);
  58967. this.name = attributes.name ? attributes.name.trim() : "";
  58968. this.batchOutput = null;
  58969. this.flipLabel = null;
  58970. this.fontInfo = null;
  58971. this.xdc = null;
  58972. }
  58973. }
  58974. class ConfigNamespace {
  58975. static [_namespaces.$buildXFAObject](name, attributes) {
  58976. if (ConfigNamespace.hasOwnProperty(name)) {
  58977. return ConfigNamespace[name](attributes);
  58978. }
  58979. return undefined;
  58980. }
  58981. static acrobat(attrs) {
  58982. return new Acrobat(attrs);
  58983. }
  58984. static acrobat7(attrs) {
  58985. return new Acrobat7(attrs);
  58986. }
  58987. static ADBE_JSConsole(attrs) {
  58988. return new ADBE_JSConsole(attrs);
  58989. }
  58990. static ADBE_JSDebugger(attrs) {
  58991. return new ADBE_JSDebugger(attrs);
  58992. }
  58993. static addSilentPrint(attrs) {
  58994. return new AddSilentPrint(attrs);
  58995. }
  58996. static addViewerPreferences(attrs) {
  58997. return new AddViewerPreferences(attrs);
  58998. }
  58999. static adjustData(attrs) {
  59000. return new AdjustData(attrs);
  59001. }
  59002. static adobeExtensionLevel(attrs) {
  59003. return new AdobeExtensionLevel(attrs);
  59004. }
  59005. static agent(attrs) {
  59006. return new Agent(attrs);
  59007. }
  59008. static alwaysEmbed(attrs) {
  59009. return new AlwaysEmbed(attrs);
  59010. }
  59011. static amd(attrs) {
  59012. return new Amd(attrs);
  59013. }
  59014. static area(attrs) {
  59015. return new Area(attrs);
  59016. }
  59017. static attributes(attrs) {
  59018. return new Attributes(attrs);
  59019. }
  59020. static autoSave(attrs) {
  59021. return new AutoSave(attrs);
  59022. }
  59023. static base(attrs) {
  59024. return new Base(attrs);
  59025. }
  59026. static batchOutput(attrs) {
  59027. return new BatchOutput(attrs);
  59028. }
  59029. static behaviorOverride(attrs) {
  59030. return new BehaviorOverride(attrs);
  59031. }
  59032. static cache(attrs) {
  59033. return new Cache(attrs);
  59034. }
  59035. static change(attrs) {
  59036. return new Change(attrs);
  59037. }
  59038. static common(attrs) {
  59039. return new Common(attrs);
  59040. }
  59041. static compress(attrs) {
  59042. return new Compress(attrs);
  59043. }
  59044. static compressLogicalStructure(attrs) {
  59045. return new CompressLogicalStructure(attrs);
  59046. }
  59047. static compressObjectStream(attrs) {
  59048. return new CompressObjectStream(attrs);
  59049. }
  59050. static compression(attrs) {
  59051. return new Compression(attrs);
  59052. }
  59053. static config(attrs) {
  59054. return new Config(attrs);
  59055. }
  59056. static conformance(attrs) {
  59057. return new Conformance(attrs);
  59058. }
  59059. static contentCopy(attrs) {
  59060. return new ContentCopy(attrs);
  59061. }
  59062. static copies(attrs) {
  59063. return new Copies(attrs);
  59064. }
  59065. static creator(attrs) {
  59066. return new Creator(attrs);
  59067. }
  59068. static currentPage(attrs) {
  59069. return new CurrentPage(attrs);
  59070. }
  59071. static data(attrs) {
  59072. return new Data(attrs);
  59073. }
  59074. static debug(attrs) {
  59075. return new Debug(attrs);
  59076. }
  59077. static defaultTypeface(attrs) {
  59078. return new DefaultTypeface(attrs);
  59079. }
  59080. static destination(attrs) {
  59081. return new Destination(attrs);
  59082. }
  59083. static documentAssembly(attrs) {
  59084. return new DocumentAssembly(attrs);
  59085. }
  59086. static driver(attrs) {
  59087. return new Driver(attrs);
  59088. }
  59089. static duplexOption(attrs) {
  59090. return new DuplexOption(attrs);
  59091. }
  59092. static dynamicRender(attrs) {
  59093. return new DynamicRender(attrs);
  59094. }
  59095. static embed(attrs) {
  59096. return new Embed(attrs);
  59097. }
  59098. static encrypt(attrs) {
  59099. return new Encrypt(attrs);
  59100. }
  59101. static encryption(attrs) {
  59102. return new Encryption(attrs);
  59103. }
  59104. static encryptionLevel(attrs) {
  59105. return new EncryptionLevel(attrs);
  59106. }
  59107. static enforce(attrs) {
  59108. return new Enforce(attrs);
  59109. }
  59110. static equate(attrs) {
  59111. return new Equate(attrs);
  59112. }
  59113. static equateRange(attrs) {
  59114. return new EquateRange(attrs);
  59115. }
  59116. static exclude(attrs) {
  59117. return new Exclude(attrs);
  59118. }
  59119. static excludeNS(attrs) {
  59120. return new ExcludeNS(attrs);
  59121. }
  59122. static flipLabel(attrs) {
  59123. return new FlipLabel(attrs);
  59124. }
  59125. static fontInfo(attrs) {
  59126. return new FontInfo(attrs);
  59127. }
  59128. static formFieldFilling(attrs) {
  59129. return new FormFieldFilling(attrs);
  59130. }
  59131. static groupParent(attrs) {
  59132. return new GroupParent(attrs);
  59133. }
  59134. static ifEmpty(attrs) {
  59135. return new IfEmpty(attrs);
  59136. }
  59137. static includeXDPContent(attrs) {
  59138. return new IncludeXDPContent(attrs);
  59139. }
  59140. static incrementalLoad(attrs) {
  59141. return new IncrementalLoad(attrs);
  59142. }
  59143. static incrementalMerge(attrs) {
  59144. return new IncrementalMerge(attrs);
  59145. }
  59146. static interactive(attrs) {
  59147. return new Interactive(attrs);
  59148. }
  59149. static jog(attrs) {
  59150. return new Jog(attrs);
  59151. }
  59152. static labelPrinter(attrs) {
  59153. return new LabelPrinter(attrs);
  59154. }
  59155. static layout(attrs) {
  59156. return new Layout(attrs);
  59157. }
  59158. static level(attrs) {
  59159. return new Level(attrs);
  59160. }
  59161. static linearized(attrs) {
  59162. return new Linearized(attrs);
  59163. }
  59164. static locale(attrs) {
  59165. return new Locale(attrs);
  59166. }
  59167. static localeSet(attrs) {
  59168. return new LocaleSet(attrs);
  59169. }
  59170. static log(attrs) {
  59171. return new Log(attrs);
  59172. }
  59173. static map(attrs) {
  59174. return new MapElement(attrs);
  59175. }
  59176. static mediumInfo(attrs) {
  59177. return new MediumInfo(attrs);
  59178. }
  59179. static message(attrs) {
  59180. return new Message(attrs);
  59181. }
  59182. static messaging(attrs) {
  59183. return new Messaging(attrs);
  59184. }
  59185. static mode(attrs) {
  59186. return new Mode(attrs);
  59187. }
  59188. static modifyAnnots(attrs) {
  59189. return new ModifyAnnots(attrs);
  59190. }
  59191. static msgId(attrs) {
  59192. return new MsgId(attrs);
  59193. }
  59194. static nameAttr(attrs) {
  59195. return new NameAttr(attrs);
  59196. }
  59197. static neverEmbed(attrs) {
  59198. return new NeverEmbed(attrs);
  59199. }
  59200. static numberOfCopies(attrs) {
  59201. return new NumberOfCopies(attrs);
  59202. }
  59203. static openAction(attrs) {
  59204. return new OpenAction(attrs);
  59205. }
  59206. static output(attrs) {
  59207. return new Output(attrs);
  59208. }
  59209. static outputBin(attrs) {
  59210. return new OutputBin(attrs);
  59211. }
  59212. static outputXSL(attrs) {
  59213. return new OutputXSL(attrs);
  59214. }
  59215. static overprint(attrs) {
  59216. return new Overprint(attrs);
  59217. }
  59218. static packets(attrs) {
  59219. return new Packets(attrs);
  59220. }
  59221. static pageOffset(attrs) {
  59222. return new PageOffset(attrs);
  59223. }
  59224. static pageRange(attrs) {
  59225. return new PageRange(attrs);
  59226. }
  59227. static pagination(attrs) {
  59228. return new Pagination(attrs);
  59229. }
  59230. static paginationOverride(attrs) {
  59231. return new PaginationOverride(attrs);
  59232. }
  59233. static part(attrs) {
  59234. return new Part(attrs);
  59235. }
  59236. static pcl(attrs) {
  59237. return new Pcl(attrs);
  59238. }
  59239. static pdf(attrs) {
  59240. return new Pdf(attrs);
  59241. }
  59242. static pdfa(attrs) {
  59243. return new Pdfa(attrs);
  59244. }
  59245. static permissions(attrs) {
  59246. return new Permissions(attrs);
  59247. }
  59248. static pickTrayByPDFSize(attrs) {
  59249. return new PickTrayByPDFSize(attrs);
  59250. }
  59251. static picture(attrs) {
  59252. return new Picture(attrs);
  59253. }
  59254. static plaintextMetadata(attrs) {
  59255. return new PlaintextMetadata(attrs);
  59256. }
  59257. static presence(attrs) {
  59258. return new Presence(attrs);
  59259. }
  59260. static present(attrs) {
  59261. return new Present(attrs);
  59262. }
  59263. static print(attrs) {
  59264. return new Print(attrs);
  59265. }
  59266. static printHighQuality(attrs) {
  59267. return new PrintHighQuality(attrs);
  59268. }
  59269. static printScaling(attrs) {
  59270. return new PrintScaling(attrs);
  59271. }
  59272. static printerName(attrs) {
  59273. return new PrinterName(attrs);
  59274. }
  59275. static producer(attrs) {
  59276. return new Producer(attrs);
  59277. }
  59278. static ps(attrs) {
  59279. return new Ps(attrs);
  59280. }
  59281. static range(attrs) {
  59282. return new Range(attrs);
  59283. }
  59284. static record(attrs) {
  59285. return new Record(attrs);
  59286. }
  59287. static relevant(attrs) {
  59288. return new Relevant(attrs);
  59289. }
  59290. static rename(attrs) {
  59291. return new Rename(attrs);
  59292. }
  59293. static renderPolicy(attrs) {
  59294. return new RenderPolicy(attrs);
  59295. }
  59296. static runScripts(attrs) {
  59297. return new RunScripts(attrs);
  59298. }
  59299. static script(attrs) {
  59300. return new Script(attrs);
  59301. }
  59302. static scriptModel(attrs) {
  59303. return new ScriptModel(attrs);
  59304. }
  59305. static severity(attrs) {
  59306. return new Severity(attrs);
  59307. }
  59308. static silentPrint(attrs) {
  59309. return new SilentPrint(attrs);
  59310. }
  59311. static staple(attrs) {
  59312. return new Staple(attrs);
  59313. }
  59314. static startNode(attrs) {
  59315. return new StartNode(attrs);
  59316. }
  59317. static startPage(attrs) {
  59318. return new StartPage(attrs);
  59319. }
  59320. static submitFormat(attrs) {
  59321. return new SubmitFormat(attrs);
  59322. }
  59323. static submitUrl(attrs) {
  59324. return new SubmitUrl(attrs);
  59325. }
  59326. static subsetBelow(attrs) {
  59327. return new SubsetBelow(attrs);
  59328. }
  59329. static suppressBanner(attrs) {
  59330. return new SuppressBanner(attrs);
  59331. }
  59332. static tagged(attrs) {
  59333. return new Tagged(attrs);
  59334. }
  59335. static template(attrs) {
  59336. return new Template(attrs);
  59337. }
  59338. static templateCache(attrs) {
  59339. return new TemplateCache(attrs);
  59340. }
  59341. static threshold(attrs) {
  59342. return new Threshold(attrs);
  59343. }
  59344. static to(attrs) {
  59345. return new To(attrs);
  59346. }
  59347. static trace(attrs) {
  59348. return new Trace(attrs);
  59349. }
  59350. static transform(attrs) {
  59351. return new Transform(attrs);
  59352. }
  59353. static type(attrs) {
  59354. return new Type(attrs);
  59355. }
  59356. static uri(attrs) {
  59357. return new Uri(attrs);
  59358. }
  59359. static validate(attrs) {
  59360. return new Validate(attrs);
  59361. }
  59362. static validateApprovalSignatures(attrs) {
  59363. return new ValidateApprovalSignatures(attrs);
  59364. }
  59365. static validationMessaging(attrs) {
  59366. return new ValidationMessaging(attrs);
  59367. }
  59368. static version(attrs) {
  59369. return new Version(attrs);
  59370. }
  59371. static versionControl(attrs) {
  59372. return new VersionControl(attrs);
  59373. }
  59374. static viewerPreferences(attrs) {
  59375. return new ViewerPreferences(attrs);
  59376. }
  59377. static webClient(attrs) {
  59378. return new WebClient(attrs);
  59379. }
  59380. static whitespace(attrs) {
  59381. return new Whitespace(attrs);
  59382. }
  59383. static window(attrs) {
  59384. return new Window(attrs);
  59385. }
  59386. static xdc(attrs) {
  59387. return new Xdc(attrs);
  59388. }
  59389. static xdp(attrs) {
  59390. return new Xdp(attrs);
  59391. }
  59392. static xsl(attrs) {
  59393. return new Xsl(attrs);
  59394. }
  59395. static zpl(attrs) {
  59396. return new Zpl(attrs);
  59397. }
  59398. }
  59399. exports.ConfigNamespace = ConfigNamespace;
  59400. /***/ }),
  59401. /* 90 */
  59402. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59403. Object.defineProperty(exports, "__esModule", ({
  59404. value: true
  59405. }));
  59406. exports.ConnectionSetNamespace = void 0;
  59407. var _namespaces = __w_pdfjs_require__(77);
  59408. var _xfa_object = __w_pdfjs_require__(75);
  59409. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  59410. class ConnectionSet extends _xfa_object.XFAObject {
  59411. constructor(attributes) {
  59412. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  59413. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  59414. this.xmlConnection = new _xfa_object.XFAObjectArray();
  59415. this.xsdConnection = new _xfa_object.XFAObjectArray();
  59416. }
  59417. }
  59418. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  59419. constructor(attributes) {
  59420. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  59421. this.id = attributes.id || "";
  59422. this.name = attributes.name || "";
  59423. this.use = attributes.use || "";
  59424. this.usehref = attributes.usehref || "";
  59425. }
  59426. }
  59427. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  59428. constructor(attributes) {
  59429. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  59430. this.id = attributes.id || "";
  59431. this.name = attributes.name || "";
  59432. this.use = attributes.use || "";
  59433. this.usehref = attributes.usehref || "";
  59434. }
  59435. }
  59436. class Operation extends _xfa_object.StringObject {
  59437. constructor(attributes) {
  59438. super(CONNECTION_SET_NS_ID, "operation");
  59439. this.id = attributes.id || "";
  59440. this.input = attributes.input || "";
  59441. this.name = attributes.name || "";
  59442. this.output = attributes.output || "";
  59443. this.use = attributes.use || "";
  59444. this.usehref = attributes.usehref || "";
  59445. }
  59446. }
  59447. class RootElement extends _xfa_object.StringObject {
  59448. constructor(attributes) {
  59449. super(CONNECTION_SET_NS_ID, "rootElement");
  59450. this.id = attributes.id || "";
  59451. this.name = attributes.name || "";
  59452. this.use = attributes.use || "";
  59453. this.usehref = attributes.usehref || "";
  59454. }
  59455. }
  59456. class SoapAction extends _xfa_object.StringObject {
  59457. constructor(attributes) {
  59458. super(CONNECTION_SET_NS_ID, "soapAction");
  59459. this.id = attributes.id || "";
  59460. this.name = attributes.name || "";
  59461. this.use = attributes.use || "";
  59462. this.usehref = attributes.usehref || "";
  59463. }
  59464. }
  59465. class SoapAddress extends _xfa_object.StringObject {
  59466. constructor(attributes) {
  59467. super(CONNECTION_SET_NS_ID, "soapAddress");
  59468. this.id = attributes.id || "";
  59469. this.name = attributes.name || "";
  59470. this.use = attributes.use || "";
  59471. this.usehref = attributes.usehref || "";
  59472. }
  59473. }
  59474. class Uri extends _xfa_object.StringObject {
  59475. constructor(attributes) {
  59476. super(CONNECTION_SET_NS_ID, "uri");
  59477. this.id = attributes.id || "";
  59478. this.name = attributes.name || "";
  59479. this.use = attributes.use || "";
  59480. this.usehref = attributes.usehref || "";
  59481. }
  59482. }
  59483. class WsdlAddress extends _xfa_object.StringObject {
  59484. constructor(attributes) {
  59485. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  59486. this.id = attributes.id || "";
  59487. this.name = attributes.name || "";
  59488. this.use = attributes.use || "";
  59489. this.usehref = attributes.usehref || "";
  59490. }
  59491. }
  59492. class WsdlConnection extends _xfa_object.XFAObject {
  59493. constructor(attributes) {
  59494. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  59495. this.dataDescription = attributes.dataDescription || "";
  59496. this.name = attributes.name || "";
  59497. this.effectiveInputPolicy = null;
  59498. this.effectiveOutputPolicy = null;
  59499. this.operation = null;
  59500. this.soapAction = null;
  59501. this.soapAddress = null;
  59502. this.wsdlAddress = null;
  59503. }
  59504. }
  59505. class XmlConnection extends _xfa_object.XFAObject {
  59506. constructor(attributes) {
  59507. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  59508. this.dataDescription = attributes.dataDescription || "";
  59509. this.name = attributes.name || "";
  59510. this.uri = null;
  59511. }
  59512. }
  59513. class XsdConnection extends _xfa_object.XFAObject {
  59514. constructor(attributes) {
  59515. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  59516. this.dataDescription = attributes.dataDescription || "";
  59517. this.name = attributes.name || "";
  59518. this.rootElement = null;
  59519. this.uri = null;
  59520. }
  59521. }
  59522. class ConnectionSetNamespace {
  59523. static [_namespaces.$buildXFAObject](name, attributes) {
  59524. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  59525. return ConnectionSetNamespace[name](attributes);
  59526. }
  59527. return undefined;
  59528. }
  59529. static connectionSet(attrs) {
  59530. return new ConnectionSet(attrs);
  59531. }
  59532. static effectiveInputPolicy(attrs) {
  59533. return new EffectiveInputPolicy(attrs);
  59534. }
  59535. static effectiveOutputPolicy(attrs) {
  59536. return new EffectiveOutputPolicy(attrs);
  59537. }
  59538. static operation(attrs) {
  59539. return new Operation(attrs);
  59540. }
  59541. static rootElement(attrs) {
  59542. return new RootElement(attrs);
  59543. }
  59544. static soapAction(attrs) {
  59545. return new SoapAction(attrs);
  59546. }
  59547. static soapAddress(attrs) {
  59548. return new SoapAddress(attrs);
  59549. }
  59550. static uri(attrs) {
  59551. return new Uri(attrs);
  59552. }
  59553. static wsdlAddress(attrs) {
  59554. return new WsdlAddress(attrs);
  59555. }
  59556. static wsdlConnection(attrs) {
  59557. return new WsdlConnection(attrs);
  59558. }
  59559. static xmlConnection(attrs) {
  59560. return new XmlConnection(attrs);
  59561. }
  59562. static xsdConnection(attrs) {
  59563. return new XsdConnection(attrs);
  59564. }
  59565. }
  59566. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  59567. /***/ }),
  59568. /* 91 */
  59569. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59570. Object.defineProperty(exports, "__esModule", ({
  59571. value: true
  59572. }));
  59573. exports.DatasetsNamespace = void 0;
  59574. var _xfa_object = __w_pdfjs_require__(75);
  59575. var _namespaces = __w_pdfjs_require__(77);
  59576. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  59577. class Data extends _xfa_object.XmlObject {
  59578. constructor(attributes) {
  59579. super(DATASETS_NS_ID, "data", attributes);
  59580. }
  59581. [_xfa_object.$isNsAgnostic]() {
  59582. return true;
  59583. }
  59584. }
  59585. class Datasets extends _xfa_object.XFAObject {
  59586. constructor(attributes) {
  59587. super(DATASETS_NS_ID, "datasets", true);
  59588. this.data = null;
  59589. this.Signature = null;
  59590. }
  59591. [_xfa_object.$onChild](child) {
  59592. const name = child[_xfa_object.$nodeName];
  59593. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  59594. this[name] = child;
  59595. }
  59596. this[_xfa_object.$appendChild](child);
  59597. }
  59598. }
  59599. class DatasetsNamespace {
  59600. static [_namespaces.$buildXFAObject](name, attributes) {
  59601. if (DatasetsNamespace.hasOwnProperty(name)) {
  59602. return DatasetsNamespace[name](attributes);
  59603. }
  59604. return undefined;
  59605. }
  59606. static datasets(attributes) {
  59607. return new Datasets(attributes);
  59608. }
  59609. static data(attributes) {
  59610. return new Data(attributes);
  59611. }
  59612. }
  59613. exports.DatasetsNamespace = DatasetsNamespace;
  59614. /***/ }),
  59615. /* 92 */
  59616. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59617. Object.defineProperty(exports, "__esModule", ({
  59618. value: true
  59619. }));
  59620. exports.LocaleSetNamespace = void 0;
  59621. var _namespaces = __w_pdfjs_require__(77);
  59622. var _xfa_object = __w_pdfjs_require__(75);
  59623. var _utils = __w_pdfjs_require__(76);
  59624. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  59625. class CalendarSymbols extends _xfa_object.XFAObject {
  59626. constructor(attributes) {
  59627. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  59628. this.name = "gregorian";
  59629. this.dayNames = new _xfa_object.XFAObjectArray(2);
  59630. this.eraNames = null;
  59631. this.meridiemNames = null;
  59632. this.monthNames = new _xfa_object.XFAObjectArray(2);
  59633. }
  59634. }
  59635. class CurrencySymbol extends _xfa_object.StringObject {
  59636. constructor(attributes) {
  59637. super(LOCALE_SET_NS_ID, "currencySymbol");
  59638. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  59639. }
  59640. }
  59641. class CurrencySymbols extends _xfa_object.XFAObject {
  59642. constructor(attributes) {
  59643. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  59644. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  59645. }
  59646. }
  59647. class DatePattern extends _xfa_object.StringObject {
  59648. constructor(attributes) {
  59649. super(LOCALE_SET_NS_ID, "datePattern");
  59650. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  59651. }
  59652. }
  59653. class DatePatterns extends _xfa_object.XFAObject {
  59654. constructor(attributes) {
  59655. super(LOCALE_SET_NS_ID, "datePatterns", true);
  59656. this.datePattern = new _xfa_object.XFAObjectArray(4);
  59657. }
  59658. }
  59659. class DateTimeSymbols extends _xfa_object.ContentObject {
  59660. constructor(attributes) {
  59661. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  59662. }
  59663. }
  59664. class Day extends _xfa_object.StringObject {
  59665. constructor(attributes) {
  59666. super(LOCALE_SET_NS_ID, "day");
  59667. }
  59668. }
  59669. class DayNames extends _xfa_object.XFAObject {
  59670. constructor(attributes) {
  59671. super(LOCALE_SET_NS_ID, "dayNames", true);
  59672. this.abbr = (0, _utils.getInteger)({
  59673. data: attributes.abbr,
  59674. defaultValue: 0,
  59675. validate: x => x === 1
  59676. });
  59677. this.day = new _xfa_object.XFAObjectArray(7);
  59678. }
  59679. }
  59680. class Era extends _xfa_object.StringObject {
  59681. constructor(attributes) {
  59682. super(LOCALE_SET_NS_ID, "era");
  59683. }
  59684. }
  59685. class EraNames extends _xfa_object.XFAObject {
  59686. constructor(attributes) {
  59687. super(LOCALE_SET_NS_ID, "eraNames", true);
  59688. this.era = new _xfa_object.XFAObjectArray(2);
  59689. }
  59690. }
  59691. class Locale extends _xfa_object.XFAObject {
  59692. constructor(attributes) {
  59693. super(LOCALE_SET_NS_ID, "locale", true);
  59694. this.desc = attributes.desc || "";
  59695. this.name = "isoname";
  59696. this.calendarSymbols = null;
  59697. this.currencySymbols = null;
  59698. this.datePatterns = null;
  59699. this.dateTimeSymbols = null;
  59700. this.numberPatterns = null;
  59701. this.numberSymbols = null;
  59702. this.timePatterns = null;
  59703. this.typeFaces = null;
  59704. }
  59705. }
  59706. class LocaleSet extends _xfa_object.XFAObject {
  59707. constructor(attributes) {
  59708. super(LOCALE_SET_NS_ID, "localeSet", true);
  59709. this.locale = new _xfa_object.XFAObjectArray();
  59710. }
  59711. }
  59712. class Meridiem extends _xfa_object.StringObject {
  59713. constructor(attributes) {
  59714. super(LOCALE_SET_NS_ID, "meridiem");
  59715. }
  59716. }
  59717. class MeridiemNames extends _xfa_object.XFAObject {
  59718. constructor(attributes) {
  59719. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  59720. this.meridiem = new _xfa_object.XFAObjectArray(2);
  59721. }
  59722. }
  59723. class Month extends _xfa_object.StringObject {
  59724. constructor(attributes) {
  59725. super(LOCALE_SET_NS_ID, "month");
  59726. }
  59727. }
  59728. class MonthNames extends _xfa_object.XFAObject {
  59729. constructor(attributes) {
  59730. super(LOCALE_SET_NS_ID, "monthNames", true);
  59731. this.abbr = (0, _utils.getInteger)({
  59732. data: attributes.abbr,
  59733. defaultValue: 0,
  59734. validate: x => x === 1
  59735. });
  59736. this.month = new _xfa_object.XFAObjectArray(12);
  59737. }
  59738. }
  59739. class NumberPattern extends _xfa_object.StringObject {
  59740. constructor(attributes) {
  59741. super(LOCALE_SET_NS_ID, "numberPattern");
  59742. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  59743. }
  59744. }
  59745. class NumberPatterns extends _xfa_object.XFAObject {
  59746. constructor(attributes) {
  59747. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  59748. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  59749. }
  59750. }
  59751. class NumberSymbol extends _xfa_object.StringObject {
  59752. constructor(attributes) {
  59753. super(LOCALE_SET_NS_ID, "numberSymbol");
  59754. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  59755. }
  59756. }
  59757. class NumberSymbols extends _xfa_object.XFAObject {
  59758. constructor(attributes) {
  59759. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  59760. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  59761. }
  59762. }
  59763. class TimePattern extends _xfa_object.StringObject {
  59764. constructor(attributes) {
  59765. super(LOCALE_SET_NS_ID, "timePattern");
  59766. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  59767. }
  59768. }
  59769. class TimePatterns extends _xfa_object.XFAObject {
  59770. constructor(attributes) {
  59771. super(LOCALE_SET_NS_ID, "timePatterns", true);
  59772. this.timePattern = new _xfa_object.XFAObjectArray(4);
  59773. }
  59774. }
  59775. class TypeFace extends _xfa_object.XFAObject {
  59776. constructor(attributes) {
  59777. super(LOCALE_SET_NS_ID, "typeFace", true);
  59778. this.name = attributes.name | "";
  59779. }
  59780. }
  59781. class TypeFaces extends _xfa_object.XFAObject {
  59782. constructor(attributes) {
  59783. super(LOCALE_SET_NS_ID, "typeFaces", true);
  59784. this.typeFace = new _xfa_object.XFAObjectArray();
  59785. }
  59786. }
  59787. class LocaleSetNamespace {
  59788. static [_namespaces.$buildXFAObject](name, attributes) {
  59789. if (LocaleSetNamespace.hasOwnProperty(name)) {
  59790. return LocaleSetNamespace[name](attributes);
  59791. }
  59792. return undefined;
  59793. }
  59794. static calendarSymbols(attrs) {
  59795. return new CalendarSymbols(attrs);
  59796. }
  59797. static currencySymbol(attrs) {
  59798. return new CurrencySymbol(attrs);
  59799. }
  59800. static currencySymbols(attrs) {
  59801. return new CurrencySymbols(attrs);
  59802. }
  59803. static datePattern(attrs) {
  59804. return new DatePattern(attrs);
  59805. }
  59806. static datePatterns(attrs) {
  59807. return new DatePatterns(attrs);
  59808. }
  59809. static dateTimeSymbols(attrs) {
  59810. return new DateTimeSymbols(attrs);
  59811. }
  59812. static day(attrs) {
  59813. return new Day(attrs);
  59814. }
  59815. static dayNames(attrs) {
  59816. return new DayNames(attrs);
  59817. }
  59818. static era(attrs) {
  59819. return new Era(attrs);
  59820. }
  59821. static eraNames(attrs) {
  59822. return new EraNames(attrs);
  59823. }
  59824. static locale(attrs) {
  59825. return new Locale(attrs);
  59826. }
  59827. static localeSet(attrs) {
  59828. return new LocaleSet(attrs);
  59829. }
  59830. static meridiem(attrs) {
  59831. return new Meridiem(attrs);
  59832. }
  59833. static meridiemNames(attrs) {
  59834. return new MeridiemNames(attrs);
  59835. }
  59836. static month(attrs) {
  59837. return new Month(attrs);
  59838. }
  59839. static monthNames(attrs) {
  59840. return new MonthNames(attrs);
  59841. }
  59842. static numberPattern(attrs) {
  59843. return new NumberPattern(attrs);
  59844. }
  59845. static numberPatterns(attrs) {
  59846. return new NumberPatterns(attrs);
  59847. }
  59848. static numberSymbol(attrs) {
  59849. return new NumberSymbol(attrs);
  59850. }
  59851. static numberSymbols(attrs) {
  59852. return new NumberSymbols(attrs);
  59853. }
  59854. static timePattern(attrs) {
  59855. return new TimePattern(attrs);
  59856. }
  59857. static timePatterns(attrs) {
  59858. return new TimePatterns(attrs);
  59859. }
  59860. static typeFace(attrs) {
  59861. return new TypeFace(attrs);
  59862. }
  59863. static typeFaces(attrs) {
  59864. return new TypeFaces(attrs);
  59865. }
  59866. }
  59867. exports.LocaleSetNamespace = LocaleSetNamespace;
  59868. /***/ }),
  59869. /* 93 */
  59870. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59871. Object.defineProperty(exports, "__esModule", ({
  59872. value: true
  59873. }));
  59874. exports.SignatureNamespace = void 0;
  59875. var _namespaces = __w_pdfjs_require__(77);
  59876. var _xfa_object = __w_pdfjs_require__(75);
  59877. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  59878. class Signature extends _xfa_object.XFAObject {
  59879. constructor(attributes) {
  59880. super(SIGNATURE_NS_ID, "signature", true);
  59881. }
  59882. }
  59883. class SignatureNamespace {
  59884. static [_namespaces.$buildXFAObject](name, attributes) {
  59885. if (SignatureNamespace.hasOwnProperty(name)) {
  59886. return SignatureNamespace[name](attributes);
  59887. }
  59888. return undefined;
  59889. }
  59890. static signature(attributes) {
  59891. return new Signature(attributes);
  59892. }
  59893. }
  59894. exports.SignatureNamespace = SignatureNamespace;
  59895. /***/ }),
  59896. /* 94 */
  59897. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59898. Object.defineProperty(exports, "__esModule", ({
  59899. value: true
  59900. }));
  59901. exports.StylesheetNamespace = void 0;
  59902. var _namespaces = __w_pdfjs_require__(77);
  59903. var _xfa_object = __w_pdfjs_require__(75);
  59904. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  59905. class Stylesheet extends _xfa_object.XFAObject {
  59906. constructor(attributes) {
  59907. super(STYLESHEET_NS_ID, "stylesheet", true);
  59908. }
  59909. }
  59910. class StylesheetNamespace {
  59911. static [_namespaces.$buildXFAObject](name, attributes) {
  59912. if (StylesheetNamespace.hasOwnProperty(name)) {
  59913. return StylesheetNamespace[name](attributes);
  59914. }
  59915. return undefined;
  59916. }
  59917. static stylesheet(attributes) {
  59918. return new Stylesheet(attributes);
  59919. }
  59920. }
  59921. exports.StylesheetNamespace = StylesheetNamespace;
  59922. /***/ }),
  59923. /* 95 */
  59924. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59925. Object.defineProperty(exports, "__esModule", ({
  59926. value: true
  59927. }));
  59928. exports.XdpNamespace = void 0;
  59929. var _namespaces = __w_pdfjs_require__(77);
  59930. var _xfa_object = __w_pdfjs_require__(75);
  59931. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  59932. class Xdp extends _xfa_object.XFAObject {
  59933. constructor(attributes) {
  59934. super(XDP_NS_ID, "xdp", true);
  59935. this.uuid = attributes.uuid || "";
  59936. this.timeStamp = attributes.timeStamp || "";
  59937. this.config = null;
  59938. this.connectionSet = null;
  59939. this.datasets = null;
  59940. this.localeSet = null;
  59941. this.stylesheet = new _xfa_object.XFAObjectArray();
  59942. this.template = null;
  59943. }
  59944. [_xfa_object.$onChildCheck](child) {
  59945. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  59946. return ns && child[_xfa_object.$namespaceId] === ns.id;
  59947. }
  59948. }
  59949. class XdpNamespace {
  59950. static [_namespaces.$buildXFAObject](name, attributes) {
  59951. if (XdpNamespace.hasOwnProperty(name)) {
  59952. return XdpNamespace[name](attributes);
  59953. }
  59954. return undefined;
  59955. }
  59956. static xdp(attributes) {
  59957. return new Xdp(attributes);
  59958. }
  59959. }
  59960. exports.XdpNamespace = XdpNamespace;
  59961. /***/ }),
  59962. /* 96 */
  59963. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59964. Object.defineProperty(exports, "__esModule", ({
  59965. value: true
  59966. }));
  59967. exports.XhtmlNamespace = void 0;
  59968. var _xfa_object = __w_pdfjs_require__(75);
  59969. var _namespaces = __w_pdfjs_require__(77);
  59970. var _html_utils = __w_pdfjs_require__(82);
  59971. var _utils = __w_pdfjs_require__(76);
  59972. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  59973. 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-align", "text-decoration", "text-indent", "vertical-align", "widows", "kerning-mode", "xfa-font-horizontal-scale", "xfa-font-vertical-scale", "xfa-spacerun", "xfa-tab-stops"]);
  59974. const StyleMapping = new Map([["page-break-after", "breakAfter"], ["page-break-before", "breakBefore"], ["page-break-inside", "breakInside"], ["kerning-mode", value => value === "none" ? "none" : "normal"], ["xfa-font-horizontal-scale", value => `scaleX(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-font-vertical-scale", value => `scaleY(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-spacerun", ""], ["xfa-tab-stops", ""], ["font-size", (value, original) => {
  59975. value = original.fontSize = (0, _utils.getMeasurement)(value);
  59976. return (0, _html_utils.measureToString)(0.99 * value);
  59977. }], ["letter-spacing", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["line-height", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-bottom", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-left", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-right", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-top", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["text-indent", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["font-family", value => value]]);
  59978. const spacesRegExp = /\s+/g;
  59979. const crlfRegExp = /[\r\n]+/g;
  59980. function mapStyle(styleStr, node) {
  59981. const style = Object.create(null);
  59982. if (!styleStr) {
  59983. return style;
  59984. }
  59985. const original = Object.create(null);
  59986. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  59987. const mapping = StyleMapping.get(key);
  59988. if (mapping === "") {
  59989. continue;
  59990. }
  59991. let newValue = value;
  59992. if (mapping) {
  59993. if (typeof mapping === "string") {
  59994. newValue = mapping;
  59995. } else {
  59996. newValue = mapping(value, original);
  59997. }
  59998. }
  59999. if (key.endsWith("scale")) {
  60000. if (style.transform) {
  60001. style.transform = `${style[key]} ${newValue}`;
  60002. } else {
  60003. style.transform = newValue;
  60004. }
  60005. } else {
  60006. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  60007. }
  60008. }
  60009. if (style.fontFamily) {
  60010. (0, _html_utils.setFontFamily)({
  60011. typeface: style.fontFamily,
  60012. weight: style.fontWeight || "normal",
  60013. posture: style.fontStyle || "normal",
  60014. size: original.fontSize || 0
  60015. }, node, node[_xfa_object.$globalData].fontFinder, style);
  60016. }
  60017. (0, _html_utils.fixTextIndent)(style);
  60018. return style;
  60019. }
  60020. function checkStyle(node) {
  60021. if (!node.style) {
  60022. return "";
  60023. }
  60024. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  60025. if (key === "font-family") {
  60026. node[_xfa_object.$globalData].usedTypefaces.add(value);
  60027. }
  60028. return VALID_STYLES.has(key);
  60029. }).map(kv => kv.join(":")).join(";");
  60030. }
  60031. const NoWhites = new Set(["body", "html"]);
  60032. class XhtmlObject extends _xfa_object.XmlObject {
  60033. constructor(attributes, name) {
  60034. super(XHTML_NS_ID, name);
  60035. this.style = attributes.style || "";
  60036. }
  60037. [_xfa_object.$clean](builder) {
  60038. super[_xfa_object.$clean](builder);
  60039. this.style = checkStyle(this);
  60040. }
  60041. [_xfa_object.$acceptWhitespace]() {
  60042. return !NoWhites.has(this[_xfa_object.$nodeName]);
  60043. }
  60044. [_xfa_object.$onText](str) {
  60045. str = str.replace(crlfRegExp, "");
  60046. if (!this.style.includes("xfa-spacerun:yes")) {
  60047. str = str.replace(spacesRegExp, " ");
  60048. }
  60049. if (str) {
  60050. this[_xfa_object.$content] += str;
  60051. }
  60052. }
  60053. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  60054. const xfaFont = Object.create(null);
  60055. const margin = {
  60056. top: NaN,
  60057. bottom: NaN,
  60058. left: NaN,
  60059. right: NaN
  60060. };
  60061. let lineHeight = null;
  60062. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  60063. switch (key) {
  60064. case "font-family":
  60065. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  60066. break;
  60067. case "font-size":
  60068. xfaFont.size = (0, _utils.getMeasurement)(value);
  60069. break;
  60070. case "font-weight":
  60071. xfaFont.weight = value;
  60072. break;
  60073. case "font-style":
  60074. xfaFont.posture = value;
  60075. break;
  60076. case "letter-spacing":
  60077. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  60078. break;
  60079. case "margin":
  60080. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  60081. switch (values.length) {
  60082. case 1:
  60083. margin.top = margin.bottom = margin.left = margin.right = values[0];
  60084. break;
  60085. case 2:
  60086. margin.top = margin.bottom = values[0];
  60087. margin.left = margin.right = values[1];
  60088. break;
  60089. case 3:
  60090. margin.top = values[0];
  60091. margin.bottom = values[2];
  60092. margin.left = margin.right = values[1];
  60093. break;
  60094. case 4:
  60095. margin.top = values[0];
  60096. margin.left = values[1];
  60097. margin.bottom = values[2];
  60098. margin.right = values[3];
  60099. break;
  60100. }
  60101. break;
  60102. case "margin-top":
  60103. margin.top = (0, _utils.getMeasurement)(value);
  60104. break;
  60105. case "margin-bottom":
  60106. margin.bottom = (0, _utils.getMeasurement)(value);
  60107. break;
  60108. case "margin-left":
  60109. margin.left = (0, _utils.getMeasurement)(value);
  60110. break;
  60111. case "margin-right":
  60112. margin.right = (0, _utils.getMeasurement)(value);
  60113. break;
  60114. case "line-height":
  60115. lineHeight = (0, _utils.getMeasurement)(value);
  60116. break;
  60117. }
  60118. }
  60119. measure.pushData(xfaFont, margin, lineHeight);
  60120. if (this[_xfa_object.$content]) {
  60121. measure.addString(this[_xfa_object.$content]);
  60122. } else {
  60123. for (const child of this[_xfa_object.$getChildren]()) {
  60124. if (child[_xfa_object.$nodeName] === "#text") {
  60125. measure.addString(child[_xfa_object.$content]);
  60126. continue;
  60127. }
  60128. child[_xfa_object.$pushGlyphs](measure);
  60129. }
  60130. }
  60131. if (mustPop) {
  60132. measure.popFont();
  60133. }
  60134. }
  60135. [_xfa_object.$toHTML](availableSpace) {
  60136. const children = [];
  60137. this[_xfa_object.$extra] = {
  60138. children
  60139. };
  60140. this[_xfa_object.$childrenToHTML]({});
  60141. if (children.length === 0 && !this[_xfa_object.$content]) {
  60142. return _utils.HTMLResult.EMPTY;
  60143. }
  60144. return _utils.HTMLResult.success({
  60145. name: this[_xfa_object.$nodeName],
  60146. attributes: {
  60147. href: this.href,
  60148. style: mapStyle(this.style, this)
  60149. },
  60150. children,
  60151. value: this[_xfa_object.$content] || ""
  60152. });
  60153. }
  60154. }
  60155. class A extends XhtmlObject {
  60156. constructor(attributes) {
  60157. super(attributes, "a");
  60158. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  60159. }
  60160. }
  60161. class B extends XhtmlObject {
  60162. constructor(attributes) {
  60163. super(attributes, "b");
  60164. }
  60165. [_xfa_object.$pushGlyphs](measure) {
  60166. measure.pushFont({
  60167. weight: "bold"
  60168. });
  60169. super[_xfa_object.$pushGlyphs](measure);
  60170. measure.popFont();
  60171. }
  60172. }
  60173. class Body extends XhtmlObject {
  60174. constructor(attributes) {
  60175. super(attributes, "body");
  60176. }
  60177. [_xfa_object.$toHTML](availableSpace) {
  60178. const res = super[_xfa_object.$toHTML](availableSpace);
  60179. const {
  60180. html
  60181. } = res;
  60182. if (!html) {
  60183. return _utils.HTMLResult.EMPTY;
  60184. }
  60185. html.name = "div";
  60186. html.attributes.class = ["xfaRich"];
  60187. return res;
  60188. }
  60189. }
  60190. class Br extends XhtmlObject {
  60191. constructor(attributes) {
  60192. super(attributes, "br");
  60193. }
  60194. [_xfa_object.$text]() {
  60195. return "\n";
  60196. }
  60197. [_xfa_object.$pushGlyphs](measure) {
  60198. measure.addString("\n");
  60199. }
  60200. [_xfa_object.$toHTML](availableSpace) {
  60201. return _utils.HTMLResult.success({
  60202. name: "br"
  60203. });
  60204. }
  60205. }
  60206. class Html extends XhtmlObject {
  60207. constructor(attributes) {
  60208. super(attributes, "html");
  60209. }
  60210. [_xfa_object.$toHTML](availableSpace) {
  60211. const children = [];
  60212. this[_xfa_object.$extra] = {
  60213. children
  60214. };
  60215. this[_xfa_object.$childrenToHTML]({});
  60216. if (children.length === 0) {
  60217. return _utils.HTMLResult.success({
  60218. name: "div",
  60219. attributes: {
  60220. class: ["xfaRich"],
  60221. style: {}
  60222. },
  60223. value: this[_xfa_object.$content] || ""
  60224. });
  60225. }
  60226. if (children.length === 1) {
  60227. const child = children[0];
  60228. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  60229. return _utils.HTMLResult.success(child);
  60230. }
  60231. }
  60232. return _utils.HTMLResult.success({
  60233. name: "div",
  60234. attributes: {
  60235. class: ["xfaRich"],
  60236. style: {}
  60237. },
  60238. children
  60239. });
  60240. }
  60241. }
  60242. class I extends XhtmlObject {
  60243. constructor(attributes) {
  60244. super(attributes, "i");
  60245. }
  60246. [_xfa_object.$pushGlyphs](measure) {
  60247. measure.pushFont({
  60248. posture: "italic"
  60249. });
  60250. super[_xfa_object.$pushGlyphs](measure);
  60251. measure.popFont();
  60252. }
  60253. }
  60254. class Li extends XhtmlObject {
  60255. constructor(attributes) {
  60256. super(attributes, "li");
  60257. }
  60258. }
  60259. class Ol extends XhtmlObject {
  60260. constructor(attributes) {
  60261. super(attributes, "ol");
  60262. }
  60263. }
  60264. class P extends XhtmlObject {
  60265. constructor(attributes) {
  60266. super(attributes, "p");
  60267. }
  60268. [_xfa_object.$pushGlyphs](measure) {
  60269. super[_xfa_object.$pushGlyphs](measure, false);
  60270. measure.addString("\n");
  60271. measure.addPara();
  60272. measure.popFont();
  60273. }
  60274. [_xfa_object.$text]() {
  60275. return super[_xfa_object.$text]() + "\n";
  60276. }
  60277. }
  60278. class Span extends XhtmlObject {
  60279. constructor(attributes) {
  60280. super(attributes, "span");
  60281. }
  60282. }
  60283. class Sub extends XhtmlObject {
  60284. constructor(attributes) {
  60285. super(attributes, "sub");
  60286. }
  60287. }
  60288. class Sup extends XhtmlObject {
  60289. constructor(attributes) {
  60290. super(attributes, "sup");
  60291. }
  60292. }
  60293. class Ul extends XhtmlObject {
  60294. constructor(attributes) {
  60295. super(attributes, "ul");
  60296. }
  60297. }
  60298. class XhtmlNamespace {
  60299. static [_namespaces.$buildXFAObject](name, attributes) {
  60300. if (XhtmlNamespace.hasOwnProperty(name)) {
  60301. return XhtmlNamespace[name](attributes);
  60302. }
  60303. return undefined;
  60304. }
  60305. static a(attributes) {
  60306. return new A(attributes);
  60307. }
  60308. static b(attributes) {
  60309. return new B(attributes);
  60310. }
  60311. static body(attributes) {
  60312. return new Body(attributes);
  60313. }
  60314. static br(attributes) {
  60315. return new Br(attributes);
  60316. }
  60317. static html(attributes) {
  60318. return new Html(attributes);
  60319. }
  60320. static i(attributes) {
  60321. return new I(attributes);
  60322. }
  60323. static li(attributes) {
  60324. return new Li(attributes);
  60325. }
  60326. static ol(attributes) {
  60327. return new Ol(attributes);
  60328. }
  60329. static p(attributes) {
  60330. return new P(attributes);
  60331. }
  60332. static span(attributes) {
  60333. return new Span(attributes);
  60334. }
  60335. static sub(attributes) {
  60336. return new Sub(attributes);
  60337. }
  60338. static sup(attributes) {
  60339. return new Sup(attributes);
  60340. }
  60341. static ul(attributes) {
  60342. return new Ul(attributes);
  60343. }
  60344. }
  60345. exports.XhtmlNamespace = XhtmlNamespace;
  60346. /***/ }),
  60347. /* 97 */
  60348. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60349. Object.defineProperty(exports, "__esModule", ({
  60350. value: true
  60351. }));
  60352. exports.UnknownNamespace = void 0;
  60353. var _namespaces = __w_pdfjs_require__(77);
  60354. var _xfa_object = __w_pdfjs_require__(75);
  60355. class UnknownNamespace {
  60356. constructor(nsId) {
  60357. this.namespaceId = nsId;
  60358. }
  60359. [_namespaces.$buildXFAObject](name, attributes) {
  60360. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  60361. }
  60362. }
  60363. exports.UnknownNamespace = UnknownNamespace;
  60364. /***/ }),
  60365. /* 98 */
  60366. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60367. Object.defineProperty(exports, "__esModule", ({
  60368. value: true
  60369. }));
  60370. exports.XRef = void 0;
  60371. var _util = __w_pdfjs_require__(2);
  60372. var _primitives = __w_pdfjs_require__(5);
  60373. var _parser = __w_pdfjs_require__(27);
  60374. var _core_utils = __w_pdfjs_require__(9);
  60375. var _crypto = __w_pdfjs_require__(72);
  60376. class XRef {
  60377. constructor(stream, pdfManager) {
  60378. this.stream = stream;
  60379. this.pdfManager = pdfManager;
  60380. this.entries = [];
  60381. this.xrefstms = Object.create(null);
  60382. this._cacheMap = new Map();
  60383. this.stats = {
  60384. streamTypes: Object.create(null),
  60385. fontTypes: Object.create(null)
  60386. };
  60387. this._newRefNum = null;
  60388. }
  60389. getNewRef() {
  60390. if (this._newRefNum === null) {
  60391. this._newRefNum = this.entries.length;
  60392. }
  60393. return _primitives.Ref.get(this._newRefNum++, 0);
  60394. }
  60395. resetNewRef() {
  60396. this._newRefNum = null;
  60397. }
  60398. setStartXRef(startXRef) {
  60399. this.startXRefQueue = [startXRef];
  60400. }
  60401. parse(recoveryMode = false) {
  60402. let trailerDict;
  60403. if (!recoveryMode) {
  60404. trailerDict = this.readXRef();
  60405. } else {
  60406. (0, _util.warn)("Indexing all PDF objects");
  60407. trailerDict = this.indexObjects();
  60408. }
  60409. trailerDict.assignXref(this);
  60410. this.trailer = trailerDict;
  60411. let encrypt;
  60412. try {
  60413. encrypt = trailerDict.get("Encrypt");
  60414. } catch (ex) {
  60415. if (ex instanceof _core_utils.MissingDataException) {
  60416. throw ex;
  60417. }
  60418. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  60419. }
  60420. if ((0, _primitives.isDict)(encrypt)) {
  60421. const ids = trailerDict.get("ID");
  60422. const fileId = ids && ids.length ? ids[0] : "";
  60423. encrypt.suppressEncryption = true;
  60424. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  60425. }
  60426. let root;
  60427. try {
  60428. root = trailerDict.get("Root");
  60429. } catch (ex) {
  60430. if (ex instanceof _core_utils.MissingDataException) {
  60431. throw ex;
  60432. }
  60433. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  60434. }
  60435. if ((0, _primitives.isDict)(root) && root.has("Pages")) {
  60436. this.root = root;
  60437. } else {
  60438. if (!recoveryMode) {
  60439. throw new _core_utils.XRefParseException();
  60440. }
  60441. throw new _util.FormatError("Invalid root reference");
  60442. }
  60443. }
  60444. processXRefTable(parser) {
  60445. if (!("tableState" in this)) {
  60446. this.tableState = {
  60447. entryNum: 0,
  60448. streamPos: parser.lexer.stream.pos,
  60449. parserBuf1: parser.buf1,
  60450. parserBuf2: parser.buf2
  60451. };
  60452. }
  60453. const obj = this.readXRefTable(parser);
  60454. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  60455. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  60456. }
  60457. let dict = parser.getObj();
  60458. if (!(0, _primitives.isDict)(dict) && dict.dict) {
  60459. dict = dict.dict;
  60460. }
  60461. if (!(0, _primitives.isDict)(dict)) {
  60462. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  60463. }
  60464. delete this.tableState;
  60465. return dict;
  60466. }
  60467. readXRefTable(parser) {
  60468. const stream = parser.lexer.stream;
  60469. const tableState = this.tableState;
  60470. stream.pos = tableState.streamPos;
  60471. parser.buf1 = tableState.parserBuf1;
  60472. parser.buf2 = tableState.parserBuf2;
  60473. let obj;
  60474. while (true) {
  60475. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  60476. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  60477. break;
  60478. }
  60479. tableState.firstEntryNum = obj;
  60480. tableState.entryCount = parser.getObj();
  60481. }
  60482. let first = tableState.firstEntryNum;
  60483. const count = tableState.entryCount;
  60484. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  60485. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  60486. }
  60487. for (let i = tableState.entryNum; i < count; i++) {
  60488. tableState.streamPos = stream.pos;
  60489. tableState.entryNum = i;
  60490. tableState.parserBuf1 = parser.buf1;
  60491. tableState.parserBuf2 = parser.buf2;
  60492. const entry = {};
  60493. entry.offset = parser.getObj();
  60494. entry.gen = parser.getObj();
  60495. const type = parser.getObj();
  60496. if (type instanceof _primitives.Cmd) {
  60497. switch (type.cmd) {
  60498. case "f":
  60499. entry.free = true;
  60500. break;
  60501. case "n":
  60502. entry.uncompressed = true;
  60503. break;
  60504. }
  60505. }
  60506. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  60507. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  60508. }
  60509. if (i === 0 && entry.free && first === 1) {
  60510. first = 0;
  60511. }
  60512. if (!this.entries[i + first]) {
  60513. this.entries[i + first] = entry;
  60514. }
  60515. }
  60516. tableState.entryNum = 0;
  60517. tableState.streamPos = stream.pos;
  60518. tableState.parserBuf1 = parser.buf1;
  60519. tableState.parserBuf2 = parser.buf2;
  60520. delete tableState.firstEntryNum;
  60521. delete tableState.entryCount;
  60522. }
  60523. if (this.entries[0] && !this.entries[0].free) {
  60524. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  60525. }
  60526. return obj;
  60527. }
  60528. processXRefStream(stream) {
  60529. if (!("streamState" in this)) {
  60530. const streamParameters = stream.dict;
  60531. const byteWidths = streamParameters.get("W");
  60532. let range = streamParameters.get("Index");
  60533. if (!range) {
  60534. range = [0, streamParameters.get("Size")];
  60535. }
  60536. this.streamState = {
  60537. entryRanges: range,
  60538. byteWidths,
  60539. entryNum: 0,
  60540. streamPos: stream.pos
  60541. };
  60542. }
  60543. this.readXRefStream(stream);
  60544. delete this.streamState;
  60545. return stream.dict;
  60546. }
  60547. readXRefStream(stream) {
  60548. let i, j;
  60549. const streamState = this.streamState;
  60550. stream.pos = streamState.streamPos;
  60551. const byteWidths = streamState.byteWidths;
  60552. const typeFieldWidth = byteWidths[0];
  60553. const offsetFieldWidth = byteWidths[1];
  60554. const generationFieldWidth = byteWidths[2];
  60555. const entryRanges = streamState.entryRanges;
  60556. while (entryRanges.length > 0) {
  60557. const first = entryRanges[0];
  60558. const n = entryRanges[1];
  60559. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  60560. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  60561. }
  60562. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  60563. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  60564. }
  60565. for (i = streamState.entryNum; i < n; ++i) {
  60566. streamState.entryNum = i;
  60567. streamState.streamPos = stream.pos;
  60568. let type = 0,
  60569. offset = 0,
  60570. generation = 0;
  60571. for (j = 0; j < typeFieldWidth; ++j) {
  60572. type = type << 8 | stream.getByte();
  60573. }
  60574. if (typeFieldWidth === 0) {
  60575. type = 1;
  60576. }
  60577. for (j = 0; j < offsetFieldWidth; ++j) {
  60578. offset = offset << 8 | stream.getByte();
  60579. }
  60580. for (j = 0; j < generationFieldWidth; ++j) {
  60581. generation = generation << 8 | stream.getByte();
  60582. }
  60583. const entry = {};
  60584. entry.offset = offset;
  60585. entry.gen = generation;
  60586. switch (type) {
  60587. case 0:
  60588. entry.free = true;
  60589. break;
  60590. case 1:
  60591. entry.uncompressed = true;
  60592. break;
  60593. case 2:
  60594. break;
  60595. default:
  60596. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  60597. }
  60598. if (!this.entries[first + i]) {
  60599. this.entries[first + i] = entry;
  60600. }
  60601. }
  60602. streamState.entryNum = 0;
  60603. streamState.streamPos = stream.pos;
  60604. entryRanges.splice(0, 2);
  60605. }
  60606. }
  60607. indexObjects() {
  60608. const TAB = 0x9,
  60609. LF = 0xa,
  60610. CR = 0xd,
  60611. SPACE = 0x20;
  60612. const PERCENT = 0x25,
  60613. LT = 0x3c;
  60614. function readToken(data, offset) {
  60615. let token = "",
  60616. ch = data[offset];
  60617. while (ch !== LF && ch !== CR && ch !== LT) {
  60618. if (++offset >= data.length) {
  60619. break;
  60620. }
  60621. token += String.fromCharCode(ch);
  60622. ch = data[offset];
  60623. }
  60624. return token;
  60625. }
  60626. function skipUntil(data, offset, what) {
  60627. const length = what.length,
  60628. dataLength = data.length;
  60629. let skipped = 0;
  60630. while (offset < dataLength) {
  60631. let i = 0;
  60632. while (i < length && data[offset + i] === what[i]) {
  60633. ++i;
  60634. }
  60635. if (i >= length) {
  60636. break;
  60637. }
  60638. offset++;
  60639. skipped++;
  60640. }
  60641. return skipped;
  60642. }
  60643. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  60644. const endobjRegExp = /\bendobj[\b\s]$/;
  60645. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  60646. const CHECK_CONTENT_LENGTH = 25;
  60647. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  60648. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  60649. const objBytes = new Uint8Array([111, 98, 106]);
  60650. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  60651. this.entries.length = 0;
  60652. const stream = this.stream;
  60653. stream.pos = 0;
  60654. const buffer = stream.getBytes(),
  60655. length = buffer.length;
  60656. let position = stream.start;
  60657. const trailers = [],
  60658. xrefStms = [];
  60659. while (position < length) {
  60660. let ch = buffer[position];
  60661. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  60662. ++position;
  60663. continue;
  60664. }
  60665. if (ch === PERCENT) {
  60666. do {
  60667. ++position;
  60668. if (position >= length) {
  60669. break;
  60670. }
  60671. ch = buffer[position];
  60672. } while (ch !== LF && ch !== CR);
  60673. continue;
  60674. }
  60675. const token = readToken(buffer, position);
  60676. let m;
  60677. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  60678. position += skipUntil(buffer, position, trailerBytes);
  60679. trailers.push(position);
  60680. position += skipUntil(buffer, position, startxrefBytes);
  60681. } else if (m = objRegExp.exec(token)) {
  60682. const num = m[1] | 0,
  60683. gen = m[2] | 0;
  60684. let contentLength,
  60685. startPos = position + token.length,
  60686. updateEntries = false;
  60687. if (!this.entries[num]) {
  60688. updateEntries = true;
  60689. } else if (this.entries[num].gen === gen) {
  60690. try {
  60691. const parser = new _parser.Parser({
  60692. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  60693. });
  60694. parser.getObj();
  60695. updateEntries = true;
  60696. } catch (ex) {
  60697. if (ex instanceof _core_utils.ParserEOFException) {
  60698. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  60699. } else {
  60700. updateEntries = true;
  60701. }
  60702. }
  60703. }
  60704. if (updateEntries) {
  60705. this.entries[num] = {
  60706. offset: position - stream.start,
  60707. gen,
  60708. uncompressed: true
  60709. };
  60710. }
  60711. while (startPos < buffer.length) {
  60712. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  60713. contentLength = endPos - position;
  60714. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  60715. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  60716. if (endobjRegExp.test(tokenStr)) {
  60717. break;
  60718. } else {
  60719. const objToken = nestedObjRegExp.exec(tokenStr);
  60720. if (objToken && objToken[1]) {
  60721. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  60722. contentLength -= objToken[1].length;
  60723. break;
  60724. }
  60725. }
  60726. startPos = endPos;
  60727. }
  60728. const content = buffer.subarray(position, position + contentLength);
  60729. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  60730. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  60731. xrefStms.push(position - stream.start);
  60732. this.xrefstms[position - stream.start] = 1;
  60733. }
  60734. position += contentLength;
  60735. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  60736. trailers.push(position);
  60737. position += skipUntil(buffer, position, startxrefBytes);
  60738. } else {
  60739. position += token.length + 1;
  60740. }
  60741. }
  60742. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  60743. this.startXRefQueue.push(xrefStms[i]);
  60744. this.readXRef(true);
  60745. }
  60746. let trailerDict;
  60747. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  60748. stream.pos = trailers[i];
  60749. const parser = new _parser.Parser({
  60750. lexer: new _parser.Lexer(stream),
  60751. xref: this,
  60752. allowStreams: true,
  60753. recoveryMode: true
  60754. });
  60755. const obj = parser.getObj();
  60756. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  60757. continue;
  60758. }
  60759. const dict = parser.getObj();
  60760. if (!(0, _primitives.isDict)(dict)) {
  60761. continue;
  60762. }
  60763. try {
  60764. const rootDict = dict.get("Root");
  60765. if (!(rootDict instanceof _primitives.Dict)) {
  60766. continue;
  60767. }
  60768. const pagesDict = rootDict.get("Pages");
  60769. if (!(pagesDict instanceof _primitives.Dict)) {
  60770. continue;
  60771. }
  60772. const pagesCount = pagesDict.get("Count");
  60773. if (!Number.isInteger(pagesCount)) {
  60774. continue;
  60775. }
  60776. } catch (ex) {
  60777. continue;
  60778. }
  60779. if (dict.has("ID")) {
  60780. return dict;
  60781. }
  60782. trailerDict = dict;
  60783. }
  60784. if (trailerDict) {
  60785. return trailerDict;
  60786. }
  60787. throw new _util.InvalidPDFException("Invalid PDF structure.");
  60788. }
  60789. readXRef(recoveryMode = false) {
  60790. const stream = this.stream;
  60791. const startXRefParsedCache = new Set();
  60792. try {
  60793. while (this.startXRefQueue.length) {
  60794. const startXRef = this.startXRefQueue[0];
  60795. if (startXRefParsedCache.has(startXRef)) {
  60796. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  60797. this.startXRefQueue.shift();
  60798. continue;
  60799. }
  60800. startXRefParsedCache.add(startXRef);
  60801. stream.pos = startXRef + stream.start;
  60802. const parser = new _parser.Parser({
  60803. lexer: new _parser.Lexer(stream),
  60804. xref: this,
  60805. allowStreams: true
  60806. });
  60807. let obj = parser.getObj();
  60808. let dict;
  60809. if ((0, _primitives.isCmd)(obj, "xref")) {
  60810. dict = this.processXRefTable(parser);
  60811. if (!this.topDict) {
  60812. this.topDict = dict;
  60813. }
  60814. obj = dict.get("XRefStm");
  60815. if (Number.isInteger(obj)) {
  60816. const pos = obj;
  60817. if (!(pos in this.xrefstms)) {
  60818. this.xrefstms[pos] = 1;
  60819. this.startXRefQueue.push(pos);
  60820. }
  60821. }
  60822. } else if (Number.isInteger(obj)) {
  60823. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !(0, _primitives.isStream)(obj = parser.getObj())) {
  60824. throw new _util.FormatError("Invalid XRef stream");
  60825. }
  60826. dict = this.processXRefStream(obj);
  60827. if (!this.topDict) {
  60828. this.topDict = dict;
  60829. }
  60830. if (!dict) {
  60831. throw new _util.FormatError("Failed to read XRef stream");
  60832. }
  60833. } else {
  60834. throw new _util.FormatError("Invalid XRef stream header");
  60835. }
  60836. obj = dict.get("Prev");
  60837. if (Number.isInteger(obj)) {
  60838. this.startXRefQueue.push(obj);
  60839. } else if ((0, _primitives.isRef)(obj)) {
  60840. this.startXRefQueue.push(obj.num);
  60841. }
  60842. this.startXRefQueue.shift();
  60843. }
  60844. return this.topDict;
  60845. } catch (e) {
  60846. if (e instanceof _core_utils.MissingDataException) {
  60847. throw e;
  60848. }
  60849. (0, _util.info)("(while reading XRef): " + e);
  60850. }
  60851. if (recoveryMode) {
  60852. return undefined;
  60853. }
  60854. throw new _core_utils.XRefParseException();
  60855. }
  60856. getEntry(i) {
  60857. const xrefEntry = this.entries[i];
  60858. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  60859. return xrefEntry;
  60860. }
  60861. return null;
  60862. }
  60863. fetchIfRef(obj, suppressEncryption = false) {
  60864. if (obj instanceof _primitives.Ref) {
  60865. return this.fetch(obj, suppressEncryption);
  60866. }
  60867. return obj;
  60868. }
  60869. fetch(ref, suppressEncryption = false) {
  60870. if (!(ref instanceof _primitives.Ref)) {
  60871. throw new Error("ref object is not a reference");
  60872. }
  60873. const num = ref.num;
  60874. const cacheEntry = this._cacheMap.get(num);
  60875. if (cacheEntry !== undefined) {
  60876. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  60877. cacheEntry.objId = ref.toString();
  60878. }
  60879. return cacheEntry;
  60880. }
  60881. let xrefEntry = this.getEntry(num);
  60882. if (xrefEntry === null) {
  60883. this._cacheMap.set(num, xrefEntry);
  60884. return xrefEntry;
  60885. }
  60886. if (xrefEntry.uncompressed) {
  60887. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  60888. } else {
  60889. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  60890. }
  60891. if ((0, _primitives.isDict)(xrefEntry)) {
  60892. xrefEntry.objId = ref.toString();
  60893. } else if ((0, _primitives.isStream)(xrefEntry)) {
  60894. xrefEntry.dict.objId = ref.toString();
  60895. }
  60896. return xrefEntry;
  60897. }
  60898. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  60899. const gen = ref.gen;
  60900. let num = ref.num;
  60901. if (xrefEntry.gen !== gen) {
  60902. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  60903. }
  60904. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  60905. const parser = new _parser.Parser({
  60906. lexer: new _parser.Lexer(stream),
  60907. xref: this,
  60908. allowStreams: true
  60909. });
  60910. const obj1 = parser.getObj();
  60911. const obj2 = parser.getObj();
  60912. const obj3 = parser.getObj();
  60913. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  60914. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  60915. }
  60916. if (obj3.cmd !== "obj") {
  60917. if (obj3.cmd.startsWith("obj")) {
  60918. num = parseInt(obj3.cmd.substring(3), 10);
  60919. if (!Number.isNaN(num)) {
  60920. return num;
  60921. }
  60922. }
  60923. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  60924. }
  60925. if (this.encrypt && !suppressEncryption) {
  60926. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  60927. } else {
  60928. xrefEntry = parser.getObj();
  60929. }
  60930. if (!(0, _primitives.isStream)(xrefEntry)) {
  60931. this._cacheMap.set(num, xrefEntry);
  60932. }
  60933. return xrefEntry;
  60934. }
  60935. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  60936. const tableOffset = xrefEntry.offset;
  60937. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  60938. if (!(0, _primitives.isStream)(stream)) {
  60939. throw new _util.FormatError("bad ObjStm stream");
  60940. }
  60941. const first = stream.dict.get("First");
  60942. const n = stream.dict.get("N");
  60943. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  60944. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  60945. }
  60946. let parser = new _parser.Parser({
  60947. lexer: new _parser.Lexer(stream),
  60948. xref: this,
  60949. allowStreams: true
  60950. });
  60951. const nums = new Array(n);
  60952. const offsets = new Array(n);
  60953. for (let i = 0; i < n; ++i) {
  60954. const num = parser.getObj();
  60955. if (!Number.isInteger(num)) {
  60956. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  60957. }
  60958. const offset = parser.getObj();
  60959. if (!Number.isInteger(offset)) {
  60960. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  60961. }
  60962. nums[i] = num;
  60963. offsets[i] = offset;
  60964. }
  60965. const start = (stream.start || 0) + first;
  60966. const entries = new Array(n);
  60967. for (let i = 0; i < n; ++i) {
  60968. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  60969. if (length < 0) {
  60970. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  60971. }
  60972. parser = new _parser.Parser({
  60973. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  60974. xref: this,
  60975. allowStreams: true
  60976. });
  60977. const obj = parser.getObj();
  60978. entries[i] = obj;
  60979. if ((0, _primitives.isStream)(obj)) {
  60980. continue;
  60981. }
  60982. const num = nums[i],
  60983. entry = this.entries[num];
  60984. if (entry && entry.offset === tableOffset && entry.gen === i) {
  60985. this._cacheMap.set(num, obj);
  60986. }
  60987. }
  60988. xrefEntry = entries[xrefEntry.gen];
  60989. if (xrefEntry === undefined) {
  60990. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  60991. }
  60992. return xrefEntry;
  60993. }
  60994. async fetchIfRefAsync(obj, suppressEncryption) {
  60995. if (obj instanceof _primitives.Ref) {
  60996. return this.fetchAsync(obj, suppressEncryption);
  60997. }
  60998. return obj;
  60999. }
  61000. async fetchAsync(ref, suppressEncryption) {
  61001. try {
  61002. return this.fetch(ref, suppressEncryption);
  61003. } catch (ex) {
  61004. if (!(ex instanceof _core_utils.MissingDataException)) {
  61005. throw ex;
  61006. }
  61007. await this.pdfManager.requestRange(ex.begin, ex.end);
  61008. return this.fetchAsync(ref, suppressEncryption);
  61009. }
  61010. }
  61011. getCatalogObj() {
  61012. return this.root;
  61013. }
  61014. }
  61015. exports.XRef = XRef;
  61016. /***/ }),
  61017. /* 99 */
  61018. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61019. Object.defineProperty(exports, "__esModule", ({
  61020. value: true
  61021. }));
  61022. exports.MessageHandler = void 0;
  61023. var _util = __w_pdfjs_require__(2);
  61024. const CallbackKind = {
  61025. UNKNOWN: 0,
  61026. DATA: 1,
  61027. ERROR: 2
  61028. };
  61029. const StreamKind = {
  61030. UNKNOWN: 0,
  61031. CANCEL: 1,
  61032. CANCEL_COMPLETE: 2,
  61033. CLOSE: 3,
  61034. ENQUEUE: 4,
  61035. ERROR: 5,
  61036. PULL: 6,
  61037. PULL_COMPLETE: 7,
  61038. START_COMPLETE: 8
  61039. };
  61040. function wrapReason(reason) {
  61041. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  61042. (0, _util.warn)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  61043. return reason;
  61044. }
  61045. switch (reason.name) {
  61046. case "AbortException":
  61047. return new _util.AbortException(reason.message);
  61048. case "MissingPDFException":
  61049. return new _util.MissingPDFException(reason.message);
  61050. case "PasswordException":
  61051. return new _util.PasswordException(reason.message, reason.code);
  61052. case "UnexpectedResponseException":
  61053. return new _util.UnexpectedResponseException(reason.message, reason.status);
  61054. case "UnknownErrorException":
  61055. return new _util.UnknownErrorException(reason.message, reason.details);
  61056. default:
  61057. return new _util.UnknownErrorException(reason.message, reason.toString());
  61058. }
  61059. }
  61060. class MessageHandler {
  61061. constructor(sourceName, targetName, comObj) {
  61062. this.sourceName = sourceName;
  61063. this.targetName = targetName;
  61064. this.comObj = comObj;
  61065. this.callbackId = 1;
  61066. this.streamId = 1;
  61067. this.postMessageTransfers = true;
  61068. this.streamSinks = Object.create(null);
  61069. this.streamControllers = Object.create(null);
  61070. this.callbackCapabilities = Object.create(null);
  61071. this.actionHandler = Object.create(null);
  61072. this._onComObjOnMessage = event => {
  61073. const data = event.data;
  61074. if (data.targetName !== this.sourceName) {
  61075. return;
  61076. }
  61077. if (data.stream) {
  61078. this._processStreamMessage(data);
  61079. return;
  61080. }
  61081. if (data.callback) {
  61082. const callbackId = data.callbackId;
  61083. const capability = this.callbackCapabilities[callbackId];
  61084. if (!capability) {
  61085. throw new Error(`Cannot resolve callback ${callbackId}`);
  61086. }
  61087. delete this.callbackCapabilities[callbackId];
  61088. if (data.callback === CallbackKind.DATA) {
  61089. capability.resolve(data.data);
  61090. } else if (data.callback === CallbackKind.ERROR) {
  61091. capability.reject(wrapReason(data.reason));
  61092. } else {
  61093. throw new Error("Unexpected callback case");
  61094. }
  61095. return;
  61096. }
  61097. const action = this.actionHandler[data.action];
  61098. if (!action) {
  61099. throw new Error(`Unknown action from worker: ${data.action}`);
  61100. }
  61101. if (data.callbackId) {
  61102. const cbSourceName = this.sourceName;
  61103. const cbTargetName = data.sourceName;
  61104. new Promise(function (resolve) {
  61105. resolve(action(data.data));
  61106. }).then(function (result) {
  61107. comObj.postMessage({
  61108. sourceName: cbSourceName,
  61109. targetName: cbTargetName,
  61110. callback: CallbackKind.DATA,
  61111. callbackId: data.callbackId,
  61112. data: result
  61113. });
  61114. }, function (reason) {
  61115. comObj.postMessage({
  61116. sourceName: cbSourceName,
  61117. targetName: cbTargetName,
  61118. callback: CallbackKind.ERROR,
  61119. callbackId: data.callbackId,
  61120. reason: wrapReason(reason)
  61121. });
  61122. });
  61123. return;
  61124. }
  61125. if (data.streamId) {
  61126. this._createStreamSink(data);
  61127. return;
  61128. }
  61129. action(data.data);
  61130. };
  61131. comObj.addEventListener("message", this._onComObjOnMessage);
  61132. }
  61133. on(actionName, handler) {
  61134. const ah = this.actionHandler;
  61135. if (ah[actionName]) {
  61136. throw new Error(`There is already an actionName called "${actionName}"`);
  61137. }
  61138. ah[actionName] = handler;
  61139. }
  61140. send(actionName, data, transfers) {
  61141. this._postMessage({
  61142. sourceName: this.sourceName,
  61143. targetName: this.targetName,
  61144. action: actionName,
  61145. data
  61146. }, transfers);
  61147. }
  61148. sendWithPromise(actionName, data, transfers) {
  61149. const callbackId = this.callbackId++;
  61150. const capability = (0, _util.createPromiseCapability)();
  61151. this.callbackCapabilities[callbackId] = capability;
  61152. try {
  61153. this._postMessage({
  61154. sourceName: this.sourceName,
  61155. targetName: this.targetName,
  61156. action: actionName,
  61157. callbackId,
  61158. data
  61159. }, transfers);
  61160. } catch (ex) {
  61161. capability.reject(ex);
  61162. }
  61163. return capability.promise;
  61164. }
  61165. sendWithStream(actionName, data, queueingStrategy, transfers) {
  61166. const streamId = this.streamId++,
  61167. sourceName = this.sourceName,
  61168. targetName = this.targetName,
  61169. comObj = this.comObj;
  61170. return new ReadableStream({
  61171. start: controller => {
  61172. const startCapability = (0, _util.createPromiseCapability)();
  61173. this.streamControllers[streamId] = {
  61174. controller,
  61175. startCall: startCapability,
  61176. pullCall: null,
  61177. cancelCall: null,
  61178. isClosed: false
  61179. };
  61180. this._postMessage({
  61181. sourceName,
  61182. targetName,
  61183. action: actionName,
  61184. streamId,
  61185. data,
  61186. desiredSize: controller.desiredSize
  61187. }, transfers);
  61188. return startCapability.promise;
  61189. },
  61190. pull: controller => {
  61191. const pullCapability = (0, _util.createPromiseCapability)();
  61192. this.streamControllers[streamId].pullCall = pullCapability;
  61193. comObj.postMessage({
  61194. sourceName,
  61195. targetName,
  61196. stream: StreamKind.PULL,
  61197. streamId,
  61198. desiredSize: controller.desiredSize
  61199. });
  61200. return pullCapability.promise;
  61201. },
  61202. cancel: reason => {
  61203. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  61204. const cancelCapability = (0, _util.createPromiseCapability)();
  61205. this.streamControllers[streamId].cancelCall = cancelCapability;
  61206. this.streamControllers[streamId].isClosed = true;
  61207. comObj.postMessage({
  61208. sourceName,
  61209. targetName,
  61210. stream: StreamKind.CANCEL,
  61211. streamId,
  61212. reason: wrapReason(reason)
  61213. });
  61214. return cancelCapability.promise;
  61215. }
  61216. }, queueingStrategy);
  61217. }
  61218. _createStreamSink(data) {
  61219. const streamId = data.streamId,
  61220. sourceName = this.sourceName,
  61221. targetName = data.sourceName,
  61222. comObj = this.comObj;
  61223. const self = this,
  61224. action = this.actionHandler[data.action];
  61225. const streamSink = {
  61226. enqueue(chunk, size = 1, transfers) {
  61227. if (this.isCancelled) {
  61228. return;
  61229. }
  61230. const lastDesiredSize = this.desiredSize;
  61231. this.desiredSize -= size;
  61232. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  61233. this.sinkCapability = (0, _util.createPromiseCapability)();
  61234. this.ready = this.sinkCapability.promise;
  61235. }
  61236. self._postMessage({
  61237. sourceName,
  61238. targetName,
  61239. stream: StreamKind.ENQUEUE,
  61240. streamId,
  61241. chunk
  61242. }, transfers);
  61243. },
  61244. close() {
  61245. if (this.isCancelled) {
  61246. return;
  61247. }
  61248. this.isCancelled = true;
  61249. comObj.postMessage({
  61250. sourceName,
  61251. targetName,
  61252. stream: StreamKind.CLOSE,
  61253. streamId
  61254. });
  61255. delete self.streamSinks[streamId];
  61256. },
  61257. error(reason) {
  61258. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  61259. if (this.isCancelled) {
  61260. return;
  61261. }
  61262. this.isCancelled = true;
  61263. comObj.postMessage({
  61264. sourceName,
  61265. targetName,
  61266. stream: StreamKind.ERROR,
  61267. streamId,
  61268. reason: wrapReason(reason)
  61269. });
  61270. },
  61271. sinkCapability: (0, _util.createPromiseCapability)(),
  61272. onPull: null,
  61273. onCancel: null,
  61274. isCancelled: false,
  61275. desiredSize: data.desiredSize,
  61276. ready: null
  61277. };
  61278. streamSink.sinkCapability.resolve();
  61279. streamSink.ready = streamSink.sinkCapability.promise;
  61280. this.streamSinks[streamId] = streamSink;
  61281. new Promise(function (resolve) {
  61282. resolve(action(data.data, streamSink));
  61283. }).then(function () {
  61284. comObj.postMessage({
  61285. sourceName,
  61286. targetName,
  61287. stream: StreamKind.START_COMPLETE,
  61288. streamId,
  61289. success: true
  61290. });
  61291. }, function (reason) {
  61292. comObj.postMessage({
  61293. sourceName,
  61294. targetName,
  61295. stream: StreamKind.START_COMPLETE,
  61296. streamId,
  61297. reason: wrapReason(reason)
  61298. });
  61299. });
  61300. }
  61301. _processStreamMessage(data) {
  61302. const streamId = data.streamId,
  61303. sourceName = this.sourceName,
  61304. targetName = data.sourceName,
  61305. comObj = this.comObj;
  61306. const streamController = this.streamControllers[streamId],
  61307. streamSink = this.streamSinks[streamId];
  61308. switch (data.stream) {
  61309. case StreamKind.START_COMPLETE:
  61310. if (data.success) {
  61311. streamController.startCall.resolve();
  61312. } else {
  61313. streamController.startCall.reject(wrapReason(data.reason));
  61314. }
  61315. break;
  61316. case StreamKind.PULL_COMPLETE:
  61317. if (data.success) {
  61318. streamController.pullCall.resolve();
  61319. } else {
  61320. streamController.pullCall.reject(wrapReason(data.reason));
  61321. }
  61322. break;
  61323. case StreamKind.PULL:
  61324. if (!streamSink) {
  61325. comObj.postMessage({
  61326. sourceName,
  61327. targetName,
  61328. stream: StreamKind.PULL_COMPLETE,
  61329. streamId,
  61330. success: true
  61331. });
  61332. break;
  61333. }
  61334. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  61335. streamSink.sinkCapability.resolve();
  61336. }
  61337. streamSink.desiredSize = data.desiredSize;
  61338. new Promise(function (resolve) {
  61339. resolve(streamSink.onPull && streamSink.onPull());
  61340. }).then(function () {
  61341. comObj.postMessage({
  61342. sourceName,
  61343. targetName,
  61344. stream: StreamKind.PULL_COMPLETE,
  61345. streamId,
  61346. success: true
  61347. });
  61348. }, function (reason) {
  61349. comObj.postMessage({
  61350. sourceName,
  61351. targetName,
  61352. stream: StreamKind.PULL_COMPLETE,
  61353. streamId,
  61354. reason: wrapReason(reason)
  61355. });
  61356. });
  61357. break;
  61358. case StreamKind.ENQUEUE:
  61359. (0, _util.assert)(streamController, "enqueue should have stream controller");
  61360. if (streamController.isClosed) {
  61361. break;
  61362. }
  61363. streamController.controller.enqueue(data.chunk);
  61364. break;
  61365. case StreamKind.CLOSE:
  61366. (0, _util.assert)(streamController, "close should have stream controller");
  61367. if (streamController.isClosed) {
  61368. break;
  61369. }
  61370. streamController.isClosed = true;
  61371. streamController.controller.close();
  61372. this._deleteStreamController(streamController, streamId);
  61373. break;
  61374. case StreamKind.ERROR:
  61375. (0, _util.assert)(streamController, "error should have stream controller");
  61376. streamController.controller.error(wrapReason(data.reason));
  61377. this._deleteStreamController(streamController, streamId);
  61378. break;
  61379. case StreamKind.CANCEL_COMPLETE:
  61380. if (data.success) {
  61381. streamController.cancelCall.resolve();
  61382. } else {
  61383. streamController.cancelCall.reject(wrapReason(data.reason));
  61384. }
  61385. this._deleteStreamController(streamController, streamId);
  61386. break;
  61387. case StreamKind.CANCEL:
  61388. if (!streamSink) {
  61389. break;
  61390. }
  61391. new Promise(function (resolve) {
  61392. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  61393. }).then(function () {
  61394. comObj.postMessage({
  61395. sourceName,
  61396. targetName,
  61397. stream: StreamKind.CANCEL_COMPLETE,
  61398. streamId,
  61399. success: true
  61400. });
  61401. }, function (reason) {
  61402. comObj.postMessage({
  61403. sourceName,
  61404. targetName,
  61405. stream: StreamKind.CANCEL_COMPLETE,
  61406. streamId,
  61407. reason: wrapReason(reason)
  61408. });
  61409. });
  61410. streamSink.sinkCapability.reject(wrapReason(data.reason));
  61411. streamSink.isCancelled = true;
  61412. delete this.streamSinks[streamId];
  61413. break;
  61414. default:
  61415. throw new Error("Unexpected stream case");
  61416. }
  61417. }
  61418. async _deleteStreamController(streamController, streamId) {
  61419. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  61420. delete this.streamControllers[streamId];
  61421. }
  61422. _postMessage(message, transfers) {
  61423. if (transfers && this.postMessageTransfers) {
  61424. this.comObj.postMessage(message, transfers);
  61425. } else {
  61426. this.comObj.postMessage(message);
  61427. }
  61428. }
  61429. destroy() {
  61430. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  61431. }
  61432. }
  61433. exports.MessageHandler = MessageHandler;
  61434. /***/ }),
  61435. /* 100 */
  61436. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61437. Object.defineProperty(exports, "__esModule", ({
  61438. value: true
  61439. }));
  61440. exports.PDFWorkerStream = void 0;
  61441. var _util = __w_pdfjs_require__(2);
  61442. class PDFWorkerStream {
  61443. constructor(msgHandler) {
  61444. this._msgHandler = msgHandler;
  61445. this._contentLength = null;
  61446. this._fullRequestReader = null;
  61447. this._rangeRequestReaders = [];
  61448. }
  61449. getFullReader() {
  61450. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  61451. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  61452. return this._fullRequestReader;
  61453. }
  61454. getRangeReader(begin, end) {
  61455. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  61456. this._rangeRequestReaders.push(reader);
  61457. return reader;
  61458. }
  61459. cancelAllRequests(reason) {
  61460. if (this._fullRequestReader) {
  61461. this._fullRequestReader.cancel(reason);
  61462. }
  61463. for (const reader of this._rangeRequestReaders.slice(0)) {
  61464. reader.cancel(reason);
  61465. }
  61466. }
  61467. }
  61468. exports.PDFWorkerStream = PDFWorkerStream;
  61469. class PDFWorkerStreamReader {
  61470. constructor(msgHandler) {
  61471. this._msgHandler = msgHandler;
  61472. this.onProgress = null;
  61473. this._contentLength = null;
  61474. this._isRangeSupported = false;
  61475. this._isStreamingSupported = false;
  61476. const readableStream = this._msgHandler.sendWithStream("GetReader");
  61477. this._reader = readableStream.getReader();
  61478. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  61479. this._isStreamingSupported = data.isStreamingSupported;
  61480. this._isRangeSupported = data.isRangeSupported;
  61481. this._contentLength = data.contentLength;
  61482. });
  61483. }
  61484. get headersReady() {
  61485. return this._headersReady;
  61486. }
  61487. get contentLength() {
  61488. return this._contentLength;
  61489. }
  61490. get isStreamingSupported() {
  61491. return this._isStreamingSupported;
  61492. }
  61493. get isRangeSupported() {
  61494. return this._isRangeSupported;
  61495. }
  61496. async read() {
  61497. const {
  61498. value,
  61499. done
  61500. } = await this._reader.read();
  61501. if (done) {
  61502. return {
  61503. value: undefined,
  61504. done: true
  61505. };
  61506. }
  61507. return {
  61508. value: value.buffer,
  61509. done: false
  61510. };
  61511. }
  61512. cancel(reason) {
  61513. this._reader.cancel(reason);
  61514. }
  61515. }
  61516. class PDFWorkerStreamRangeReader {
  61517. constructor(begin, end, msgHandler) {
  61518. this._msgHandler = msgHandler;
  61519. this.onProgress = null;
  61520. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  61521. begin,
  61522. end
  61523. });
  61524. this._reader = readableStream.getReader();
  61525. }
  61526. get isStreamingSupported() {
  61527. return false;
  61528. }
  61529. async read() {
  61530. const {
  61531. value,
  61532. done
  61533. } = await this._reader.read();
  61534. if (done) {
  61535. return {
  61536. value: undefined,
  61537. done: true
  61538. };
  61539. }
  61540. return {
  61541. value: value.buffer,
  61542. done: false
  61543. };
  61544. }
  61545. cancel(reason) {
  61546. this._reader.cancel(reason);
  61547. }
  61548. }
  61549. /***/ })
  61550. /******/ ]);
  61551. /************************************************************************/
  61552. /******/ // The module cache
  61553. /******/ var __webpack_module_cache__ = {};
  61554. /******/
  61555. /******/ // The require function
  61556. /******/ function __w_pdfjs_require__(moduleId) {
  61557. /******/ // Check if module is in cache
  61558. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  61559. /******/ if (cachedModule !== undefined) {
  61560. /******/ return cachedModule.exports;
  61561. /******/ }
  61562. /******/ // Create a new module (and put it into the cache)
  61563. /******/ var module = __webpack_module_cache__[moduleId] = {
  61564. /******/ // no module.id needed
  61565. /******/ // no module.loaded needed
  61566. /******/ exports: {}
  61567. /******/ };
  61568. /******/
  61569. /******/ // Execute the module function
  61570. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  61571. /******/
  61572. /******/ // Return the exports of the module
  61573. /******/ return module.exports;
  61574. /******/ }
  61575. /******/
  61576. /************************************************************************/
  61577. /******/ /* webpack/runtime/define property getters */
  61578. /******/ (() => {
  61579. /******/ // define getter functions for harmony exports
  61580. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  61581. /******/ for(var key in definition) {
  61582. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  61583. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  61584. /******/ }
  61585. /******/ }
  61586. /******/ };
  61587. /******/ })();
  61588. /******/
  61589. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  61590. /******/ (() => {
  61591. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  61592. /******/ })();
  61593. /******/
  61594. /******/ /* webpack/runtime/make namespace object */
  61595. /******/ (() => {
  61596. /******/ // define __esModule on exports
  61597. /******/ __w_pdfjs_require__.r = (exports) => {
  61598. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  61599. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  61600. /******/ }
  61601. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  61602. /******/ };
  61603. /******/ })();
  61604. /******/
  61605. /************************************************************************/
  61606. var __webpack_exports__ = {};
  61607. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  61608. (() => {
  61609. var exports = __webpack_exports__;
  61610. Object.defineProperty(exports, "__esModule", ({
  61611. value: true
  61612. }));
  61613. Object.defineProperty(exports, "WorkerMessageHandler", ({
  61614. enumerable: true,
  61615. get: function () {
  61616. return _worker.WorkerMessageHandler;
  61617. }
  61618. }));
  61619. var _worker = __w_pdfjs_require__(1);
  61620. const pdfjsVersion = '2.11.338';
  61621. const pdfjsBuild = 'dedff3c98';
  61622. })();
  61623. /******/ return __webpack_exports__;
  61624. /******/ })()
  61625. ;
  61626. });
  61627. //# sourceMappingURL=pdf.worker.js.map